// Search

function topSearch(){
  topSearchClear();
  document.topSearch.submit();
}
function topSearch1(){
  document.topSearch1.submit();
}

function topSearchClear() {
  if ((document.topSearch.searchQ.value == 'Search') || (document.topSearch.searchQ.value == 'Recherche')) {
    document.topSearch.searchQ.value = '';
  }
}
function topSearchFillEn() {
  if (document.topSearch.searchQ.value == '') {
    document.topSearch.searchQ.value = 'Search';
  }
}
function topSearchFillFr() {
  if (document.topSearch.searchQ.value == '') {
    document.topSearch.searchQ.value = 'Recherche';
  }
}

function brokenImage(imageObj) {
  imageObj.src = "../../images/pix/pix_trans.gif";
  return true;
}


//////////////////////////////////////////////////////
//change le url dans les pulldown avec onchange
function ChangeURL(newurl) {
    self.location.href=newurl;
}

function webcastWindow(url) {
  var subWin = null;
  var ScreenWidth = screen.width;
  if(ScreenWidth < 900){
    subWin=window.open(url,'event','scrollbars=yes,height=580,width=800');
  }else{
    subWin=window.open(url,'event','scrollbars=yes,height=680,width=800');
  }
}

if (document.images) {

    imgbullet_on = new Image();
    imgbullet_on.src = "../../images/b_bullet_on.gif";
    imgbullet_off = new Image();
    imgbullet_off.src = "../../images/b_bullet_off.gif";

    imagelion = new Image();
    imagelion.src = "../../images/pastille_li_open.gif";
    imagelioff = new Image();
    imagelioff.src = "../../images/pastille_li_off.gif";

    imgdownload_on = new Image();
    imgdownload_on.src = "../../images/b_download_doc_on.gif";
    imgdownload_off = new Image();
    imgdownload_off.src = "../../images/b_download_doc_off.gif";

    imgquotation_on = new Image();
    imgquotation_on.src = "../../images/quotationmark_on.gif";
    imgquotation_off = new Image();
    imgquotation_off.src = "../../images/quotationmark_off.gif";


}
function changeImages() {
    if (document.images) {
        for (var i=0; i<changeImages.arguments.length; i+=2) {
        document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
        }
    }
}

//////////////////////////////////////////////////////
// message go out of bce web site.
function goOut(lang)
{
        var areyousure='Undefined';

        if(lang=='fr')
          areyousure = 'Vous quittez maintenant le Site Web de BCE. Une nouvelle fenêtre s\'ouvrira. Vous n\'aurez qu\'à la fermer lorsque vous désirerez revenir.';
    else
          areyousure = 'You are now leaving the BCE Website. A new window will open. Close the window when you wish to return.';

        return confirm(areyousure);
}

function disclaimer(lang)
{
    var message='Undefined';

        if(lang=='fr')
          message = 'Le document suivant a été reformaté pour mieux s\'afficher à l’écran. Consultez la version PDF si vous désirez voir la version officielle. Je reconnais que le document HTML peut être différent de la version officielle.';
    else
          message = 'The following document has been reformatted to best suit its presentation on the screen. Please see the PDF version of this document if you wish to view its official version. I recognize that the HTML document may be different from the official version.';

        return confirm(message);
}

function pdfreport(lang,nbmessage)
{
  var message = "";
  if(nbmessage == "1"){
    if(lang=='fr'){
          message = 'La notice d\'offre est en révision. Veuillez noter que le Régime de réinvestissement des dividendes est administré par la Société de fiducie Computershare du Canada et toute correspondance/requêtes doivent leur être acheminées.';
    }else{
          message = 'The Offering Circular is under review. Please note that the Dividend Reinvestment Plan is administered by Computershare Trust Company of Canada and all correspondence/inquiries should be directed to Computershare.';
    }
  }else if(nbmessage=="2"){
    if(lang=='fr'){
          message = 'Le prospectus est en révision. Veuillez noter que le Régime de réinvestissement des dividendes est administré par la Société de fiducie Computershare du Canada et toute correspondance/requêtes doivent leur être acheminées.';
    }else{
          message = 'The Prospectus is under review. Please note that the Dividend Reinvestment Plan is administered by Computershare Trust Company of Canada and all correspondence/inquiries should be directed to Computershare.';
    }
  }else if(nbmessage=="3"){
    if(lang=='fr'){
          message = 'La formule d\'inscription est en révision. Veuillez noter que le Régime de réinvestissement des dividendes est administré par la Société de fiducie Computershare du Canada et toute correspondance/requêtes doivent leur être acheminées.';
    }else{
          message = 'The enrollment form is under review. Please note that the Dividend Reinvestment Plan is administered by Computershare Trust Company of Canada and all correspondence/inquiries should be directed to Computershare.';
    }
  }
        
        return confirm(message);
}

// dynamique popup.php

/*function popUp(adresse,w_name,w_width,w_height,showLocation,showToolbar,showStatus,showMenuBar,showDirectories,showCopyHistory,showScrollBars,showResizable){
window.open(adresse,(showLocation==null?'window_name':w_name),"location="+(showLocation==true?'yes':'no')+",toolbar="+(showToolbar==true?'yes':'no')+",status="+(showStatus==true?'yes':'no')+",menubar="+(showMenuBar==true?'yes':'no')+",directories="+(showDirectories==true?'yes':'no')+",copyhistory="+(showCopyHistory==true?'yes':'no')+",scrollbars="+((showScrollBars==true)?'yes':(showScrollBars=='auto')?'auto':'no')+",resizable="+(showResizable==true?'yes':'no')+",width="+w_width+",height="+w_height+"");
}*/
function popUp(adresse,w_name,w_width,w_height,showLocation,showToolbar,showStatus,showMenuBar,showDirectories,showCopyHistory,showScrollBars,showResizable){
window.open(adresse,(showLocation==null?'window_name':w_name),"location="+(showLocation==true?'yes':'no')+",toolbar="+(showToolbar==true?'yes':'no')+",status="+(showStatus==true?'yes':'no')+",menubar="+(showMenuBar==true?'yes':'no')+",directories="+(showDirectories==true?'yes':'no')+",copyhistory="+(showCopyHistory==true?'yes':'no')+",scrollbars=yes,resizable="+(showResizable==true?'yes':'no')+",width="+w_width+",height="+w_height);
}

