window.onload = function() {	
	spanarray = $('.toplevel');
	for (i = 0; i < spanarray.length; i = i + 1) {
		spanarray[i].onclick = function() {
			if ( this.isclicked === 1 ) {
				this.isclicked = 0;
				for (j = 0; j < childarray.length; j = j + 1) {
					if (childarray[j].nodeName === "UL") {
					childarray[j].style.display = "none";
					}
				}
			} else {
				this.isclicked = 1;
				childarray = this.parentNode.childNodes;
				for (j = 0; j < childarray.length; j = j + 1) {
					if (childarray[j].nodeName === "UL") {
					childarray[j].style.display = "inline";
					}
				}
			}
		}
	}
}


