// JavaScript Document
// http://www.alistapart.com/articles/horizdropdowns

startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("main_menu");
if ( navRoot != null)
{
	for (i=0; i<navRoot.childNodes.length; i++) {
	node = navRoot.childNodes[i];
	if ((node.nodeName=="LI") && ( node.className != "over")) {
	node.onmouseover=function() {
	this.className+=" over";
	  }
	  node.onmouseout=function() {
	  this.className=this.className.replace(" over", "");
	   }
	   }
	  }
	 }
	}
}

if (document.getElementById && document.createElement) {
  if (window.addEventListener) {
    window.addEventListener("load",startList,true);
  } else if (window.attachEvent){
    window.attachEvent("onload",startList);
  }
}

//AAL: modified to chain onload, was breakin on IE6 w/ body onload otherwise
//window.onload=startList;


function focusHighlight( mainMenuID, subMenuID, activeMenuID)
{
	mainMenu = document.getElementById('main_menu');
/*	for ( i = 0; i < mainMenu.childNodes.length; i++)
	{
		n = mainMenu.childNodes[i];
		if ( n.nodeName == 'LI')
		{
			if ( n.id != ('main_menu_' + mainMenuID))
				n.className = '';
			else
				n.className = 'over';
			for ( j = 0; j < n.childNodes.length; j++)
			{
				m = n.childNodes[j];
				if ( m.nodeName=='UL')
				{
					for ( k = 0; k < m.childNodes.length; k++)
					{
						o = m.childNodes[k];
						if ( o.nodeName=='LI')
						{
							for ( l = 0; l < o.childNodes.length; l++)
							{
								p = o.childNodes[l];
								if ( o.id==('main_menu_' + mainMenuID + '_' + subMenuID))
								{
									p.className = 'over';
								} else
								{
									p.className = '';
								}
							}
						}
					}
				}
			}
		}
	}
*/
	mainMenuItem = document.getElementById( 'main_menu_' + mainMenuID)
	if ( mainMenuItem != undefined)
	{
		mainMenuItem.className="over";
		subMenuItem = document.getElementById( 'main_menu_' + mainMenuID + '_' + subMenuID);
		if ( subMenuItem != undefined)
		{
			for ( i = 0; i < subMenuItem.childNodes.length; i++)
			{
				n = subMenuItem.childNodes[i];
				if ( n.nodeName=='A')
				{
					n.className='over';
				}
			}
		}
	}
}


function blurUnhighlight( mainMenuID, subMenuID, activeMenuID)
{
	mainMenu = document.getElementById('main_menu');

	mainMenuItem = document.getElementById( 'main_menu_' + mainMenuID)
	if ( mainMenuItem != undefined)
	{
		mainMenuItem.className="";
		subMenuItem = document.getElementById( 'main_menu_' + mainMenuID + '_' + subMenuID);
		if ( subMenuItem != undefined)
		{
			for ( i = 0; i < subMenuItem.childNodes.length; i++)
			{
				n = subMenuItem.childNodes[i];
				if ( n.nodeName=='A')
				{
					n.className='';
				}
			}
		}
	}
}
