<!--
// Calendrier





function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}
function checkDate(myDayStr,myMonthStr,myYearStr) {
 
months=new Array;
months['01']='Jan';
months['02']='Feb';
months['03']='Mar';
months['04']='Apr';
months['05']='May';
months['06']='Jun';
months['07']='Jul';
months['08']='Aug';
months['09']='Sep';
months['10']='Oct';
months['11']='Nov';
months['12']='Dec';
if(months[myMonthStr]) {
//if(myDayStr.charAt('0')==0) myDayStr=myDayStr.substring(1);
var myDateStr = myDayStr + ' ' + months[myMonthStr] + ' ' + myYearStr + ' ' +'12:00:00';


/* Using form values, create a new date object
which looks like "Wed Jan 1 00:00:00 EST 1975". */
var myDate = new Date( myDateStr );
// Convert the date to a string so we can parse it.
var myDate_string = myDate.toGMTString();


/* Split the string at every space and put the values into an array so,
using the previous example, the first element in the array is "Wed", the
second element is "Jan", the third element is "1", etc. */
var myDate_array = myDate_string.split( ' ' );


/* If we entered "Feb 31, 1975" in the form, the "new Date()" function
converts the value to "Mar 3, 1975". Therefore, we compare the month
in the array with the month we entered into the form. If they match,
then the date is valid, otherwise, the date is NOT valid. */
if ( myDate_array[2] != months[myMonthStr] ) {
  return false;
} else {
  return true;
}
}
else return false;
}
 


function echeck(str) { 
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}


		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}


		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}


		 if (str.indexOf(at,(lat+1))!=-1){
		    return false

		 }


		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }


		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }


 		 return true					
	}


