function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

// Function to replace the li:hover pseudo class
function addHover() {
	if (document.getElementById("menu")) {
		var allMenuItems = document.getElementById("menu").getElementsByTagName("LI");
		for (i=0;i<allMenuItems.length;i++) {
			allMenuItems[i].onmouseover = function() {
				if (!this.className) {
					this.className = "hover";
				} else {
					this.className = this.className+" hover";
				}
			}
			allMenuItems[i].onmouseout = function() {
				this.className = this.className.replace(/\s?hover/,"");
			}
		}
	}
}

addLoadEvent(addHover);