String.prototype.trim = function() {
temp = this;
while ((escape(temp).indexOf('%u2018') > -1) || (escape(temp).indexOf('%u2019') > -1))
   { 
   temp = escape(temp).replace('%u2018', '%27').replace('%u2019', '%27');
   temp = unescape(temp);
   }
return temp.replace(/^\s*/,"").replace(/\s*$/,"").replace("’","'").replace("–","-")
}

function MM_swapImgRestore() { 
  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_preloadImages() { 
  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 MM_findObj(n, d) { 
  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]; 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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { 
  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) {  
  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();
}
MM_reloadPage(true);

function MM_showHideLayers() { 
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function OuvrirBanqueImage(noBanqueDImage, noBanqueDImageAvecCategorie, langue)
   {
   WindowBanqueImage = open(adresseScripts + 'banqueDImagesPop' + langue + '.cfm?noBanqueDImage=' + noBanqueDImage + '&noBanqueDImageAvecCategorie=' + noBanqueDImageAvecCategorie, 'FenetreBanqueImage', 'scrollbars=no,status=yes,menubar=no,locationbar=no,directories=no,resizable=no,statusbar=no,toolbar=no,' +  StringGrandeur(730,362));
   WindowBanqueImage.focus();	
   }
   
function OuvrirFenetre(page, largeur, hauteur, scrollBars)
   {
   if (typeof(scrollBars) == 'undefined')
      scrollBars = true;
   if (scrollBars)
      WindowFenetre = open(page, 'WindowFenetre', 'resizable=no,scrollbars=yes,status=yes,menubar=no,' + StringGrandeur(largeur,hauteur));
   else
      WindowFenetre = open(page, 'WindowFenetre', 'resizable=no,scrollbars=no,status=yes,menubar=no,' + StringGrandeur(largeur,hauteur));
   WindowFenetre.focus();
   }

function OuvrirEnvoyerAUnAmi(langue)
   {
   EnvoyerAmi = open('', 'EnvoyerAmi', 'resizable=no,scrollbars=yes,status=no,menubar=no,' + StringGrandeur(477,495));
   document.DonneesImprimer.action = adresseScripts + 'demandeDEnvoyerAUnAmi' + langue + '.cfm';
   document.DonneesImprimer.target = 'EnvoyerAmi';
   document.DonneesImprimer.submit();
   }   

function OuvrirEvaluerCettePage(langue)
   {
   EnvoyerAmi = open('', 'EvaluerCettePage', 'resizable=no,scrollbars=yes,status=no,menubar=no,' + StringGrandeur(555,285));
   document.DonneesImprimer.action = adresseScripts + 'demandeDEvaluerCettePage' + langue + '.cfm';
   document.DonneesImprimer.target = 'EvaluerCettePage';
   document.DonneesImprimer.submit();
   }  
   
function StringGrandeur (width, height)
   {
   var string = 'width=' + width + ',height=' + height + ',left=' + ((screen.width - width) / 2) + ',top=' + ((screen.height - height) / 2) + ',screenX=' + ((screen.width - width) / 2) + ',screenY=' + ((screen.height - height) / 2);
   return string;
   }

function ValiderCourriel(valeur, langue)
   {
   var stringErreur = '';
   var nAccepte = 'abcdefghijklmnopqrstuvwxyz0123456789-_.@';
   var nChar;
   valeur = valeur.toLowerCase();
   valeur = valeur.trim();  
   var indexOfArobas     = valeur.indexOf('@');
   var indexOf2Arobas    = valeur.lastIndexOf('@');
   var lastIndexOfPoint  = valeur.lastIndexOf('.');
   var indexOf2Point     = valeur.indexOf('..');
   var valeurLength      = valeur.length;		
   var indexOfEspace     = valeur.indexOf(' ');   
   
   if (indexOfEspace     != -1)
      if (langue == '_ang')
	  	  stringErreur = 'Your e-mail must not contain any spaces.';   
      else
	  	  stringErreur = 'Votre courriel doit pas contenir d\'espace.';   
   if (indexOfArobas     < 0)
      if (langue == '_ang')
	  	  stringErreur = 'Your e-mail must contain an @ character.';   
      else
	  	  stringErreur = 'Votre courriel doit contenir un arobas (@).';
   if (indexOfArobas     == 0)
      if (langue == '_ang')
	  	  stringErreur = 'Your e-mail must have at least one character in front of the @ character.';   
      else
	  	  stringErreur = 'Votre courriel doit avoir un minimum d\'un caractère avant l\'arobas (@).';		  
   if (lastIndexOfPoint     < (indexOfArobas + 1))
      if (langue == '_ang')
	  	  stringErreur = 'Your e-mail must contain at least one dot (.) after the @ character.';   
      else
	  	  stringErreur = 'Votre courriel doit contenir au moins un point (.) après l\'arobas (@).';
   if (lastIndexOfPoint     == valeurLength-1)
      if (langue == '_ang')
	  	  stringErreur = 'Your e-mail must not end with a dot (.).';   
      else
	  	  stringErreur = 'Votre courriel ne peut se terminer par un point (.).';		  
   if (indexOf2Arobas       != indexOfArobas)
      if (langue == '_ang')
	  	  stringErreur = 'Your e-mail must only have one @ character.';   
      else
	  	  stringErreur = 'Votre courriel doit contenir seulement un arobas (@).';	  
   if (indexOf2Point       != -1)
      if (langue == '_ang')
	  	  stringErreur = 'Your e-mail cannot have two dots (..) in a row.';   
      else
	  	  stringErreur = 'Votre courriel ne peut pas contenir 2 points de suite (..).';
   if (stringErreur == '')
      {       
      for (var i=0; i<valeur.length; i++)
         {
         nChar = '' + valeur.substring(i, i+1).toLowerCase();
         if (nAccepte.indexOf(nChar) == -1){		
                if (langue == '_ang')
                   stringErreur = 'Your e-mail contains the (' + valeur.substring(i, i+1) + ') which is not a valid character for an e-mail.';   
                else
                   stringErreur = 'Votre courriel contient le caractère (' + valeur.substring(i, i+1) + ') qui n\'est pas un caractère valide dans un courriel.';
				i = valeur.length;
			}
         }  
      }
   if (stringErreur == '')
      return true;   	
   else
   	  {
      if (langue == '_ang')
         alert(stringErreur + '\nHere is an example of a valid e-mail: name@domain.com');
      else
         alert(stringErreur + '\nVoici l\'exemple d\'un courriel valide : nom@domaine.com');
	    return false;	  
	  }      
   }

function DivExpanderDate(modeAVerifier) {
	  
  if (!modeAVerifier)
  { 
     TableauDateArrivee2.style.visibility = 'hidden'; 
     TableauDateArrivee2.style.display = 'none'; 
  }
  else
  { 
    TableauDateArrivee2.style.visibility = 'visible'; 
    TableauDateArrivee2.style.display = 'block';
  }
}   

var timeoutIDMenuLayer = 0;
var afficherMenu = '';
function AfficherMenuLayer(id)
   {
   afficherMenu = id;
   CacherMenuLayer();
   var d = document.getElementById(id);
   if (d) 
      d.style.display = 'block';
   }
function CacherMenuLayer(p_temps)
   {
   if (typeof(p_temps) == 'undefined')
      {
      for (var i = 1; i<=10; i++)
         {
         if ((document.getElementById('smenu'+i)) && (afficherMenu != ('smenu' + i)))
            {
            document.getElementById('smenu'+i).style.display = 'none';
            }
         }
      clearTimeout(timeoutIDMenuLayer);
      timeoutIDMenuLayer = 0;
      afficherMenu = '';
      }
   else if (timeoutIDMenuLayer == 0)
      {
      timeoutIDMenuLayer = setTimeout("CacherMenuLayer();", p_temps);
      }
   }

function TraiterErreur()
   {
   WindowAvertissement = open('http://www.numerique.ca/scripts/Publique/templateErrorJavascript.cfm?nomPage=' + document.location, 'ErreurJS', 'scrollbars=no,status=no,' + StringGrandeur(400,150));
   return true;
   }
   
function ValiderNewsletter()
   { 
   if (!ValiderCourriel(document.DonneesNewsletter.courriel.value, '') || (document.DonneesNewsletter.courriel.value == 'nom@domaine.com'))
      {
      document.DonneesNewsletter.courriel.focus();
      return false;
      }
   return true;
   }   

function ChangerPhoto(image){
  for(var i=1;i<4;i++){
   if(i != image){
    eval('document.getElementById("image'+i+'").style.visibility="hidden"');
    eval('document.getElementById("image'+i+'").style.display="none"');
    eval('document.getElementById("imageP'+i+'").className="imageBordurePale"');
   }else{
    eval('document.getElementById("image'+i+'").style.visibility="visible"');
    eval('document.getElementById("image'+i+'").style.display="block"');
    eval('document.getElementById("imageP'+i+'").className="imageBordure"'); 
   }
  }
}

 function Antispam(tableau1, tableau2, subject){
   var courriel = ""; 
   var texte    = "";
   for (i=0;i<tableau1.length;i++)
     courriel+=String.fromCharCode(tableau1[i])
   if (typeof(tableau2) != 'undefined'){
       if (tableau2.length > 0){
           for (i=0;i<tableau2.length;i++)
             texte+=String.fromCharCode(tableau2[i])
	   }
	   else
	      texte = courriel;
   }			  
   else
   	  texte = courriel;
   if (typeof(tableau2) == 'undefined')
       subject = "";
	   
   tableauTexte = texte.split("@");
   if (tableauTexte.length == 2){
   	  texte = tableauTexte[0] + '<span style="display:none;">REMOVE-THIS-FORM-SPAM</span>&#64;' + tableauTexte[1];
   }   
   document.write('<a href="mailto:a" onclick="this.href = AntiSpamClic(Array(' + tableau1 + '),\'' + subject + '\');">' + texte + '</a>');   
 }
 function AntiSpamClic(tableau1, subject){ 
   var courriel = ""; 
   for (i=0;i<tableau1.length;i++)
     courriel+=String.fromCharCode(tableau1[i]);
   if (subject.length > 0)
   	  courriel+= '?subject=' + subject;
   return 'mai' + 'lto:' + courriel; 
 }
   
   /*
function Antispam(tableau1, tableau2, subject){   
var courriel = "";    
var texte    = "";   
for (i=0;i<tableau1.length;i++)     
	courriel+=String.fromCharCode(tableau1[i])   
	if (typeof(tableau2) != 'undefined'){       
	   if (tableau2.length > 0){           
	   	  for (i=0;i<tableau2.length;i++)             
		  	  texte+=String.fromCharCode(tableau2[i])	   
		  }else
		      texte = courriel;
		  }
	   else   	  
	      texte = courriel;   
		  if (typeof(tableau2) == 'undefined')      
		  	  subject = "";	      
		  tableauTexte = texte.split("@");   
		  if (tableauTexte.length == 2){   	  
		  	 texte = tableauTexte[0] + '<span style="display:none;">REMOVE-THIS-FOR-SPAM</span>&#64;' + tableauTexte[1];   
	   }      
	   document.write('<a href="mailto:a" onclick="this.href = AntiSpamClic(Array(' + tableau1 + '),\'' + subject + '\');">' + texte + '</a>');    
}

function AntiSpamClic(tableau1, subject){    
		 var courriel = "";    
		 for (i=0;i<tableau1.length;i++)     
		 	 courriel+=String.fromCharCode(tableau1[i]);   
		 if (subject.length > 0)   	  
		 		 courriel+= '?subject=' + subject;   
		 return 'mai' + 'lto:' + courriel;  
}     
      */
   
//window.onerror = TraiterErreur;
