﻿
function body_load(editMode)
{
    InitializeMenu(); 
}
 
     
function InitializeMenu()
{
	//get the menu
	var tmp_oMenu = document.getElementById("menu");
	
	//continue if the menu has been found
	if (tmp_oMenu == null) return;
	
	//get all the menu elements
	var tmp_oSubMenus = tmp_oMenu.getElementsByTagName("UL");
	
	//loop all the menu elements
	var oElements;
	for (var i=0; i<tmp_oSubMenus.length; i++)
	{
		//skip the first menu because thats the main menu
		if (i>0)
		{
			//and set the 'haschildren' class for every menuitem with submenu's
			oElements = tmp_oSubMenus[i].parentNode.childNodes;
			
			//debug
			tmp_oSubMenus[i].parentNode.className += " haschildren"
			
			for (var j=0; j<oElements.length; j++)
			{
				if (oElements[j].tagName == "A")
				{
					oElements[j].className += " haschildren"
					break;
				}
			}
		}
	}
}


