
// fix to start the menu all collapsed
if (document.getElementById){ 
	document.write('<style type="text/css">\n')
	document.write('.submenu{display: none;}\n')
	document.write('</style>\n')
}

function SwitchSub(obj, ref){
//reset the submenus
	var ar = document.getElementById(obj).getElementsByTagName("a");
	for (var i=0; i<ar.length; i++){
		ar[i].className = "submenutxt";
	}
if (ref != null){
	ar[ref].className = "submenutxtA";
}

//switch style of current item
//	if (ref != 0){
//		 ref.className="submenutxtA";
//	}
}

function SwitchMenu(id, sub, remote){
//id = mainmenu indicator
//sub = submenu indicator
//call like this:
//SwitchMenu(1,2) -- results in opening menu item 1 with sub item 2 highlighted
//SwitchMenu(1,null) -- results in opening menu item 1 with no sub item highlighted

//reset all submenu items
	var obj = "sub"+id
	var main = "main"+id

	if (sub != null){
		sub=sub-1
	}
	SwitchSub(obj, sub);

	var ar = document.getElementById("masterdiv").getElementsByTagName("div");
	for (var i=0; i<ar.length; i++){
		var title = ar[i].getElementsByTagName("a");
		title[0].className="menu";
	}

//Toggle main appearance to orange and bold
	var title = document.getElementById(main).getElementsByTagName("a");
	title[0].className="menuA";

//show/hide submenus
	if(document.getElementById){
		var ar = document.getElementById("masterdiv").getElementsByTagName("span");
		var el = document.getElementById(obj);
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){

				if (ar[i].className=="submenu") 
				ar[i].style.display = "none";

			}
			el.style.display = "block";
		}else{
		if (remote){
			el.style.display = "none";
			}
		}
	}
}


