function initMenus()
{
// get menubox
	var x = document.getElementById('menubox');
	if (!x) return;
/*
 Get divs within menubox.
 if the id of that div is not found in the location
 path, and the div is a submenu, hide that submenu.
 Note: submenu id names must be the same as the
 directory name their child pages are in.
*/	var y = x.getElementsByTagName('div');
	var loc = document.location.href;
	for (var i=0;i<y.length;i++)
	{	if (y[i].className = "submenu")
		{	r = new RegExp(y[i].id);
			if (loc.search(r) == -1)
				y[i].style.display = 'none';
		}
	}
/*
 Change the href in the menu parent links to
 the toggle function using their menuChild value.
 this value is the id name of thier child.
*/	var y = x.getElementsByTagName('a');
	for (var i=0;i<y.length;i++)
	{	if (y[i].getAttribute('menuChild'))
			y[i].href= 'javascript:toggle(\'' + y[i].getAttribute('menuChild') + '\');' ;
	}
}

function toggle(id)
{	
// change the display style of 'id' to block or none.
	var x = document.getElementById(id).style;
	if (!x) return;
	x.display == 'none' ?  x.display = 'block' : x.display = 'none';
}