// JavaScript Document

function activeMenuItem(p,q)
{
	

curMenuItem=p
if (document.all)
{ objs = document.all.tags("li");
subs = document.all.tags("ul");

}
else if (document.getElementsByTagName)
{ objs = document.getElementsByTagName("li");
subs = document.getElementsByTagName("ul");
}
else if (document.layers)
{ objs = document.layers["li"];
subs = document.layers["ul"];
}
for(z=0;z<objs.length;z++){
	//set current menu, submenu
	if(objs[z].id==p){
	objs[z].className="activeMain"
	objs[z].getElementsByTagName("ul")[0].className="activeSub";
	subElements=objs[z].getElementsByTagName("li")	
	
	for(y=0;y<subElements.length;y++){
		if(subElements[y].id==q){
			subElements[y].id="activeSubItem"
			
			}
		
		}
	
	}
	//mouseover functionality		
	if(objs[z].parentNode.id=="mainNav"){
	objs[z].onmouseover=function(){
		subNodes=this.parentNode.getElementsByTagName("ul")
		for( g=0;g<subNodes.length;g++){
			subNodes[g].style.display = "none";
			}
		var curId=this.getElementsByTagName("ul").item(0)
		var curAnchor=this.getElementsByTagName("a").item(0);
		curAnchor.style.backgroundColor="#ff6600"
		curAnchor.style.color="#fff"
		this.style.backgroundColor="#ff6600"
		curId.style.display = "inline";	
			}
		
		objs[z].onmouseout=function(){
		
		var curId=this.getElementsByTagName("ul").item(0);
		var curAnchor=this.getElementsByTagName("a")[0];
		curId.style.display = "none";
		if(curMenuItem!=this.id){
			curAnchor.style.color="#333"
			this.style.backgroundColor="#fff"
			curAnchor.style.backgroundColor="#fff"
			}for( g=0;g<objs.length;g++){
			if(objs[g].id==curMenuItem){
				objs[g].getElementsByTagName("ul").item(0).style.display="inline"
				}
			}
			
			}
		
		
		}
		

	
}
}



