
<!--
var timeOut = null, numMenus = 0;
var menus = new Object();
var ns4 = false; // true if the browser supports layers
var ie4 = false; // true if the browser supports document.all
var otherDOM = false; // true if ns6
var ie5plus = false; // true if browser is IE 5+
var adjustSpacing = false; // true if we need to adjust menu spacing
var colorBckgnd = 'white';
var colorFrgrnd = 'black';
var curMenu = 0;
var curMenuHeadImg;
//var activeMenuHeading = -1; // holds number of the active menu (heading)

function detectBrowser() {
  if (document.layers) ns4 = true;
  else if (document.all) {
    ie4 = true;
    if (navigator.userAgent.indexOf("MSIE 4") != -1) ie5plus = false;
    else ie5plus = true;
    if (((navigator.userAgent.indexOf("MSIE 5.5") == -1) &&
         (navigator.userAgent.indexOf("MSIE 6") == -1)) ||
         (navigator.userAgent.indexOf("Mac") != -1)) {
        adjustSpacing = true;
    }
  }
  else if (document.getElementById) {
    otherDOM = true;
    adjustSpacing = true;
  }
}

function addItem(menuName, item, action) {
  if (!menus[menuName]) {
    var newMenu = new Object();
    newMenu.name = menuName;
    newMenu.num = numMenus++;
    newMenu.items = new Array();
    newMenu.actions = new Array();
    newMenu.layers = new Array(); //added by Bill Adams for NS4 bug not showing hover
    menus[menuName] = newMenu;
  }
  // IE4 doesn't support push() so add manually
  menus[menuName].items[menus[menuName].items.length] = item;
  menus[menuName].actions[menus[menuName].actions.length] = action;
}

function showNS4hover(menuCurrent, menuItemIndex) {
  if(menuCurrent) menuCurrent.actions[menuItemIndex].bgcolor=red;
  else alert('no valid menu');
}

/** * Creates each of the sub menus. */
function createMenus(backgroundColor, width) { //foregroundColor,
  colorBckgnd = backgroundColor;

  var menuIndexCurrent = -1;
  for (var menu in menus) {
    var theMenu = menus[menu];
    menuIndexCurrent++;
    if (ns4) {
     //CANNOT BE OF CLASS MENU OR NS4 WILL FILL ENTIRE MENU LENGTH OF BOXES
     document.write('<layer bgcolor="' + colorBckgnd + '" onmouseover="clearTimeout(timeOut)" onmouseout="timeOut = setTimeout(\'menuDisableOnMouseOut(' + theMenu.num + ')\',500)" visibility="hide" name="menu' + theMenu.num + '" z-index="100">');
     document.write('\n<spacer type="block" width="' + width + '" height="' + 1 + '"><BR>');
    }
    else { //if (ie4 || otherDOM) {
     //only include background color if was specified - left and top must be here or creates large gap in current page!
     document.write('\n<div style="left:0; top:0; width: ' + width + 'px; bgcolor: ' + colorBckgnd + '; background-color: ' + colorBckgnd + '; color: ' + colorFrgrnd + ';" class="menu" id="menu' + theMenu.num + '" onmouseover="clearTimeout(timeOut)" onmouseout="timeOut = setTimeout(\'menuDisableOnMouseOut(' + theMenu.num + ')\',500)">');
    }
    for (var i=0; i<theMenu.items.length; i++) {
      //use spacer to handle padding, NS4 doesn't match with others.
      //document.write('<spacer type="block" width="' + width + '" height="' + 1 + '"></spacer><BR>');
      if (ns4) {                //menuItemNS4
        //tried to do mouse over. using style attribute will crash NS4.7
        document.write('\n&nbsp;<a class="menuItem" href="' + theMenu.actions[i] + '">' + theMenu.items[i] + '</a>&nbsp;<BR>');
      }
      else if (ie4 || otherDOM) {
        document.write('\n<a class="menuItem" href="' + theMenu.actions[i] + '">' + theMenu.items[i] + '</a>');
      }
    }
    if (ns4) {
	    document.write('<spacer type="block" width="' + width + '" height="' + 4 + '"><BR>');
      document.write('</layer>');
    }
    else if (ie4 || otherDOM) {
      document.write('</div>');
	    document.write('<spacer type="block" width="' + width + '" height="' + 10 + '">');
    }

  }

}

/**
 * Auto-disables the menu after a short period of time so the cursor has time
 * to travel from the menu button to the menu itself (otherwise it would
 * immediately hide the menu preventing it from being used.
 */
function menuDisableOnMouseOut(which) {
  //Start the timer to give cursor time to travel onto the drop-down menu which
  //will cancel the timer and cause the menu to remain on-screen.
  timeOut = setTimeout('protectedHideMenu(' + which + ')',500);
}

/**
 * Should not be called by external onMouseXXX events - internal use only
 * called by the timer when it has elapsed indicating the cursor is no longer
 * over the menu indicated by the which variable passed in.
 */
function protectedHideMenu(which) { // accepts an integer indicating which menu to hide
  if (ns4) {
    document.layers["menu" + which].visibility = "hide";
  }
  else if (ie4) {
    var curMen = document.all("menu" + which);
    if(curMen) curMen.style.visibility = "hidden";
  }
  else if (otherDOM) {
    document.getElementById("menu" + which).style.visibility = "hidden";
  }
  //disable the menuHead image
  if(curMenuHeadImg) CSIShow(/*CMP*/curMenuHeadImg,0);
}

/**
 * HTML page should have <PRE>
 * <TOPMARGIN="0" LEFTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0"></PRE> else
 * the adjustSpacing values should be enabled.
 * @return
 */
function menuEnableOnMouseOver(which, x, y) { //not compatible with NS4: event
  protectedHideMenu(curMenu); //hide current menu
  curMenu = which;
  clearTimeout(timeOut);
  if (adjustSpacing) { //Only needed if this isn't set for the page:
    //<body TOPMARGIN="0" LEFTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">
    //x += 4; //y += 7; //must be exactly 7
  }
  protectedShowMenu(which, x, y);
}

function protectedShowMenu(which,x,y,bgcolor,bordercolor) { // accepts an integer indicating which menu to show and x/y if not ns4
  if (ns4) {
    document.layers["menu" + which].left = x;
    document.layers["menu" + which].top = y;
    document.layers["menu" + which].visibility = "show";
  }
  else if (ie4) {
    document.all("menu" + which).style.left = x;
    document.all("menu" + which).style.top = y;
    document.all("menu" + which).style.visibility = "visible";
  }
  else if (otherDOM) {
    document.getElementById("menu" + which).style.left = x;
    document.getElementById("menu" + which).style.top = y;
    document.getElementById("menu" + which).style.visibility = "visible";
  }
}


function myfunctionout(whichimage,whichmenu) {
  //alert('hello out');
  //image CSIShow called above in protectedHideMenuMethod
  //  old: CSIShow(/*CMP*/whichimage,0);
  menuDisableOnMouseOut(whichmenu);
  return;
}

function myfunctionover(whichimage,whichmenu,x,y) {
  //alert('hello over');
  //curMenuHeadImg = whichimage; //so can be disabled above
  CSIShow(/*CMP*/whichimage,1);
  menuEnableOnMouseOver(whichmenu, x, y);
  curMenuHeadImg = whichimage; //must be assigned below the CSIShow call (2 lines up)
  return;
}


detectBrowser();
//-->










