// JavaScript Document

function setNav() {

	if(window.main_nav && document.getElementById("nav-" + main_nav)){
		document.getElementById("nav-" + main_nav).className = "on";
	}
	if(window.sub_nav && document.getElementById("sub-nav-" + sub_nav)){
		document.getElementById("sub-nav-" + sub_nav).className = "on";
	}

	var sfEls = new Array();
	//set up navigation
	sfEls[0] = document.getElementById("navigation").getElementsByTagName("li");
	for (var i=0; i<sfEls[0].length; i++) {
		sfEls[0][i].onmouseover=function() {
			this.className+=" over";
			if(this.childNodes[2]){
				this.childNodes[2].style.zIndex = 2;
			}
		}
		sfEls[0][i].onmouseout=function() {
			this.className=this.className.replace(new RegExp("over\\b"), "");
			if(this.childNodes[2]){
				this.childNodes[2].style.zIndex = 0;
			}
		}
	}
	//set up my account dropdown
	if(document.getElementById("subscribers")){
		sfEls[1] = document.getElementById("subscribers").getElementsByTagName("li");
		for (var i=0; i<sfEls[1].length; i++) {
			sfEls[1][i].onmouseover=function() {
				this.className="over";
			}
			sfEls[1][i].onmouseout=function() {
				this.className=this.className.replace(new RegExp("over\\b"), "");
				
				
			}
		}
	}	
	
	
}

window.onload = setNav;