var re_date = /^\d{1,2}\-\d{1,2}\-\d{4}$/;
var tempo = new Array();
var max_mois = new Array();
for (n=1;n<100;n++)
   {
   if (n==4 || n==6 || n==9 || n==11)
      max_mois[n] = 30;
   else
      max_mois[n] = 31;
   }

function valideDate(dateSaisie)
   {
   t_date = re_date.test(dateSaisie);

   if (t_date)
      t_date = t_date && analyse(dateSaisie,1,2,3);

   return t_date;
   }

function analyse(quoi,p_jour,p_mois,p_an)
   {
   tempo = quoi.split('-')
   jour = eval(tempo[(p_jour-1)]);
   mois = eval(tempo[(p_mois-1)]);
   an = eval(tempo[(p_an-1)]);

   if (bisx(an))
      max_mois[2] = 29;
   else
      max_mois[2] = 28;

   t_tempo = (jour<=max_mois[mois] && mois<=12 && mois>=1 && jour>=1);

   return t_tempo;
   }

function bisx(quoi)
   {
   if ((quoi % 100 == 0) && (quoi % 400 == 0))
      return true;
   else if ((quoi % 4) == 0)
      return true;

   return false;
   }

function DateAdd(startDate, numDays, numMonths, numYears)
   {
   var returnDate = new Date(startDate.getTime());
   var yearsToAdd = numYears;
   var month = returnDate.getMonth()	+ numMonths;
   if (month > 11)
      {
      yearsToAdd = Math.floor((month+1)/12);
      month -= 12*yearsToAdd;
      yearsToAdd += numYears;
      }
   returnDate.setMonth(month);
   returnDate.setFullYear(returnDate.getFullYear()	+ yearsToAdd);
   returnDate.setTime(returnDate.getTime()+60000*60*24*numDays);
   return returnDate;
   }

function YearAdd(startDate, numYears)
   {
   return DateAdd(startDate,0,0,numYears);
   }

function MonthAdd(startDate, numMonths)
   {
   return DateAdd(startDate,0,numMonths,0);
   }

function DayAdd(startDate, numDays)
   {
   return DateAdd(startDate,numDays,0,0);
   }

function DateDiff(date1, date2)
   {
   diff = new Date();
   diff.setTime(Math.abs(date1.getTime() - date2.getTime()));
   timediff = diff.getTime();
   days = Math.floor(timediff / (1000 * 60 * 60 * 24)); 
   timediff -= days * (1000 * 60 * 60 * 24);
   return days;	
   }	

function PopulerJours(mois, jour, annee)
   {
   var vieuxJourSelectionne = jour.selectedIndex;
   
   nbOptions = jour.length;
   for (i=0; i < nbOptions; i++)
      jour[0] = null;

   var nbJours = 0;
   
   switch (mois)
      {
	  case '01' :
	     nbJours = 31;
	     break; 
	  case '02' :
		 if ((annee % 4) == 0)
			if (((annee % 100) == 0) && ((annee % 400) == 0))
			   nbJours = 29;
			else 
			   if ((annee % 100) == 0)
			      nbJours = 28;
			   else
			      nbJours = 29;
		 else
			nbJours = 28;
	     break; 
	  case '03' :
	     nbJours = 31;
	     break; 
	  case '04' :
	     nbJours = 30;
	     break; 
	  case '05' :
	     nbJours = 31;
	     break; 
	  case '06' :
	     nbJours = 30;
	     break; 
	  case '07' :
	     nbJours = 31;
	     break; 
	  case '08' :
	     nbJours = 31;
	     break; 
	  case '09' :
	     nbJours = 30;
	     break; 
	  case '10' :
	     nbJours = 31;
	     break; 
	  case '11' :
	     nbJours = 30;
	     break; 
	  case '12' :
	     nbJours = 31;
	     break; 
	  default : 
         nbJours = 31;
	     break;
      }
	  
   var i = 1;
   while (i <= nbJours)
      {
      if (i < 10)
         nouvelleOption = new Option('0' + i, '0' + i);
      else
         nouvelleOption = new Option(i, i);

      jour.options[(i - 1)] = nouvelleOption;
	  i++;
	  }
   
   if (vieuxJourSelectionne >= jour.length)
      jour[(jour.length - 1)].selected = true;
   else 
      jour[vieuxJourSelectionne].selected = true;
   }

function OuvrirTelechargement(langue)
   {
   WindowTelechargement = open('fenetreTelechargement'+langue+'.cfm', 'Telechargement', 'scrollbars=no,statusbar=no,menubar=no,' + StringGrandeur(423,230));
   }
   
