menuCloser              = null;

currentChildpopup       = "";

currentParentpopupX      = "";

currentImageMenuParent  = "";

maxlevels               = 16;

currentParentText       = 0;

menuLevels              = new Array("","","","","","","","","","","","","","","","");

parentText              = new Array("","","","","","","","","","","","","","","","");

menuIsActive = false;

loaded = false;

xTimes=1;

comboYearsInfo = "1996-3000";

comboPagesInfo = "61000,65000,";

comboPageId    = "14002,14003,14005,";

// JAG - End variables declaration...

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 menuLoadImage() {

	MM_preloadImages(

	'/cgi/media/bt1_company_1_e.gif',

	'/cgi/media/bt1_industries_1_e.gif',

	'/cgi/media/bt1_sevice_1_e.gif',

	'/cgi/media/bt1_investors_1_e.gif',

	'/cgi/media/bt1_careers_1_e.gif',

	'/cgi/media/bt1_news_1_e.gif',

	'/cgi/media/bt1_library_1_e.gif',

	'/cgi/media/bt1_tools_1_e.gif',

        '/cgi/media/bt0_home_1_e.gif',

        '/cgi/media/bt0_contact_1_e.gif',

        '/cgi/media/bt0_langu_1_f.gif',

        '/cgi/media/bt0_go_1_e.gif');

}

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) && (activeParent != 'null')) {

		switchImage(activeParent,IMG_ON);

	}

	if (activeItem != null) {

		switchImage(activeItem,IMG_ON);

	}

}

 function setJSPVars(langJS,strFlashV,strPageId,usrFlash,xactiveMenuLayer,xactiveItem,xactiveParent,strImgOn,mainJspId,nDocCateg,nDocLevel) {

        pageId          = strPageId;

        flashVersion    = strFlashV;

        userFlashChoice = usrFlash;

				activeMenuLayer	= xactiveMenuLayer;

				currentpopup 	= xactiveMenuLayer;

				activeItem      = xactiveItem;

				activepopup 	= xactiveMenuLayer;

				activeParent 	= xactiveParent;

        mainPagePath    = mainJspId;



       if (nDocCateg != null) {

          docCateg = nDocCateg;

        }



        if ((strImgOn != null) && (strImgOn != "null")) {

          switchImage(strImgOn,IMG_ON);

          imgAlwaysOn = strImgOn;

        }



	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

  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);

    disposeFlashBox(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);

//        disposeFlashBox(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";

		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,null);

        }

}*/

function checkmenu(strMenu) {

  if (menuIsActive) {

    return;

  }

  menuCloser = null;

  closeCurrents(strMenu,false);

  disposeComboBox(true,null);

//  disposeFlashBox(true,null);

}

function closePopup(strMenu,itemId,bgColor,childPopup,isFloat) {

  menuIsActive = false;

  if (menuCloser == null) {

    menuCloser = setTimeout("checkmenu('" + strMenu + "')",1000);

  }

}

function tocItem(name,nMenuParent,strMenuLayer,popupMenu,fileExtension,imgRealName,noAddPrefix,keepHighLight) {

  this.name = name;

  this.isImageItem = (imgRealName != null);

  this.keepHighLight = keepHighLight;

  this.menuParent = nMenuParent;

  this.parentLayer = strMenuLayer;

  this.popupChild = popupMenu;

  this.visible = false;

  if (this.isImageItem) {

    if ((noAddPrefix == null) || (!noAddPrefix)) {

      this.on = imgLangPreSufix + imgRealName + imgLangPostSufixOn + fileExtension;

      this.off = imgLangPreSufix + imgRealName + imgLangPostSufixOff + fileExtension;

    }

    else {

      this.on = imgLangPreSufix + imgRealName + "_1" + fileExtension;

      this.off = imgLangPreSufix + imgRealName + "_0" + fileExtension;

    }

  }

}

function toc_new(name,nMenuParent,strMenuLayer,popupMenu,fileExtension,imgRealName,noAddPrefix,keepHighLight) {

  if ((fileExtension != null) && (fileExtension != "") && (fileExtension != "null")) {

    if (fileExtension.indexOf(".") == -1) {

      fileExtension = "." + fileExtension;

    }

  }

  tocItem[name] = new tocItem(name,nMenuParent,strMenuLayer,popupMenu,fileExtension,imgRealName,noAddPrefix,keepHighLight);

}

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 linkToSpeech(objSelected) {

	var langURL = "/web/en/news_events/speeches_and_webcasts/";

	if (window.location.href.toLowerCase().indexOf("/fr/") > -1) {

		langURL = "/web/fr/nouvelles/discours_webdiffusions/";

	}

  if (objSelected != null) {

    //getNewURL(objSelected.options[objSelected.selectedIndex].value);

    //window.location.href = langURL + objSelected.options[objSelected.selectedIndex].text + "/p1.htm";
	window.location.href = langURL + objSelected.options[objSelected.selectedIndex].value + "/p1.htm";

  }

}

