// Globals // An optional string that gives the root of the menu files. This should be empty if // the "images", "css", and "js" folders are located at the root of the website. Otherwise // specify the subfolder where those folders are located. Do not end the path with a "/". var ROOTPREFIX = ""; //var ROOTPREFIX = ""; // The global timer that controls whether the active menu is shown var TIMERID = null; var TIMEOUT = 100; // timeout in ms var SELECTEDNAVITEM; //var VERTICALOFFSET = 0; // // Menu Navigation Objects // // NavMenu object. // This is the main object that implements the dropdown menu. It encapsulates data // and methods necessary to hide/show a particular menu at the appropriate time. // // Params: // sID: a string that must be unique among all the menus. It is used to construct element IDs, most // notably for the div. Must be coordinated with image filenames for menu images (and rollovers). // nLeft: the pixel position of the left edge of the menu (with respect to entire document) // nTop: the pixel position of the top edge of the menu (with respect to entire document) // linkArray: an array of NavMenuItem objects to be used in the menu // function NavMenu(sID, nLeft, nTop, linkArray) { // Allocate linkArray if not provided if( linkArray == null ) linkArray = new Array(0); // Properties this.id = sID; this.left = nLeft; this.top = nTop; this.isActive = false; this.defaultStateIsOn = false; this.links = linkArray; this.sLink = null; // DINGO ADD: Selected sub item // Methods // writeDiv: writes the div to the page in a hidden state, ready to be shown at the correct location // when activated. this.writeDiv = function() { // Figure out our index into the navMenus array var nIndex = -1; var nTemp = 0; for( nTemp = 0; nTemp < navMenus.length; nTemp++ ) { if( navMenus[nTemp].id == this.id ) nIndex = nTemp; } // If not found, return if( nIndex == -1 ) return; // Write div document.writeln("
"); //image added to top of menu to simulate the bottom of the button //document.writeln(""); if( this.links.length > 0 ) { document.writeln("
"); var sMouseEvents = ""; for( nTemp = 0; nTemp < this.links.length; nTemp++ ) { sMouseEvents = " onmouseover=\"navMenus[" + nIndex + "].links[" + nTemp + "].mouseOver();\" onmouseout=\"navMenus[" + nIndex + "].links[" + nTemp + "].mouseOut();\""; document.writeln(""); } document.writeln("
"); } document.writeln("
"); } // mouseOver: called when the user mouses over the navigation element for the menu (the menu image). // activates the menu and deactivates all the others. this.mouseOver = function() { // Clear any existing timers StopTimer(); // Activate this menu this.activate(); // Deactivate the others var nTemp = 0; for( nTemp = 0; nTemp < navMenus.length; nTemp++ ) { if ( navMenus[nTemp].id != this.id ) { //navMenus[nTemp].deactivate(); navMenus[nTemp].onOverAnother() ; } } } // mouseOut: called when the user mouses out of the navigation element for the menu (the menu image) // starts the timer which checks whether the menu should stay open this.mouseOut = function() { // Start timer StartTimer(); } this.onOverAnother = function() { this.deactivate() ; // DINGO ADD: Set to low button state /* var imgElem = document.getElementById("nav_" + this.id); //alert( "imgElem: " + imgElem ) ; if( imgElem != null && !this.defaultStateIsOn) { imgElem.src = ROOTPREFIX + "/images/nav_" + this.id + ".gif"; } else { imgElem.src = ROOTPREFIX + "/images/nav_" + this.id + "_active.gif"; } */ } this.onOutAnother = function() { //this.deactivate() ; // DINGO ADD: Set to low button state // Switch to regular image // this.resetImageToDefault(); } // activate: set rollover image and show the menu div this.activate = function() { // Switch to rollover image /* var imgElem = document.getElementById("nav_" + this.id); if( imgElem != null ) imgElem.src = ROOTPREFIX + "/images/nav_" + this.id + "_over.gif"; */ // Show the div var menuDiv = document.getElementById("navmenudiv_" + this.id); if( menuDiv != null ) { for( var i=0; i