
function loadCityValider(xhr){
var listing=xhr.responseText.replace(/\n/gi,"<br>");
document.getElementById("cityZone").innerHTML=listing;
document.getElementById("city").value="";
}

function loadCity(code){
new Ajax_request('inc/load_city.php',{method:'get',params:'code='+code,onSuccess:loadCityValider});
}

function loadCityFromId(code){
new Ajax_request('inc/load_city_id.php',{method:'get',params:'id='+code,onSuccess:loadCityValider});
}

function loadCityNameValider(xhr){
var valeur=xhr.responseText.replace(/\n/gi,"<br>");
document.getElementById("city").value=valeur;
geolocaliser();
}

function loadCityName(code){
new Ajax_request('inc/load_city.php',{method:'get',params:'name='+code,onSuccess:loadCityNameValider});
}

function nextStage(valeur){
closeAllStage();
colorStage(valeur);
document.getElementById("form_"+valeur).style.display="inline"
}

function previousStage(valeur){
closeAllStage();
colorStage(valeur);
document.getElementById("form_"+valeur).style.display="inline"
}

function closeAllStage(){
	for(i=1;i<20;i++){
		if(document.getElementById("form_"+i)){
		document.getElementById("form_"+i).style.display="none"
		document.getElementById("tdStage_"+i).style.backgroundColor="#efefff";
		}
	}
}

function colorStage(valeur){
	for(i=1;i<=valeur;i++){
		if(document.getElementById("tdStage_"+i)){
		document.getElementById("tdStage_"+i).style.backgroundColor="#7CB445";
		}
	}
}

function seeAddPhoto(qui){
document.getElementById("addPhoto"+qui).style.display="inline";
}

function hideAddPhoto(qui){
document.getElementById("addPhoto"+qui).style.display="none";
}

function verifSelectionPhoto(qui){
if(document.getElementById("photo_"+qui).value==""){
alert("Veuillez choisir une photo.");
return false;
}
return true;
}

function voirPhoto(valeur, identifiant){
document.getElementById("photo["+identifiant+"]").value=valeur;
document.getElementById("photo_view_"+identifiant).src="photo.php?image="+valeur+"&w=50&h=0";
document.getElementById("link_sup_"+identifiant).style.display="inline";
document.getElementById("photo_view_"+identifiant).style.display="inline";
}

function supprimerPhotoValider(xhr){
var identifiant=xhr.responseText.replace(/\n/gi,"<br>");
document.getElementById("link_sup_"+identifiant).style.display="none";
document.getElementById("photo_view_"+identifiant).src="/images/default.png";
}

function supprimerPhoto(identifiant){
document.getElementById("photo["+identifiant+"]").value="";
new Ajax_request('inc/photo_delete.php',{method:'get',params:'id='+identifiant,onSuccess:supprimerPhotoValider});
}

function loadSearchOptionValider(xhr){
var listing=xhr.responseText.replace(/\n/gi,"");
document.getElementById("searchoption").innerHTML=listing;
}

function loadSearchOption(code){
new Ajax_request('inc/load_searchOption.php',{method:'get',params:'id_categorie='+code,onSuccess:loadSearchOptionValider});
}