function linkToNewsArticles(objSelected) {

	var langURL = "/web/en/selected_media_articles/";

	if (window.location.href.toLowerCase().indexOf("/fr/") > -1) {

		langURL = "/web/fr/articles_presse_choisis/";

	}

  if (objSelected != null) {

    //getNewURL(objSelected.options[objSelected.selectedIndex].value);

    //window.location.href = langURL + objSelected.options[objSelected.selectedIndex].text + "/p1.htm";
	window.location.href = langURL + objSelected.options[objSelected.selectedIndex].value + "/p1.htm";

  }

}

function changeLang(strCurLang,strNextLang) {



  toHREF = window.location.href;

  if ((toHREF.indexOf("MainPage") > -1) && (toHREF.indexOf("Params=") == -1)) {

    toHREF = "MainPage.jsp?Params=" + flashVersion + "." + strNextLang + "." + pageId + "." + userFlashChoice;

  } else {

	 	var frRegs 	= new Array(/Params=(N|Y)\.CA\./i, /\/fr\//i, /langue=fr/i);

		var frTo 		= new Array("Params=$1.CA.", "/fr/", "langue=fr");



		var enRegs 	= new Array(/Params=(N|Y)\.US\./i, /\/en\//i, /langue=en/i);

		var enTo 		= new Array("Params=$1.US.", "/en/", "langue=en");



	  toHREF = window.location.href;



		var from 	= ((strCurLang=="CA")?frRegs:enRegs);

		var to 		= ((strCurLang=="CA")?enTo:frTo);



		for (var i = 0; i < from.length; i++) {

			toHREF = toHREF.replace(from[i], to[i]);

		}

 }



  window.location.href = toHREF;

}

function validateComboInfo() {

  if ((!comboYearsInfo) || (!comboPagesInfo)) {

    return false;

  }

  var nPos = comboYearsInfo.indexOf("-");

  var nBottomYear = parseInt(comboYearsInfo.substring(0,nPos));

  var nTopYear = parseInt(comboYearsInfo.substring(nPos + 1));

//  return ((comboPagesInfo.indexOf(pageId + ",") > -1) && ((docCateg>=nBottomYear) && (docCateg<=nTopYear)));
  return false;
}

function validateComboId() {
  if (!comboPageId) {
    return false;
  }
  return (comboPageId.indexOf(pageId + ",") > -1);
}

function disposeComboBox(bOnOff,xMenu,parentMenu) {

    strUrl = window.location.pathname;

    strHref = window.location.href;

    if (validateComboInfo()) {

      if ((xMenu == null) && (bOnOff)) {

        bHideCombo = true;

      }

      else {

        bHideCombo = (strHideComboOnMenu.indexOf(xMenu) == -1) ? false : true;

      }

      itemCombo = null;

    }

    else if (validateComboId()) {
        if ((xMenu == null) && (bOnOff)) {
          bHideCombo = true;
        } else {
          bHideCombo = (strHideComboOnMenu.indexOf(xMenu) == -1) ? false : true;
        }
    }
    else {
    	bHideCombo = false;
    }

//    	if ((location.pathname.indexOf("/en/usa.htm") > -1) || (location.pathname.indexOf("/fr/etats-unis.htm") > -1)) {
//	    if ((comboPageId.indexOf(pageId + ",") > -1)) {
//    		bHideCombo = true;
//    	} 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 disposeFlashBox(bOnOff,xMenu) {

    strUrl = window.location.pathname;

    strHref = window.location.href;

    if (((strHref.indexOf("/en/home.htm") > -1 ) || (strHref.indexOf("/fr/accueil.htm") > -1 ) || strUrl.length <= 1) && 

        (navigator.appVersion.indexOf("MSIE") == -1) && (navigator.appVersion.indexOf("Mac") == -1)) {

	      if ((xMenu == null) && (bOnOff)) {

	        bHideCombo = true;

	      }

	      else {

	        bHideCombo = (strHideComboOnMenu.indexOf(xMenu) == -1) ? false : true;

	      }

	      itemFlash = null;



	    if (NS6 && bHideCombo) {

	      itemFlash = document.getElementById("flashBox");

	      if (itemFlash == null) {

	        return;

	      }

	      itemFlash.style.visibility = bOnOff ? "visible" : "hidden";

	    }

	    else {

	      if (NS4 && bHideCombo) {

	          itemFlash = eval("document.layers.flashBox");

	          if (itemFlash == null) {

	            return;

	          }

	          itemFlash.visibility = bOnOff ? "visible" : "hide";

	      }

	      else {

	        if (bHideCombo) {

	          itemFlash = eval("flashBox");

	          if (itemFlash == null) {

	            return;

	          }

	          itemFlash.style.visibility = bOnOff ? "visible" : "hidden";

	        }

	      }

	    }

	  }

}



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) {

    if (pageId == null || strPageId == null) {

        pageId = "0";

    }

    if (flashVersion == null) {

        flashVersion = "Y";

    }

    if (userFlashChoice == null) {

        userFlashChoice = "0";

    }

    if ((bNewWindow == null) || (!bNewWindow)) {

        window.location.href = fixURL + "?Params=" + flashVersion + "." + realLangue + "." + pageId + "." + userFlashChoice;

    }

    else {

        document.open(  fixURL + "?Params=" + flashVersion + "." + realLangue + "." + pageId + "." + userFlashChoice,

                        "","toolbar=yes,menubar=yes,scrollbars=yes,location=yes,status=yes,width=750,height=500,resizable=yes,top=0,left=0");

    }

}

function getNewURL(strPageId,bNewWindow,strLangParam,xParameters,paramPlugCateg) {

	bPlugCategory = true;

	if ((paramPlugCateg != null) && (!paramPlugCateg)) {

		bPlugCategory = false;

	}

    strNewPageId  = strPageId;

    strLangToUse  = realLangue;

    strInk        = "";

    strXParameter = "";

    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 ((xParameters != null) && (xParameters != "") && (xParameters != "null")) {

      strXParameter = xParameters;

    }

    else {

      if (bPlugCategory) {

      	if ((pageId != null) && ((docCategToSearch.indexOf(pageId.substring(0,3)) > -1) && (docCateg == 0))) {

      	  strTemp = strPageId.substring(0,2) + "0";

      	  bIsDocOrCateg = ((docCategToSearch.indexOf(strTemp) > -1) || (docTypeToSearch.indexOf(strTemp) > -1));

      	  strTemp = pageId.substring(0,2) + "0";

      	  bPageIsCateg  = ((docCategToSearch.indexOf(strTemp) > -1) || (docTypeToSearch.indexOf(strTemp) > -1));

      	  if (bIsDocOrCateg) {

      	    strXParameter = "&categ=" + pageId.substring(0,3);

      	  }

      	}

      	else {

      	  if (docTypeToSearch.indexOf(strPageId.substring(0,2)) > -1) {

      	    if (docCateg == 0) {

      	      strXParameter = "&categ=" + strPageId.substring(0,2) + "0";

      	    }

      	    else {

      	      strXParameter = "&categ=" + docCateg;

      	    }

      	  }

      	}

      }

    }

    if ((bNewWindow == null) || (!bNewWindow)) {

        window.location.href = mainPagePath + flashVersion + "." + strLangToUse + "." + strNewPageId + "." + userFlashChoice + strInk + strXParameter;

    }

    else {

        document.open(  mainPagePath + flashVersion + "." + strLangToUse + "." + strNewPageId + "." + userFlashChoice + strInk + strXParameter,

                        "","toolbar=yes,menubar=yes,scrollbars=yes,location=yes,status=yes,width=750,height=500,resizable=yes,top=0,left=0");

    }

}



function forwardTo(strFixUrl,strPageId,bNewWindow) {

    strNewPageId = strPageId;

    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 ((bNewWindow == null) || (!bNewWindow)) {

        window.location.href = strFixUrl + mainPagePath + flashVersion + "." + realLangue + "." + strNewPageId + "." + userFlashChoice + strInk;

    }

    else {

        window.open(  strFixUrl + mainPagePath + flashVersion + "." + realLangue + "." + strNewPageId + "." + userFlashChoice + strInk,

                        "","toolbar=yes,menubar=yes,scrollbars=yes,location=yes,status=yes,width=750,height=500,resizable=yes,top=0,left=0");

    }

}

function linkToPressReleases(objSelected) {

  if (objSelected != null) {

    //getNewURL("61000",null,null,"&categ=" + objSelected.options[objSelected.selectedIndex].value);

    if (window.location.href.toLowerCase().indexOf("/fr/") > -1) {

    	window.location.href= "/web/fr/nouvelles/communiques/" + objSelected.options[objSelected.selectedIndex].value + "/p1.htm"; 

    } else {

    	window.location.href= "/web/en/news_events/press_releases/" + objSelected.options[objSelected.selectedIndex].value + "/p1.htm"; 

    }	

  }

}

function linkToNewsFlash(objSelected) {

  if (objSelected != null) {

    //getNewURL("65000",null,null,"&categ=" + objSelected.options[objSelected.selectedIndex].value);

    if (window.location.href.toLowerCase().indexOf("/fr/") > -1) {

    	window.location.href= "/web/fr/nouvelles/nouvelles-eclair/" + objSelected.options[objSelected.selectedIndex].value + "/p1.htm"; 

    } else {

    	window.location.href= "/web/en/news_events/news_flashes/" + objSelected.options[objSelected.selectedIndex].value + "/p1.htm"; 

    }	

  }

}

// NEW FUNCTIONS SECTION

function checkMenuMO(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);

        disposeComboBox(true,null);

//        disposeFlashBox(true,null);

        openPopup(tocItem[strMenu].popupChild);

        tocItem[strMenu].visible = true;

        registerMenus(strMenu,tocItem[strMenu].popupChild,true,false,false);

      }

    }

    else {

      closeCurrents(null,true);

    }

  }

}

