// AJAX POUR LA PAGE PRESTATAIRE 
var xhr = null; 
// INITIALISATION	
//--------------------------------------------------------------------------------------------
function getxhr(){
	if(window.XMLHttpRequest) // Firefox et autres
	   xhr = new XMLHttpRequest(); 
	else if(window.ActiveXObject){ // Internet Explorer 
		try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } 
		catch (e) { xhr = new ActiveXObject("Microsoft.XMLHTTP"); }
	}
	else { // XMLHttpRequest non support? par le navigateur 
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	   xhr = false; 
	} 
}
//-----------------------------------------------------------------------------
// FONCTION AFFICHE CONTENU
// Utilitaire pour "/jumi/menu-page-prestataire.php"
//----------------------------------------------------------------------------
function afficher_contenu(contenu,prestataire){
//alert (prestataire);
	getxhr();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){
			reponse = xhr.responseText;
			document.getElementById('CONTENU-FENETRE').style.display = 'block'; 
			document.getElementById('CONTENU-FENETRE').innerHTML = reponse;
		}else{
			reponse = "<center><img src='/00_BIBLIOTHEQUE/DESIGN/LIGHTBOX/loading.gif'><br />chargement...</center>";
			document.getElementById('CONTENU-FENETRE').innerHTML = reponse;
		}
	}
	//document.getElementById(immat).style.color = "blue";
	xhr.open("GET", "http://www.maison-et-services.com/jumi/outils-prestataire/"+contenu+"-ajax.php?prestataire="+prestataire+"&d=" + (new Date()).getTime(), true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send(prestataire);
}
//-----------------------------------------------------------------------------
// FONCTION OK FORMULAIRE INFORMATION
//----------------------------------------------------------------------------
function envoi_form_info(mail_presta,nom_client,prenom_client,adress1,adress2,CP,ville,tel,mail,commentaires,rdv,reduc,cesu,menage,jardinage,vitres,nettoyage){
	getxhr();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){
			reponse = xhr.responseText;
			document.getElementById('INFORMATION').innerHTML = reponse;
		}else{
			reponse = "<center><img src='loading.gif'><br />chargement...</center>";
			document.getElementById('INFORMATION').innerHTML = reponse;
		}
	}
	xhr.open("GET", "/components/com_structures/views/structures/tmpl/envoi_mail_information.php?mail_presta="+mail_presta+"&nom="+nom_client+"&prenom="+prenom_client+"&adress1="+adress1+"&adress2="+adress2+"&CP="+CP+"&ville="+ville+"&tel="+tel+"&mail="+mail+"&commentaires="+commentaires+"&rdv="+rdv+"&reduc="+reduc+"&cesu="+cesu+"&menage="+menage+"&jardinage="+jardinage+"&vitres="+vitres+"&nettoyage="+nettoyage     , true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send(mail_presta,nom_client,prenom_client,adress1,adress2,CP,ville,tel,mail,commentaires,rdv,reduc,cesu,menage,jardinage,vitres,nettoyage);
}		
//-----------------------------------------------------------------------------
// FONCTION VERIFIE INFOS DEMANDE INFORMATION
//----------------------------------------------------------------------------
	function verifInfos() {
		var correct=0;
		if ((document.form3.nom_client.value=="") && (correct==0)) {
			document.form3.nom_client.style.border="2px solid #eeb500";
			alert("ATTENTION : Le champ nom est obligatoire");
			correct=1;
		}
		document.form3.nom_client.style.border="";
		if ((document.form3.prenom_client.value=="") && (correct==0)) {
			alert("ATTENTION : Le champ prenom est obligatoire");
			document.form3.prenom_client.style.border="2px solid #eeb500";
			correct=1;
		}
		document.form3.prenom_client.style.border="";
		if ((document.form3.adresse1_client.value=="") && (correct==0)) {
			alert("ATTENTION : Le champ adresse est obligatoire");
			document.form3.adresse1_client.style.border="2px solid #eeb500";				
			correct=1;
		}
		document.form3.adresse1_client.style.border="";
		if ((document.form3.cp_client.value=="") && (correct==0)) {
			alert("ATTENTION : Le champ code postal est obligatoire");
			document.form3.cp_client.style.border="2px solid #eeb500";	
			correct=1;
		}
		document.form3.cp_client.style.border="";		
		if ((document.form3.ville_client.value=="") && (correct==0)) {
			alert("ATTENTION : Le champ ville est obligatoire");
			document.form3.ville_client.style.border="2px solid #eeb500";					
			correct=1;
		}
		document.form3.ville_client.style.border="";	
		if ((document.form3.tel_client.value=="") && (correct==0)) {
			alert("ATTENTION : Le champ tel. est obligatoire");
			document.form3.tel_client.style.border="2px solid #eeb500";					
			correct=1;
		}	
		document.form3.tel_client.style.border="";
		if ((document.form3.mail_client.value=="") && (correct==0)) {	
			alert("ATTENTION : Le champ mail est obligatoire");
			document.form3.mail_client.style.border="2px solid #eeb500";	
			correct=1;
		}else{
			adresse = document.form3.mail_client.value;
			var place = adresse.indexOf("@",1);
			var point = adresse.indexOf(".",place+1);
			if ((place > -1)&&(adresse.length >2)&&(point > 1))
				{
				}
			else
				{
				alert("ATTENTION : Votre adresse mail est mal saisie");
				correct=1;
				}
		}	
		document.form3.mail_client.style.border="";	
	if (correct==0) {
		envoi_form_info(document.form3.mail_presta.value, document.form3.nom_client.value, document.form3.prenom_client.value, document.form3.adresse1_client.value, document.form3.adresse2_client.value, document.form3.cp_client.value, document.form3.ville_client.value, document.form3.tel_client.value, document.form3.mail_client.value, document.form3.commentaires.value, document.form3.rdv.checked, document.form3.reduc.checked, document.form3.cesu.checked, document.form3.menage.checked, document.form3.jardinage.checked, document.form3.vitres.checked, document.form3.nettoyage.checked);
	}
}
//-----------------------------------------------------------------------------
// FONCTION FERMER CONTENU
//----------------------------------------------------------------------------
function fermer_contenu(){
	document.getElementById('CONTENU-FENETRE').style.display = 'none'; 
}
//------------------------------------------------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// FONCTION OK FORMULAIRE DEMANDE DEVIS
//----------------------------------------------------------------------------
function envoi_form_devis(prestataire,mail_presta,nom_client,prenom_client,adresse,ville,tel,mail,menage,jardinage,vitres,nettoyage,commentaires){
	//alert('envoi-fichier');

	
	//Encodage des caractères spéciaux qui vont passer dans l'URL : &, ?, +, ...
	nom_client = encodeURIComponent(nom_client);
	prenom_client = encodeURIComponent(prenom_client);
	adresse = encodeURIComponent(adresse);
	ville = encodeURIComponent(ville);
	commentaires = encodeURIComponent(commentaires);

	
	var besoins = new Array(menage,jardinage,vitres,nettoyage);
	
	for(var i=0;i<besoins.length;i++)
	{
		if(besoins[i]==1)
		{
			besoins[i]
		}
	}
	
	getxhr();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){
			reponse = xhr.responseText;
			document.getElementById('CONTENU-PRINCIPAL').innerHTML = reponse;
							//alert ('mail envoyer');
	document.location.href="/demande-devis.html";
			
		}else{
			reponse = "<center><img src='loading.gif'><br />chargement...</center>";
			document.getElementById('CONTENU-PRINCIPAL').innerHTML = reponse;		
		}
	}
	//xhr.open("GET", "http://www.maison-et-services.com/jumi/outils-prestataire/mail-devis.php" , true);

	xhr.open("GET", "http://www.maison-et-services.com/jumi/outils-prestataire/mail-devis.php?prestataire="+prestataire+"&mail_presta="+mail_presta+"&nom="+nom_client+"&prenom="+prenom_client+"&adresse="+adresse+"&ville="+ville+"&tel="+tel+"&mail="+mail+"&menage="+menage+"&jardinage="+jardinage+"&vitres="+vitres+"&nettoyage="+nettoyage+"&commentaires="+commentaires    , true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded', 'text/html; charset=ISO-8859-1');
	
	xhr.send(prestataire,mail_presta,nom_client,prenom_client,adresse,ville,tel,mail,menage,jardinage,vitres,nettoyage,commentaires);
	

}	
//-----------------------------------------------------------------------------
// FONCTION VERIFIE INFOS DEMANDE DEVIS
//----------------------------------------------------------------------------
function verifDevis() {

		//alert('Verifdevis');
		
		 	var correct=0;
			if ((document.form3.nom.value=="")) {
				//alert("ATTENTION : Le champ nom est obligatoire");
				document.form3.nom.style.border="2px solid #ff0000";
				correct=1;
			}else{
				document.form3.nom.style.border="";
			}

			// if ((document.form3.prenom.value=="")) {
				//alert("ATTENTION : Le champ prenom est obligatoire");
				// document.form3.prenom.style.border="2px solid #ff0000";
				// correct=1;
			// }else{
				// document.form3.prenom.style.border="";
			// }
			
			if ((document.form3.adresse.value=="")) {
				//alert("ATTENTION : Le champ adresse est obligatoire");
				document.form3.adresse.style.border="2px solid #ff0000";					
				correct=1;
			}else{
				document.form3.adresse.style.border="";
			}
			
			if ((document.form3.ville.value=="")) {
				//alert("ATTENTION : Le champ ville est obligatoire");
				document.form3.ville.style.border="2px solid #ff0000";					
				correct=1;
			}else{
				document.form3.ville.style.border="";
			}

			if ((document.form3.tel.value=="")) {
				//alert("ATTENTION : Le champ tel. est obligatoire");
				document.form3.tel.style.border="2px solid #ff0000";					
				correct=1;
			}else{
				document.form3.tel.style.border="";
			}	

			if ((document.form3.email.value=="")) {	
				//alert("ATTENTION : Le champ mail est obligatoire");
				document.form3.email.style.border="2px solid #ff0000";	
				correct=1;
			}else{
				adresse_mail = document.form3.email.value;
				var place = adresse_mail.indexOf("@",1);
				var point = adresse_mail.indexOf(".",place+1);
				if ((place > -1)&&(adresse_mail.length >2)&&(point > 1))
					{
					document.form3.email.style.border="";
					}
				else
					{
					alert("ATTENTION : Votre adresse mail est mal saisie");
					correct=1;
					document.form3.email.style.border="2px solid #eeb500";	
					}
			}
			
			if(document.form3.menage.checked==true)
			{
				var menage = 1;
			}
			else { var menage = 0; }
			
			if(document.form3.jardinage.checked==true)
			{
				var jardinage = 1;
			}
			else { var jardinage = 0; }
			
			if(document.form3.vitres.checked==true)
			{
				var vitres = 1;
			}
			else { var vitres = 0; }
			
			if(document.form3.nettoyage.checked==true)
			{
				var nettoyage = 1;
			}
			else { var nettoyage = 0; }
			
			
		if (correct==1) {
			alert("Vous n'avez pas correctement rempli le formulaire.");
		}
		
		if (correct==0) {

			envoi_form_devis(document.form3.prestataire.value, document.form3.mail_presta.value, document.form3.nom.value, document.form3.prenom.value, document.form3.adresse.value,  document.form3.ville.value, document.form3.tel.value, document.form3.email.value, menage, jardinage, vitres, nettoyage, document.form3.commentaires.value);
			
			fermer_contenu();
			
			}
			
	}

