String.prototype.trim = function() {
temp = escape(this);
while ((temp.indexOf('%BB') > -1) || (temp.indexOf('%AB') > -1) || (temp.indexOf('%u2018') > -1) || (temp.indexOf('%u2019') > -1))
   { 
   temp = temp.replace(/%BB/, "'");
   temp = temp.replace(/%AB/, "'");
   temp = temp.replace(/%u2018/, "'");
   temp = temp.replace(/%u2019/, "'");
   }
temp = unescape(temp); 
return temp.replace(/^\s*/,"").replace(/\s*$/,"").replace("’","'").replace("–","-");
}


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,379));
   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(adresseScripts + 'demandeDEnvoyerAUnAmi' + langue + '.cfm?nomPagePourImprimer=' + window.location, 'EnvoyerAmi', 'resizable=no,scrollbars=yes,status=no,menubar=no,' + StringGrandeur(580,565));
   }   
   
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 OuvrirGoogleMaps(p_parametres)
   {
   if (typeof(p_parametres) == 'undefined')
      {
      }
   return Lightbox.show(adresseScripts + p_parametres, '', 'width=780, height=620');
   }

function changerOngletVisible(groupeOnglet,position)
  	{
    for(var i=0;i<eval(groupeOnglet+'.length');i++)
        {
    	if(i+1 != position)
    	    {
			$('a##'+eval(groupeOnglet+'['+(i)+'][0]')).removeClass('selected');
			$('div##'+eval(groupeOnglet+'['+(i)+'][1]')).addClass('cache');
    	    }
    		else
    		{
    		$('a##'+eval(groupeOnglet+'['+(i)+'][0]')).addClass('selected');
			$('div##'+eval(groupeOnglet+'['+(i)+'][1]')).removeClass('cache');
    		}
        }
	$("img.lazy").lazyload();
    }


//window.onerror = TraiterErreur;

