// JavaScript Document
function addLoadEvent(func) 
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function')
	{
    	window.onload = func;
	} 
	else
	{
    	window.onload = function() 
		{
			if (oldonload) 
			{
        		oldonload();
      		}
      		func();
    	}
	}
}

function showPage(pageId) 
{
	if (pageId == "") 
	{
		alert("The Page ID is Empty:")
	}
	else 
	{
		var xmlhttp = null;
		var myPageName = "/home/" + pageId + ".html";
		
		if (window.XMLHttpRequest)
		{
		  xmlhttp = new XMLHttpRequest(); // code for IE7+, Firefox, Chrome, Opera, Safari
		}
		else if (window.ActiveXObject)
		{
		  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // code for IE6, IE5
		}
		else
		{
		  alert("Your browser does not support XMLHTTP!");
		}
		
		if (xmlhttp != null)
		{	
			xmlhttp.onreadystatechange = function()
			{	
				if (xmlhttp.readyState == 4)
				{
					document.getElementById('content').innerHTML = xmlhttp.responseText;
				}
			};
			
			xmlhttp.open("GET",myPageName,false);
			xmlhttp.send(null);
			
			if (xmlhttp.onreadystatechange == null)
			{
				document.getElementById('content').innerHTML = xmlhttp.responseText;
			}
		}
	}
}

function copyDate() {
	var d = new Date();
	document.write(d.getFullYear());
}