function NumberFormat(num)
{
this.COMMA = ',';
this.PERIOD = '.';
this.DASH = '-'; 
this.LEFT_PAREN = '('; 
this.RIGHT_PAREN = ')'; 
this.LEFT_OUTSIDE = 0; 
this.LEFT_INSIDE = 1;  
this.RIGHT_INSIDE = 2;  
this.RIGHT_OUTSIDE = 3;  
this.LEFT_DASH = 0; 
this.RIGHT_DASH = 1; 
this.PARENTHESIS = 2; 
this.num;
this.numOriginal;
this.hasSeparators = false;  
this.separatorValue;  
this.inputDecimalValue; 
this.decimalValue;  
this.negativeFormat; 
this.negativeRed; 
this.hasCurrency;  
this.currencyPosition;  
this.currencyValue;  
this.places;
this.setNumber = setNumberNF;
this.toUnformatted = toUnformattedNF;
this.setInputDecimal = setInputDecimalNF; 
this.setSeparators = setSeparatorsNF; 
this.setCommas = setCommasNF;
this.setNegativeFormat = setNegativeFormatNF; 
this.setNegativeRed = setNegativeRedNF; 
this.setCurrency = setCurrencyNF;
this.setCurrencyPrefix = setCurrencyPrefixNF;
this.setCurrencyValue = setCurrencyValueNF; 
this.setCurrencyPosition = setCurrencyPositionNF; 
this.setPlaces = setPlacesNF;
this.toFormatted = toFormattedNF;
this.toPercentage = toPercentageNF;
this.getOriginal = getOriginalNF;
this.getRounded = getRoundedNF;
this.preserveZeros = preserveZerosNF;
this.justNumber = justNumberNF;
this.setInputDecimal(this.PERIOD); 
this.setNumber(num); 
this.setCommas(true);
this.setNegativeFormat(this.LEFT_DASH); 
this.setNegativeRed(false); 
this.setCurrency(true);
this.setCurrencyPrefix('$');
this.setPlaces(2);
}
function setInputDecimalNF(val)
{
this.inputDecimalValue = val;
}
function setNumberNF(num)
{
this.numOriginal = num;
this.num = this.justNumber(num);
}
function toUnformattedNF()
{
return (this.num);
}
function getOriginalNF()
{
return (this.numOriginal);
}
function setNegativeFormatNF(format)
{
this.negativeFormat = format;
}
function setNegativeRedNF(isRed)
{
this.negativeRed = isRed;
}
function setSeparatorsNF(isC, separator, decimal)
{
this.hasSeparators = isC;
if (separator == null) separator = this.COMMA;
if (decimal == null) decimal = this.PERIOD;
if (separator == decimal)
{
this.decimalValue = (decimal == this.PERIOD) ? this.COMMA : this.PERIOD;
}
else
{
this.decimalValue = decimal;
}
this.separatorValue = separator;
}
function setCommasNF(isC)
{
this.setSeparators(isC, this.COMMA, this.PERIOD);
}
function setCurrencyNF(isC)
{
this.hasCurrency = isC;
}
function setCurrencyValueNF(val)
{
this.currencyValue = val;
}
function setCurrencyPrefixNF(cp)
{
this.setCurrencyValue(cp);
this.setCurrencyPosition(this.LEFT_OUTSIDE);
}
function setCurrencyPositionNF(cp)
{
this.currencyPosition = cp
}
function setPlacesNF(p)
{
this.places = p;
}
function toFormattedNF()
{
var pos;
var nNum = this.num; 
var nStr;            
var splitString = new Array(2);   
nNum = this.getRounded(nNum);
nStr = this.preserveZeros(Math.abs(nNum)); 
if (nStr.indexOf(this.PERIOD) == -1)
{
splitString[0] = nStr;
splitString[1] = '';
}
else
{
splitString = nStr.split(this.PERIOD, 2);
}
if (this.hasSeparators)
{
pos = splitString[0].length;
while (pos > 0)
{
pos -= 3;
if (pos <= 0) break;
splitString[0] = splitString[0].substring(0,pos)
+ this.separatorValue
+ splitString[0].substring(pos, splitString[0].length);
}
}
if (splitString[1].length > 0)
{
nStr = splitString[0] + this.decimalValue + splitString[1];
}
else
{
nStr = splitString[0];
}
var c0 = '';
var n0 = '';
var c1 = '';
var n1 = '';
var n2 = '';
var c2 = '';
var n3 = '';
var c3 = '';
var negSignL = (this.negativeFormat == this.PARENTHESIS) ? this.LEFT_PAREN : this.DASH;
var negSignR = (this.negativeFormat == this.PARENTHESIS) ? this.RIGHT_PAREN : this.DASH;
if (this.currencyPosition == this.LEFT_OUTSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n2 = negSignR;
}
if (this.hasCurrency) c0 = this.currencyValue;
}
else if (this.currencyPosition == this.LEFT_INSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n3 = negSignR;
}
if (this.hasCurrency) c1 = this.currencyValue;
}
else if (this.currencyPosition == this.RIGHT_INSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n3 = negSignR;
}
if (this.hasCurrency) c2 = this.currencyValue;
}
else if (this.currencyPosition == this.RIGHT_OUTSIDE)
{
if (nNum < 0)
{
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n2 = negSignR;
}
if (this.hasCurrency) c3 = this.currencyValue;
}
nStr = c0 + n0 + c1 + n1 + nStr + n2 + c2 + n3 + c3;
if (this.negativeRed && nNum < 0)
{
nStr = '<font color="red">' + nStr + '</font>';
}
return (nStr);
}
function toPercentageNF()
{
nNum = this.num * 100;
nNum = this.getRounded(nNum);
return nNum + '%';
}
function getRoundedNF(val)
{
var factor;
var i;
factor = 1;
for (i=0; i<this.places; i++)
{	factor *= 10; }
val *= factor;
val = Math.round(val);
val /= factor;
return (val);
}
function preserveZerosNF(val)
{
var i;
val = val + '';
if (this.places <= 0) return val; 
var decimalPos = val.indexOf('.');
if (decimalPos == -1)
{
val += '.';
for (i=0; i<this.places; i++)
{
val += '0';
}
}
else
{
var actualDecimals = (val.length - 1) - decimalPos;
var difference = this.places - actualDecimals;
for (i=0; i<difference; i++)
{
val += '0';
}
}
return val;
}
function justNumberNF(val)
{
val = (val==null) ? 0 : val;
var newVal = val + ""; 
var isPercentage = false;
var isFormattedNeg = false;
if (newVal.indexOf('%') != -1)
{
newVal = newVal.replace(/\%/g, '');
isPercentage = true;
}
if (newVal.indexOf(this.DASH) != -1
|| (newVal.indexOf(this.LEFT_PAREN) != -1 && newVal.indexOf(this.RIGHT_PAREN) != -1))
{
newVal = newVal.replace(/[\-\(\)]/g, '');
isFormattedNeg = true;
}
if (this.inputDecimalValue != this.PERIOD)
{
newVal = newVal.replace(/\./g, '');
}
var itrDecimal;
var tempVal = '';
var foundDecimal = false;
for (itrDecimal=0; itrDecimal<newVal.length; itrDecimal++)
{
if (newVal.charAt(itrDecimal) == this.inputDecimalValue)
{
if (foundDecimal)
{
}
else
{
tempVal = tempVal + this.PERIOD;
foundDecimal = true;
}
}
else
{
tempVal = tempVal + newVal.charAt(itrDecimal);
}
}
newVal = tempVal;
if (isFormattedNeg) newVal = '-' + newVal;
if (isNaN(newVal))
{
newVal = parseFloat(newVal.replace(/[^\d\.\-]/g, ''));
newVal = (isNaN(newVal) ? 0 : newVal); 
}
else if (!isFinite(newVal))
{
newVal = 0;
}
if (isPercentage)
{
newVal = newVal / 100;
}
return newVal;
}   

