// Define variables with browser information
var detect = navigator.userAgent.toLowerCase();
var browser,version,total,thestring;

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

function centerDiv(divId) {
	var scrWidth = document.body.clientWidth;	//get width of browser
	var scrHeight = document.body.clientHeight; //get height of browser
	var theDiv = document.getElementById(divId);
	
	// internet exlorer uses proprietary mathod to get computed style properties
    if (checkIt('msie')) {	
		var divIdWidth = parseInt(document.getElementById(divId).currentStyle.width);
		var divIdHeight = parseInt(document.getElementById(divId).currentStyle.height);
	}
	// mozilla and firefox use the DOM
	else {
		var divIdWidth = parseInt(document.defaultView.getComputedStyle(theDiv, '').getPropertyValue("width"));
		var divIdHeight = parseInt(document.defaultView.getComputedStyle(theDiv, '').getPropertyValue("height"));
	}
	// position theDiv centered in horizontal and vertical direction	
	theDiv.style.left = Math.max(0,(scrWidth-divIdWidth)/2 );
	theDiv.style.top = Math.max(0,(scrHeight-divIdHeight)/2 );
}
