/**
 * Adds and removes classes to a list of links to allow keyboard accessibility
 *
 * @param string dropDownId
 * @param string hoverClass
 * @param int mouseOffDelay
 */
function dropdown(dropdownId, hoverClass, mouseOffDelay) {
	if(dropdown = document.getElementById(dropdownId)) {
		var listItems = dropdown.getElementsByTagName('li');
		for(var i = 0; i < listItems.length; i++) {
			listItems[i].onmouseover = function()
			{
			  for (j=0; j<listItems.length; j++)
			  {
			     listItems[j].className = removeClass(listItems[j]);
			  }

			  this.className = addClass(this);
			}
			listItems[i].onmouseout = function() {
				var that = this;
				setTimeout(function() { that.className = removeClass(that); }, mouseOffDelay);
				this.className = that.className;
			}
			
			var anchor = listItems[i].getElementsByTagName('a');
			anchor = anchor[0];
			anchor.onfocus = function() { tabOn(this.parentNode); }
			anchor.onblur = function() { tabOff(this.parentNode); }
		}
	}
	
	function tabOn(li) {
		if(li.nodeName == 'LI') {
			li.className = addClass(li);
			tabOn(li.parentNode.parentNode);
		}
	}
	
	function tabOff(li) {
		if(li.nodeName == 'LI') {
			li.className = removeClass(li);
			tabOff(li.parentNode.parentNode);
		}
	}
	
	function addClass(li) { return li.className + ' ' + hoverClass; }
	function removeClass(li) { return li.className.replace(hoverClass, ""); }
}



/*
startList = function()
{
  if (document.getElementById)
  {
	navRoot = document.getElementById("navbar");

	for (i=0; i<navRoot.childNodes.length; i++)
	{
	  node = navRoot.childNodes[i];
	  if (node.nodeName=="LI")
	  {
		node.onmouseover=function()
		{
		  for (j=0; j<navRoot.childNodes.length; j++)
		  {
		     if (navRoot.childNodes[j].nodeName=="LI")
		     {
		       navRoot.childNodes[j].className=navRoot.childNodes[j].className.replace(" over", "");
		     }
		  }
		  
		  this.className+=" over";

		}

		node.onmouseout=function()
		{ 
		  var that = this;
		  setTimeout(function() { that.className=that.className.replace(" over", ""); }, 500);
		  this.className=that.className;
		  //this.className=this.className.replace(" over", "");
		}
	  }
	}
  }
}

window.onload=startList;
*/