backup.script.js
author Eugen Sawin <sawine@me73.com>
Sun, 04 Jul 2010 00:15:47 +0200
changeset 8 b1a67cf82daf
permissions -rw-r--r--
Added border to canvas.
     1 var QUOTES_NUMBER = 25;
     2 
     3 function load_page(html, params)
     4 {
     5 	if (params != "")
     6 		html += "?";	
     7 	window.location = html + params;	
     8 	//window.location.reload();
     9 }
    10 
    11 function google_an1()
    12 {
    13     var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    14     document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));    
    15 }
    16 
    17 function google_an2()
    18 {
    19     var pageTracker = _gat._getTracker("UA-2137333-1");
    20     pageTracker._initData();
    21     pageTracker._trackPageview();
    22 }
    23 
    24 function google_an()
    25 {	    
    26 	google_an1();
    27 	if (typeof(_gat) == "object")
    28 	    google_an2();	
    29 }
    30 
    31 function http_request_object()
    32 {
    33     var xmlHttpObject = null;
    34     
    35     if (typeof(XMLHttpRequest) != "undefined") 
    36     {
    37         xmlHttpObject = new XMLHttpRequest();
    38     }
    39     
    40     //For IE6 and IE5
    41     if (xmlHttpObject == null) 
    42     {
    43         try 
    44         {
    45             xmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
    46         }   
    47         catch(e) 
    48         {
    49             try 
    50             {
    51                 xmlHttpObject = new ActiveXObject("Msxml2.XMLHTTP");
    52             }
    53             catch(e) 
    54             {
    55                 xmlHttpObject = null;
    56             }
    57         }
    58     }
    59     return xmlHttpObject;
    60 }
    61 
    62 function load_header(current)
    63 {
    64     var file;
    65 	if (current == "home")
    66         file = "/homenav.html";
    67     else if (current == "resume")
    68         file = "/resumenav.html";
    69     else if (current == "howiwork")
    70         file = "/howiworknav.html";
    71     else if (current == "personalwork")
    72         file = "/personalworknav.html";
    73     else if (current == "tutorials")
    74         file = "/tutorialsnav.html";
    75     else if (current == "contact")
    76         file = "/contactnav.html";
    77 	
    78 	var currentFile = self.location.hostname + self.location.pathname;		
    79 	var request = http_request_object();
    80 	var url  = "http://" + self.location.hostname + file;
    81 	request.open("GET", url, false);
    82 	request.setRequestHeader("User-Agent", navigator.userAgent);
    83 	request.send(null)
    84 	// if (oRequest.status == 200) alert(oRequest.responseText);
    85 	// else alert("Error executing XMLHttpRequest call!");	
    86 	//document.write(url);
    87     document.getElementById('header').innerHTML = request.responseText;
    88     //document.write(request.responseText);
    89     
    90     //alert(request.responseText);
    91 }
    92 
    93 function load_sidebar()
    94 {
    95     var file = "/sidebar.html";
    96 	var currentFile = self.location.hostname + self.location.pathname;		
    97 	var request = http_request_object();
    98 	var url  = "http://" + self.location.hostname + file;	
    99 	request.open("GET", url, false);
   100 	request.setRequestHeader("User-Agent", navigator.userAgent);
   101 	request.send(null)
   102 	// if (oRequest.status == 200) alert(oRequest.responseText);
   103 	// else alert("Error executing XMLHttpRequest call!");	
   104 	//document.write(url);
   105 	//document.write(request.responseText);
   106     document.getElementById('sidebar').innerHTML = request.responseText;
   107 }
   108 
   109 function load_random_quote()
   110 {   
   111    var file = "/quotes/quote" + Math.floor(Math.random() * QUOTES_NUMBER + 1) + ".html";
   112 	var currentFile = self.location.hostname + self.location.pathname;		
   113 	var request = http_request_object();
   114 	var url  = "http://" + self.location.hostname + file;	
   115 	request.open("GET", url, false);
   116 	request.setRequestHeader("User-Agent", navigator.userAgent);
   117 	request.send(null)
   118 	// if (oRequest.status == 200) alert(oRequest.responseText);
   119 	// else alert("Error executing XMLHttpRequest call!");	
   120 	//document.write(url);
   121 	//document.write(request.responseText);
   122     document.getElementById('random_quote').innerHTML = request.responseText;
   123 }
   124 
   125 function load_footer()
   126 {
   127 	var file = "/footer.html";
   128 	var currentFile = self.location.hostname + self.location.pathname;		
   129 	var request = http_request_object();
   130 	var url  = "http://" + self.location.hostname + file;	
   131 	request.open("GET", url, false);
   132 	request.setRequestHeader("User-Agent", navigator.userAgent);
   133 	request.send(null)
   134 	// if (oRequest.status == 200) alert(oRequest.responseText);
   135 	// else alert("Error executing XMLHttpRequest call!");	
   136 	//document.write(url);
   137 	//document.write(request.responseText);
   138     document.getElementById('footer').innerHTML = request.responseText;
   139 }