//window.onload = function() { checkCanvas(); }
window.onresize = function() { checkCanvas(); }

//used to help keep the site in-bounds with vertically centering
function checkCanvas() {
	var macie5 = document.all && !document.mimeType && !(navigator.userAgent.indexOf("Konqueror") > -1);
	if(document.getElementById && document.createElement && !macie5) { 	
		var horizon = document.getElementById('horizon');
		var wSize = getWindowSize();
		if(horizon.offsetTop < 0) {
			horizon.style.top = '0px';
			horizon.style.marginTop = '0px';
		}
		if(wSize['height'] > horizon.offsetHeight) {
			horizon.style.top = '50%';
			horizon.style.marginTop = (horizon.offsetHeight / 2) * -1 + 'px';
		}
	}
}

//helper function for checkCanvas
function getWindowSize() {
	var wSize = Array();
	if (typeof(window.innerHeight) == 'number') {
		wSize['width'] = window.innerWidth;
		wSize['height'] = window.innerHeight;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		wSize['width'] = document.documentElement.clientWidth;
		wSize['height'] = document.documentElement.clientHeight;
	} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		wSize['width'] = document.body.clientWidth;
		wSize['height'] = document.body.clientHeight;
	}
	return wSize;
}
