﻿// JScript File

var interval;
var objSelectedMenu;

function outList() {
    // Selects section menu
    var myObject = document.getElementById("menuSection" + menu);
    if (myObject) {
        myObject.className = "menu_0" + menu + " selected_0" + menu + " over";
    }
    clearInterval(interval);
}

startList = function() {
    objSelectedMenu = document.getElementById("menuSection" + menu);
	main_menuRoot = document.getElementById("main_menu");
	for (i=0; i<main_menuRoot.childNodes.length; i++) {
		node = main_menuRoot.childNodes[i];
		if (node.nodeName=="LI") {
            node.onmouseover=function() {
                // De-selects section menu
                if ( (this.id) != ("menuSection" + menu) ) {
				    var myObject = document.getElementById("menuSection" + menu);
    	            if (myObject) {
                        myObject.className = myObject.className.split(' ')[0];
	                }
                }
                // Selects a section/subsection
                var inx = this.id.split("menuSection")[1];
                this.className = "menu_0" + inx + " selected_0" + inx + " over";
				clearInterval(interval);
			}
			node.onmouseout=function() {
			    // De-selects current section/subsection
			    if (this != objSelectedMenu) {
                    var inx = this.id.split("menuSection")[1];
				    this.className = "menu_0" + inx;
                    interval = setInterval("outList();", 100);
                }
			}
		}
	}
}
window.onload=startList;