// FEATURE BOX
var DHTML = (document.getElementById || document.all );

// PAS TOUCHE!!
function getObj(name)
{
  if (document.getElementById)
  {
    this.obj = document.getElementById(name);
    this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
    this.obj = document.all[name];
    this.style = document.all[name].style;
  }
  else if (document.layers)
  {
    this.obj = document.layers[name];
    this.style = document.layers[name];
  }
}

/////////////////////////////=========================

///Rodrigo -- Dynamique feature at home page
function changeDynamoHome(h01)
{
    if (!DHTML) return;
    var x = new getObj(h01);
    x.style.color = "#626E90";
    x.style.textDecoration = "underline";
}

function restoreDynamoHome(h01)
{
    if (!DHTML) return;
    var x = new getObj(h01);
    x.style.color = "#626E90";
    x.style.textDecoration = "none";
}


/////////////////////////////=========================


function changeFeatureCol(col)
{
    if (!DHTML) return;
    var x = new getObj(col);
    x.style.color = "#626E90";
        x.style.textDecoration = "underline";
}
function restoreFeatureCol(col)
{
    if (!DHTML) return;
    var x = new getObj(col);
    x.style.color = "#626E90";
    x.style.textDecoration = "none";
}
function changeFeatureColQuickLink(col)
{
    if (!DHTML) return;
    var x = new getObj(col);
    x.style.color = "#000000";
        x.style.textDecoration = "underline";
}
function restoreFeatureColQuickLink(col)
{
    if (!DHTML) return;
    var x = new getObj(col);
    x.style.color = "#003366";
    x.style.textDecoration = "underline";
}

//Preload images function. 09-01-2004

var myimages=new Array()
function preloadimages(){
  for (i=0;i<preloadimages.arguments.length;i++){
    myimages[i]=new Image()
    myimages[i].src=preloadimages.arguments[i]
//  document.write("toto: " + preloadimages.arguments[i] +"<br>");
  }
}

// Open a link from a popup to the page directly under. (See Responsibility section environnement/footprint)
function getLink(url){
	this.opener.location = url;
	//this.close();
}

/////////////////////////////=========================
//This function opens/clses the regions
    function TransformRegion(obold, odiv, ohidden) {
        HideAllOtherRegions(odiv);
        if(ohidden.value == 'True') {
            odiv.style.display = 'none';
            ohidden.value = "False";
            //obold.style.font = 'normal lighter 7.5pt Verdana';
            obold.style.fontWeight = 'normal';
            obold.style.color = '#403e2b';
        } else {
            odiv.style.display = 'block';
            ohidden.value = "True";
      //obold.style.font = 'normal bolder 7.5pt Verdana';
            obold.style.fontWeight = 'bolder';
            obold.style.color = '#403e2b';
        }
    }
    //http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/font.asp
    //http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/fontweight.asp
    //This function makes sure that by default all regions are closed. If a Div id is passed, that item will be left opened by default..
    function InitRegion() {
        for(i=1;i<999;i++) {
            if (window.document.getElementById('HiddenField'+i)) {
                HidField = window.document.getElementById('HiddenField'+i);
                DivRegion = window.document.getElementById('Div'+i);

                if(HidField.value == 'True') {
                    DivRegion.style.display = 'none';
                    HidField.value = "False";
                }
            } else {
                break; // We reach this point when we cannot find any other elements to initialize..
            }
        }
    }

    //This function closes all regions
    function HideAllOtherRegions(odiv) {
    var ActiveDivId = odiv.id.substring(3);
        for(i=1;i<999;i++) {
            if (i!=ActiveDivId) {
        if (window.document.getElementById('HiddenField'+i)) {
          HidField = window.document.getElementById('HiddenField'+i);
          DivRegion = window.document.getElementById('Div'+i);
          BoldRegion = window.document.getElementById('bold'+i);
  
          if(HidField.value == 'True') {
            DivRegion.style.display = 'none';
            HidField.value = "False";
            //BoldRegion.style.font = 'normal lighter 7.5pt Verdana';
            BoldRegion.style.fontWeight = 'normal';
            BoldRegion.style.color = '#403e2b';
          }
        } else {
          break; // We reach this point when we cannot find any other elements to close..
        }
      }
        }
    }
	
	
/////////////////////////////=========================
//LUB Special Dynamic Menu
	
function toggle(id){
    ul = "ul_" + id;
	li = id;
    img = "img_" + id;
    ulElement = document.getElementById(ul);
	liElement = document.getElementById(li);
    imgElement = document.getElementById(img);
    if (ulElement){
            if (ulElement.className == 'closed'){
                    ulElement.className = "open";
					liElement.className = "lub_active";
                    imgElement.src = "../../images/dot_menu_open.gif";
					
                    }else{
                    ulElement.className = "closed";
					liElement.className = "lub_off";
                    imgElement.src = "../../images/dot_menu.gif";
                    }
            }
    }
	