// -------------------

// VERFI TEST
//-------------------------

function veriftest() {
	//alert ('test');
	envoi_form_test(document.formTest.commentaires.value);
	}

	
	
function envoi_form_test(commentaires){
	
	//Encodage des caractères spéciaux qui vont passer dans l'URL : &, ?, +, ...
	commentaires = encodeURIComponent(commentaires);
	
	getxhr();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){
			reponse = xhr.responseText;
			document.getElementById('CONTENU-PRINCIPAL').innerHTML = reponse;
							//alert ('mail envoyer');
	//document.location.href="/demande-devis.html";
			
		}else{
			reponse = "<center><img src='loading.gif'><br />chargement...</center>";
			document.getElementById('CONTENU-PRINCIPAL').innerHTML = reponse;

			
		}
	}
	//xhr.open("GET", "http://www.maison-et-services.com/jumi/outils-prestataire/mail-devis.php" , true);

	xhr.open("GET", "http://www.maison-et-services.com/jumi/TESTFORM/envois-test.php?commentaires="+commentaires+"&d=" + (new Date()).getTime()    , true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded', 'text/html; charset=UTF-8');
	xhr.send(commentaires);
	

}

function escapeHtml(unsafe) {
	return unsafe
      .replace(/&/g, "&amp;")
      .replace(/</g, "&lt;")
      .replace(/>/g, "&gt;")
      .replace(/"/g, "&quot;")
      .replace(/'/g, "&#039;");
	}
	
	
//-----------------------------------------------------------------------------
// FONCTION OK FORMULAIRE INTERVENTION
//----------------------------------------------------------------------------
function envoi_form_interv(mail_presta,nom_client,prenom_client,adress1,adress2,CP,ville,tel,mail,commentaires,menage,jardinage,vitres,nettoyage){
	getxhr();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){
			reponse = xhr.responseText;
			document.getElementById('INTERVENTION').innerHTML = reponse;
		}else{
			reponse = "<center><img src='loading.gif'><br />chargement...</center>";
			document.getElementById('INTERVENTION').innerHTML = reponse;
		}
	}
	xhr.open("GET", "/components/com_structures/views/structures/tmpl/envoi_mail_intervention.php?mail_presta="+mail_presta+"&nom="+nom_client+"&prenom="+prenom_client+"&adress1="+adress1+"&adress2="+adress2+"&CP="+CP+"&ville="+ville+"&tel="+tel+"&mail="+mail+"&commentaires="+commentaires+"&menage="+menage+"&jardinage="+jardinage+"&vitres="+vitres+"&nettoyage="+nettoyage     , true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send(mail_presta,nom_client,prenom_client,adress1,adress2,CP,ville,tel,mail,commentaires,menage,jardinage,vitres,nettoyage);
}	
//-----------------------------------------------------------------------------
// FONCTION VERIFIE INFOS DEMANDE INTREVENTION
//----------------------------------------------------------------------------
function verifInterv() {
		var correct2=0;
		if ((document.form2.nom_client.value=="") && (correct2==0)) {
			document.form2.nom_client.style.border="2px solid #eeb500";
			alert("ATTENTION : Le champ nom est obligatoire");
			correct2=1;
		}
		document.form2.nom_client.style.border="";
		if ((document.form2.prenom_client.value=="") && (correct2==0)) {
			alert("ATTENTION : Le champ prenom est obligatoire");
			document.form2.prenom_client.style.border="2px solid #eeb500";
			correct2=1;
		}
		document.form2.prenom_client.style.border="";
		if ((document.form2.adresse1_client.value=="") && (correct2==0)) {
			alert("ATTENTION : Le champ adresse est obligatoire");
			document.form2.adresse1_client.style.border="2px solid #eeb500";				
			correct2=1;
		}
		document.form2.adresse1_client.style.border="";
		if ((document.form2.cp_client.value=="") && (correct2==0)) {
			alert("ATTENTION : Le champ code postal est obligatoire");
			document.form2.cp_client.style.border="2px solid #eeb500";	
			correct2=1;
		}
		document.form2.cp_client.style.border="";		
		if ((document.form2.ville_client.value=="") && (correct2==0)) {
			alert("ATTENTION : Le champ ville est obligatoire");
			document.form2.ville_client.style.border="2px solid #eeb500";					
			correct2=1;
		}
		document.form2.ville_client.style.border="";	
		if ((document.form2.tel_client.value=="") && (correct2==0)) {
			alert("ATTENTION : Le champ tel. est obligatoire");
			document.form2.tel_client.style.border="2px solid #eeb500";					
			correct2=1;
		}	
		document.form2.tel_client.style.border="";
		if ((document.form2.mail_client.value=="") && (correct2==0)) {	
			alert("ATTENTION : Le champ mail est obligatoire");
			document.form2.mail_client.style.border="2px solid #eeb500";	
			correct2=1;
		}
		else{
			adresse1 = document.form2.mail_client.value;
			var place1 = adresse1.indexOf("@",1);
			var point1 = adresse1.indexOf(".",place1+1);
			if ((place1 > -1)&&(adresse1.length >2)&&(point1 > 1))
				{
				}
			else
				{
				alert("ATTENTION : Votre adresse mail est mal saisie");
				correct2=1;
				}
		}	
		document.form2.mail_client.style.border="";	
	if (correct2==0) {
		envoi_form_interv(document.form2.mail_presta.value, document.form2.nom_client.value, document.form2.prenom_client.value, document.form2.adresse1_client.value, document.form2.adresse2_client.value, document.form2.cp_client.value, document.form2.ville_client.value, document.form2.tel_client.value, document.form2.mail_client.value, document.form2.commentaires.value, document.form2.menage.checked, document.form2.jardinage.checked, document.form2.vitres.checked, document.form2.nettoyage.checked);
	}
}
// ===================================
//FONCTION RECHERCHE PRESTATAIRE SUIVANT CP
// ===================================
function trouvecp(cp){
	if (cp=='') {
		alert('Indiquez votre CODE POSTAL, pour trouver votre prestataire MAISON et SERVICES');		
	}else{
		//alert(cp);
		getxhr();
		xhr.onreadystatechange = function(){
			if(xhr.readyState == 4 && xhr.status == 200){
				reponse = xhr.responseText;
				document.getElementById('RESULTAT-CP').innerHTML = reponse;

			}else{
				reponse = "<center><img src='/modules/mod_carte/images/loading.gif' style='margin:140px auto ' />RECHERCHE EN COURS</center>";
				document.getElementById('RESULTAT-CP').innerHTML = reponse;
			}
		}
		
		
		xhr.open("GET", "http://www.maison-et-services.com/jumi/moteur-cherche-prestataire/resultat-recherche-cp.php?CP="+cp+"&d=" + (new Date()).getTime()  , true);					
		xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		//xhr.send(region,categorie,type);
		xhr.send(cp);	
	}		
}
// ===================================
//FONCTION AFFICHAGE DE FICHE PRESTATAIRE
// ===================================
	function afficher_fichePrestataire(ville){
		//alert ('affich fiche prestataire'+ville);
		var xhrPrestataire = null;
		if(window.XMLHttpRequest) // Firefox et autres
		   xhrPrestataire = new XMLHttpRequest(); 
		else if(window.ActiveXObject){ // Internet Explorer 		
		   try {
					xhrPrestataire = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					xhrPrestataire = new ActiveXObject("Microsoft.XMLHTTP");
				}
		}
		else { // XMLHttpRequest non supporte par le navigateur 
		   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
		   xhrPrestataire = false; 
		} 
		xhrPrestataire.onreadystatechange = function(){
			if(xhrPrestataire.readyState == 4 && xhrPrestataire.status == 200){
				reponse = xhrPrestataire.responseText;
				document.getElementById('FICHE-VILLE').innerHTML = reponse;	
				//date=new Date;
				//date.setFullYear(date.getFullYear()+2);
				//EcrireCookie('ficheVille', ville, date, '/');
			}else{
				reponse = "<center><img src='/modules/mod_carte/images/loading.gif' style='margin:140px auto ' /> ??????????????</center>";
				//On se sert de innerHTML pour rajouter les options a la liste
				document.getElementById('FICHE-VILLE').innerHTML = reponse;
				}
			}
		//	xhrPrestataire.open("GET", "http://www.maison-et-services.com/modules/mod_carte/mod_agence.php?ville="+ville, true);	
			xhrPrestataire.open("GET", "http://www.maison-et-services.com/jumi/fiche-ville-tetiere.php?ville="+ville, true);	
			xhrPrestataire.setRequestHeader('Content-Type','application/x-www-sform-urlencoded');
			xhrPrestataire.send(ville);	
	}		
// ===================================
//FONCTION ECIRE COOKIE DE CARTE
function EcrireCookie(nom, valeur, expires, path){
//alert ('ecrire cookie :'+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" : "");
}
//
// ===================================
//FONCTION DETRUIRE COOKIE DE CARTE
function EffaceCookie(nom){
	//alert ('detruire cookie');
	date=new Date;
	date.setFullYear(date.getFullYear()-1);
	EcrireCookie(nom,null,date); 
}
//
// ===================================
//FONCTION LIRE COOKIE DE CARTE
function getCookieVal(offset){
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1) endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr)); 
	alert('offset');
}
function LireCookie(nom) {
	//alert ('lire')
	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; 
}
//-->
// SCRIPT D'INITIALISATION de MULTIPLES ONLOAD
function addOnloadEvent(fnc){
  if ( typeof window.addEventListener != "undefined" )
	window.addEventListener( "load", fnc, false );
  else if ( typeof window.attachEvent != "undefined" ) {
    window.attachEvent( "onload", fnc );
  }
  else {
    if ( window.onload != null ) {
      var oldOnload = window.onload;
      window.onload = function ( e ) {
        oldOnload( e );
        window[fnc]();
      };
    }
    else
      window.onload = fnc;
  }
}
//-----------------------------------------------------------------------------
// !!!!! ATTENTION --> ANCIENNE VERSION - A SUPPRIMER EN FIN DE DEV de version JUMI
function afficher_carteFrance(region,categorie,type){
	if (region != '') {
			getxhr();
			xhr.onreadystatechange = function(){
				if(xhr.readyState == 4 && xhr.status == 200){
					reponse = xhr.responseText;
					document.getElementById('CARTE-AFFICHAGE').innerHTML = reponse;
					date=new Date;
					date.setFullYear(date.getFullYear()+2);
					deja_region = LireCookie("carte-affiche-region");
					if (deja_region != region){
					//alert (deja_region);
					EcrireCookie('carte-affiche-region', region, date, '/');
					EcrireCookie('carte-affiche-categorie', categorie, date, '/');
					EcrireCookie('carte-affiche-type', type, date, '/');
					}
				}else{
					reponse = "<center><img src='/modules/mod_carte/images/loading.gif' style='margin:140px auto ' /></center>";
					document.getElementById('CARTE-AFFICHAGE').innerHTML = reponse;
				}
			}
			if (type == 'region'){	
				xhr.open("GET", "http://www.maison-et-services.com/modules/mod_carte/mod_region.php?region="+region+"&categorie="+categorie+"&type_plot="+type , true);	
			}else if (type == 'departement'){
				xhr.open("GET", "http://www.maison-et-services.com/modules/mod_carte/mod_departement.php?departement="+region+"&categorie="+categorie+"&type_plot="+type , true);	
			}else if (type == 'france'){
				xhr.open("GET", "http://www.maison-et-services.com/modules/mod_carte/mod_france.php?type_plot="+type+"&categorie="+categorie, true);	
			}else if (type == 'ville'){
				xhr.open("GET", "http://www.maison-et-services.com/modules/mod_carte/mod_agence.php?ville="+region+"&categorie="+categorie, true);	
			}else if (type == 'CP'){
				xhr.open("GET", "http://www.maison-et-services.com/modules/mod_carte/mod_recherche_agence.php?CP="+region+"&categorie="+categorie, true);	
			}
			xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			//xhr.send(region,categorie,type);
			xhr.send("region="+region+"&categorie="+categorie+"&type_plot="+type);	
	}		
}
//-----------------------------------------------------------------------------
function afficher_carteInteract(region,categorie,type){
	if (region!=''){
	//alert(region);
			getxhr();		
			xhr.onreadystatechange = function(){
				if(xhr.readyState == 4 && xhr.status == 200){
					reponse = xhr.responseText;
					document.getElementById('CARTE-AFFICHAGE').innerHTML = reponse;

				}else{
					reponse = "<center><img src='/modules/mod_carte/images/loading.gif' style='margin:140px auto ' />RECHERCHE EN COURS</center>";
					document.getElementById('CARTE-AFFICHAGE').innerHTML = reponse;
				}
			}
			
			
			
			if (type=='region'){	
				xhr.open("GET", "http://www.maison-et-services.com/jumi/carte-interact/region.php?region="+region+"&categorie="+categorie+"&type_plot="+type , true);	
			}else if (type=='departement'){
				xhr.open("GET", "http://www.maison-et-services.com/modules/mod_carte/mod_departement.php?departement="+region+"&categorie="+categorie+"&type_plot="+type , true);	
			}else if (type=='france'){
				xhr.open("GET", "http://www.maison-et-services.com/modules/mod_carte/mod_france.php?type_plot="+type+"&categorie="+categorie, true);	
			}else if (type=='ville'){
				xhr.open("GET", "http://www.maison-et-services.com/modules/mod_carte/mod_agence.php?ville="+region+"&categorie="+categorie, true);	
			}
			xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			//xhr.send(region,categorie,type);
			xhr.send("region="+region+"&categorie="+categorie+"&type_plot="+type);	
			
	}		
}

//Test merci devis
function merciDevis() {
	alert('Merci !');
}
