//-- This file includes the code used to display the menus on the CUSWE website
//-- It must be included each time the main html_setup.asp file is used

//-- Set any constants first!
      var currDivObj = null;

//-- This first script is used to hide and/or display the selected menu, for Entries, Planets, or Categories.

      function changeDiv(selValue) {
        var divObj;
        var divName = "div" + selValue;
        if (document.all)
          divObj = document.all[divName];
        else if (document.layers)
          divObj = document.layers[divName];
        else if (document.getElementById)
          divObj = document.getElementById(divName);

        if(currDivObj) {
          currDivObj.style.visibility = "hidden";
        }
        divObj.style.visibility = "visible";
        currDivObj = divObj; 
      }

//-- This is another hide/display routine, used for the search page
      function showHideDiv(id)
      {
        var elem = document.getElementById(id);
        if (elem) 
        {
          if (elem.style.display != 'block') 
          {
            elem.style.display = 'block';
            elem.style.visibility = 'visible';
          } 
          else
          {
            elem.style.display = 'none';
            elem.style.visibility = 'hidden';
          }
        }
      }

//-- This script is used to automagically go to the selected section of the encyclopedia.
//-- It's basically the same as the ones below for Entries and Planets...

      function sectionSelect(form) {
        var formindex=form.sections.selectedIndex;
        var indexvalue=form.sections.options[formindex].value;
        var dud = 0;
        switch (indexvalue) {
          case "Entries" :
          case "Planets" :
          case "Categories" :
            changeDiv(indexvalue);
            break;
          case "none" : 
            dud = dud + 1;
            break;
          default : window.location=form.sections.options[formindex].value
        } 
      }

//-- This script is used to automagically go to the selected entries of the encyclopedia.
//-- It's basically the same as the one above for Sections...

      function entrySelect(form) {
        var appname= navigator.appName;
        var appversion=parseInt(navigator.appVersion);
        if (appname == "Netscape" && appversion >= 3) {
          var formindex=form.entries.selectedIndex;
          var storage=form.entries.options[formindex].text;
          if (form.entries.options[formindex].value != "none") {
            var msg=storage+"You are now being transferred to the -> "+storage;
            for (var spot=0;spot<msg.length-storage.length;spot++) {
              var x=msg.substring(spot,msg.length);
              form.entries.options[formindex].text=x;
              for(var d=0;d<150;d++) { };
            }
            window.location=form.entries.options[formindex].value;
            form.entries[formindex].text=storage;
          }
        }
        else {
          var formindex=form.entries.selectedIndex;
          if (form.entries.options[formindex].value != "none") {
            window.location=form.entries.options[formindex].value;
          }
        }
      }

//-- This script is used to automagically go to the selected planets of the encyclopedia.
//-- It's basically the same as the one above for Sections...

      function planetSelect(form) {
        var appname= navigator.appName;
        var appversion=parseInt(navigator.appVersion);
        if (appname == "Netscape" && appversion >= 3) {
          var formindex=form.planets.selectedIndex;
          var storage=form.planets.options[formindex].text;
          if (form.planets.options[formindex].value != "none") {
            var msg=storage+"You are now being transferred to the -> "+storage;
            for (var spot=0;spot<msg.length-storage.length;spot++) {
              var x=msg.substring(spot,msg.length);
              form.planets.options[formindex].text=x;
              for(var d=0;d<150;d++) { };
            }
            window.location=form.planets.options[formindex].value;
            form.planets[formindex].text=storage;
          }
        }
        else {
          var formindex=form.planets.selectedIndex;
          if (form.planets.options[formindex].value != "none") {
            window.location=form.planets.options[formindex].value;
          }
        }
      }
