/*
	selectListItem finds the list item within the element with 'id' that has
	a matching @title, either on the LI or its descendants
*/
function selectListItem(id, topic) {
	var menu = document.getElementById(id);
	var elements = menu.getElementsByTagName('*');
	var ancestor;
	for (var i=0; i<elements.length; i++) {
		if (elements[i].nodeType == 1 && elements[i].title == topic) {
			if (elements[i].nodeName == 'A') {
				elements[i].className = 'selected';
			} else {
				ancestor = elements[i];
				while (ancestor.nodeName != 'LI') { ancestor = ancestor.parentNode }
				ancestor.className = 'selected';
			}
		}
	}
}

/* Son of Suckerfish Dropdowns */

sfHover = function() {
	var sfEls = document.getElementById("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"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);