// JavaScript Document
// Top menubar 
var cssmenuids=["cssmenu1"]; //Enter id(s) of CSS Horizontal UL menus, separated by commas
var csssubmenuoffset=-1; //Offset of submenus from main menu. Default is 0 pixels.

sfHover = function() {
	try {
		var sfEls = document.getElementById("nav").getElementsByTagName("li");
	} catch(e) {
		return;
	}
	
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

function createcssmenu2(){
for (var i=0; i<cssmenuids.length; i++){
	try {
  		var ultags=document.getElementById(cssmenuids[i]).getElementsByTagName("ul");
	} catch(e) {
		continue;
	}
    
 	for (var t=0; t<ultags.length; t++){
		ultags[t].style.top=ultags[t].parentNode.offsetHeight+csssubmenuoffset+"px";
		
    	var spanref=document.createElement("span");
			spanref.className="arrowdiv";
			spanref.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;";
			ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref);
			
    	ultags[t].parentNode.onmouseover=function(){
			this.style.zIndex=100;
    		this.getElementsByTagName("ul")[0].style.visibility="visible";
			this.getElementsByTagName("ul")[0].style.zIndex=0;
    	}
		
    	ultags[t].parentNode.onmouseout=function(){
			this.style.zIndex=0;
			this.getElementsByTagName("ul")[0].style.visibility="hidden";
			this.getElementsByTagName("ul")[0].style.zIndex=100;
    	}
	}
  }
}

if (window.addEventListener) {
	window.addEventListener("load", createcssmenu2, false);
	//window.attachEvent("onload", sfHover);
} else if (window.attachEvent) {
	window.attachEvent("onload", createcssmenu2);
	window.attachEvent("onload", sfHover);
}

//Menu chang color
function hiLight(el,color) {
	el.style.background=color;
}

