// menus.js

// 10-15-00 by Robert Clemenzi
// 09-13-03  Modified to support Netscape 7.0 - see lines that contain "NETSCAPE_7"

browserName = navigator.appName;
browserVer=parseInt(navigator.appVersion);

if ((browserName=="Netscape"                    && browserVer>=3)||
    (browserName=="Microsoft Internet Explorer" && browserVer>=4))
        version="n3";
   else version="n2";
     
if (version=="n3")
  window.OnError = null;

var IE;          // 1 if browser is Internet Explorer
var NETSCAPE;    // 1 if browser is Netscape
var NETSCAPE_7;  // 1 if browser is Netscape 7
var showing;     // Current popup showing, if any
var on_link;     // 1 if pointer is on a menu option
var the_time;    // Keeps track of a temporary "time"
var out_time;    // The "time" the last mouseout occured

if(document.all)            {         IE=1; }
if(document.layers)         {   NETSCAPE=1; }
if(document.getElementById) { NETSCAPE_7=1; }

showing  = "";
the_time =  1;
out_time =  1;
on_link  =  0;

setTimeout("auto_hide()", 1000);

function show(id_name) 
{
  window.OnError = null;
  hide();                    // Hide the current menu
  showing = id_name;
  set_on_link(1);
  if(id_name == "")          // This allows entries without pop-ups
  {
    return null;
  }
  if(IE)         document.all[id_name].style.visibility            = "visible";
  if(NETSCAPE)   document.layers[id_name].visibility               = "show";
  if(NETSCAPE_7) document.getElementById(showing).style.visibility = "visible";

 // setTimeout("auto_hide()", 1000);
  return null;
}

function hide() 
{
  window.OnError = null;
  if(showing != "") 
  {
    if(IE)         document.all[showing].style.visibility            = "hidden";
    if(NETSCAPE)   document.layers[showing].visibility               = "hide";
    if(NETSCAPE_7) document.getElementById(showing).style.visibility = "hidden";
  }
  showing = "";
}

  // Timer to hide the menu if the mouse is not pointing to it
function auto_hide() 
{
  window.OnError = null;
  the_time ++;
  if(on_link == 0 && showing != "" && the_time > out_time) 
  {
    hide();
  }

  if(the_time >= 30000) 
  {
    the_time = 0;
    out_time = 0;
  }

  setTimeout("auto_hide()", 1000);
}

function set_on_link(flag) 
{
  window.OnError = null;
  the_time = 0;
  out_time = 1;
  on_link  = flag;
}

function reset_on_exit() 
{
  window.OnError = null;
  showing  = "";
  the_time =  1;
  out_time =  1;
  on_link  =  0;
}
