/* menu.js Menu behavior scripts. :AUTHOR: James Green :CREATED: June 24, 2008 :UPDATED: JG 06/24/2008 - Initial setup. :DEPENDENCIES: /lib/jquery-1.2.2.js */ $(document).ready(function() { var m = ""; /* Get the select list from both the search results page and the advanced search page, which ever is active. The purpose of this is to hide these fields because of an IE6 bug that does not properly display select lists behind other dynamic html. */ var selectNum = $("[name='num']"); var selectSite = $("[name='site']"); // Set the on and off states for each of the primary menu options. $("div#panel-primary-menu a").hover( function() { var menuId = $(this).attr("id"); if(menuId!=="" && menuId!==null) { // Close any open menus before opening another. if($("div.drop-down-menu").is(":visible")) { $("div.drop-down-menu").hide(); $(selectNum).css({visibility:"visible"}); $(selectSite).css({visibility:"visible"}); } // Open the drop down menu associated with this anchor. // Show the anchor's hover state. // Keep track of which anchor id was just opened. $("#drop-down-" + menuId).show(); $(this).addClass("drop-down"); m = menuId; $(selectNum).css({visibility:"hidden"}); $(selectSite).css({visibility:"hidden"}); } else { // If this anchor has no id, then it has no drop down. // Make sure all anchors are at the normal state. // Close any drop down that might have been open. $(this).removeClass("drop-down"); $("div.drop-down-menu").hide(); $(selectNum).css({visibility:"visible"}); $(selectSite).css({visibility:"visible"}); } }, function() { // Make sure all anchors are at the normal state. // Close any drop down that might have been open. $(this).removeClass("drop-down"); $("div.drop-down-menu").hide(); $(selectNum).css({visibility:"visible"}); $(selectSite).css({visibility:"visible"}); } ); // Set the on and off states for each of the drop down menus. $("div.drop-down-menu").hover( function() { // Keeps the current drop down visible when mouse moves down from the current anchor. // Check to see if anchor is already in hover state. $(this).show(); $(selectNum).css({visibility:"hidden"}); $(selectSite).css({visibility:"hidden"}); if(m!=="") { $("#" + m).addClass("drop-down"); } }, function() { $(this).hide(); $(selectNum).css({visibility:"visible"}); $(selectSite).css({visibility:"visible"}); if(m!=="") { $("#" + m).removeClass("drop-down"); } } ); });