/*
Name: splash.js
Author: Dallas Petersen
Purpose:
*/

/*Returns height of browser window*/
function getWindowHeight() {
	var windowHeight = 0;
	
	//Height of window from non-IE browsers
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		//Height of window for IE6+ standards compliant mode
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			//Height of window for other versions of IE
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

/**/
function setContent() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentElement = document.getElementById('containerstart');
			var contentHeight = contentElement.offsetHeight;
			if (windowHeight - contentHeight > 0) {
				contentElement.style.position = 'relative';
				contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2)) + 'px';
				if(navigator.userAgent.indexOf("Safari") != -1){contentElement.style.marginTop = '7px';}
			}
			else {
				contentElement.style.position = 'static';
			}
		}
	}
}

/*Run after window has loaded*/
window.onload = function() {
	setContent();
	
	//Safari browser requires a resize in order for it to correctly display the adjusted content
	//This is a hack since a resize like this will screw up a maximized window
	//if(navigator.userAgent.indexOf("Safari") != -1){self.resizeBy(-1,0); self.resizeBy(1,0);}
}

/*Runs when window is resized*/
window.onresize = function() {
	setContent();
}

/*Function provides backdoor for easy development on cedev and prince*/
function enter()
{
	location = "../secure/lesson1p1.htm";
}

function begin(w)
{
	var l = new String(location);
	a = l.split("/");
	newlocation = ""
	for(i=0;i<a.length-1;i++) newlocation += a[i] + "/";
	newlocation += "begin.htm";
	w.location = newlocation;
}
