// JAG - Variables Declaration...
NS4 = (document.layers);
NS6 =  ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 5))
IE4 = (document.all);
ver4 = (NS4 || IE4);
MAC45 = (navigator.appVersion.indexOf("MSIE 4.5") != -1)
isMac = (navigator.appVersion.indexOf("Mac") != -1);
  // Attach the proper CSS classes
  css_Mac = "/webnavigation/css/navigation_mac.css";
  css_Win = "/webnavigation/css/navigation_pc.css";
  document.write((navigator.appVersion.indexOf("Mac")!= -1) ?
                "<link rel='stylesheet' href='" + css_Mac + "' type='text/css'>" :
                "<link rel='stylesheet' href='" + css_Win + "' type='text/css'>");
// Main navigation settings
currentHref = null;
mainCurrentpopup = null;
mainCurrentParent = null;
mainActiveItem = null;
mainActivepopup = null;
mainActiveParent = null;
overcheck = null;
overmenu = 0;
pageId = 1;
loaded = false;
imgPrefixLang           = "_f";
menuCloser              = null;
currentChildpopup       = "";
currentParentpopupX      = "";
currentImageMenuParent  = "";
maxlevels               = 16;
currentParentText       = 0;
menuLevels              = new Array("","","","","","","","","","","","","","","","");
parentText              = new Array("","","","","","","","","","","","","","","","");
mainNavigationPopups    = new Array("","","","","","","","","","","","","","","","");
mainNavigationImages    = new Array("","","","","","","","","","","","","","","","");
hidenMainMenuDone       = false;
cntMainNavigationRegImg = 0;
cntMainNavigationRegPops=0;
menuIsActive = false;
activeItem = null;
activeParent = null;
activepopup = null;
loaded = false;
currentpopup = null;
// Default values...
var mainPagePath        = "/web/jsp/";
var imgLangPreSufix     = "/media/";
var imgLangPostSufixOn  = "_1_f";
var imgLangPostSufixOff = "_0_f";
var tempChild = null;
var tempParent = null;
currentParent = null;
// JAG - End variables declaration...
// JAG - Routing 'constants'...
var US                  = 1;
var ES                  = 2;
var CA                  = 3;
var CAEN                = 1;
var CAFR                = 3;
var OT                  = 1;
var us                  = 1;
var es                  = 2;
var ca                  = 3;
var caen                = 1;
var cafr                = 3;
var ot                  = 1;
// Next variables are used for Flash version pages mapping
var N                   = 'N';
var Y                   = 'Y';
var n                   = 'N';
var y                   = 'Y';
var userFlashChoice     = 0;
var flashVersion        = null;
var realLangue          = 'CA';
var pageId              = "0";
var lang                = "US";
var IMG_ON              = "on";
var IMG_OFF             = "off";
//end var declarations...

