// JavaScript Document

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\\\s)"+searchClass+"(\\\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function toggleChild() {
	d = this.childNodes[1].style.display;
	
	if (d == 'block') {
		this.childNodes[1].style.display = 'none';	
		this.style.listStyleImage = "url('/images/bullet-off.png')";
	}
	else {
		this.childNodes[1].style.display = 'block';
		this.style.listStyleImage = "url('/images/bullet-on.png')";
	}
}

startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("dropdown-nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
  				}
  				node.onmouseout=function() {
  					this.className=this.className.replace(" over", "");
   				}
   			}
  		}
 	}
	
	hiddens = getElementsByClass("hidden");
	for (i=0; i<hiddens.length; i++) {
		/*alert(hiddens[i].parentNode.nodeName);*/
		hiddens[i].parentNode.onclick = toggleChild;
	}
	
}
window.onload=startList;