var xmlHttp;

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;
}

function ajaxBoxReady() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById('mainContent').innerHTML = xmlHttp.responseText;
	}
}

function loadAjaxBox(url)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	xmlHttp.onreadystatechange=ajaxBoxReady;
	xmlHttp.open("GET", "AJAX/loadFromMySQL.php?cid=" + url, true);
	xmlHttp.send(null);
}

function centerTheBox()
{

/*How big is the browser window?*/
var winH = 460;

 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      winH = window.innerHeight;
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       winH = document.documentElement.clientHeight;
 }
 
 // older versions of IE
 
 else
 {
       winH = document.getElementsByTagName('body')[0].clientHeight;
 }

	if (winH > 640)
	{
		topMarginSize = (winH - 640) / 2;
		document.getElementById('wrapper').style.marginTop = topMarginSize + "px";
	}
	else
	{
		document.getElementById('wrapper').style.marginTop = "0px";
	}
}
