	
//---------------------------------------------------
//Correct the Housemenu active state and IE hover problems
//---------------------------------------------------

var sParentClass = "CurrentItemParent"
var sChildClass = "CurrentItemChild"



	function setHouseMenuCurrentItem(strCurrentId){	
		//get the current active node, this is the LI containing the active link
		var oMenu = document.getElementById (strCurrentId);

		if (undefined != oMenu){
			searchUp (oMenu);
			setActiveChildClass(oMenu);
		}
	}
	
	
		
	function searchUp(oNode){
	//move up from the active item in the dom to set the classes to active
			var oParent = oNode.parentNode;
			
			//Stop search if the root Div is reached
			if (oParent.tagName != "DIV"){
				//Do not handle the LI's
				if (oParent.tagName == "LI"){
					var oChildren = oParent.childNodes;
					for (var i=0; i<oChildren.length; i++) {
						//Set the calssname for all but A
						if (oChildren[i]){
							if (oChildren[i].tagName == "A"){
								oChildren[i].className = sParentClass;
							}
						}
					}

				}
				oParent.className += " ";
				oParent.className += sParentClass;
				searchUp(oParent);
				
			}
	}
	
	
	
	function setActiveChildClass(oMenu){
		var oChildUl = oMenu.getElementsByTagName('UL');
			for (var i=0; i<oChildUl.length; i++){
				//Check if this is the first level UL
				if (oChildUl[i].parentNode == oMenu){
					oChildUl[i].className = sChildClass
				}
			}				
	}
	
	function SetLiLevel0(){
	//Add the level to the LI's class on the first level.
	var oUL = document.getElementById("HouseMenuNav0");
		var oUlChildren = oUL.childNodes
			for (var i=0; i<oUlChildren.length; i++){
					oUlChildren[i].className += " level0"
			}		
	}
	

	function InitAll()
		{
		//alert("init");
		setHouseMenuCurrentItem("HMMainMenuCurrentItem");
		}
		
		//Add function to load event of page
		if (window.addEventListener){
			window.addEventListener("load", InitAll, false);
		}
		else if (window.attachEvent){
			window.attachEvent ("onload", InitAll)
		} 