function checkMenuMOUT(strMenu) {

  clearTimeout(menuCloser);

  menuIsActive = false;

  if (tocItem[strMenu].visible) {

    menuCloser = setTimeout("checkmenu('"+ strMenu +"')",1000);

  }

  else {

    switchImage(strMenu,IMG_OFF);

  }

}

function openPopup(strMenu,itemId,hLiteColor,childPopup,isFloat,menuParent) {

  if (isParentText(strMenu) && currentChildpopup != childPopup) {

    closeCurrents(null,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;

    if ((childPopup == "CGITopNav12C") || (childPopup == "CGITopNav12A")) {

      disposeComboBox(false,"CGITopNav16");

      disposeFlashBox(false,"CGITopNav16");

    }

    else {

      disposeComboBox(true,null);

//      disposeFlashBox(true,null);

    }

    currentParentpopupX = strMenu;

  }

  else {

    if ((currentChildpopup != "CGITopNav12C") && (currentChildpopup != "CGITopNav12A")) {

      disposeComboBox(true,null);

//      disposeFlashBox(true,null);

    }

    if ((strMenu != currentChildpopup) && (menuParent != currentChildpopup)) {

      closeXPopup(currentChildpopup);

      currentChildpopup = "";

      disposeComboBox(true,null);

//      disposeFlashBox(true,null);

    }

  }

  registerMenus(strMenu,childPopup,false,false,false);

  disposeComboBox(false,strMenu);

  disposeFlashBox(false,strMenu);

}

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 != null) && (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);

}

