function initPage()
{
	var nav = document.getElementById("nav");
	if (nav)
	{
		var nodes = nav.getElementsByTagName("li");
		for (var i = 0; i < nodes.length; i++)
		{
			if (nodes[i].getElementsByTagName('div')[0]) {
				var _div = nodes[i].getElementsByTagName('div')[0];
				var _divWidth = _div.offsetWidth;
				var _liParentWidth = nodes[i].offsetWidth;

				if (_liParentWidth > _divWidth) _div.style.width = _liParentWidth+'px';
				else _div.style.width = _divWidth+5+'px';
				
				nodes[i].onmouseover = function () {
					this.className += ' hover';
				}
				nodes[i].onmouseout = function () {
					this.className = this.className.replace("hover", "");
				}
			}
		}
		if (nodes[0].parentNode.className.indexOf('nav-load') == -1)
			nodes[0].parentNode.className += ' nav-load';
	}
}
if (window.addEventListener)
	window.addEventListener("load", initPage, false);
else if (window.attachEvent)
	window.attachEvent("onload", initPage);
