var xmlHttp=null;



var GLOBAL_PAGE_URL = null;

function load_page(page_url)
{

	GLOBAL_PAGE_URL = page_url;
	
	xmlHttp=GetXmlHttpObject();
	
	if(xmlHttp == null)
	{
		alert("Your browser does not support AJAX!!!!!");
		return;
	}
	
	var url = "http://worldslargestclock.com/load_page.php" + "?page_url=" + page_url;
	
	
	xmlHttp.onreadystatechange=stateChanged;
	
	xmlHttp.open("GET", url,true);
	
	xmlHttp.send(null);
	
	
	
	

}

function placeFooter()
{	
	//alert('37 in here');
	
	if(document.getElementById("store_indicator").innerHTML == "true")
	{
		//alert('41 and now here');
		if(navigator.appName == "Microsoft Internet Explorer")//if using internet exlplorer
		{
			placeFooterSpecific(1300);
		}
		else//if good browsers
		{
			placeFooterSpecific(1200);
		}
	}
	else
	{
		var height = document.getElementById("main_area").offsetHeight;
		
		height += 114;
		//alert(height);
	
		document.getElementById("absolute_bottom").style.top = height+"px";
		
	
		//alert("about to go in the width");
		if (window.innerWidth)
		{
			var width = window.innerWidth;
		}
		else if (document.documentElement && document.documentElement.clientWidth)
		{
			var width = document.documentElement.clientWidth;
		}
		else if (document.body.clientWidth)
		{
			var width = document.body.clientWidth;
		}
		else
		{
			var width = screen.width;
		}
		//width+=12;
		//alert(width);
		document.getElementById("absolute_bottom").style.width = width+"px";
		
		//alert("done in here");
	}
	
}

function placeFooterSpecific(place_at_height)
{
	//alert("in second guy");
	var height = place_at_height;
	
	document.getElementById("absolute_bottom").style.top = height+"px";
	
	var width = window.innerWidth;
	document.getElementById("absolute_bottom").style.width = width+"px";
	
}

function stateChanged() 
{
	
	
	
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("main_area").innerHTML=xmlHttp.responseText;
		if(GLOBAL_PAGE_URL == 'standard_clock.php')
		{
			clock();
		}
		
		else if(GLOBAL_PAGE_URL == 'countdown.php')
		{
			//alert("going in to countdown_reset(1)");
			countdown_reset(1);
		}
		
		else if(GLOBAL_PAGE_URL == 'timer.php')
		{
			timer_reset();
		}
		
		else if(GLOBAL_PAGE_URL == 'calendar.php')
		{
			calendar_reset(0);
			save_calendar();
		}
		
		if(GLOBAL_PAGE_URL =='store.php')
		{

			if(navigator.appName == "Microsoft Internet Explorer")//if using internet exlplorer
			{
				placeFooterSpecific(1300);
			}
			else//if good browsers
			{
				placeFooterSpecific(1200);
			}
		}
		else
		{

			placeFooter();
			
		}
		
	}
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
  	{
  		// Firefox, Opera 8.0+, Safari
 		xmlHttp=new XMLHttpRequest();
  	}
	catch (e)
  	{
  		// Internet Explorer
  		try
    	{
    		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    	}
  		catch (e)
    	{
    		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    	}
  	}
	return xmlHttp;
}