/* Calculate the width of the window */
function scrW(scrWdth) {
var width = 0; 
if (navigator.appName == "Microsoft Internet Explorer") {
 width = document.body.offsetWidth;
 } else if (navigator.appName == "Netscape") {
 width = window.innerWidth; 
 }
return width;
}	

var tableWdth = 600;
var scrWdth = 0;
var mnuLeft = 0;
var menuTopIE = 162;
var menuLeftIE = [0,60,145,0,270,0,410,0];
var menuIEvar = 20;
var menuTopNS = ["0px","110px","110px","0px","110px","110px"];

/* align the menu components and display the banner and menu */
function startUp() {
var scrWdth = scrW(scrWdth);
for( i = 0; i < 8; i++) {
  if (navigator.appName == "Microsoft Internet Explorer") {
    document.getElementById("mnuS" + i).style.top = menuTopIE + "px";
    if (scrWdth <= tableWdth) {
	  document.getElementById("mnuS" + i).style.left = menuLeftIE[i]; + "px";
    } else {
  	  document.getElementById("mnuS" + i).style.left = (((scrWdth - tableWdth) / 2) - menuIEvar + (menuLeftIE[i])) + "px";
    }  
  } else if (navigator.appName == "Netscape") {
    document.getElementById("mnuS" + i).style.top = menuTopNS[i];
    if (scrWdth >= 800) {
      document.getElementById("mnuS" + i).style.left = menuLeftNS[i];
    } else {
      document.getElementById("mnuS" + i).style.left = menuLeftNS[i];
    }  
  }
}
}

/* set empty variables for timer to hide sub menus because the first time we try to unset them they may not be there */
var tim1Mnu = 0; 
var tim0Mnu = 0; 

/* Stop timer from hiding menu if user puts mouse over menu item */
function shoMnuS() {
tim0Mnu = clearTimeout(tim1Mnu);
}

/* Hide all submenus (whatever one is visible) when user takes mouse off menu */
function hidMnuS() {
for( i = 0; i < 8; i++) {
  document.getElementById("mnuS" + i).style.visibility = "hidden";
  document.getElementById("mnuS" + i).style.zindex = 2;
  }
}

/* colors set when mouse on or off the menu items */
var bgOn="rgb(240,214,159)";
var bgOff="rgb(218,158,35)";

/* set background color and display sub menu when mouse on an item with a sub menu */
function onMnu(mnu,bg) {
shoMnuS();
hidMnuS();
document.getElementById("mnu" + mnu).style.backgroundColor = bg;
document.getElementById("mnuS" + mnu).style.visibility = "visible";
document.getElementById("mnuS" + mnu).style.zIndex = 99;
}

/* set background color when mouse on an item with no sub menu */
function onLink(mnu,bg) {
shoMnuS();
hidMnuS();
document.getElementById("mnu" + mnu).style.backgroundColor = bg;
}

/* set color and start time to hide sub menu when mouse off a menu item */
function offMnu(mnu,bg) {
document.getElementById("mnu" + mnu).style.backgroundColor = bg;
tim1Mnu = setTimeout("hidMnuS()",400);
}

/* set color when mouse on or off a sub menu item */
function onMnuS(opt,bg) {
document.getElementById(opt).style.backgroundColor = bg; 
}

/* set address of new page when mouse click on a link */
function goMnu(opt) {
window.location = opt;
}