function MM_validateForm() { //v5.0
  var i,p,q,nm,pswd,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { 
  	test=args[i+2]; 
	val=MM_findObj(args[i]); 
	val2=MM_findObj(args[i+1]);
	valchk=args[i];
    if (val) { 
		nm=val.name; 
		if(test.indexOf('array')!=-1){
			p=test.indexOf("array");
			q=test.indexOf(":");
			r=test.indexOf("|");
			formu=test.substring(r+1);
			var required=false;
			if(p>0 && test.substring(0,p)=='R') required=true;
			eval("rnm=document.forms['"+formu+"'].elements['"+valchk+"'];");
			if(rnm.length){
				for(k=0;k<rnm.length;k++){
					valx=rnm[k].value;
					if(valx=='' && required) {
						errors+='- Les champs '+nm+' sont obligatoires.\n';
						break;
					}
					else if(test.substring(q+1,r)=='isNum' && isNaN(valx)) {
						errors+='- L\'un des champs '+nm+' ne contient pas un nombre.\n';
						break;
					}

				}
			}
			else{
				valx=rnm.value;
				if(valx=='' && required) {
					errors+='- Les champs '+nm+' sont obligatoires.\n';
				}
				else if(test.substring(q+1,r)=='isNum' && isNaN(valx)) {
					errors+='- L\'un des champs '+nm+' ne contient pas un nombre.\n';
				}
			}


		}
		else if ((val=val.value)!="") {
			if (test.indexOf('isEmail')!=-1) { 
				if (!echeck(val)) errors+='- Le champ '+nm+' doit contenir une adresse e-mail correcte.\n';
      		} 
			else if(test.indexOf('chk')!=-1){
				p=test.indexOf(':');
				f=test.indexOf('|');
				form=test.substring(f+1);
				
				damin=test.substring(4,p);
				damax=test.substring(p+1,f);
				tmpcpt=0;
				
				for (var y=0;y<document.forms[''+form+''].elements[''+valchk+''].length;y++){
					if(document.forms[''+form+''].elements[''+valchk+''][y].checked) {
						tmpcpt++;
					}
				}

				
				if(tmpcpt<damin || (tmpcpt>damax && damax>0)){
					if(damax==0) errors+='- Vous devez cocher au moins '+damin+' cases pour le champ '+valchk+'.\n';
					else if(damin==0 ) errors+='- Vous devez cocher au plus '+damax+' cases pour le champ '+valchk+'.\n';
					else errors+='- Vous devez cocher entre '+damin+' et '+damax+' cases pour le champ '+valchk+'.\n';
				}
				
			}
			else if (test.indexOf('same') != -1 && val2) {

				if (val2.value=="") errors += '- Le champ '+val2.name+' est obligatoire.\n'; 
				else if (val2.value!=val) errors += '- Les champs '+nm+' et '+val2.name+' doivent être identiques.\n'; 
			}
			else if (test.indexOf('dateF') != -1){
				 myarraydate=val.split("/");
				 thisDate=new Date();
				 if(myarraydate.length!=3 || isNaN(myarraydate[0]) || isNaN(myarraydate[1]) || isNaN(myarraydate[2]) || myarraydate[2].length!=4 || !checkDate(myarraydate[0],myarraydate[1],myarraydate[2])) errors += '- Le champ '+nm+' doit contenir une date valide au format JJ/MM/AAAA.\n'; 
			}
			else if (test.indexOf('dateE') != -1){
				 myarraydate=val.split("/");
				 thisDate=new Date();
				 if(myarraydate.length!=3 || isNaN(myarraydate[0]) || isNaN(myarraydate[1]) || isNaN(myarraydate[2]) || myarraydate[0].length!=4 || !checkDate(myarraydate[2],myarraydate[1],myarraydate[0])) errors += '- Le champ '+nm+' doit contenir une date valide au format AAAA/MM/JJ.\n'; 
			}
			else if(test.indexOf('mini') != -1 ){
				if(val.length<test.substring(test.indexOf('mini')+4)) errors+='- Le champ '+nm+' doit contenir au moins '+test.substring(test.indexOf('mini')+4)+' caractères.\n';
			}
			else if (test!='R') {
				
        		if (isNaN(val)) errors+='- Le champ '+nm+' doit contenir un nombre.\n';
        		if (test.indexOf('inRange') != -1) { 
					p=test.indexOf(':');
          			min=test.substring(8,p);
					max=test.substring(p+1);
          			if (val<min && (max=='' || max==0)) errors+='- Le champ '+nm+' doit être un nombre supérieur à '+min+'.\n';
          			else if ((val<min || max<val) && max==min) errors+='- Le champ '+nm+' doit être un nombre égal à '+min+'.\n';
          			else if ((min=='' || min==0) && max<val) errors+='- Le champ '+nm+' doit être un nombre inféreieur à '+max+'.\n';
          			else if ((val<min || max<val) && min!='' && min!=0 && max!='' && max!=0) errors+='- Le champ '+nm+' doit être un nombre entre '+min+' et '+max+'.\n';
    			}
			}
			
			/*if(test.indexOf('mini') != -1 ){
				if(val.length<test.substring(test.indexOf('mini')+4)) errors+='- Le champ '+nm+' doit contenir au moins '+test.substring(test.indexOf('mini')+4)+' caractères.\n';
			}*/
		}
		else if (val2 && test.charAt(0) == 'R' && test.indexOf('same') != -1) {
			if(val=="" && val2.value=="") errors += '- Les champs '+nm+' et '+val2.name+' sont obligatoires.\n'; 
			else if (val=="") errors += '- Le champ '+nm+' est obligatoire.\n'; 
			if(!(val=="" && val2.value=="")&&test.indexOf('mini') != -1 ){
				if(val2.value.length<test.substring(test.indexOf('mini')+4)) errors+='- Le champ '+val2.name+' doit contenir au moins '+test.substring(test.indexOf('mini')+4)+' caractères.\n';
			}
		}
		else if (val2&&val2.value=="" && test.charAt(0) == 'R') errors += '- L\'un des champs '+nm+' et '+val2.name+' est obligatoire.\n'; 
		else if (!val2 && test.charAt(0) == 'R') errors += '- Le champ '+nm+' est obligatoire.\n'; 
		
	}
  } 
  if (errors) alert('Les erreurs suivantes sont apparues :\n\n'+errors);
  document.MM_returnValue = (errors == '');
}


