script.js
changeset 0 d9b71931f372
child 7 cfde0597a8dc
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/script.js	Thu May 27 13:10:09 2010 +0200
     1.3 @@ -0,0 +1,139 @@
     1.4 +var QUOTES_NUMBER = 32;
     1.5 +
     1.6 +function load_page(html, params)
     1.7 +{
     1.8 +	if (params != "")
     1.9 +		html += "?";	
    1.10 +	window.location = html + params;	
    1.11 +	//window.location.reload();
    1.12 +}
    1.13 +
    1.14 +function google_an1()
    1.15 +{
    1.16 +    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    1.17 +    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));    
    1.18 +}
    1.19 +
    1.20 +function google_an2()
    1.21 +{
    1.22 +    var pageTracker = _gat._getTracker("UA-2137333-1");
    1.23 +    pageTracker._initData();
    1.24 +    pageTracker._trackPageview();
    1.25 +}
    1.26 +
    1.27 +function google_an()
    1.28 +{	    
    1.29 +	google_an1();
    1.30 +	if (typeof(_gat) == "object")
    1.31 +	    google_an2();	
    1.32 +}
    1.33 +
    1.34 +function http_request_object()
    1.35 +{
    1.36 +    var xmlHttpObject = null;
    1.37 +    
    1.38 +    if (typeof(XMLHttpRequest) != "undefined") 
    1.39 +    {
    1.40 +        xmlHttpObject = new XMLHttpRequest();
    1.41 +    }
    1.42 +    
    1.43 +    //For IE6 and IE5
    1.44 +    if (xmlHttpObject == null) 
    1.45 +    {
    1.46 +        try 
    1.47 +        {
    1.48 +            xmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
    1.49 +        }   
    1.50 +        catch(e) 
    1.51 +        {
    1.52 +            try 
    1.53 +            {
    1.54 +                xmlHttpObject = new ActiveXObject("Msxml2.XMLHTTP");
    1.55 +            }
    1.56 +            catch(e) 
    1.57 +            {
    1.58 +                xmlHttpObject = null;
    1.59 +            }
    1.60 +        }
    1.61 +    }
    1.62 +    return xmlHttpObject;
    1.63 +}
    1.64 +
    1.65 +function load_header(current)
    1.66 +{
    1.67 +    var file;
    1.68 +	if (current == "home")
    1.69 +        file = "/homenav.html";
    1.70 +    else if (current == "resume")
    1.71 +        file = "/resumenav.html";
    1.72 +    else if (current == "howiwork")
    1.73 +        file = "/howiworknav.html";
    1.74 +    else if (current == "personalwork")
    1.75 +        file = "/personalworknav.html";
    1.76 +    else if (current == "tutorials")
    1.77 +        file = "/tutorialsnav.html";
    1.78 +    else if (current == "contact")
    1.79 +        file = "/contactnav.html";
    1.80 +	
    1.81 +	var currentFile = self.location.hostname + self.location.pathname;		
    1.82 +	var request = http_request_object();
    1.83 +	var url  = "http://" + self.location.hostname + file;
    1.84 +	request.open("GET", url, false);
    1.85 +	request.setRequestHeader("User-Agent", navigator.userAgent);
    1.86 +	request.send(null)
    1.87 +	// if (oRequest.status == 200) alert(oRequest.responseText);
    1.88 +	// else alert("Error executing XMLHttpRequest call!");	
    1.89 +	//document.write(url);
    1.90 +    document.getElementById('header').innerHTML = request.responseText;
    1.91 +    //document.write(request.responseText);
    1.92 +    
    1.93 +    //alert(request.responseText);
    1.94 +}
    1.95 +
    1.96 +function load_sidebar()
    1.97 +{
    1.98 +    var file = "/sidebar.html";
    1.99 +	var currentFile = self.location.hostname + self.location.pathname;		
   1.100 +	var request = http_request_object();
   1.101 +	var url  = "http://" + self.location.hostname + file;	
   1.102 +	request.open("GET", url, false);
   1.103 +	request.setRequestHeader("User-Agent", navigator.userAgent);
   1.104 +	request.send(null)
   1.105 +	// if (oRequest.status == 200) alert(oRequest.responseText);
   1.106 +	// else alert("Error executing XMLHttpRequest call!");	
   1.107 +	//document.write(url);
   1.108 +	//document.write(request.responseText);
   1.109 +    document.getElementById('sidebar').innerHTML = request.responseText;
   1.110 +}
   1.111 +
   1.112 +function load_random_quote()
   1.113 +{   
   1.114 +   var file = "/quotes/quote" + Math.floor(Math.random() * QUOTES_NUMBER + 1) + ".html";
   1.115 +	var currentFile = self.location.hostname + self.location.pathname;		
   1.116 +	var request = http_request_object();
   1.117 +	var url  = "http://" + self.location.hostname + file;	
   1.118 +	request.open("GET", url, false);
   1.119 +	request.setRequestHeader("User-Agent", navigator.userAgent);
   1.120 +	request.send(null)
   1.121 +	// if (oRequest.status == 200) alert(oRequest.responseText);
   1.122 +	// else alert("Error executing XMLHttpRequest call!");	
   1.123 +	//document.write(url);
   1.124 +	//document.write(request.responseText);
   1.125 +    document.getElementById('random_quote').innerHTML = request.responseText;
   1.126 +}
   1.127 +
   1.128 +function load_footer()
   1.129 +{
   1.130 +	var file = "/footer.html";
   1.131 +	var currentFile = self.location.hostname + self.location.pathname;		
   1.132 +	var request = http_request_object();
   1.133 +	var url  = "http://" + self.location.hostname + file;	
   1.134 +	request.open("GET", url, false);
   1.135 +	request.setRequestHeader("User-Agent", navigator.userAgent);
   1.136 +	request.send(null)
   1.137 +	// if (oRequest.status == 200) alert(oRequest.responseText);
   1.138 +	// else alert("Error executing XMLHttpRequest call!");	
   1.139 +	//document.write(url);
   1.140 +	//document.write(request.responseText);
   1.141 +    document.getElementById('footer').innerHTML = request.responseText;
   1.142 +}