function popupJSP(popJSP)
{
  showMenu(popJSP);
  if (mainActiveParent != null) {
    switchImage(mainActiveParent,IMG_ON);
  }
  if (mainActiveItem != null) {
    switchImage(mainActiveItem,IMG_ON);
  }
}
function setJSPVars(langJS,strFlashV,strPageId,usrFlash,xactiveMenuLayer,xactiveItem,xactiveParent,ImgOn,mainJspId) {
  pageId            = strPageId;
  flashVersion      = strFlashV;
  userFlashChoice   = usrFlash;
  activeMenuLayer   = xactiveMenuLayer;
  activeItem        = xactiveItem;
  activepopup 	    = xactiveMenuLayer;
  activeParent 	    = xactiveParent;
  mainPagePath      = mainJspId;
  mainCurrentpopup  = xactiveMenuLayer;
  mainActiveItem    = xactiveItem;
  mainActivepopup   = xactiveMenuLayer;
  mainActiveParent  = xactiveParent;
  switch (langJS)
  {
    case 1:
      imgLangPostSufixOn  = "_1_e";
      imgLangPostSufixOff = "_0_e";
      imgPrefixLang       = "_e";
      realLangue          = "US";
    break;
    case 2:
      imgLangPostSufixOn  = "_1_s";
      imgLangPostSufixOff = "_0_s";
      imgPrefixLang       = "_s";
      realLangue          = "ES";
    break;
    case 3:
      imgLangPostSufixOn  = "_1_f";
      imgLangPostSufixOff = "_0_f";
      imgPrefixLang       = "_f";
      realLangue          = "CA";
    break;
  }
  lang =realLangue;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
    theURL = getUrlVars(theURL);
    window.open(theURL,winName,features);
}
function getUrlVars(strUrl) {
    strTemp = strUrl;
    strAux = "";
    nPos    = strTemp.indexOf('<FLASHEXT>');
    if (nPos > -1) {
        if (nPos == 0) {
            strTemp = flashVersion + strTemp.substring(10);
        }
        else {
            if ((flashVersion == "Y") && (userFlashChoice == "0")) {
                strAux = "_fla";
            }
            strTemp = strTemp.substring(0,nPos) + strAux + strTemp.substring(nPos + 10)
        }
    }
    nPos    = strTemp.indexOf('<FLASH>');
    if (nPos > -1) {
        if (nPos == 0) {
            strTemp = flashVersion + strTemp.substring(7);
        }
        else {
            strTemp = strTemp.substring(0,nPos) + flashVersion + strTemp.substring(nPos + 7)
        }
    }
    nPos = strTemp.indexOf('<LANG>');
    if (nPos > -1) {
        if (nPos == 0) {
            strTemp = realLangue + strTemp.substring(6);
        }
        else {
            strTemp = strTemp.substring(0,nPos) + realLangue + strTemp.substring(nPos + 6)
        }
    }
    nPos = strTemp.indexOf('<PAGEID>');
    if (nPos > -1) {
        if (nPos == 0) {
            strTemp = pageId + strTemp.substring(8);
        }
        else {
            strTemp = strTemp.substring(0,nPos) + pageId + strTemp.substring(nPos + 8)
        }
    }
    nPos = strTemp.indexOf('<USRFLASH>');
    if (nPos > -1) {
        if (nPos == 0) {
            strTemp = userFlashChoice + strTemp.substring(10);
        }
        else {
            strTemp = strTemp.substring(0,nPos) + userFlashChoice + strTemp.substring(nPos + 10)
        }
    }
    nPos = strTemp.indexOf('<INK>');
    if (nPos > -1) {
        if (nPos == 0) {
            strTemp = userFlashChoice + strTemp.substring(5);
        }
        else {
            strTemp = strTemp.substring(0,nPos) + "#" + strTemp.substring(nPos + 5)
        }
    }
    return strTemp;
}
function rout2Page(fixURL,bNewWindow, strPageId) {
  strPageId = strPageId != null ? new String(strPageId) : null;
  pageToGo = pageId == null ? "0" : pageId;
  pageToGo = strPageId != null ? strPageId : pageId;
  pageToGo = ((pageToGo == null) || (pageToGo == "null") || (pageToGo == "") || (pageToGo == "0")) ? "1" : pageToGo;
    if (flashVersion == null) {
        flashVersion = "Y";
    }
    if (userFlashChoice == null) {
        userFlashChoice = "0";
    }
    if ((bNewWindow == null) || (!bNewWindow)) {
        top.location.href = fixURL + "?Params=" + flashVersion + "." + realLangue + "." + pageToGo + "." + userFlashChoice;
    }
    else {
        window.open(  fixURL + "?Params=" + flashVersion + "." + realLangue + "." + pageToGo + "." + userFlashChoice,"","toolbar=yes,menubar=yes,scrollbars=yes,location=yes,status=yes,width=750,height=500,resizable=yes,top=0,left=0");
    }
    if ((currentImageMenuParent != null) && (currentImageMenuParent != "") && (currentImageMenuParent != "null")) {
    	switchImage(currentImageMenuParent,IMG_OFF);
    	tocItem[currentImageMenuParent].visible = false;

    }
}
function setParentTo(strPageId,bNewWindow,strLang,strRequired) {
	strUrl = getNewURL(strPageId,bNewWindow,strLang,strRequired);
	parent.opener.location.href = strUrl;
}
function getNewURL(strPageId,bNewWindow,strLangParam,asString) {
    strPageId = strPageId != null ? new String(strPageId) : null;
    strNewPageId = strPageId;
    strLangToUse = realLangue;
    strInk = "";
    nPos = strPageId.indexOf("INK");
    if (nPos > -1) {
        strNewPageId = strPageId.substring(0,nPos);
        strInk = "#" + strPageId.substring(nPos + 3);
    }
    if (flashVersion == null) {
        flashVersion = "Y";
    }
    if (userFlashChoice == null) {
        userFlashChoice = "0";
    }
    if (strLangParam != null) {
        strLangToUse = strLangParam;
    }
    if (asString == null) {
    	if ((bNewWindow == null) || (!bNewWindow)) {
    	    top.location.href = "/web/jsp/MainPage.jsp?Params=" + flashVersion + "." + strLangToUse + "." + strNewPageId + "." + userFlashChoice + strInk;
    	}
    	else {
    	    document.open(  "/web/jsp/MainPage.jsp?Params=" + flashVersion + "." + strLangToUse + "." + strNewPageId + "." + userFlashChoice + strInk,
                        "","toolbar=yes,menubar=yes,scrollbars=yes,location=yes,status=yes,width=750,height=500,resizable=yes,top=0,left=0");
    	}
    }
    else {
    	return "/web/jsp/MainPage.jsp?Params=" + flashVersion + "." + strLangToUse + "." + strNewPageId + "." + userFlashChoice + strInk;
    }
}

