function confirmation_modification(text) {
	var a = false;
	a=confirm(text);
	if (a) return true;
	else return false;
}

function EcrireCookie(nom, valeur) {
	var argv=EcrireCookie.arguments;
	var argc=EcrireCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=nom+"="+escape(valeur)+
		((expires===null) ? "" : ("; expires="+expires.toGMTString()))+
		((path===null) ? "" : ("; path="+path))+
		((domain===null) ? "" : ("; domain="+domain))+
		((secure===true) ? "; secure" : "");
}

function getCookieVal(offset) {
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1) {endstr=document.cookie.length;}
	return unescape(document.cookie.substring(offset, endstr));
}

function LireCookie(nom) {
	var arg=nom+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen) {
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg) {return getCookieVal(j);}
		i=document.cookie.indexOf(" ",i)+1;
		if (i===0) {break;}
	}
	return null;
}

function envoieRequeteStatut(url,id,st,coul) {
	var xhr_object = null;
	var position = id;
	if (window.XMLHttpRequest) {xhr_object = new XMLHttpRequest();}
	else
		if (window.ActiveXObject) {xhr_object = new ActiveXObject("Microsoft.XMLHTTP");}
		// On ouvre la requete vers la page désirée
	xhr_object.open("GET", url, true);
	xhr_object.onreadystatechange = function() {
		if ( xhr_object.readyState == 4 ) {
			// j'affiche dans la DIV spécifiées le contenu retourné par le fichier
			document.getElementById(position).innerHTML = xhr_object.responseText;
		}
		if (st=='statut1') {
			document.getElementById('statut1').style.backgroundColor=coul;
			document.getElementById('statut1').style.color="#FFFFFF";
			document.getElementById('statut2').style.backgroundColor="#FFFFFF";
			document.getElementById('statut2').style.color="#757575";
		} else if (st=='statut2') {
			document.getElementById('statut2').style.backgroundColor=coul;
			document.getElementById('statut2').style.color="#FFFFFF";
			document.getElementById('statut1').style.backgroundColor="#FFFFFF";
			document.getElementById('statut1').style.color="#757575";
		} else if (st=='typeCand1') {
			document.getElementById('typeCand1').style.backgroundColor=coul;
			document.getElementById('typeCand1').style.color="#FFFFFF";
			document.getElementById('typeCand2').style.backgroundColor="#FFFFFF";
			document.getElementById('typeCand2').style.color="#757575";
			document.getElementById('typeCand3').style.backgroundColor="#FFFFFF";
			document.getElementById('typeCand3').style.color="#757575";
		} else if (st=='typeCand2') {
			document.getElementById('typeCand2').style.backgroundColor=coul;
			document.getElementById('typeCand2').style.color="#FFFFFF";
			document.getElementById('typeCand1').style.backgroundColor="#FFFFFF";
			document.getElementById('typeCand1').style.color="#757575";
			document.getElementById('typeCand3').style.backgroundColor="#FFFFFF";
			document.getElementById('typeCand3').style.color="#757575";
		} else if (st=='typeCand3') {
			document.getElementById('typeCand3').style.backgroundColor=coul;
			document.getElementById('typeCand3').style.color="#FFFFFF";
			document.getElementById('typeCand1').style.backgroundColor="#FFFFFF";
			document.getElementById('typeCand1').style.color="#757575";
			document.getElementById('typeCand2').style.backgroundColor="#FFFFFF";
			document.getElementById('typeCand2').style.color="#757575";
		}
	}
	// dans le cas du get
	xhr_object.send(null);
}

function envoieRequete(url,id) {
	var xhr_object = null;
	var position = id;
	if(window.XMLHttpRequest)  xhr_object = new XMLHttpRequest();
	else
	  if (window.ActiveXObject)  xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 

	// On ouvre la requete vers la page désirée
	xhr_object.open("GET", url, true);
	xhr_object.onreadystatechange = function() {
	if ( xhr_object.readyState == 4 ) {
		// j'affiche dans la DIV spécifiées le contenu retourné par le fichier
		document.getElementById(position).innerHTML = xhr_object.responseText;
	}
	}
	// dans le cas du get
	xhr_object.send(null);
}

function showOnglet(id) {
	document.getElementById('Ong1').style.backgroundPosition = '0 0';
	document.getElementById('Ong2').style.backgroundPosition = '0 0';
	document.getElementById('Ong3').style.backgroundPosition = '0 0';
	document.getElementById('Ong4').style.backgroundPosition = '0 0';
	document.getElementById('Ong5').style.backgroundPosition = '0 0';
	document.getElementById('Ong6').style.backgroundPosition = '0 0';
	document.getElementById('Ong7').style.backgroundPosition = '0 0';
	document.getElementById('Ong'+id).style.backgroundPosition = '0 -36px';
}

function verifMail(a) {
	testm = false ;
	for (var j=1 ; j<(a.length) ; j++) {
		if (a.charAt(j)=='@') {
			if (j<(a.length-4)){
				for (var k=j ; k<(a.length-2) ; k++) {
					if (a.charAt(k)=='.') testm = true;
				}
			}
		}
	}
	if (testm==false) {
		alert('Veuillez indiquer une adresse de messagerie valide ...');
		return false;
	} else {
		return true;
	}
}

