	
//---------------------------------------------------
//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;
							}
						}
					}

				}
				var className = oParent.className
				className = className + " " + sParentClass;
				oParent.className = className;
				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(sMenuId, iLevel){
	//Add the level to the LI's class on level iLevel.
	var oUL = document.getElementById(sMenuId + iLevel);
		var oUlChildren = oUL.childNodes
			for (var i=0; i<oUlChildren.length; i++){
					oUlChildren[i].className += " level" + iLevel
			}		
	}
	
	//Correct hover for IE 6
	function newHoverFix(menuId) {
		var oMenu = document.getElementById(menuId);
		if (undefined != oMenu){
		 //alert (menuId);
			var ieLIs = oMenu.getElementsByTagName('LI');
			for (var i=0; i<ieLIs.length; i++) if (ieLIs[i]){
				ieLIs[i].onmouseover=function() {this.className+=" sfhover";}
				ieLIs[i].onmouseout=function() {this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), '');}
			}
		}	
	}


	function InitAll()
		{
		//alert("init");
		var sHouseMenuId = "DTVMainMenu"
		SetLiLevel0 (sHouseMenuId, 0);		
		setHouseMenuCurrentItem(sHouseMenuId + "CurrentItem");
		newHoverFix (sHouseMenuId);
		sHouseMenuId = "DTVSubMenu"
		setHouseMenuCurrentItem(sHouseMenuId + "CurrentItem");
		}
		
		//Add function to load event of page
		if (window.addEventListener){
			window.addEventListener("load", InitAll, false);
		}
		else if (window.attachEvent){
			window.attachEvent ("onload", InitAll)
		} 