var nf = new NumberFormat(0);
nf.setCurrencyPrefix('');	   
   
function SetMaxChar(champ, max, langue)
   {
   if (champ.value.length > max)
      {
      champ.value = champ.value.substring(0,max);
      if (langue == "_ang")
         alert("Your message has exceeded the maximum length for sending a page and has been automatically truncated to "+max+" characters.");
      else
         alert("Votre message dépasse le nombre de caractères permis et a été réduit à "+max+" caractères."); 
      }
   }

function convertirHTML(texte)
{	
	texte = texte.replace(/&quot;/g,'\"');	// 34 22
	texte = texte.replace(/&amp;/g,'&');	// 38 26
	texte = texte.replace(/&#39;/g,'\'');	// 39 27
	texte = texte.replace(/&lt;/g,'<');		// 60 3C
	texte = texte.replace(/&gt;/g,'>');		// 62 3E
	texte = texte.replace(/&circ;/g,'^');	// 94 5E
	texte = texte.replace(/&lsquo;/g,'‘');	// 145 91
	texte = texte.replace(/&rsquo;/g,'’');	// 146 92
	texte = texte.replace(/&ldquo;/g,'“');	// 147 93
	texte = texte.replace(/&rdquo;/g,'”');	// 148 94
	texte = texte.replace(/&bull;/g,'•');	// 149 95
	texte = texte.replace(/&ndash;/g,'–');	// 150 96
	texte = texte.replace(/&mdash;/g,'—');	// 151 97
	texte = texte.replace(/&tilde;/g,'˜');	// 152 98
	texte = texte.replace(/&trade;/g,'™');	// 153 99
	texte = texte.replace(/&scaron;/g,'š');	// 154 9A
	texte = texte.replace(/&rsaquo;/g,'›');	// 155 9B
	texte = texte.replace(/&oelig;/g,'œ');	// 156 9C
	texte = texte.replace(/&#357;/g,'');	// 157 9D
	texte = texte.replace(/&#382;/g,'ž');	// 158 9E
	texte = texte.replace(/&Yuml;/g,'Ÿ');	// 159 9F
	texte = texte.replace(/&nbsp;/g,' ');	// 160 A0 
	texte = texte.replace(/&iexcl;/g,'¡');	// 161 A1
	texte = texte.replace(/&cent;/g,'¢');	// 162 A2
	texte = texte.replace(/&pound;/g,'£');	// 163 A3
	texte = texte.replace(/&curren;/g,'¤');	// 164 A4
	texte = texte.replace(/&yen;/g,'¥');	// 165 A5
	texte = texte.replace(/&brvbar;/g,'¦');	// 166 A6
	texte = texte.replace(/&sect;/g,'§');	// 167 A7
	texte = texte.replace(/&uml;/g,'¨');	// 168 A8
	texte = texte.replace(/&copy;/g,'©');	// 169 A9
	texte = texte.replace(/&ordf;/g,'ª');	// 170 AA
	texte = texte.replace(/&laquo;/g,'«');	// 171 AB
	texte = texte.replace(/&not;/g,'¬');	// 172 AC
	texte = texte.replace(/&shy;/g,'­');	// 173 AD
	texte = texte.replace(/&reg;/g,'®');	// 174 AE
	texte = texte.replace(/&macr;/g,'¯');	// 175 AF
	texte = texte.replace(/&deg;/g,'°');	// 176 B0
	texte = texte.replace(/&plusmn;/g,'‘');	// 177 B1
	texte = texte.replace(/&sup2;/g,'²');	// 178 B2
	texte = texte.replace(/&sup3;/g,'³');	// 179 B3
	texte = texte.replace(/&acute;/g,'´');	// 180 B4
	texte = texte.replace(/&micro;/g,'µ');	// 181 B5
	texte = texte.replace(/&para/g,'¶');	// 182 B6
	texte = texte.replace(/&middot;/g,'·');	// 183 B7
	texte = texte.replace(/&cedil;/g,'¸');	// 184 B8
	texte = texte.replace(/&sup1;/g,'¹');	// 185 B9
	texte = texte.replace(/&ordm;/g,'º');	// 186 BA
	texte = texte.replace(/&raquo;/g,'»');	// 187 BB
	texte = texte.replace(/&frac14;/g,'¼');	// 188 BC
	texte = texte.replace(/&frac12;/g,'½');	// 189 BD
	texte = texte.replace(/&frac34;/g,'¾');	// 190 BE
	texte = texte.replace(/&iquest;/g,'¿');	// 191 BF
	texte = texte.replace(/&Agrave;/g,'À');	// 192 C0
	texte = texte.replace(/&Aacute;/g,'Á');	// 193 C1
	texte = texte.replace(/&Acirc;/g,'Â');	// 194 C2
	texte = texte.replace(/&Atilde;/g,'Ã');	// 195 C3
	texte = texte.replace(/&Auml;/g,'Ä');	// 196 C4
	texte = texte.replace(/&Aring;/g,'Å');	// 197 C5
	texte = texte.replace(/&AElig;/g,'Æ');	// 198 C6
	texte = texte.replace(/&Ccedil;/g,'Ç');	// 199 C7
	texte = texte.replace(/&Egrave;/g,'È');	// 200 C8
	texte = texte.replace(/&Eacute;/g,'É');	// 201 C9
	texte = texte.replace(/&Ecirc;/g,'Ê');	// 202 CA
	texte = texte.replace(/&Euml;/g,'Ë');	// 203 CB
	texte = texte.replace(/&Igrave;/g,'Ì');	// 204 CC
	texte = texte.replace(/&Iacute;/g,'Í');	// 205 CD
	texte = texte.replace(/&Icirc;/g,'Î');	// 206 CE
	texte = texte.replace(/&Iuml;/g,'Ï');	// 207 CF
	texte = texte.replace(/&ETH;/g,'Ð');	// 208 D0
	texte = texte.replace(/&Ntilde;/g,'Ñ');	// 209 D1
	texte = texte.replace(/&Ograve;/g,'Ò');	// 210 D2
	texte = texte.replace(/&Oacute;/g,'Ó');	// 211 D3
	texte = texte.replace(/&Ocirc;/g,'Ô');	// 212 D4
	texte = texte.replace(/&Otilde;/g,'Õ');	// 213 D5
	texte = texte.replace(/&Ouml;/g,'Ö');	// 214 D6
	texte = texte.replace(/&times;/g,'×');	// 215 D7
	texte = texte.replace(/&Oslash;/g,'Ø');	// 216 D8
	texte = texte.replace(/&Ugrave;/g,'Ù');	// 217 D9
	texte = texte.replace(/&Uacute;/g,'Ú');	// 218 DA
	texte = texte.replace(/&Ucirc;/g,'Û');	// 219 DB
	texte = texte.replace(/&Uuml;/g,'Ü');	// 220 DC
	texte = texte.replace(/&Yacute;/g,'Ý');	// 221 DD
	texte = texte.replace(/&THORN;/g,'Þ');	// 222 DE
	texte = texte.replace(/&szlig;/g,'ß');	// 223 DF
	texte = texte.replace(/&aacute;/g,'à');	// 224 E0
	texte = texte.replace(/&aacute;/g,'á');	// 225 E1
	texte = texte.replace(/&acirc;/g,'â');	// 226 E2
	texte = texte.replace(/&atilde;/g,'ã');	// 227 E3
	texte = texte.replace(/&auml;/g,'ä');	// 228 E4
	texte = texte.replace(/&aring;/g,'å');	// 229 E5
	texte = texte.replace(/&aelig;/g,'æ');	// 230 E6
	texte = texte.replace(/&ccedil;/g,'ç');	// 231 E7
	texte = texte.replace(/&egrave;/g,'è');	// 232 E8
	texte = texte.replace(/&eacute;/g,'é');	// 233 E9
	texte = texte.replace(/&ecirc;/g,'ê');	// 234 EA
	texte = texte.replace(/&euml;/g,'ë');	// 235 EB
	texte = texte.replace(/&igrave;/g,'ì');	// 236 EC
	texte = texte.replace(/&iacute;/g,'í');	// 237 ED
	texte = texte.replace(/&icirc;/g,'î');	// 238 EE
	texte = texte.replace(/&iuml;/g,'ï');	// 239 EF
	texte = texte.replace(/&eth;/g,'ð');	// 240 F0
	texte = texte.replace(/&ntilde;/g,'ñ');	// 241 F1
	texte = texte.replace(/&ograve;/g,'ò');	// 242 F2
	texte = texte.replace(/&oacute;/g,'ó');	// 243 F3
	texte = texte.replace(/&ocirc;/g,'ô');	// 244 F4
	texte = texte.replace(/&otilde;/g,'õ');	// 245 F5
	texte = texte.replace(/&ouml;/g,'ö');	// 246 F6
	texte = texte.replace(/&divide;/g,'÷');	// 247 F7
	texte = texte.replace(/&oslash;/g,'ø');	// 248 F8
	texte = texte.replace(/&ugrave;/g,'ù');	// 249 F9
	texte = texte.replace(/&uacute;/g,'ú');	// 250 FA
	texte = texte.replace(/&ucirc;/g,'û');	// 251 FB
	texte = texte.replace(/&uuml;/g,'ü');	// 252 FC
	texte = texte.replace(/&yacute;/g,'ý');	// 253 FD
	texte = texte.replace(/&thorn;/g,'þ');	// 254 FE
	texte = texte.replace(/&yuml;/g,'ÿ');	// 255 FF
	return texte;
}
   
   
function InitialisationFormulaire(p_formulaire)
   {
   formulaireAUtiliser = eval(p_formulaire);
   // On vérifie si on doit enlever les classes erreurs qu'il y a eu...
   for(var h=0; h < formulaireAUtiliser.elements.length; h++)
      {
      if(formulaireAUtiliser.elements[h].className.indexOf("erreur") != -1)
         {
		 var classe = formulaireAUtiliser.elements[h].className;
         var classeAvantErreur = classe.substring(7);
         formulaireAUtiliser.elements[h].className = classeAvantErreur;
         }
      }
   }
function ViderArray(arrayAVider)
   {
   nbOptions = arrayAVider.length;
   for (i=0; i < nbOptions; i++)
      arrayAVider[0] = null;
   }

//Prototype pour fonction indexOf   
if (!Array.prototype.indexOf) {
	Array.prototype.indexOf = function(val, fromIndex) {
		if (typeof(fromIndex) != 'number') fromIndex = 0;
		for (var index = fromIndex,len = this.length; index < len; index++)
			if (this[index] == val) return index;
		return -1;
	}
}
function ArrayFind(p_tableauAChercher, valeurAChercher)
   {
   for (indexArray = 0; indexArray < p_tableauAChercher.length; indexArray++)
      if (p_tableauAChercher[indexArray].nomDuChamps == valeurAChercher)
         {
         return indexArray;
         }
   return -1;
   }  

function ValiderChampsObligatoires(p_formulaire,p_listeChamps)
   {
   ViderArray(tableauErreurObligatoire);
   ViderArray(tableauErreurOptionnel);
   texteErreur = "";

   for (i = 0; i < p_listeChamps.length; i++)
      {
      if (p_listeChamps[i].obligatoire)
         {
         switch (p_listeChamps[i].typeDeChamp)
            {
            case 'texte' : 
               eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.trim();
               if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.length == 0)
                  {
                  tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
                  } 
               break;
            case 'texteAutre' : 
               eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.trim();
               if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.length == 0)
                  {
                  tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
                  } 
               break;
            case 'memo' : 
               eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.trim();
               if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.length == 0)
                  {
                  tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
                  } 
               break;
            case 'select' : 
               if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '.selectedIndex]').value.length == 0)
                  {
                  tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
                  } 
               break;
            case 'radio' : 
               cocheQuelqueChose = false;
               for (indexRadio = 0; indexRadio < eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length; indexRadio++)
                  {
                  if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexRadio + '].checked') == true)
                     {
                     cocheQuelqueChose = true;
                     break;
                     }
                  }
               if(!cocheQuelqueChose)
                  {
                  tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
                  }
               break;
            case 'checkbox' : 
               if (typeof(eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length) == 'undefined')
                  {
                  if (!eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).checked)
                     {
                     tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
                     }
                  }
               else
                  {
                  cocheQuelqueChose = false;
                  for (indexCheckbox = 0; indexCheckbox < eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length; indexCheckbox++)
                     {
                     if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexCheckbox + ']').checked)
                        {
                        cocheQuelqueChose = true;
                        break;
                        }
                     }
                  if(!cocheQuelqueChose)
                     {
                     tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
                     }
                  }
               break;
            case 'consoleWord' : 
               tempMCEControl = tinyMCE.getInstanceById(p_listeChamps[i].nomDuChamp);
               if ((tempMCEControl) && (tempMCEControl.getBody().innerHTML == ''))
                  {
                  tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
                  } 
               break;
            case 'fichier' : 
               if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.length == 0)
                  {
                  tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
                  }
               break;
            case 'image' : 
               if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.length == 0)
                  {
                  tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
                  }
               break;
            case 'div' : 
               if (eval(p_listeChamps[i].nomDuChamp).innerHTML == '')
                  {
                  tableauErreurObligatoire[tableauErreurObligatoire.length] = p_listeChamps[i];
                  }
               break;
            default : 
               break;
            }
         }
      }
   }
   
