var ids = new Array();

	function initMenu() {
		var startMenu = document.getElementById("uslxmenu");
		var divs=startMenu.getElementsByTagName("div");
		
		for (var i=0;i<divs.length;i++) {
			ids[i] = divs[i].getAttribute("id");
		}
	
	}
	
	function switchid(id, imgPrefix) {
		var idLevel = id.split("-").length;

		for (i=0; i<ids.length;i++) {
			if (ids[i].split("-").length == idLevel) {
				if (ids[i].substring(0, id.length) == id) {
					if (statusdiv(ids[i]) == true) {
						hidediv(ids[i]);
						if (idLevel > 2) {
							document.getElementById("img_" + id).setAttribute("src", "/images/" + imgPrefix + "_closed.gif");
						}
						
					} else {
						showdiv(ids[i]);
						if (idLevel > 2) {
							document.getElementById("img_" + id).setAttribute("src", "/images/" + imgPrefix + "_open.gif");						
						}
					}
				}
			}
		}
		
	}
	
	function hidediv(id) {
		//safe function to hide an element with a specified id
		if (document.getElementById) { // DOM3 = IE5, NS6
			document.getElementById(id).style.display = 'none';
		}
		else {
			if (document.layers) { // Netscape 4
				document.id.display = 'none';
			}
			else { // IE 4
				document.all.id.style.display = 'none';
			}
		}
	}
	
	function showdiv(id) {
		//safe function to show an element with a specified id
			  
		if (document.getElementById) { // DOM3 = IE5, NS6
			document.getElementById(id).style.display = 'block';
		}
		else {
			if (document.layers) { // Netscape 4
				document.id.display = 'block';
			}
			else { // IE 4
				document.all.id.style.display = 'block';
			}
		}
	}
  
	function statusdiv(id) {
		//safe function to show an element with a specified id
		
		if (document.getElementById) { // DOM3 = IE5, NS6
			if (document.getElementById(id).style.display == 'block') {
				return true
			};
		}
		else {
			if (document.layers) { // Netscape 4
				if (document.id.display == 'block') {
					return true
				};
			}
			else { // IE 4
				if (document.all.id.style.display == 'block') {return true};
			}
		}

		return false;
	}
