window.onload = function() {
	toggleSubnav();
}

function _getElementsByClassName(classname){
        var rl = new Array();
        var re = new RegExp('(^| )'+classname+'( |$)');
        var ael = document.getElementsByTagName('*');
        var op = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
        if (document.all && !op) ael = document.all;
        for(i=0, j=0 ; i<ael.length ; i++) {
                if(re.test(ael[i].className)) {
                        rl[j]=ael[i];
                        j++;
                }
        }
        return rl;
}

function toggleSubnav() {
	subNavs = _getElementsByClassName('sub_nav');
	for (i=0; i < subNavs.length; i++) {
		theItem = subNavs[i].parentNode;
		if (document.all) {
			theSubNav = theItem.children[0];
		}
		else theSubNav = theItem.childNodes[1];
		if (theSubNav.className == "selected") {
			if (document.all) theItem.lastChild.style.display = "block";
			else theItem.childNodes[3].style.display = "block";
		
		}
		else {
			theItem.onmouseover = function() {
				if (document.all) this.lastChild.style.display = "block";
				else this.childNodes[3].style.display = "block";
			}
			theItem.onmouseout = function() {
				if (document.all) this.lastChild.style.display = "none";
				else this.childNodes[3].style.display = "none";
			}
		}
	}
}