doMenu = function() {
	iWidth = (navigator.appName.indexOf("Microsoft") != -1)
	       ? document.body.offsetWidth
		   : window.innerWidth;
	showLeft = ((iWidth - 950) / 2) + 'px';

	// position active menu
	if (document.getElementById('active')) {
		activeMenu = document.getElementById('active');
		activeMenu.childNodes[2].style.left = showLeft;
		activeMenu.className = 'show';
	}

	menuDiv = document.getElementById('main');
	for (i = 0; i < menuDiv.childNodes.length; i++) {
		node = menuDiv.childNodes[i];
		if (node.nodeName == 'LI') {
			node.onmouseover = function() {
				if (document.getElementById('active')) {
					activeMenu.className = '';
					activeMenu.id = '' ;
				}

				this.className += 'show';
				this.id = 'active' ;
				activeMenu = document.getElementById('active');
				
				if (this.childNodes[2].nodeName == 'UL') {
					this.childNodes[2].style.left = showLeft;
				}
			}
			node.onmouseout = function() {
				this.className = this.className.replace('show', '');
				
				if (document.getElementById('active')) {
					activeMenu.className = 'show';
				}
			}
		}
	}
}

window.onload = doMenu;
window.onresize = doMenu;
