<!-- JEO Productions/StudioNorth  --  Sept 2003/*   Various JavaScript functions for dropdown menus*/// ====================================================================== function debTrace(msg) {    var debugOn = true;    if (debugOn) {      alert("DEBUG MESSAGE\n\n" +msg);    }  }// ===================  function isNS4plus() {   if (document.layers) {     return true;   }    else return false;   }// ===================  function isIE4plus() {   if (document.all) {     return true;   }    else return false;   }// ===================  function isGecko( menu ) {     if( document.getElementById(menu) ) // Gecko powered       return true;    else       return false; } // =================== // set up constants and menu names array // ======================================  var dropDownMenuNames = ["aboutDropDown", "doingBusinessDropDown", "facultyResourcesDropDown", "employeeResourcesDropDown", "newsInfoDropDown" ]; if ( isNS4plus() ) {         // NS style   visible = 'show';   hidden = 'hide'; } else if ( isIE4plus() ) {  //  IE style   visible = 'visible';   hidden = 'hidden'; } else  {                      //  attempt to deal with other browsers, Safari   visible = 'visible';   hidden = 'hidden'; } // =================== // toggle visibility functions and process menu clicks // ====================================== function getMenuObjRef(menu) {     if ( isNS4plus() ) {       thisMenu = document.layers[menu];     } else if ( isIE4plus() ) {       thisMenu = document.all(menu).style;     } else if ( document.getElementById(menu) ) {        // hope for Gecko, Mac 7//    debTrace("Trap Gecko browser in getMenuObjRef() getElementById()");         var para = document.getElementById(menu);//         para.style.visibility = (para.style.visibility == "visible" ? "hidden" : "visible");  //  #### toggle?         thisMenu = para;           thisMenu = para.style;        } else {       thisMenu = document.all(menu).style;    debTrace("Defalt browser in getMenuObjRef()");      }      return thisMenu; } // =================== function makeMenuVisable( menu ) {     for( i=0; i<dropDownMenuNames.length; i++) {       if( dropDownMenuNames[i] != menu ) {  //  turn off all but referenced one//    debTrace("Turn off menu " +dropDownMenuNames[i]);          thisMenu = getMenuObjRef(dropDownMenuNames[i]);          thisMenu.visibility = hidden;       }    }    thisMenu = getMenuObjRef(menu);    thisMenu.visibility = (thisMenu.visibility == visible ? hidden : visible);  // toggle the menu        setEnterFlag( );    /*    if( isGecko(menu) ) thisMenu.style.visibility = "visible";    else thisMenu.visibility = visible; */ } // =================== function makeMenusInvisable( ) {     for( i=0; i<dropDownMenuNames.length; i++) {//    debTrace("Turn off menu " +dropDownMenuNames[i]);          thisMenu = getMenuObjRef(dropDownMenuNames[i]);          thisMenu.visibility = hidden;    }    unsetEnterFlag( ); } // =================== var links = new Array("Develop Your Proposal", "Managing Your Project", "Hiring Project Staff", "Protecting Your Intelectual Property", "Research Policies", "Research Projects", "Forms");// ======================================================================// var dropDownMenuNames = ["aboutDropDown", "doingBusinessDropDown", "facultyResourcesDropDown", "employeeResourcesDropDown", "newsInfoDropDown" ];,  function processMainPageSubmenuClick( whichDropdownMenu, whichChoiceSelected ) {    gotoSubmenuClick( whichDropdownMenu, whichChoiceSelected, "" ); } // ===================     function checkDropChoiceInRange( whichChoiceSelected, whichDropdownMenu ) {    if( whichChoiceSelected<0 || whichChoiceSelected>=whichDropdownMenu.length ) {       alert("Menu choice " +whichChoiceSelected +" out of range.");       return false;    } else return true; } // ===================     function processSubmenuClick( whichDropdownMenu, whichChoiceSelected ) {    gotoSubmenuClick( whichDropdownMenu, whichChoiceSelected, "../" ); } // ===================     function gotoSubmenuClick( whichDropdownMenu, whichChoiceSelected, path ) {    //    debTrace ("doc URL is " +document.URL);    makeMenusInvisable();        var aboutSubFiles = new Array("index", "board", "executive", "administration", "financials", "staff-directory");    var doingSubFiles = new Array("index", "partner", "current-projects", "giving");        var facultySubFiles = new Array("index", "developing-proposal", "self-supported-activities", "managing-projects", "hiring-staff", "intellectual-property", "research-policies", "current-projects-activities", "forms", "faqs");    var employeeSubFiles = new Array("index", "benefits", "payroll", "forms", "policies", "jobs");    var newsSubFiles = new Array("index", "press-releases", "current-projects", "case-studies", "publications");        switch(whichDropdownMenu) {    case "aboutDropDown"://   debTrace("triggered aboutDropDown");       checkDropChoiceInRange( whichChoiceSelected, aboutSubFiles );       document.location= path + "about-sjsu-foundation/" +aboutSubFiles[whichChoiceSelected] +".htm";       break;    case "doingBusinessDropDown":       checkDropChoiceInRange( whichChoiceSelected, doingSubFiles );/*       if( whichChoiceSelected==1 ) { // special case ####          document.location= path + "sjsuf-faculty-resources/current-projects-activities.htm";       } else */       document.location= path + "doing-business/" +doingSubFiles[whichChoiceSelected] +".htm";       break;    case "facultyResourcesDropDown":       checkDropChoiceInRange( whichChoiceSelected, facultySubFiles );       document.location= path + "sjsuf-faculty-resources/" +facultySubFiles[whichChoiceSelected] +".htm";       break;    case "employeeResourcesDropDown":       checkDropChoiceInRange( whichChoiceSelected, employeeSubFiles );       document.location= path + "sjsuf-employees-resources/" +employeeSubFiles[whichChoiceSelected] +".htm";       break;    case "newsInfoDropDown":       checkDropChoiceInRange( whichChoiceSelected, newsSubFiles );/*       if( whichChoiceSelected==1 ) { // special case ####          document.location= path + "sjsuf-faculty-resources/current-projects-activities.htm";       } else */       document.location= path + "sjsuf-news-info/" +newsSubFiles[whichChoiceSelected] +".htm";       break;    case "contactDropDown":       document.location= path + "contact-sjsuf/index.htm";       break;    default :       document.location= path + "contact-sjsuf/index.htm";           } } // ===================// contact-sjsuf/index.htm sjsuf-news-info/index.htm sjsuf-employees-resources/index.htm sjsuf-faculty-resources/index.htm doing-business/index.htm about-sjsu-foundation/index.htm function facResLinks(choice) { makeMenusInvisable(); // assume choice index 1-maxMenuChoices    var links = new Array("Develop Your Proposal", "Managing Your Project", "Hiring Project Staff", "Protecting Your Intelectual Property", "Research Policies", "Research Projects", "Forms");    var thisLink = (choice<=0 || choice>links.length) ?        "Bad Menu Value <" +choice +">\n\nClose window and report this error." :        "Link to " +links[choice-1];    alert (thisLink); } // =================== var in_dropdown_menu = false;  function setEnterFlag( ) {  //  set when enter a dropdown menu (it's visible)    in_dropdown_menu = true; } // ===================  function unsetEnterFlag( ) {  //  unset when "leave" a dropdown (note rollover problems)    in_dropdown_menu = false; } // ===================  function setDropdownMenuCleanup( ) {//    setTimeout('turnOffExitedMenus()', 1000);    setTimeout('turnOffExitedMenus()', 100); } // ===================  function turnOffExitedMenus( ) {// alert("flag = " +in_dropdown_menu);    if( in_dropdown_menu==false )       makeMenusInvisable(); } // =================== //-->
