function initPage()
{
	var navRoot = document.getElementById("nav");
	var lis = navRoot.getElementsByTagName("li");
	for (var i=0; i<lis.length; i++)
	{
		lis[i].onmouseover = function()
		{
			if(this.getElementsByTagName("div")[0]) {
			this.className += " hover";
			}
	               	var cul = this.getElementsByTagName("div");
        	        if (cul){
                		for (var j=0; j<cul.length; j++){
	                        	cul[j].style.width = cul[j].parentNode.offsetWidth - 14 + "px";
		                }
			}
                }

		lis[i].onmouseout = function()
		{
			this.className = this.className.replace("hover","");
		}
	}
}

if (window.addEventListener)
	window.addEventListener("load", initPage, false);
else if (window.attachEvent)
	window.attachEvent("onload", initPage);

