function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function init(){

	var x = readCookie('pageWidth');

	if(x=="lg")
		changeCSS("lg");
	else if(x=="med")
		changeCSS("med");
	else
		changeCSS("sm");

}

function changeCSS(title) {
	var lnks = document.getElementsByTagName('link');
	for (var i = lnks.length - 1; i >= 0; i--) {
		if (lnks[i].getAttribute('rel').indexOf('style')> -1 && lnks[i].getAttribute('title')) {
			lnks[i].disabled = true;
			if (lnks[i].getAttribute('title') == title) lnks[i].disabled = false;
		}
	}
}

function showCustomize(status){
	if(document.getElementById("switchWidth") != null){
	if(status=="show"){
		document.getElementById("switchWidth").style.marginTop = "-67px";
		document.getElementById("switchWidth").style.height = "120px";
	}
	else{
		document.getElementById("switchWidth").style.marginTop = "15px";	
		document.getElementById("switchWidth").style.height = "18px";
	}
	}
}

startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("mainNav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
  				node.onmouseout=function() {
  					this.className=this.className.replace(" over", "");
   				}
   			}
  		}
 	}
}

window.onload = function(e) {
	if(document.getElementById("switchWidth") != null){
		document.getElementById("switchWidth").style.display = "block";	
		if(status=="show")
			document.getElementById("switchWidth").style.marginTop = "-67px";
		else
			document.getElementById("switchWidth").style.marginTop = "15px";
	}
	startList();
	if(document.forms["frmApply"]) {
		var currState = document.forms["frmApply"].DLState.value;
		if(currState == "IL") {
			toggleDivOL('ILClass','','show'); 
			toggleDivOL('nonILClass','','hide'); 
		} else {
			toggleDivOL('ILClass','','hide'); 
			toggleDivOL('nonILClass','','show'); 
		}
	}
}