// Thanks to SuckerFish for the initial inspiration

// Enables all top-level li's on a ul to open an embedded ul on mouseover
// Clicking on the li will keep the embedded ul open

// Call from the body tag using onload, and pass an array of tag id, i.e.
// <body onload="menuInit(['top_menu','left_menu'])">
// <ul id="top_menu"><li>XXX<ul><li>YYY</li></ul></li></ul>


function menuInit() {
	if (window.attachEvent) {
		var sfEls = document.getElementById("left_menu").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}

//function menuInit(menus) {
//	if (window.attachEvent) {
//		for (var i=0; i<menus.length; i++) {
//	   	var menu = document.getElementById(menus[i]);
	   
//			var sfEls = menu.getElementsByTagName("LI");
//			for (var i=0; i<sfEls.length; i++) {
//				sfEls[i].onmouseover=function() {
//					this.className+=" sfhover";
//				}
//				sfEls[i].onmouseout=function() {
//					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
//				}
//			}
//		}
//	}
//}
