//**********************************************************************
//
// Popup menu routines
//
// Written by Bill Bultman @ UW Fox-Valley,
// Reused without his 'direct' permission by Andy Konwinski @ Weatherguard Systems.
//
// Functions to implement the mouseover popup menus on the main page.
// When the mouse hovers the menu pick, the popup pops up and stays
// up as long as they are on the menu pick.  Once they leave the menu 
// pick, they have a short delay (menuPopTime) to get their mouse to 
// the popup before it closes.  If they get over it by that time, it 
// stays open as longas they are over it.  If they leave the popup, it 
// closes  after that same delay time.
//
//**********************************************************************

//======================================================================
// Global variable used to keep the timer ID number
var timerID = null;
var openMenuName = null;
var menuPopTime = 0.3;

//======================================================================
// Sets a timer to close all the windows after howLong seconds
function setCloseTimer (whichOne, howLong) {
  if (!timerID)
  {
    openMenuName = whichOne;
    timerID = window.setTimeout("closeAllMenus()", 1000*howLong);
  }
}

//======================================================================
// Clears the previously set timer
function clearTimer () {
  if (timerID)
    window.clearTimeout(timerID);
  timerID = null;
}

//======================================================================
// Called when onMouseOver and onMouseOut events occur on one of the
// image map menus, to make the appropriate popup appear or set them 
// all to disappear
function overMenu (whichOne) {
  closeAllMenus();
  document.getElementById(whichOne).style.visibility = 'visible';
}
function outMenu (whichOne) {
  setCloseTimer(whichOne, menuPopTime);
}

//======================================================================
// Called when onMouseOver and onMouseOut events occur on one of the
// popups, to make it stay in place or set to disappear
function overPopup (whichOne) {
  clearTimer();
}
function outPopup (whichOne) {
  setCloseTimer(whichOne, menuPopTime);
}

//======================================================================
// Closes all the popup windows
function closeOpenMenu () {
  if (openMenuName) {
    document.getElementById(openMenuName).style.visibility = 'hidden';
    clearTimer();
    openMenuName = null;
  }
}
function closeAllMenus () {
  var divList = document.getElementsByTagName("div");
  for (var i = 0; i < divList.length; i++) {
    if (divList[i].className == "navmenusub")
      divList[i].style.visibility = 'hidden';
  }
  clearTimer();
}

//======================================================================
// tell them if we are in quirks mode or css1complian mode
function showMode(){
  alert(document.compatMode)
}