function AfficherErreur(p_formulaire, p_tableauErreurObligatoire, p_tableauErreurOptionnel, p_langue)
   {
   var objEstEnvoye = eval(p_formulaire + '.estEnvoye')
   var texteErreur = "";
   var champsFocus = "";
   var lblAUtiliser = "";
   
   // Création des messages d'erreur et affichage
   if(p_tableauErreurObligatoire.length > 0)
      if (p_langue.indexOf('ang') == -1)
         texteErreur = "Les champs suivants sont obligatoires :\n\n";
      else
         texteErreur = "The following fields are required:\n\n";
		 
    
   if(p_tableauErreurObligatoire.length != 0)
      {
      for(var k=0; k < p_tableauErreurObligatoire.length; k++)
         {	   	 
         lblAUtiliser = document.getElementById('lbl_' + p_tableauErreurObligatoire[k].nomDuChamp).innerHTML;	   
         // Validation pour tous les types de champs
         switch (p_tableauErreurObligatoire[k].typeDeChamp)
            {
            case 'radio' : 
			   if(lblAUtiliser.indexOf(" :") == -1){
			     texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length) + "\n";
			   }else{
			     texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2) + "\n";
			   }
               position = 0;
               while (typeof(eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp + '[' + position + ']')) != 'undefined')
                  {
                  obj = eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp + '[' + position + ']');
                  var classe = obj.className; 
                  obj.className = "erreur " + classe;
                  position += 1;
                  }
               break;
            case 'checkbox' : 
			   if(lblAUtiliser.indexOf(" :") == -1){
			     texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length) + "\n";
			   }else{
			     texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2) + "\n";
			   }
               position = 0;
               while (typeof(eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp + '[' + position + ']')) != 'undefined')
                  {
                  obj = eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp + '[' + position + ']');
                  var classe = obj.className; 
                  obj.className = "erreur " + classe;
                  position += 1;
                  }
               break;			   
            case 'consoleWord' : 
               texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2) + "\n";
               tempMCEControl = tinyMCE.getInstanceById(p_tableauErreurObligatoire[k].nomDuChamp);
               if (tempMCEControl)
                  {
                  if(champsFocus == "")
                     champsFocus = tempMCEControl.contentWindow;
                  obj = tempMCEControl.getBody();
                  var classe = obj.className; 
				  if(obj.className.indexOf("erreur") == -1) 
                     obj.className = "erreur " + classe;
                  }
               break;
            default :                
			   if(champsFocus == "")
                  champsFocus = eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp);
               texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2) + "\n";
               obj = eval(p_formulaire + '.' + p_tableauErreurObligatoire[k].nomDuChamp);
               var classe = obj.className;
			   if(obj.className.indexOf("erreur") == -1)
                  obj.className = "erreur " + classe;
               break;
            }
         }
      }
   
   if(p_tableauErreurOptionnel.length > 0)
      if (p_langue.indexOf('ang') == -1)
         texteErreur += "\nLe(s) champ(s) suivant(s) comporte(nt) des erreurs :\n\n";
      else
         texteErreur += "\nThe following field(s) contain invalid data:\n\n";
   
   for(var m=0; m < p_tableauErreurOptionnel.length; m++)
      {
      var sectionGauche = p_tableauErreurOptionnel[m].substring(0,p_tableauErreurOptionnel[m].indexOf(' :\n'));	 
      //Validation pour les champs qui sont pas des champs autres...
      if(sectionGauche.indexOf('Autre') == -1)
         {	 
         if(champsFocus == "")
            {
            champsFocus = eval(p_formulaire + '.' + sectionGauche);
            }  	 
         lblAUtiliser = document.getElementById('lbl_' + sectionGauche).innerHTML;
         texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2);	   
         }
      //Validation pour les champs autres, car ils n'ont pas de label
      else
         {
         lblAUtiliser = document.getElementById('lbl_' + sectionGauche.substring(0, sectionGauche.length - 5)).innerHTML;
         texteErreur += lblAUtiliser.substring(0,lblAUtiliser.length - 2);
         if(champsFocus == "")
            champsFocus = eval(p_formulaire + '.' + sectionGauche); 
         }
      texteErreur +=  p_tableauErreurOptionnel[m].substring(p_tableauErreurOptionnel[m].indexOf(':'),p_tableauErreurOptionnel[m].length) + "\n\n";
      obj = eval(p_formulaire + '.' + sectionGauche);   
      var Classe = obj.className; 
	  if(obj.className.indexOf("erreur") == -1)
         obj.className = "erreur " + Classe;
	  
	  /*Enlever car une erreur survient lorsque champs radio non obligatoire... 
	  pas trouvé la raison pourquoi on l'avait là en premier lieu
      if(p_tableauErreurObligatoire.length == 0 && m == 0)
         obj.focus();*/
		 
      }      
   if(texteErreur != "")
      {
      alert(texteErreur);
      if(champsFocus != "")
         {
//         window.setTimeout(eval(champsFocus + '.focus();'), 100);
         if (typeof(champsFocus[0]) == 'undefined')
            champsFocus.focus();
         else 
            champsFocus[0].focus();
         }
      return true;
      }

   objEstEnvoye.value = 1;
   return false;
   }

