/*
 * A script to get CSS-style pull-down menus working in IE.
 * Copied from an article on alistapart and wrapped in its
 * own namespace.
 * 
 * Best to include this script and use the defer attribute to
 * delay execution until the DOM is loaded.
 *
 * There's a line at the bottom to call the appopriate methods.
 */
var PullDownMenus = {
	selectedMenu: null,

	initialize: function() {
		// Only do this for IE.
	    if (document.all && document.getElementById) {
            var navRoot = $("navmain");
            PullDownMenus.wireChildLists(navRoot);
	    }
	},

	wireChildLists: function (root) {
	    for (var i = 0; i < root.childNodes.length; i++) {
	        var node = root.childNodes[i];
        
	        if (node.nodeName=="A") {
	            node.onmouseover=function() {
	                for (var i=0; i<this.parentNode.childNodes.length; i++)
	                {
	                    var node = this.parentNode.childNodes[i];
	                    if (node.nodeName=="UL") {
	                        node.style.bgcolor = "white";
	                        node.style.position = "absolute";
	                        node.style.top = "30px";
	                        node.style.border = "1px black solid";
	                        node.style.display = "block";
                        
	                        if (PullDownMenus.selectedMenu != null &&
								node != PullDownMenus.selectedMenu)
	                        {
	                            PullDownMenus.selectedMenu.style.display = "none";
	                        }
                        
	                        node.onmouseleave=function() {
	                            this.style.display = "none";
	                        }
                        
	                        PullDownMenus.selectedMenu = node;
                        
	                        break;
	                    }
	                }
	            }
	        }
        
	        PullDownMenus.wireChildLists(node);
	    }
	}
}

PullDownMenus.initialize();