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);

// routing 'constants'...
displayModels = false;
openmenu = "";
imgPrefixLang = "_f";
activeMenu = 0;
activeMenuLayer = null;
currentpopup = null;
currentParent = null;
activeItem = null;
activepopup = null;
activeParent = null;
overcheck = null;
overmenu = 0;
menuWasOpen = 0;
lowMenuLevel = 0;
textChildPopup = null;
textParentPopup = null;
loaded = false;
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;
var pageId = "0";
var lang = "US";
var flashV = "N";
var IMG_ON = "on";
var IMG_OFF = "off";
// Default values...
var imgLangPreSufix     = "/skidoo/web/html/archives/archives_2003/media/";
var imgLangPostSufixOn  = "_1_f";
var imgLangPostSufixOff = "_0_f";
var bParentMenuOver     = false;
var comboPageId         = "100_mainPage.jsp";
var checkXComboP200_210 = "skMain7;skMain8;skMain9";
var checkXComboP220_e   = "skMain10;skMain11";
var checkXComboP220_f   = "skMain10;skMain11";
var checkXComboP200_210_f = "skMain4;skMain7;skMain8";
var checkXComboP230_f     = "skMain8;skMain9;skMain10;skMain11";
var checkXComboP230       = "skMain10;skMain11";
var checkXComboP300_301_302_303 = "skMain7;skMain8";
var checkXComboP310_f   = "skMain7;skMain8;skMain9;skMain10;skMain11";
var checkXComboP310_e   = "skMain8;skMain9;skMain10;skMain11";
var checkXComboP400_401 = "skMain7;skMain8";

