/* flymenu.js - JS to activate the flyout menus on IE
 * In the current implementation, a JS statement like
 * activateMenu("vertnav"); is necessary to turn on the
 * functionality.
 * Rewritten on 2006-09-07 by Jonny Meijer
 * Originally taken from http://www.csscreator.com/menu/multimenu.php, in turn
 * taken from http://www.alistapart.com/articles/dropdowns/
 */

activateMenu = function(nav)
{
	/* currentStyle restricts the Javascript to IE only */
	if (document.all && document.getElementById(nav).currentStyle)
	{
		navRoot = document.getElementById(nav);
		var descendants = navRoot.childNodes;
		for (i=0; i<descendants.length; i++)
		{
			registerNodeAndDescendants(descendants[i]);
		}
	}
}

/* takes a list node (li) */
function registerNodeAndDescendants(node)
{
	if (node.nodeName != "LI")
		return (false);

	node.onmouseover = function() {
		this.className += " over";
	}
	node.onmouseout = function() {
		this.className = this.className.replace(" over", "");
	}

	/* we can assume lastChild = ul */
	var descendants = node.lastChild.childNodes;
	for (var i=0; i<descendants.length; i++)
	{
		if (descendants[i].nodeName == "LI")
			registerNodeAndDescendants(descendants[i]);
	}

	return (true);
}

