function checkForm(fields){	fieldlist = fields.split(",");	error = 0;	for(i=0; i<fieldlist.length; i++){		element = document.getElementById(fieldlist[i]);		if(fieldlist[i].search('time_depart')>0){			date1id = fieldlist[i];		}		if(fieldlist[i] !== ''  && element.options && element.options[element.selectedIndex].value == ''){			element.className = 'champ_err';			error++;		} else if(fieldlist[i] !== '' && element.value == ''){			element.className = 'champ_err';			error++;		} else if(fieldlist[i].search('email')>0 && checkmail(element.value)==false){			element.className = 'champ_err';			alert('L\'adresse email saisie est invalide');			error++;		} else if(fieldlist[i].search('time_fin')>0 && checkDates(date1id, fieldlist[i]) == false){			element.className = 'champ_err';			alert('Attention ! La date de départ doit être inférieure à la date de fin');			error++;		} else {			element.className = 'champ';		}	}	if(error == 0){		return true;	} else {		return false;	}}function checkmail(val){	var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;	var returnval=emailfilter.test(val);	return returnval;}function checkPass() {	var p1 = document.getElementById("pass1");	var p2 = document.getElementById("pass2");	if(p1.value == ''){		p1.className = 'champ_err';	} else {		p1.className = 'champ';	}	if(p2.value == ''){		p2.className = 'champ_err';	} else {		p2.className = 'champ';	}	if (p1.value.length < 4) {		alert('Le mot de passe doit contenir au moins 4 caractères');		return false;	} else if (p1.value.length > 10) {		alert('Le mot de passe ne peut contenir plus de 15 caractères');		return false;	} else if (p1.value !== p2.value) {		alert('Les mots de passe ne correspondent pas !');		return false;	} 	else {		return true;	}		}function checkMail() {	if(document.getElementById("email").value == ''){		alert("Vous devez spécifier une adresse e-mail");		return false;	} else {		return true;	}}function checkMailPass() {	if(checkMail() && checkPass()){		return true;	} else {		return false;	}}//Ouvre une connection XMLHttpfunction getHTTPObject() {  var xmlhttp;  /*@cc_on  @if (@_jscript_version >= 5)    try {      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");      } catch (e) {      try {        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");        } catch (E) {        xmlhttp = false;        }      }  @else  xmlhttp = false;  @end @*/  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {    try {      xmlhttp = new XMLHttpRequest();      } catch (e) {      xmlhttp = false;      }    }  return xmlhttp;}var http = getHTTPObject();function checkAlias(val, t){  val = escape(val);  var url = 'genAlias.php?val='+val+'&t='+t;   http.open("GET", url, true);  http.onreadystatechange = handleAliasResponse;  http.send(null);}//Met à jour le formulaire sur réponsefunction handleAliasResponse() {  if (http.readyState == 4) {    results = http.responseText;	document.getElementById("1_alias").value = results;  }}function supprImg(table, id, fichier, champ){	if(confirm('Êtes-vous sur(e) de bien vouloir supprimer ce fichier ?')){		document.location.replace('suppr_file.php?t='+table+'&i='+id+'&f='+fichier+'&c='+champ);	}}function supprElement(page, table, id){	if(confirm('Êtes-vous sur(e) de bien vouloir supprimer cet élément ?')){		document.location.replace(page+'?suppr='+id+'&table='+table);	}}	function show(id){	if(document.getElementById(id).style.display == 'none'){		document.getElementById(id).style.display = 'block';		document.getElementById('p'+id).src = 'images/puceb.gif';	} else {		document.getElementById(id).style.display = 'none';		document.getElementById('p'+id).src = 'images/puce.gif';	}}function textCounter(field,counter,maxlimit,linecounter) {	// text width//	var fieldWidth =  parseInt(field.offsetWidth);	var charcnt = field.value.length;        	// trim the extra text	if (charcnt > maxlimit) { 		field.value = field.value.substring(0, maxlimit);	}	else { 	// progress bar percentage	var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;	document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";	document.getElementById(counter).innerHTML="Limite : "+percentage+"%"	// color correction on style from CCFFF -> CC0000	//setcolor(document.getElementById(counter),percentage,"background-color");	}}function setcolor(obj,percentage,prop){	obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";}function voir(id){	window.open('annuaire/fiche.php?p='+id,'Fiche','toolbar=no, location=no, directories=no, status=no, scrollbars=no, resizable=no, copyhistory=no, width=525, height=567');}function emlink(b, d){	mail = b+'@'+d;	document.write('<a href="mailto:'+mail+'">'+mail+'</a>');}