function AfficherFormulaire(p_formulaire,p_listeChamps) 
   {
   for (i = 0; i < p_listeChamps.length; i++)
      {
      // On set les labels obligatoires...
      lblAUtiliser = document.getElementById('lbl_' + p_listeChamps[i].nomDuChamp);
      if ((lblAUtiliser) && (p_listeChamps[i].obligatoire))
         {
         lblAUtiliser.className = lblAUtiliser.className + ' obl';
         }
      // On set les valeurs par défaut...
      switch (p_listeChamps[i].typeDeChamp)
         {
         case 'texte' : 
            eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = p_listeChamps[i].valeurParDefaut;
            break;
         case 'radio' : 
            for (indexRadio = 0; indexRadio < eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length; indexRadio++)
               {
               if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexRadio + '].value') == p_listeChamps[i].valeurParDefaut)
                  {
                  eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexRadio + ']').checked = true;
                  }
               }
            break;
         case 'checkbox' : 
            if (typeof(eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length) == 'undefined')
               {
               eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).checked = p_listeChamps[i].valeurParDefaut;
               }
            else
               {
               for (indexCheckbox = 0; indexCheckbox < eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length; indexCheckbox++)
                  {
                  if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexCheckbox + ']').value == p_listeChamps[i].valeurParDefaut)
                     {
                     eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexCheckbox + ']').checked = true;
                     }
                  }
               }
            break;
         case 'select' : 
            for (indexSelect = 0; indexSelect < eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).length; indexSelect++)
               {
               if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexSelect + ']').value == p_listeChamps[i].valeurParDefaut)
                  {
                  eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp + '[' + indexSelect + ']').selected = true;
                  }
               }
            break;
         case 'memo' : 
            eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = p_listeChamps[i].valeurParDefaut;
            break;
         case 'consoleWord' : 
            eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = p_listeChamps[i].valeurParDefaut;
            break;
         case 'fichier' : 
            eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = p_listeChamps[i].valeurParDefaut;
            if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.length > 0)
               {
               eval('document.' + p_listeChamps[i].nomDuChamp + '_AX').nomDuFichier = 'garderFichier';
               eval('document.' + p_listeChamps[i].nomDuChamp + '_AX').garderFichier = true;
               eval('document.' + p_listeChamps[i].nomDuChamp + '_AX').height = 40;
               }
            else
               {
               eval('document.' + p_listeChamps[i].nomDuChamp + '_AX').nomDuFichier = '';
               eval('document.' + p_listeChamps[i].nomDuChamp + '_AX').garderFichier = false;
               eval('document.' + p_listeChamps[i].nomDuChamp + '_AX').height = 23;
               }
            break;
         case 'image' : 
            eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value = p_listeChamps[i].valeurParDefaut;
            if (eval(p_formulaire + '.' + p_listeChamps[i].nomDuChamp).value.length > 0)
               {
               eval('document.' + p_listeChamps[i].nomDuChamp + '_AX').nomDuFichier = 'garderFichier';
               eval('document.' + p_listeChamps[i].nomDuChamp + '_AX').garderFichier = true;
               eval('document.' + p_listeChamps[i].nomDuChamp + '_AX').height = 40;
               eval('document[\'' + p_listeChamps[i].nomDuChamp + 'Preview\']').src = adresseSiteInternet + 'FichiersUpload/' + dossierFichiers + '/' + valeurChamps;
               }
            else
               {
               eval('document.' + p_listeChamps[i].nomDuChamp + '_AX').nomDuFichier = '';
               eval('document.' + p_listeChamps[i].nomDuChamp + '_AX').garderFichier = false;
               eval('document.' + p_listeChamps[i].nomDuChamp + '_AX').height = 23;
               eval('document[\'' + p_listeChamps[i].nomDuChamp + 'Preview\']').src = adresseSiteInternet + 'Formulaires/transparent.gif';
               }
            break;
         case 'div' : 
            eval(p_listeChamps[i].nomDuChamp).innerHTML = p_listeChamps[i].valeurParDefaut;
            break;
         default : 
            break;
         }
      }
   // On affiche le formulaire vu qu'il est caché...
   eval(p_formulaire).style.visibility = 'visible'; 
   eval(p_formulaire).style.display    = 'block';
   }
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')
         return (stringErreur + '\nHere is an example of a valid e-mail: name@domain.com');
      else
         return (stringErreur + '\nVoici l\'exemple d\'un courriel valide : nom@domaine.com');
      }      
   }

