var currentActiveItem = null;
var nodes = null;
var nav = null;

startList = function() {
	initMenu();
	if (nav){
		if (nodes){
			for (var i=0; i<nodes.length; i++) {
				nodes[i].onmouseover = function() {
					
					for (var i=0; i<nodes.length; i++)
					{
						if (nodes[i].className == 'active')
						{
							currentActiveItem = nodes[i];
							nodes[i].className = '';
						}
						else
						{
							nodes[i].className = "";
						}
					}
					this.className += " hover";
					
				}
				nodes[i].onmouseout = function() {
					this.className = this.className.replace(new RegExp(" hover"), "");
				}
			}
		}
	}
	nav.onmouseout = function()	 {
		
		for (var i=0; i<nodes.length; i++)
		{
			nodes[i].className = "";
		}
	
		if (currentActiveItem){
		currentActiveItem.className = 'active';
	}
		
	}
}

initMenu = function () {
	
	nodes = document.getElementById("navigation-top").getElementsByTagName("li");
	nav = document.getElementById("navigation-top");
	
}

if (window.addEventListener)
	window.addEventListener("load", startList, false);
else if (window.attachEvent)
	window.attachEvent("onload", startList);