// 2008-05-17 
// Eli Moulton

// Custom code to center the main div layer of the site.
// Needs _jsinc_/schapman_windowsizepos.js included before this file or it will break.

function centerMainWindow()
{
	var elem = document.getElementById('MainLayoutDiv');
	var winW = pageWidth();  // Needs _jsinc_/schapman_windowsizepos.js
	var winH = pageHeight(); // Needs _jsinc_/schapman_windowsizepos.js
	var elemW = parseInt(elem.style.width);
	var elemH = parseInt(elem.style.height);
	
	if (winW <= elemW) { elem.style.left = 0; }
	else { elem.style.left = Math.round((winW - elemW) / 2); }
	
	if (winH <= elemH) { elem.style.top = 0; }
	else { elem.style.top = Math.round((winH - elemH) / 2); }
}


function bodyOnLoad()
{
	//Setup all the link text colors
	//Don't need?
	//document.getElementById("HomeLinkIndent").style.color = colorMouseOut;
	
	//Setup the ajax data handling stuff
	if (window.XMLHttpRequest)
	{
		serverData = new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		serverData = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		serverData = false;
	}
	
	//Center the main div in the browswer window.
	centerMainWindow();	
}

