function checkForm(fields){	fieldlist = fields.split(",");	error = 0;	ed = 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].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].search('categorie_key')>0 && element.value == ''){			document.getElementById("1_RECH_categorie_key").className = 'champ_err';			alert('Vous devez sélectionner un métier\n\nSi vous n\'avez pas trouvé de métier vous précisément à votre recherche, nous vous invitons à sélectionner une famille d\'emploi plus large afin de finaliser votre inscription, puis à prendre contact avec nous par mail ou téléphone afin que nous ajoutions le métier qu\'il vous manque');			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 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 {			if(fieldlist[i].search('categorie_key')>0){				document.getElementById("1_RECH_categorie_key").className = 'champ';			}			element.className = 'champ';		}		if(fieldlist[i].search('pass1')>0){			pass1 = element.value;		} else if(fieldlist[i].search('pass2')>0 && element.value !== '' && element.value !== pass1){			element.className = 'champ_err';			alert('Les mots de passe ne correspondent pas');			error++;		}	}	if(error == 0){		return true;	} else {		alert('Vous n\'avez pas correctement renseigné les informations obligatoires.\nMerci de corriger les cases marquées en rouge sur le formulaire.');		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 {		loading();		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 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 emlink(b, d){	mail = b+'@'+d;	document.write('<a href="mailto:'+mail+'">'+mail+'</a>');}function redirect(url){	document.location.replace(url);}function checkYear(url){	element = document.getElementById('1_y');	if(element.selectedIndex == 0){		element.className = 'champ_err';	} else {		element.className = 'champ';		redirect(url);	}}function checkDates(id1, id2){	date1 = getDate(document.getElementById(id1).value);	date2 = getDate(document.getElementById(id2).value);	if(compare(date1, date2) <0){		return false;	} else {		return true;	}}function getDate(strDate){	  	day = strDate.substring(0,2);	month = strDate.substring(3,5);	year = strDate.substring(6,10);	d = new Date(0);	d.setDate(day);	d.setMonth(month-1);	d.setFullYear(year);	return d;  }function compare(date_1, date_2){	diff = date_2.getTime()-date_1.getTime();	return (diff==0?diff:diff/Math.abs(diff));}function genCal(id,date,count,surl){	document.getElementById(id).style.visibility='visible';	var url = surl+"includes/cal.php?id="+id+"&count="+count+"&date="; 	http.open("GET", url + escape(date), true);	http.onreadystatechange = handleCalResponse; 	http.send(null);}function handleCalResponse() {	if (http.readyState == 4) {		results = http.responseText;		document.getElementById('depart').innerHTML = results;		document.getElementById('fin').innerHTML = results;    }}function getCal(id, count, surl){	if(document.getElementById(id).style.visibility=='visible'){		closeCals();	} else {		closeCals();		date=document.getElementById(count+'_time_'+id).value;		genCal(id,date,count,surl);	}}function closeCals(){	document.getElementById('depart').style.visibility='hidden';	document.getElementById('fin').style.visibility='hidden';	document.getElementById('depart').innerHTML = '';	document.getElementById('fin').innerHTML = '';	}function placeDate(id,date,count){	document.getElementById(count+'_time_'+id).value=date;	closeCals();}function active(url, sens){	if(confirm('Etes-vous sur(e) de vouloir modifier l\'état de ce compte ?')){		document.location.replace(url+'&state='+sens);	}}function moder(mode){	document.getElementById("moderation").action+= mode;	document.getElementById("moderation").submit();}function changeCat(id, parentid){	var url = 'includes/changecat.php?id='+id+'&parent='+parentid;	http.open("GET", url, true);	http.onreadystatechange = handleArboResponse; 	http.send(null);}function handleArboResponse(){	var resp = http.responseText;	document.getElementById("notifications").style.display = 'block';	document.getElementById("notdetail").innerHTML = resp;}function check(name, maxi){	if(document.getElementById(name+'_0').checked == true){		chk = true;	} else {		chk = false;	}	for(i=1;i<=maxi+1;i++){		if(document.getElementById(name+'_'+i)){			document.getElementById(name+'_'+i).checked = chk;			}	}}function getPageSize(){	var xScroll, yScroll;	if (window.innerHeight && window.scrollMaxY) {			xScroll = document.body.scrollWidth;		yScroll = window.innerHeight + window.scrollMaxY;	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac		xScroll = document.body.scrollWidth;		yScroll = document.body.scrollHeight;	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari		xScroll = document.body.offsetWidth;		yScroll = document.body.offsetHeight;	}	var windowWidth, windowHeight;	if (self.innerHeight) {	// all except Explorer		windowWidth = self.innerWidth;		windowHeight = self.innerHeight;	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode		windowWidth = document.documentElement.clientWidth;		windowHeight = document.documentElement.clientHeight;	} else if (document.body) { // other Explorers		windowWidth = document.body.clientWidth;		windowHeight = document.body.clientHeight;	}		// for small pages with total height less then height of the viewport	if(yScroll < windowHeight){		pageHeight = windowHeight;	} else { 		pageHeight = yScroll;	}	// for small pages with total width less then width of the viewport	if(xScroll < windowWidth){			pageWidth = windowWidth;	} else {		pageWidth = xScroll;	}	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 	return arrayPageSize;}function redimMask(){	dims = getPageSize();	document.getElementById("maskScreen").style.height = dims[1];	document.getElementById("maskScreen").style.visibility = 'visible';	document.getElementById("notice").style.visibility = 'visible';}function loading(){	dims = getPageSize();	document.getElementById("maskScreen").style.height = dims[1];	document.getElementById("maskScreen").style.visibility = 'visible';	document.getElementById("loading").style.visibility = 'visible';}function closeNotice(){	document.getElementById("maskScreen").style.visibility = 'hidden';	document.getElementById("notice").style.visibility = 'hidden';}function addcart(name, maxi){	count = 0;	for(i=1;i<maxi+1;i++){		if(document.getElementById(name+'_'+i) && document.getElementById(name+'_'+i).checked == true){			count++;			}	}	if(count>0){		document.getElementById("cart").submit();	}}function supprMetier(key){	var reg = new RegExp("(@"+key+"@)", "g");	var ostring = document.getElementById('1_categorie_key').value.replace(reg, "");	document.getElementById('1_categorie_key').value = ostring;	document.getElementById('1_TXT_categorie_key').removeChild(document.getElementById("metier_"+key));}function doSelect(id, prfx, maxi){	for(i = 1; i<=maxi; i++){		document.getElementById(prfx+'_'+i).style.display = 'none';	}	if(id !== ''){		document.getElementById(prfx+'_'+id).style.display = 'block';	}}