
function init() {
	traverseTree(document.getElementById("mainmenu"));
}

function traverseTree(whatTree){
	if (whatTree.hasChildNodes()) {
		for(var i=0;i<whatTree.childNodes.length;i++) {
			var node_str = whatTree.childNodes[i]
			if (node_str.nodeName=="UL") {
				for(var j=0;j<node_str.childNodes.length;j++) {
					var subnode_str = node_str.childNodes[j]
					if (subnode_str.nodeName=="LI") {
						setItAndForgetIt(subnode_str);
						traverseTree(subnode_str);
					}
				}
			}
		}		
	} 
}

function setItAndForgetIt(whichNode) {
	whichNode.onmouseover=function() {
	  this.className+=" over";
	}
	whichNode.onmouseout=function() {
	  this.className="" //this.className.replace(" over", "");
	}
}

function openDiv(whichDiv) {
	var divObject = document.getElementById(whichDiv)
	divObject.style.display = 'block' 
}
function closeDiv(whichDiv) {
	var divObject = document.getElementById(whichDiv)
	divObject.style.display = 'none' 
}

function setSelected(whichActive,whichInactive) {
	var activeObject = document.getElementById(whichActive)
	var inactiveObject = document.getElementById(whichInactive)

	activeObject.style.backgroundColor = '#ffffff'; 
	activeObject.style.borderBottomColor = '#ffffff'; 
	activeObject.style.color = '#000000'; 

	inactiveObject.style.backgroundColor = '#e0e0e0'; 
	inactiveObject.style.borderBottomColor = 'c7c7c7'; 
	inactiveObject.style.color = '#555555'; 

}