hover = function() {
	var hoverID = document.getElementById('menu')
	if(hoverID==null)
		return true;
	
	var rows = hoverID.getElementsByTagName('td'); 
	for(var i=0; i<rows.length; i++){
		rows[i].onmouseover = function(){ 
			replaceClass("selected","tmp","TD");
			this.className+=' hover'; 
		} 
		rows[i].onmouseout = function(){ 
			replaceClass("tmp","selected","TD");
			this.className=this.className.replace(new RegExp("(\s)?hover\\b"), "");
		} 
	}
}

function replaceClass(cFind, cReplace, tag){
	var el = document.getElementById("menu").getElementsByTagName(tag);
	for (var i=0; i<el.length; i++) {
		if(el[i].className!=null){
			el[i].className=el[i].className.replace(new RegExp(cFind+"\\b"), cReplace);	
		}
	}
}


if (window.addEventListener){
	window.addEventListener("load",hover, false);
}else if (window.attachEvent){
	window.attachEvent("onload",hover);
}