// JavaScript Document	

function lightOn(obj){
	var LIs = obj.parentElement.getElementsByTagName("LI");
	var i = 0;
	while(LIs[i] != obj){
		i++;
	}
	
	if (i == 0){
		var color="#1a7beb";
	}else if (i == 1){
		var color="#ac1aeb";
	}else if (i == 2){
		var color="#eb1a7b";
	}else if (i == 3){
		var color="#ffb300";
	}else if (i == 4){
		var color="#f6660f";
	}else if (i == 5){
		var color="#00d100";
	}else if (i == 6){
		var color="#cc0000";
	}
	a = LIs[i].getElementsByTagName("a")[0];
	a.style.color = color;
}

function lightOff(obj){
	var color = "#FFFFFF";
	a = obj.getElementsByTagName("a")[0]
	a.style.color = color;	
}

function setCSS(css) {
	//alert(navigator.appVersion)
	if (navigator.appVersion.indexOf("MSIE") != -1 ){
		try {
			// append stylesheet to alter
			document.getElementsByTagName("head")[0].appendChild(css);
		} catch (e) {
			setTimeout(function(){setCSS(css)}, 100);
		}
	}
}
 
// create CSS element to set up the page
var css = document.createElement("link");
css.setAttribute("href","ags-ie-fonts.css");
css.setAttribute("rel","stylesheet");
css.setAttribute("type","text/css");
 


//-----------------------------------------------------------


function popUpForm(){
	window.scrollTo(0,0);
	form = document.getElementById("supportForm");
	form.style.display = "block";
	form.style.height =document.body.scrollHeight	 + "px";
	document.getElementById("step2").style.display = "none";
	document.getElementById("step1").style.display = "block";
}

function popUpFormClose(){
	form.style.display = "none";
}

function popUpFormConfirm(){
	document.getElementById("step1").style.display = "none";
	document.getElementById("step2").style.display = "block";
}

function popUpDoc(){
	window.scrollTo(0,0);
	form = document.getElementById("marketingMaterial");
	form.style.display = "block";
	form.style.height =document.body.scrollHeight	 + "px";
}
function showConfirmation(obj){
	mform = obj.form;
	mdiv = document.getElementById("subscription-confirmation")
	MHeight = mform.offsetHeight - 10 +"px";
	mdiv.style.height = MHeight;
	mform.style.display = "none";
	mdiv.style.display="block";
}
function backFix(){
	window.status = document.documentElement.offsetWidth
	if (document.documentElement.offsetWidth < 986){
		
		document.body.style.backgroundPosition = "-468px 0px";
	}else{
		document.body.style.backgroundPosition = "center 0px";
	}
}
function ini(){
	// attempt to add the css and then keep trying till we do
	setCSS(css);
	//stops moving background when window width is less then 986px
	document.body.setAttribute("onresize", "backFix();");	
}