function closePopup(strMenu,itemId,bgColor,childPopup,isFloat) {

  menuIsActive = false;

  if (menuCloser == null) {

    menuCloser = setTimeout("checkmenu('" + strMenu + "')",1000);

  }

}

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);

    }

  }

  disposeComboBox(true,null);

  disposeFlashBox(true,null);

}

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;

      }

    }

  }

  for (x=0;x<maxlevels;x++) {

    if (menuLevels[x] != "") {

//      alert(menuLevels[x]);

    }

  }

}

function findMenuLevel(strMenu) {

  for(x=0;x<maxlevels;x++) {

    tmp = menuLevels[x];

//    if (tmp != "") alert(tmp.substring(4));

    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;

}

function initValues() {

  if (NS4) {

    document.captureEvents(Event.MOUSEUP);

  }

  document.onmouseup = mouseUp;

}

function mouseUp(e) {

  closeCurrents(null,true);

  disposeComboBox(true,null);

  disposeFlashBox(true,null);

  return true;

}

function linkMiddlePage(strUrl) {

  window.location.href = strUrl;

}

function dummy() {

  return;

}



function onload_loc() {

  if (top.frames.length!=0) {

    if (window.location.href.replace)

      top.location.replace(self.location.href);

    else

      top.location.href=self.document.href;

  }

}



if (top.frames.length!=0) {

  var portailDNS = new Array("portaltest.ent.cgi.ca", "portal.ent.cgi.ca", "portail.ent.cgi.ca", "portal.ent.cginet", "portail.ent.cginet");

  var topFramesUrl = document.referrer;

  var findPortail = false;

  for (i = 0; i < (portailDNS.length); i++) {

  	if (topFramesUrl.indexOf(portailDNS[i]) > -1) {

  		findPortail = true;

  		break;

  	}

  }

  

  if (findPortail) {

    window.document.onload = onload_loc();

  }

}


