/**
 * @author Arian Stolwijk
 */

getElement = function(root,tag){
	for(var i in root.childNodes){
		if(root.childNodes[i].nodeName == tag){
			return root.childNodes[i];
		}
	}
}

getElements = function(root,tag){
	var elmts = new Array();	
	for(var i in root.childNodes){
		if(root.childNodes[i].nodeName == tag){
			elmts.push(root.childNodes[i]);
		}
	}
	return elmts;
}


window.onload = function(){
	
	var menu = getElement(document.getElementById('menu'),'UL'),
		lis = getElements(menu,'LI'),li;

	for(var i in lis){
		li = lis[i];
		li.submenu = getElement(li,'UL');
		
		if(li.submenu){
			li.submenu.style.display = 'none';
			li.onmouseover = function(){
				this.submenu.style.display = 'block';
			}
			li.onmouseout = function(){
				this.submenu.style.display = 'none';
			}
			
		}
		
	}	
	
}

