window.onload = init;

function init()
{
	initNav();
} // end function init()

function initNav()
{
	// get the menu
	var menu = getChildrenByTagName($("menu"), "ul")[0];
	
	// get the menu items
	var menu_items = getChildrenByTagName(menu, "li");
	
	// remove the top border from the first item
	// this style is applied in the stylesheet, but IE won't get it right
	menu_items[0].style.borderTop = "0px";
	
	// loop through the menu items and check if there are sub menus
	var child_menu;
	for (var i = 0; i < menu_items.length; i++)
	{
		// check if there is a sub menu
		child_menu = getChildrenByTagName(menu_items[i], "ul");
		if (child_menu.length == 1)
		{
			// remove the link
			menu_items[i].firstChild.removeAttribute("href");
		} // end if there is a sub menu
	} // end loop through the menu items

	var menu_elements = document.getElementById("menu").getElementsByTagName("li");
	var menu_length = menu_elements.length;
	for (i = 0; i < menu_length; i++) {
		if (menu_elements[i].nextSibling && menu_elements[i].nextSibling.nodeType == 3) {
			menu_elements[i].parentNode.removeChild(
			menu_elements[i].nextSibling);
		}
	}
} // end function initNav()


