/* -*- mode: c -*- */
/* Make top menu items drop down (needed for IE) */
/* Also highlight the active menu item */

function startList(active) {
	if (document.getElementById) {
		var navRoot = document.getElementById("navlist");

		if (navRoot == null)
			return;
		/* Look for list items. */
		for (i=0; i<navRoot.childNodes.length; i++) {
			var node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				/* Add mouse-in and mouse-out things
				 * to switch its CSS on the fly. */
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace("over", "");
				}
				/* Also check if this is the active one */
				for (j = 0; j < node.childNodes.length; ++j) {
					var subnode = node.childNodes[j];
					if (subnode.nodeName == "A" &&
					    /* Safari and IE */
					    ((subnode.innerText != undefined
					      && subnode.innerText == active)
					     /* Mozilla */
					     || (subnode.textContent != undefined
						 && subnode.textContent == active))) {
						/* Make it look active. */
						node.className += " current_page";
						break;
					}
				}
			}
		}
	}
}