//Valider Code Postal
function ValiderCodePostal(valeur,pays,langue)
{
 if(valeur != ""){
  if(pays == "Canada"){
   valeur = valeur.replace(' ','');
   valeur = valeur.replace('-','');    
   valeur = valeur.toUpperCase();
   var oRegExp = /^[^DFIOQUWZ0-9][0-9][^DFIOQU0-9][0-9][^DFIOQU0-9][0-9]$/;
   if (!oRegExp.test(valeur)){
    if(langue == '_ang'){
      return "You must enter a valid postal code (X9X 9X9)";
    }else{
      return "Veuillez entrer un code postal valide (X9X 9X9)";
    }	   	   
   }else if(pays == "United States"){
    if(langue == '_ang'){
      var msgErreur = "You must enter a valid zip code (99999)";
	}else{
	  var msgErreur = "Veuillez entrer un code postal valide (99999)";
	}
    zipcode = valeur.replace(' ','');
    if (!(zipcode.length == 5 || zipcode.length == 9 || zipcode.length == 10)) return msgErreur;
    if ((zipcode.length == 5 || zipcode.length == 9) && isNaN(zipcode)) return msgErreur;
    if (zipcode.length == 10 && zipcode.search && zipcode.search(/^\d{5}-\d{4}$/) == -1) return msgErreur;
   }  
  }
 } 
 return true;
}
   

function structureChamps(p_typeDeChamp, p_nomDuChamp, p_valeurParDefaut, p_obligatoire) 
   {
   this.typeDeChamp = p_typeDeChamp;
   this.nomDuChamp = p_nomDuChamp;
   this.valeurParDefaut = p_valeurParDefaut;
   this.obligatoire = p_obligatoire;
   }
   
function ActiverCalendar(p_nomChamps)
 {
  obj1 = document.getElementById('date' + p_nomChamps + 'Precise');
  obj2 = document.getElementById('f_dateJour_Donnees_' + p_nomChamps);
  obj3 = document.getElementById('f_dateMois_Donnees_' + p_nomChamps);
  obj4 = document.getElementById('f_dateAnnee_Donnees_' + p_nomChamps);
  obj5 = document.getElementById('f_trigger_Donnees_' + p_nomChamps);            
  
  if(obj1.checked == false){	  
	obj2.disabled = '';
	obj3.disabled = '';
	obj4.disabled = '';
	obj5.style.display = 'inline';			
		
  }
  else{
	obj2.disabled = 'disabled';
	obj3.disabled = 'disabled';
	obj4.disabled = 'disabled';
	obj5.style.display = 'none';			
  }	
 }

   