var browser;
if (window.navigator.userAgent.indexOf("MSIE") != -1)
	browser = 'ie';
else
	browser = 'good';

// Centers absolute positioned object
function Center(element) {
	elem = document.getElementById(element);
	if (browser == 'ie') {
		windowWidth = document.body.clientWidth;
	}
	else {
	   	windowWidth = window.innerWidth;	
	}
	elem.style.left = (windowWidth/2 - elem.offsetWidth/2) + 'px';
}


// Set height to size of window
function MaxHeight(element) {
	if(window.navigator.userAgent.indexOf("MSIE 7.0") > -1)
		windowHeight = document.documentElement.clientHeight;
	else if(browser == 'ie') {
		windowHeight = document.documentElement.clientHeight;
		windowWidth = document.documentElement.clientWidth;
		element.style.width = windowWidth + 'px';
	}
	else 
	   	windowHeight = window.innerHeight;	
	if(element.offsetHeight < windowHeight)
		element.style.height = windowHeight + 'px';
}


// Shows and hides Alert Box
function AlertBox(element) {
	elem = document.getElementById(element).parentNode;
	if(elem.style.display == 'block') {
		elem.style.display = 'none';
	}
	else {
		elem.style.display = 'block';
		Center(element);
		if(browser == 'ie')
			MaxHeight(elem.parentNode.childNodes[1]); // sets background dim to max height
		else
			MaxHeight(elem.parentNode.childNodes[3]);
	}
}