function MM_preloadImages() { //v3.0
    var d=document;
    if(d.images){
        if(!d.MM_p)
            d.MM_p=new Array();
            var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
            for(i=0; i<a.length; i++)
                if (a[i].indexOf("#")!=0){
                    d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
                }
    }
}
function popupJSP(popJSP)
{
    showMenu(popJSP);
    if (activeParent != null) {
        switchImage(activeParent,IMG_ON);
    }
    if (activeItem != null) {
        switchImage(activeItem,IMG_ON);
    }
}
function setJSPVars(langJS,xactiveMenuLayer,xactiveItem,xactiveParent,strLang,strPageId,strFlashV) {

        lang             = strLang;
        pageId          = strPageId;
        flashV          = strFlashV;
    activeMenuLayer = xactiveMenuLayer;
    currentpopup    = xactiveMenuLayer;
    activeItem  = xactiveItem;
    activepopup     = xactiveMenuLayer;
    activeParent    = xactiveParent;

    switch (langJS)
    {
        case 1:
            imgLangPostSufixOn  = "_1_e";
            imgLangPostSufixOff = "_0_e";
                        imgPrefixLang       = "_e";
                        lang = "US";
            break;
        case 2:
            imgLangPostSufixOn  = "_1_s";
            imgLangPostSufixOff = "_0_s";
                        imgPrefixLang       = "_s";
                        lang = "ES";
            break;
        case 3:
            imgLangPostSufixOn  = "_1_f";
            imgLangPostSufixOff = "_0_f";
                        imgPrefixLang       = "_f";
                        lang = "CA";
            break;
    }
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function showMenu(strMenu)
// Show Menu Layer
{
    if ((strMenu == null) || (strMenu == 'none')) {
        return;
    }
    if (NS6)
        menu=document.getElementById(strMenu);
    else if (NS4)
        menu=eval("document.layers."+strMenu);
    else
        menu=eval(strMenu);

    if ((menu != null) && (strMenu != 'none')) {
        if (NS4) menu.visibility = "show"
        else menu.style.visibility = "visible"
    }
    disposeComboBox(false,strMenu);
}

function hideMenu()
// Hide Menu Layer
{
    if ((currentpopup == null) || (currentpopup == 'none')) {
        return;
    }

if (currentpopup != null)
        {
                if (NS6)
                        menu=document.getElementById(currentpopup);
                else if (NS4)
                        menu=eval("document.layers."+currentpopup)
                else
                        menu=eval(currentpopup);
        if ((menu != null) && (menu != 'none')) {
                if (NS4) menu.visibility = "hide"
                else menu.style.visibility = "hidden";
        }
        }
        disposeComboBox(true,currentpopup);
}
function checkmenu (currentpopup,check)
// Check to see if menu is open but not used, if so it is closed
{
    if ((currentpopup == null) || (currentpopup == 'none') || (menuWasOpen > 0)) {
        return;
    }
    if ((overmenu == 0) && (check == overcheck) && (currentpopup != null) && (currentpopup != activepopup))
    {
        if (NS6)
            menu=document.getElementById(currentpopup)
        else if (NS4)
            menu=eval("document.layers."+currentpopup)
            else
                    menu=eval(currentpopup);
        if (NS4) menu.visibility = "hide";
        else menu.style.visibility = "hidden";
        window.status = activepopup;
        showMenu(activepopup);
        if (currentParent != null)
            switchImage(currentParent,IMG_OFF);
        if (activeParent != null)
            switchImage(activeParent,IMG_ON);
        if (activeItem != null)
            switchImage(activeItem,IMG_ON);
    }
                if (textParentPopup != currentpopup) {
                    hideTextMenu(textParentPopup);
                    textParentPopup = null;
                }
                hideTextMenu(textChildPopup);
                textChildPopup = null;
        if (!bParentMenuOver) {
          disposeComboBox(true,currentpopup);
        }
}

function menutimeout(strMenu)
// Set a .5 second timeout when the menu is not being used to close
{
    overcheck=overcheck+1;
    setTimeout("checkmenu(currentpopup,"+overcheck+")",1000);
}

function tocItem (name,nMenuParent,strMenuLayer,popupMenu,fileExtension,imgRealName,noAddPrefix) {
    this.menuParent = nMenuParent;
    this.parentLayer = strMenuLayer;
    this.popupChild = popupMenu;
    this.on = new Image();
    this.off = new Image();
    if (noAddPrefix == null) {
        this.on.src = imgLangPreSufix + imgRealName + imgLangPostSufixOn + fileExtension;
        this.off.src = imgLangPreSufix + imgRealName + imgLangPostSufixOff + fileExtension;
    }
    else {
        this.on.src = imgLangPreSufix + imgRealName + "_1" + fileExtension;
        this.off.src = imgLangPreSufix + imgRealName + "_0" + fileExtension;
    }
}

function toc_new (name,nMenuParent,strMenuLayer,popupMenu,fileExtension,imgRealName,noAddPrefix) {
tocItem[name] = new tocItem(name,nMenuParent,strMenuLayer,popupMenu,fileExtension,imgRealName,noAddPrefix);
}
function checkMenuMO(strMenu) {
        bParentMenuOver = true;
    if ((tocItem[strMenu].popupChild == null) && (currentpopup != null)) {
        hideMenu();
    }

        if (textParentPopup != tocItem[strMenu].popupChild) {
            hideTextMenu(textParentPopup);
        }
    activeMenuLayer = tocItem[strMenu].parentLayer;
    overmenu = tocItem[strMenu].menuParent;
    if (tocItem[strMenu].popupChild != null) {
        if (currentParent != null) {
            switchImage(currentParent,IMG_OFF);
        }
        currentParent = strMenu;
        switchImage(strMenu,IMG_ON);
        if ( activeParent != strMenu) {
            switchImage(activeParent,IMG_OFF);
        }
        hideMenu();
        showMenu(tocItem[strMenu].popupChild);
        currentpopup = tocItem[strMenu].popupChild;
    }
    else {
        switchImage(strMenu,IMG_ON);
                disposeComboBox(false,strMenu);
    }
}
function checkMenuMOUT(strMenu) {
        bParentMenuOver = false;
        if (currentParent != strMenu)
        switchImage(strMenu,IMG_OFF);
    if (currentParent == activeParent)
        switchImage(activeItem,IMG_ON);
    overmenu = 0;
    if ((tocItem[strMenu].parentLayer != null) && (tocItem[strMenu].parentLayer != activepopup)) {
        menutimeout(tocItem[strMenu].parentLayer);
    }
    else {
        menutimeout(currentpopup);
    }

}
function switchImage(imgName,imgState) {
    if (document.images) {
        if (imgName != null) {
            if ((tocItem[imgName].parentLayer == null) || (IE4) || (NS6)) {
                document[imgName].src = eval("tocItem[imgName]."+imgState+".src");
            }
            else {
                image= eval("document.layers."+tocItem[imgName].parentLayer+".document.images['"+imgName+"']");
                eval("image.src = tocItem[imgName]."+imgState+".src");
            }
        }
    }
}
function openPopup(menuId,itemId,hLiteColor,childPopup) {
    disposeComboBox(false,menuId);
    setOverMenu(menuId,1);
    if (!NS4 && !NS6) {
        eItemNew = eval("document.all('" + itemId + "')");
        eParent = eItemNew.parentElement;
        if (!(hLiteColor == null)) {
            eParent.style.background = hLiteColor;
        }
    }
    if ((textChildPopup != null) && (childPopup == null) && (menuId != textChildPopup)) {
        hideTextMenu(textChildPopup);
        textChildPopup = null;
    }

    if (childPopup != null) {
        showTextMenu(childPopup);
        textChildPopup = childPopup;
        textParentPopup = menuId;
    }
}
function closePopup(menuId,itemId,bgColor,childPopup) {
    setOverMenu(menuId,0);
    if (!NS4 && !NS6) {
        eItemNew = eval("document.all('" + itemId + "')");
        eParent = eItemNew.parentElement;
        if (!(bgColor == null)) {
            eParent.style.background = bgColor;
        }
    }
}
function hideTextMenu(strMenu) {
    if (strMenu != null) {
        if (NS4) {
            menu = eval("document.layers."+strMenu);
        }
        else {
            menu = eval(strMenu);
        }
        if (!NS4) {
            menu.style.visibility = "hidden";
        }
        else {
            menu.visibility = "hidden";
        }
    }
    disposeComboBox(true,strMenu);
}
function showTextMenu(strMenu) {
    if (strMenu != null) {
        if (NS4) {
            menu = eval("document.layers."+strMenu);
        }
        else {
            menu = eval(strMenu);
        }
        if (!NS4) {
            menu.style.visibility = "visible";
        }
        else {
            menu.visibility = "visible";
        }
    }
}
function setOverMenu(strMenu,state) {
    menuWasOpen = state;
    currentpopup = strMenu;
    if (state == 0) {
        menutimeout(currentpopup);
    }
}
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 swapImgSRoom(imgContainer,imgName,parentLayer) {
  swapImgDirect(imgContainer,imgName,parentLayer);
  if (pageId != 101) {
    return;
  }
  if (imgName.indexOf("_1") == -1) {
    if ((IE4) || (NS6)) {
      //document.all.showItem.style.visibility =  "hidden";
      document.getElementById.showItem.style.visibility =  "hidden";
    }
    else {
      document.layers.showItem.visibility = "hidden"
    }
      return;
  }
  strImgItem = "/SkiDoo2003/media/ph_roll_" + imgContainer.substr(3)  + ".jpg";
  if ((IE4) || (NS6)) {
    //document.all.showItem.style.visibility =  "visible";
    document.getElementById.showItem.style.visibility =  "visible";
    document.imgShowItem.src =  strImgItem;
  }
  else {
    document.layers.showItem.visibility = "visible";
    image= eval("document.layers.showItem.document.images[0]");
    image.src = strImgItem;
  }
}
function showRoomItem(strNewPageId) {
  if (strNewPageId == pageId) {
    return;
  }
  top.location.href = "/FishHawk/web/jsp/mainPage.jsp?Params=" + flashV + "." + lang + "." + strNewPageId + ".0";
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  //if(!(x=d[n])&&d.all) x=d.all[n];
  if(!(x=d[n])&&d.getElementById) x=d.getElementById(n);
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function disposeComboBox2(bOnOff,xMenu) {


    strUrl = top.location.pathname;
    strHref = top.location.href;
    if (    ((pageId=="61000") && ((docCateg>=1996) && (docCateg<=2005)))){
      bHideCombo = (strHideComboOnMenu.indexOf(xMenu) == -1) ? false : true;
      itemCombo = null;
    }
    else {
      bHideCombo = false;
    }

    if (NS6 && bHideCombo) {
      itemCombo = document.getElementById("layerbox");
      if (itemCombo == null) {
        return;
      }
      itemCombo.style.visibility = bOnOff ? "visible" : "hidden";
    }
    else {
      if (NS4 && bHideCombo) {
          itemCombo = eval("document.layers.layerbox");
          if (itemCombo == null) {
            return;
          }
          itemCombo.visibility = bOnOff ? "visible" : "hide";
      }
      else {
        if (bHideCombo) {
          itemCombo = eval("layerbox");
          if (itemCombo == null) {
          return;
          }
          itemCombo.style.visibility = bOnOff ? "visible" : "hidden";
        }
      }
    }
}
function disposeComboBox(bOnOff,xMenu) {
    strToEval = null;
    strHref   = top.location.href;
    if (strHref.indexOf(comboPageId) == -1) {
      return;
    }
    // showroom pages...
    if ((strHref.indexOf(".200.") > -1) || (strHref.indexOf(".210.") > -1)) {
      strToCheck = checkXComboP200_210;
      if (lang == "CA") {
        strToCheck = checkXComboP200_210_f;
      }
      if (strToCheck.indexOf(xMenu) > -1) {
        if (NS4) {
          strToEval = "document.layers.choixmodels";
        }
        else {
          strToEval = "choixmodels";
        }
      }
    }
    if ((strHref.indexOf(".220.") > -1)) {
        strToCheck = checkXComboP220_f;
      if (lang == "US") {
        strToCheck = checkXComboP220_e;
      }
      if (strToCheck.indexOf(xMenu) > -1) {
        if (NS4) {
          strToEval = "document.layers.combos";
        }
        else {
          strToEval = "combos";
        }
      }
    }
    if ((strHref.indexOf(".230.") > -1)) {
      strToCheck = checkXComboP230_f;
      if (lang == "US") {
        strToCheck = checkXComboP230;
      }
      if (strToCheck.indexOf(xMenu) > -1) {
        if (NS4) {
          strToEval = "document.layers.choixmodelsForm";
        }
        else {
          strToEval = "choixmodelsForm";
        }
      }
    }

    if ((strHref.indexOf(".300.") > -1) || (strHref.indexOf(".301.") > -1) || (strHref.indexOf(".302.") > -1) || (strHref.indexOf(".303.") > -1)) {
      if (checkXComboP300_301_302_303.indexOf(xMenu) > -1) {
        if (NS4) {
          strToEval = "document.layers.formCat1";
        }
        else {
          strToEval = "formCat1";
        }
      }
    }
    if ((strHref.indexOf(".310.") > -1) || (strHref.indexOf(".311.") > -1) || (strHref.indexOf(".312.") > -1)
        || (strHref.indexOf(".315.") > -1) || (strHref.indexOf(".316.") > -1) || (strHref.indexOf(".317.") > -1)) {
      strToCheck = checkXComboP310_f;
      if (lang == "US") {
        strToCheck = checkXComboP310_e;
      }
      if (strToCheck.indexOf(xMenu) > -1) {
        if (NS4) {
          strToEval = "document.layers.wearables_catalogue";
        }
        else {
          strToEval = "wearables_catalogue";
        }
      }
    }
    if ((strHref.indexOf(".400.") > -1) || (strHref.indexOf(".401.") > -1)) {
      if (checkXComboP400_401.indexOf(xMenu) > -1) {
        if (NS4) {
          strToEval = "document.layers.headerForm";
        }
        else {
          strToEval = "headerForm";
        }
      }
    }



    if (strToEval != null) {
      if (NS6) {
        itemCombo = document.getElementById(strToEval);
        if (itemCombo == null) {
          return;
        }
        itemCombo.style.visibility = bOnOff ? "visible" : "hidden";
      }
      else {
        if (NS4) {
          itemCombo = eval(strToEval);
          if (itemCombo == null) {
            return;
          }
          itemCombo.visibility = bOnOff ? "visible" : "hide";
        }
        else {
          itemCombo = eval(strToEval);
          if (itemCombo == null) {
            return;
          }
          itemCombo.style.visibility = bOnOff ? "visible" : "hidden";
        }
      }
    }
}