	
//---------------------------------------------------
//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 SetMenu2Level (id){
	var oMenu = document.getElementById (id);
	if (undefined != oMenu){
			var oChildren = oMenu.childNodes
			oChildren = oChildren[1].childNodes
				for (var i=0; i<oChildren.length; i++) {
						//Set the classname for all but A
							if (oChildren[i].tagName == "LI"){
								oChildren[i].className = "Menu2L0";
							}
						}	
			}
	}
	
	
		
	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"
			}		
	}
	
	//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 FlashWrite1(filePath){
           document.write ("<object id='organisatie' codebase='https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' height='150' width='150' align='middle' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'>");
           document.write ("<param name='allowScriptAccess' value='sameDomain' />");
           document.write ("<param name='movie' value='" + filePath + "img/flash/organisatie.swf?url=" + filePath + "img/flash/organisatie.txt' />");
           document.write ("<param name='quality' value='high' />");
           document.write ("<param name='bgcolor' value='#ffffff' />");
           document.write ("<embed src='" + filePath + "img/flash/organisatie.swf?url=" + filePath + "img/flash/organisatie.txt' quality='high' bgcolor='#FFFFFF' width='150' height='150' name='organisatie' align='middle' allowscriptaccess='sameDomain' type='application/x-shockwave-flash' pluginspage='https://www.macromedia.com/go/getflashplayer'> </embed> ");
           document.write ("</object>");
	}

	function FlashWrite2(filePath){
            document.write ("<object id='nieuws' codebase='https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' height='150' width='150' align='middle' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'> ");
            document.write ("<param name='allowScriptAccess' value='sameDomain' /> ");
            document.write ("<param name='movie' value='" + filePath + "img/flash/nieuws.swf?url=" + filePath + "img/flash/nieuws.txt' /> ");
            document.write ("<param name='quality' value='high' /> ");
            document.write ("<param name='bgcolor' value='#ffffff' /> ");
            document.write ("<embed src='" + filePath + "img/flash/nieuws.swf?url=" + filePath + "img/flash/nieuws.txt' quality='high' bgcolor='#FFFFFF' width='150' height='150' name='nieuws' align='middle' allowscriptaccess='sameDomain' type='application/x-shockwave-flash' pluginspage='https://www.macromedia.com/go/getflashplayer'> </embed> ");
            document.write ("</object>");
	}
	
	
	function InitAll()
		{
		//alert("init");
		setHouseMenuCurrentItem("MenuLevel1CurrentItem");
		setHouseMenuCurrentItem("MenuLevel2CurrentItem");	
		//SetMenu2Level("MenuLevel2")
		newHoverFix ("MenuLevel1");
		}
		
		//Add function to load event of page
		if (window.addEventListener){
			window.addEventListener("load", InitAll, false);
		}
		else if (window.attachEvent){
			window.attachEvent ("onload", InitAll)
		} 