function MM_validateFormEN() { //v5.0
  var i,p,q,nm,pswd,test,num,min,max,errors='',args=MM_validateFormEN.arguments;
  for (i=0; i<(args.length-2); i+=3) { 
  	test=args[i+2]; 
	val=MM_findObj(args[i]); 
	val2=MM_findObj(args[i+1]);
	valchk=args[i];
    if (val) { 
		nm=val.name; 
		if(test.indexOf('array')!=-1){
			p=test.indexOf("array");
			q=test.indexOf(":");
			r=test.indexOf("|");
			formu=test.substring(r+1);
			var required=false;
			if(p>0 && test.substring(0,p)=='R') required=true;
			eval("rnm=document.forms['"+formu+"'].elements['"+valchk+"'];");
			if(rnm.length){
				for(k=0;k<rnm.length;k++){
					valx=rnm[k].value;
					if(valx=='' && required) {
						errors+='- The fields '+nm+' are required.\n';
						break;
					}
					else if(test.substring(q+1,r)=='isNum' && isNaN(valx)) {
						errors+='- One of the fields '+nm+' is not numeric.\n';
						break;
					}

				}
			}
			else{
				valx=rnm.value;
				if(valx=='' && required) {
					errors+='- The fields '+nm+' sont obligatoires.\n';
				}
				else if(test.substring(q+1,r)=='isNum' && isNaN(valx)) {
					errors+='- One of the fields '+nm+' is not numeric.\n';
				}
			}


		}
		else if ((val=val.value)!="") {
			if (test.indexOf('isEmail')!=-1) { 
				if (!echeck(val)) errors+='- The field '+nm+' must contain a valid email address.\n';
      		} 
			else if(test.indexOf('chk')!=-1){
				p=test.indexOf(':');
				f=test.indexOf('|');
				form=test.substring(f+1);
				
				damin=test.substring(4,p);
				damax=test.substring(p+1,f);
				tmpcpt=0;
				
				for (var y=0;y<document.forms[''+form+''].elements[''+valchk+''].length;y++){
					if(document.forms[''+form+''].elements[''+valchk+''][y].checked) {
						tmpcpt++;
					}
				}

				
				if(tmpcpt<damin || (tmpcpt>damax && damax>0)){
					if(damax==0) errors+='- You must check at least '+damin+' boxes for the field '+valchk+'.\n';
					else if(damin==0 ) errors+='- You must check at the maximum '+damax+' boxes for the field '+valchk+'.\n';
					else errors+='- You must check between '+damin+' and '+damax+' boxes for the field '+valchk+'.\n';
				}
				
			}
			else if (test.indexOf('same') != -1 && val2) {

				if (val2.value=="") errors += '- The field '+val2.name+' is required.\n'; 
				else if (val2.value!=val) errors += '- The fields '+nm+' and '+val2.name+' must be the same.\n'; 
			}
			else if (test.indexOf('dateF') != -1){
				 myarraydate=val.split("/");
				 thisDate=new Date();
				 if(myarraydate.length!=3 || isNaN(myarraydate[0]) || isNaN(myarraydate[1]) || isNaN(myarraydate[2]) || myarraydate[2].length!=4 || !checkDate(myarraydate[0],myarraydate[1],myarraydate[2])) errors += '- The field '+nm+' must contain a valid date (DD/MM/YYYY).\n'; 
			}
			else if (test.indexOf('dateE') != -1){
				 myarraydate=val.split("/");
				 thisDate=new Date();
				 if(myarraydate.length!=3 || isNaN(myarraydate[0]) || isNaN(myarraydate[1]) || isNaN(myarraydate[2]) || myarraydate[0].length!=4 || !checkDate(myarraydate[2],myarraydate[1],myarraydate[0])) errors += '- The field '+nm+' must contain a valid date (YYYY/MM/DD).\n'; 
			}
			else if(test.indexOf('mini') != -1 ){
				if(val.length<test.substring(test.indexOf('mini')+4)) errors+='- The field '+nm+' must contain at least '+test.substring(test.indexOf('mini')+4)+' characters.\n';
			}
			else if (test!='R') {
				
        		if (isNaN(val)) errors+='- The field '+nm+' must a numeric.\n';
        		if (test.indexOf('inRange') != -1) { 
					p=test.indexOf(':');
          			min=test.substring(8,p);
					max=test.substring(p+1);
          			if (val<min && (max=='' || max==0)) errors+='- The field '+nm+' must contain a number higher than '+min+'.\n';
          			else if ((val<min || max<val) && max==min) errors+='- The field '+nm+' must contain a number egual to '+min+'.\n';
          			else if ((min=='' || min==0) && max<val) errors+='- The field '+nm+' must contain a number loxer than '+max+'.\n';
          			else if ((val<min || max<val) && min!='' && min!=0 && max!='' && max!=0) errors+='- The field '+nm+' must contain a number between '+min+' and '+max+'.\n';
    			}
			}
			
			/*if(test.indexOf('mini') != -1 ){
				if(val.length<test.substring(test.indexOf('mini')+4)) errors+='- Le champ '+nm+' doit contenir au moins '+test.substring(test.indexOf('mini')+4)+' caractères.\n';
			}*/
		}
		else if (val2 && test.charAt(0) == 'R' && test.indexOf('same') != -1) {
			if(val=="" && val2.value=="") errors += '- The fields '+nm+' and '+val2.name+' are required.\n'; 
			else if (val=="") errors += '- The field '+nm+' is required.\n'; 
			if(!(val=="" && val2.value=="")&&test.indexOf('mini') != -1 ){
				if(val2.value.length<test.substring(test.indexOf('mini')+4)) errors+='- The field '+val2.name+' must contain at least '+test.substring(test.indexOf('mini')+4)+' characters.\n';
			}
		}
		else if (val2&&val2.value=="" && test.charAt(0) == 'R') errors += '- One of the fields '+nm+' and '+val2.name+' is required.\n'; 
		else if (!val2 && test.charAt(0) == 'R') errors += '- The field '+nm+' is required.\n'; 
		
	}
  } 
  if (errors) alert('The following errors occured :\n\n'+errors);
  document.MM_returnValue = (errors == '');
}




 -->
