function initPage()
{
	var nav = document.getElementById("main-nav");
	if (nav)
	{
		var nodes = nav.getElementsByTagName("li");
		for (var i = 0; i < nodes.length; i++)
		{
			nodes[i].onmouseover = function () 
			{
				if (this.className.indexOf("hover") == -1)
				{
					if (window.attachEvent && !window.opera) this.className += " hover";
					var _div = this.getElementsByTagName('div')[0];
					if (_div && _div.className.indexOf('widthDone') == -1) {
						_uls = _div.getElementsByTagName('ul');
						_uls.width = 0;
						for (var j = 0; j < _uls.length; j++) {
							_uls.width += _uls[j].offsetWidth;
						}
						_div.className += ' widthDone';
						_div.style.width = (_uls.width+70)+'px';
					}
				}
			}
			nodes[i].onmouseout = function ()
			{
				if (window.attachEvent && !window.opera) this.className = this.className.replace(" hover", "");
			}
		}
	}
}
if (window.addEventListener)
	window.addEventListener("load", initPage, false);
else if (window.attachEvent)
	window.attachEvent("onload", initPage);
