// redirect if cookie is set with a preferred page
// user would only get here in this instance by following an external link, bookmark, cached page, etc...

if(pg = document.cookie.match(/CB_AUDIENCE=(prof|parents)/)){
	window.location.href = '/'+pg[1];
}
else{
	if(/CB_AUDIENCE=student/.test(document.cookie)){
		window.location.href = '/student/index.html?student';
	}
}


function browserCheck() {
	bName = navigator.appName;
	bVer = parseInt(navigator.appVersion);
	var agt=navigator.userAgent.toLowerCase();
	var browser = '';
	//if user has an outdated browser
	if (((bName == 'Netscape') && (bVer < 5))||((bName == 'Microsoft Internet Explorer') && (bVer < 4))||(agt.indexOf("MSIE 4")!=-1)) {
		popup('/html/browser_upgrade.html');
	}
}


function gotoPreferredPage(i,name){

	hasCookies           = (document.cookie.indexOf('CB_AUDIENCE=')<0) ? 0 : 1;
	var showPopup        = 1;

	if(hasCookies){
		cookieValueArray = document.cookie.match(/CB_AUDIENCE=(\d[-|,]\d[-|,]\d)/);
		state            = cookieValueArray[1].split(/[-|,]/);
		showPopup        = (state[i]==1) ? 1 : 0;
	}

	if(hasCookies & showPopup){
		popup('/student/html/popup.html?'+name,'',400,150,'no','no');
	}
}

document.write('<style type="text/css">#splash{visibility:hidden}</style>');

function toggleImages(){
	var dt  = new Date();
	var dir = dt.getTime()%5;

	document.getElementById('for-students').style.backgroundImage  = 'url(/student/splash/images/'+dir+'/students.jpg)';
	document.getElementById('for-parents').style.backgroundImage   = 'url(/student/splash/images/'+dir+'/parents.jpg)';
	document.getElementById('for-educators').style.backgroundImage = 'url(/student/splash/images/'+dir+'/educators.jpg)';
	document.getElementById('splash').style.visibility = 'visible';
}

function whichSearch() {
	if (document.getElementById('navsite').checked) {
		return true;
	}
	else {
		document.getElementById('tnavWord').value = document.getElementById('q').value;
		document.getElementById('tnavCsearchForm').submit();
		return false;
	}
}

