var menu_h=null;
function init_menu_h(){
	menu_h=document.getElementById('menu_h');
	var li=menu_h.getElementsByTagName('li'),i=li.length;
	while(i--){
		li[i].onmouseover=show_h;
	}
	menu_h.onmouseout=time_h;
	menu_h.onmouseover=clear_h;
	//zet de pijltjes aan
	var a=menu_h.getElementsByTagName('a'),i=a.length;
	while(i--){
		var ns=a[i].nextSibling; 
		if( ns != null ){
			//ns.parentNode.style.className='testtag';
			ns.parentNode.style.backgroundImage.src='../../img/logo.jpg';
		}
	}
}
var timer_h=null;
function time_h(){
	timer_h=setTimeout('hide_h(menu_h, null)',1000);
}
function clear_h(){
	if(timer_h){
		clearTimeout(timer_h);
		timer_h=null;
	}
}
function show_h(){
	var ul=this.parentNode;
	while(ul){
		if(ul.tagName.toLowerCase()=='ul'){
			hide_h(ul,this);
			break;
		}
		ul=ul.parentNode;
	}
	ul=this.firstChild;
	while(ul){
		if(ul.nodeType==1 && ul.tagName.toLowerCase()=='ul'){
			ul.style.display='block';
			ul.style.visibility='';
			break;
		}
		ul=ul.nextSibling;
	}
}
function hide_h(level,skipli){
	var stack=[level],i=0,li,j,el,tag;
	do{li=stack[i].childNodes,j=li.length;
		while(j--){
			el=li[j];
			if(el.nodeType==1 && el!=skipli){
				tag=el.tagName.toLowerCase();
				if(tag=='li'){
					stack[i++]=el;
				}else if( tag=='ul' && el.style.display=='block'){
					stack[i++]=el;
					el.style.display='none';
					el.style.visibility='hidden';
				}
			}
		}
	}
	while(i--);
}


function init_menu_h_old(){
	menu_h=document.getElementById('menu_h');
	var li=menu_h.getElementsByTagName('li'),i=li.length;
	while(i--){
		li[i].onmouseover=show_h;
		var nextSib = li[i].nextSibling;
		while( nextSib.nodeType != 1 ) {
			nextSib.parentNode.style.backgroundColor='#0f0';			
		}
		
		var temp = li[i].firstChild;
		alert( temp.nextSibling );
		//alert( li[i].firstChild.firstChild.tagName.toLowerCase()=='ul' );
		
		//if after the link we get an ul then color this one
		
		
		
		
		//if( li[i].firstChild.innerHTML == undefined ) {
		//	if( li[i].parentNode.parentNode.tagName.toLowerCase()=='li' ) {//alert( li[i].parentNode.tagName.toLowerCase() );
		//		li[i].parentNode.parentNode.style.backgroundColor='#0f0';
		//	}
		//}
		//alert( li[i].firstChild.tagName.toLowerCase() );
		
		
		//var ul=li[i].parentNode;
		//if(ul.tagName.toLowerCase()=='ul'){
		//	li[i].style.backgroundColor='#00f';
		//}
		
		
		//alert( li[i].childNodes[ 1 ] );
		//if(li[i].firstChild.tagName.toLowerCase()=='ul'){
		//	li[i].style.backgroundColor='#f00';
		//}
	}
	menu_h.onmouseout=time_h;
	menu_h.onmouseover=clear_h;
}