function forwardTo(strFixUrl,strPageId,bNewWindow,strLang) {
    strPageId = strPageId != null ? new String(strPageId) : null;
    strNewPageId = strPageId;
    strInk = "";
    strLangToGo = (strLang == null) ? realLangue : strLang;
    nPos = strPageId.indexOf("INK");
    if (nPos > -1) {
        strNewPageId = strPageId.substring(0,nPos);
        strInk = "#" + strPageId.substring(nPos + 3);
    }
    if (flashVersion == null) {
        flashVersion = "Y";
    }
    if (userFlashChoice == null) {
        userFlashChoice = "0";
    }
    if ((bNewWindow == null) || (!bNewWindow)) {
        top.location.href = strFixUrl + "web/jsp/MainPage.jsp?Params=" + flashVersion + "." + strLangToGo + "." + strNewPageId + "." + userFlashChoice + strInk;
    }
    else {
        window.open(  strFixUrl + "web/jsp/MainPage.jsp?Params=" + flashVersion + "." + strLangToGo + "." + strNewPageId + "." + userFlashChoice + strInk,
                        "","toolbar=yes,menubar=yes,scrollbars=yes,location=yes,status=yes,width=750,height=500,resizable=yes,top=0,left=0");
    }
}
function tocItem(name,nMenuParent,strMenuLayer,popupMenu,fileExtension,imgRealName,noAddPrefix,keepHighLight,paramLangPreSufix) {
  this.name = name;
  this.isImageItem = (imgRealName != null);
  this.keepHighLight = keepHighLight == null ? false : keepHighLight;
  this.menuParent = nMenuParent;
  this.parentLayer = strMenuLayer;
  this.popupChild = popupMenu;
  this.visible = false;
  if (this.isImageItem) {
	imgPath = paramLangPreSufix != null ? paramLangPreSufix : imgLangPreSufix;
    if ((noAddPrefix == null) || (!noAddPrefix)) {
      this.on = imgPath + imgRealName + imgLangPostSufixOn + fileExtension;
      this.off = imgPath + imgRealName + imgLangPostSufixOff + fileExtension;
    }
    else {
      this.on = imgPath + imgRealName + "_1" + fileExtension;
      this.off = imgPath + imgRealName + "_0" + fileExtension;
    }
  }
}
function toc_new(name,nMenuParent,strMenuLayer,popupMenu,fileExtension,imgRealName,noAddPrefix,keepHighLight,paramLangPreSufix) {
  if ((fileExtension != null) && (fileExtension != "") && (fileExtension != "null")) {
    if (fileExtension.indexOf(".") == -1) {
      fileExtension = "." + fileExtension;
    }
  }
  tocItem[name] = new tocItem(name,nMenuParent,strMenuLayer,popupMenu,fileExtension,imgRealName,noAddPrefix,keepHighLight,paramLangPreSufix);
}
function swapImgDirect(imgContainer,imgName,parentLayer) {
    if (document.images) {
        if (imgName != null) {
             if ((parentLayer == null) || (IE4) || (NS6)) {
                document[imgContainer].src = imgName;
            }
            else {
                image= eval("document.layers."+parentLayer+".document.images['"+imgContainer+"']");
                image.src = imgName;
            }
        }
    }
}
function changeLang(strNextLang) {
  toHREF = top.location.href;
  if ((toHREF.indexOf("edrMain") > -1) && (toHREF.indexOf("Params=") == -1)) {
    toHREF = "edrMain.jsp?Params=" + flashVersion + "." + strNextLang + "." + pageId + "." + userFlashChoice;
  }
  else {
    var frFrom 	= new Array(/\.CA\./, /\/fr\//,/_fr_/);
    var frTo      = new Array("\.CA\.", "/fr/","_fr_");

    var enFrom 	= new Array(/\.US\./, /\/en\//,/_en_/);
    var enTo      = new Array("\.US\.", "/en/","_en_");

    var esFrom 	= new Array(/\.ES\./, /\/es\//,/_es_/);
    var esTo      = new Array("\.ES\.", "/es/","_es_");

    var from      = ((realLangue=="CA")?frFrom:((realLangue=="US")?enFrom:esFrom));
    var to        = ((strNextLang=="CA")?frTo:((strNextLang=="US")?enTo:esTo));

    for (var i = 0; i < from.length; i++) {
      toHREF = toHREF.replace(from[i], to[i]);
    }
  }
  top.location.href = toHREF;
}
function initValues() {
  if (NS4) {
    document.captureEvents(Event.MOUSEUP);
  }
  document.onmouseup = mouseUp;
}
function mouseUp(e) {
  closeCurrents(null,true);
  return true;
}
function dummy() {
  return;
}
// NEW FUNCTIONS SECTION
function checkMenuMO(strMenu) {
  if (checkIfIsMain(strMenu)) {
      closeCurrents(null,true);
      return checkMenuMainNavigationMO(strMenu);
  }
  menuIsActive = true;
  if ((tocItem[strMenu].isImageItem) && (!tocItem[strMenu].keepHighLight)) {
    switchImage(strMenu,IMG_ON);
    if ((tocItem[strMenu].popupChild != null) &&
        (tocItem[strMenu].popupChild != "null") &&
        (tocItem[strMenu].popupChild != "none")) {
      if (strMenu != currentImageMenuParent) {
        closeCurrents(null,true);
      }
      currentImageMenuParent = strMenu;
      if (!tocItem[strMenu].visible) {
        closeCurrents(null,true);
        openPopup(tocItem[strMenu].popupChild);
        setMainNavigationVisualIndex(false);
        tocItem[strMenu].visible = true;
        registerMenus(strMenu,tocItem[strMenu].popupChild,true,false,false);
      }
    }
    else {
      closeCurrents(null,true);
    }
  }
}
function checkMenuMOUT(strMenu) {
  if (checkIfIsMain(strMenu)) {
      return checkMenuMainNavigationMOUT(strMenu);
  }
  clearTimeout(menuCloser);
  menuIsActive = false;
  if (tocItem[strMenu].visible) {
    menuCloser = setTimeout("checkmenu('"+ strMenu +"')",2000);
  }
  else {
    switchImage(strMenu,IMG_OFF);
  }
}
function openPopup(strMenu,itemId,hLiteColor,childPopup,isFloat,menuParent) {
  if (isParentText(strMenu) && currentChildpopup != childPopup) {
    closeCurrents(null,false);
  }
  setMainNavigationVisualIndex(false);
  menuIsActive = true;
  openClosePopup(strMenu,true);
  if ((childPopup != null) && (childPopup != "null") && (childPopup != "none")) {
    if ((childPopup != currentParentpopupX) && (strMenu != currentParentpopupX) && (currentChildpopup != strMenu)) {
      closeXPopup(currentParentpopupX);
    }
    openClosePopup(strMenu,true);
    openPopup(childPopup,null,null,null,null,strMenu);
    currentChildpopup = childPopup;
    currentParentpopupX = strMenu;
  }
  else {
    if ((strMenu != currentChildpopup) && (menuParent != currentChildpopup)) {
      closeXPopup(currentChildpopup);
      currentChildpopup = "";
    }
  }
  registerMenus(strMenu,childPopup,false,false,false);
}
function closeXPopup(strMenu) {
  openClosePopup(strMenu,false);
}
function openClosePopup(strMenu,bOnOff) {
  if ((strMenu == null) || (strMenu == 'none') || (strMenu == "null") || (strMenu == "") || (isParentText(strMenu))) {
    return;
  }
  if (bOnOff) {
    clearTimeout(menuCloser);
    menuCloser = null;
  }
  if (NS6) {
    menu=document.getElementById(strMenu);
  }
  else {
    menu = (NS4) ? eval("document.layers."+strMenu) : eval(strMenu);
  }
  if ((menu) && (menu != 'none')) {
    if (NS4) menu.visibility = (bOnOff) ? "show" : "hide";
    else menu.style.visibility = (bOnOff) ? "visible" : "hidden";
  }
}
function switchImage(imgName,imgState) {
  if ((imgName == null) || (imgName == "") || (imgName == 'null') || (imgName == "none")) {
    return;
  }
  if (document.images) {
    if ((tocItem[imgName].parentLayer == null) || (IE4) || (NS6)) {
      document[imgName].src = eval("tocItem[imgName]."+imgState);
    }
    else {
      image= eval("document.layers."+tocItem[imgName].parentLayer+".document.images['"+imgName+"']");
      eval("image.src = tocItem[imgName]."+imgState);
    }
  }
}
function checkmenu(strMenu) {
  if (menuIsActive) {
    return;
  }
  menuCloser = null;
  closeCurrents(strMenu,false);
  if (overmenu == 0) {
    closeMainActives();
    popupJSP(activepopup);
  }
}
function closePopup(strMenu,itemId,bgColor,childPopup,isFloat) {
  menuIsActive = false;
  if (menuCloser == null) {
    setMainNavigationVisualIndex(true);
    menuCloser = setTimeout("checkmenu('" + strMenu + "')",2000);
  }
}
function closeCurrents(strMenu,bIsImage) {
  menuLevel = 0;
  if ((strMenu != null) && (menuIsActive)) {
    menuLevel = findMenuLevel(new String(strMenu));
    if (menuLevel == -1) {
      return;
    }
  }
  for(x=(maxlevels -1);x>=menuLevel;--x) {
    if (menuLevels[x] != "") {
      closeMenu(x);
    }
  }
  setMainNavigationVisualIndex(true);
}
function registerMenus(parentMenu,childMenu,bParentImage,bChildImage,bFloatParent) {
  parentMenu = ((parentMenu == null) || (parentMenu == "null") || (parentMenu == "none")) ? "" : parentMenu;
  childMenu = ((childMenu == null) || (childMenu == "null") || (childMenu == "none")) ? "" : childMenu;
  nextLevelPosition = -1;
  canRegisterParent = (findMenuLevel(parentMenu) == -1);
  canRegisterChild = (findMenuLevel(childMenu) == -1);
  if (canRegisterParent || canRegisterChild) {
    for(x=0;x<maxlevels;x++) {
      if (menuLevels[x] == "") {
        nextLevelPosition = x;
        break;
      }
    }
    if (nextLevelPosition > -1) {
      if ((canRegisterParent) && (parentMenu != "")) {
        menuLevels[nextLevelPosition] = ((bParentImage) ? "1" : "0") + ";0;" + parentMenu;
        if ((childMenu != null) && (nextLevelPosition < 15) && (childMenu != "")) {
          menuLevels[nextLevelPosition + 1] = ((bChildImage) ? "1" : "0") + ";1;" + childMenu;
        }
      }
      if ((!canRegisterParent) && (canRegisterChild) && (childMenu != "")) {
        menuLevels[nextLevelPosition] = "0;1;" + childMenu;
      }
    }
  }
}
function findMenuLevel(strMenu) {
  for(x=0;x<maxlevels;x++) {
    tmp = menuLevels[x];
    if ((tmp != "") && (tmp.substring(4) == strMenu)) {
      return x;
      break;
    }
  }
  return -1;
}
function closeMenu(nMenu) {
  strMenu = menuLevels[nMenu];
  isImage = (strMenu.substring(0,1) == "1") ? true : false;
  isLayer = (strMenu.substring(2,3) == "1") ? true : false;
  strMenu = strMenu.substring(4);
  if (isImage) {
    switchImage(strMenu,IMG_OFF);
    tocItem[strMenu].visible = false;
  }
  else {
    closeXPopup(strMenu);
  }
  menuLevels[nMenu] = "";
}
function menutimeout() {
}
function isParentText(strMenu) {
  for(x=0;x<maxlevels;x++) {
    if (parentText[x] == strMenu) {
      return true;
    }
  }
  return false;
}
function registerParentText(strMenu) {
  if (currentParentText < (maxlevels -1)) {
    currentParentText++;
    parentText[currentParentText] = strMenu;
  }
}
function currentsAreNotActive(strMenu,childPopup,menuParent) {
  bReturn = ((menuParent == null) || (menuParent == "undefined"));
  return bReturn;
}
// Main navigation functionality
function registerMainNavigationImages(strImage) {
mainNavigationImages[cntMainNavigationRegImg] = strImage;
cntMainNavigationRegImg++;
}
function registerMainNavigationPopups(strPopup) {
mainNavigationPopups[cntMainNavigationRegPops] = strPopup;
cntMainNavigationRegPops++;
}
function checkIfIsMain(strMenu) {
  max = mainNavigationImages.length;
  found = false;
  for (x=0;x<max;x++) {
    if (mainNavigationImages[x] == strMenu) {
      found = true;
      break;
    }
  }
  if (!found) {
    for (x=0;x<max;x++) {
      if (mainNavigationPopups[x] == tocItem[strMenu].parentLayer) {
        found = true;
        break;
      }
    }
  }
  return found;
}
function checkMenuMainNavigationMO(strMenu) {
	overmenu = tocItem[strMenu].menuParent;
	if ((tocItem[strMenu].popupChild != null) && (tocItem[strMenu].popupChild != "EMPTYMENU")) {
		if (mainCurrentParent != null) {
			switchImage(mainCurrentParent,IMG_OFF);
		}
		mainCurrentParent = strMenu;
		switchImage(strMenu,IMG_ON);
		if ( mainActiveParent != strMenu) {
			switchImage(mainActiveParent,IMG_OFF);
		}
		hideMenu();
		showMenu(tocItem[strMenu].popupChild);
		mainCurrentpopup = tocItem[strMenu].popupChild;
	}
	else {
		switchImage(strMenu,IMG_ON);
	}
}
function checkMenuMainNavigationMOUT(strMenu) {
	if (strMenu == mainActiveItem) {
          return;
        }
	if (mainCurrentParent != strMenu)
		switchImage(strMenu,IMG_OFF);
	if (mainCurrentParent == mainActiveParent)
		switchImage(mainActiveItem,IMG_ON);
	overmenu = 0;
	if ((tocItem[strMenu].parentLayer != null) && (tocItem[strMenu].parentLayer != mainActivepopup)) {
		mainMenutimeout(tocItem[strMenu].parentLayer);
	}
	else {
		mainMenutimeout(mainCurrentpopup);
	}
}
function showMenu(strMenu) {
   if ((strMenu == 'null') || (strMenu == null) || (strMenu == "#") || (strMenu == "EMPTYMENU") || (strMenu == "none")) {
    return;
    }
    if (NS6) {
        menu=document.getElementById(strMenu);
    }
    else {
        if (NS4) {
      	    menu=eval("document.layers."+strMenu);
        }
	else {
      	    menu=eval(strMenu);
        }
    }
    if (NS4) menu.visibility = "show"
    else menu.style.visibility = "visible"

    mainCurrentpopup = strMenu;
}

function hideMenu() {
    if ((mainCurrentpopup != null) && (mainCurrentpopup != 'null')) {
        if (NS6) {
            menu=document.getElementById(mainCurrentpopup);
        }
        else {
            if (NS4) {
                menu=eval("document.layers."+mainCurrentpopup)
            }
            else {
                menu=eval(mainCurrentpopup);
            }
        }
        if (NS4) {
           if (menu) menu.visibility = "hide"
        }
        else {
            if (menu.style) menu.style.visibility = "hidden";
            else return;
        }
    }
}
function checkMainMenu (mainCurrentpopup,check)
{
  if (overmenu > 0) {
    return;
  }
	if ((overmenu == 0) && (check == overcheck) && (mainCurrentpopup != null) && (mainCurrentpopup != mainActivepopup))
	{
		closeMainActives();
	}
}
function mainMenutimeout(strMenu)
// Set a .5 second timeout when the menu is not being used to close
{
    if ((strMenu == 'null') || (strMenu == null) || (strMenu == "#") || (strMenu == "EMPTYMENU") || (strMenu == "none")) {
    return;
    }
    overcheck=overcheck+1;
    setTimeout("checkMainMenu(mainCurrentpopup,"+overcheck+")",1000);
}
function setMainNavigationVisualIndex(onOff) {
  hidenMainMenuDone = !onOff;
  index = onOff ? "10" : "0";
  max=mainNavigationPopups.length;
  for (x=0;x<max;x++) {
    if (mainNavigationPopups[x] == "") {
      break;
    }
    if (NS6) {
        menu=document.getElementById(mainNavigationPopups[x]);
    }
    else {
        if (NS4) {
      	    menu=eval("document.layers."+mainNavigationPopups[x]);
            menu.zIndex = index;
        }
	else {
      	    menu=eval(  mainNavigationPopups[x]);
        }
    }
    if (!NS4) menu.style.zIndex = index;
  }
}
function setCurrentHRef(hRef) {
  currentHref = hRef;
}
function closeMainActives() {
	if ((mainCurrentpopup == null) || (mainCurrentpopup == "") || (mainCurrentpopup == "null")) {
		return;
	}
	if (NS6)
		menu=document.getElementById(mainCurrentpopup)
	else if (NS4)
			menu=eval("document.layers."+mainCurrentpopup)
		else
			menu=eval(mainCurrentpopup);
	if (NS4) menu.visibility = "hide";
	else menu.style.visibility = "hidden";
	window.status = mainActivepopup;
	showMenu(mainActivepopup);
	if (mainCurrentParent != null)
		switchImage(mainCurrentParent,IMG_OFF);
	if (mainActiveParent != null)
		switchImage(mainActiveParent,IMG_ON);
	if (mainActiveItem != null)
		switchImage(mainActiveItem,IMG_ON);
}