/* menu.js */
/* controls the menu's */


/* ShowMenuParent - ensures that the main menu item for the moused over sub menu item remains selected */
function ShowMenuParent(element)
{
	// we are beginning with the anchor tag... the location for it is...
	// 	<li>
	//			<a href="#">about emily's voice</a>
	//			<ul>
	//				<li>
	//					<a href="#" onmouseover="ShowMenuParent(this);" onmouseout="HideMenuParent(this);">emily's story</a>      // here
	//				</li>
	//			</ul>
	//	</li>
	
	// ok - from the a tag, lets get to the parent..
	var ListItem = element.parentNode.parentNode.parentNode;
	
	// let's set the list item to have a class of "menu_on"
	ListItem.className = ListItem.className + " menu_on";
}

/* HideMenuParent - ensures that the main menu item for the moused over sub menu item remains selected */
function HideMenuParent(element)
{
	// ok - from the a tag, lets get to the parent..
	var ListItem = element.parentNode.parentNode.parentNode;
	
	// let's remove the classname of "menu_on"
	ListItem.className = ListItem.className.replace(/menu_on/, "");
}



/* startList - add classes for the benefit of IE */
startList = function() 
{
	if (document.all&&document.getElementById) 
	{
		navRoot = document.getElementById("page_nav");
		
		for (i=0; i<navRoot.childNodes.length; i++) 
		{
			node = navRoot.childNodes[i];
			
			if (node.nodeName=="LI") 
			{
				node.onmouseover=function() 
				{
					this.className+=" over";
  				}
  				node.onmouseout=function() 
				{
  					this.className=this.className.replace(" over", "");
   				}
   			}
  		}
 	}
}

window.onload=startList;

