

function search(){

new Ajax.Updater('resultat', 'index.php?xhttp=1&form=resultat&impot='+document.getElementById('impot').value,
 {asynchronous:true,  
 onLoading:function(){
  Element.show('ajax-loader');},
 onFailure: function(){
 
 },
 onComplete:function(){

  load = 'resultat';
	load = document.getElementById(load);
	load.style.display = 'none';
	Element.hide('ajax-loader');
	new Effect.Appear(load, {duration: 0.5});
	
}
});	

}

function search_slide(v1,v2){

new Ajax.Updater('resultat', 'index.php?xhttp=1&form=resultat&impot='+v2+'&impotmax='+v1,
 {asynchronous:true,  
 onLoading:function(){
  Element.show('ajax-loader');},
 onFailure: function(){
 
 },
 onComplete:function(){

  load = 'resultat';
	load = document.getElementById(load);
	load.style.display = 'none';
	Element.hide('ajax-loader');
	new Effect.Appear(load, {duration: 0.5});
	
}
});	

}

function search_slidem(v1,v2){

new Ajax.Updater('resultat', 'index.php?xhttp=1&form=resultat&metrecarremax='+v2+'&metrecarre='+v1,
 {asynchronous:true,  
 onLoading:function(){
  Element.show('ajax-loader');},
 onFailure: function(){
 
 },
 onComplete:function(){

  load = 'resultat';
	load = document.getElementById(load);
	load.style.display = 'none';
	Element.hide('ajax-loader');
	new Effect.Appear(load, {duration: 0.5});
	
}
});	

}

function search_slidep(v1,v2){

new Ajax.Updater('resultat', 'index.php?xhttp=1&form=resultat&prixmax='+v2+'&prix='+v1,
 {asynchronous:true,  
 onLoading:function(){
  Element.show('ajax-loader');},
 onFailure: function(){
 
 },
 onComplete:function(){

  load = 'resultat';
	load = document.getElementById(load);
	load.style.display = 'none';
	Element.hide('ajax-loader');
	new Effect.Appear(load, {duration: 0.5});
	
}
});	

}

function searchid(id_bien){

new Ajax.Updater('resultat', 'index.php?xhttp=1&form=resultat&id_bien='+id_bien,
 {asynchronous:true,  
 onLoading:function(){
  Element.show('ajax-loader');},
 onFailure: function(){
 
 },
 onComplete:function(){

  load = 'resultat';
	load = document.getElementById(load);
	load.style.display = 'none';
	Element.hide('ajax-loader');
	new Effect.Appear(load, {duration: 0.5});
	
}
});	

}

function searchzone(localisation){

new Ajax.Updater('resultat', 'index.php?xhttp=1&form=resultat&localisation='+localisation,
 {asynchronous:true,  
 onLoading:function(){
  Element.show('ajax-loader');},
 onFailure: function(){
 
 },
 onComplete:function(){

  load = 'resultat';
	load = document.getElementById(load);
	load.style.display = 'none';
	Element.hide('ajax-loader');
	new Effect.Appear(load, {duration: 0.5});
	
}
});	

}

function searchloca(){

new Ajax.Updater('resultat', 'index.php?xhttp=1&form=resultat&commune='+document.getElementById('commune').value,
 {asynchronous:true,  
 onLoading:function(){
  Element.show('ajax-loader');},
 onFailure: function(){
 
 },
 onComplete:function(){

  load = 'resultat';
	load = document.getElementById(load);
	load.style.display = 'none';
	Element.hide('ajax-loader');
	new Effect.Appear(load, {duration: 0.5});
	
}
});	

}


function  calculpret(prix_de_vente){

var apport_personnel = document.getElementById('apport_personnel').value;
var temps_credit = document.getElementById('temps_credit').value;
var taux_global = document.getElementById('taux_global').value;

var prix_de_vente;

new Ajax.Updater('credit', 'index.php?xhttp=1&form=credit&prix_de_vente='+prix_de_vente+'&apport_personnel='+apport_personnel+'&temps_credit='+temps_credit+'&taux_global='+taux_global,
 {asynchronous:true,  
 onLoading:function(){
  Element.show('ajax-loader');},
 onFailure: function(){
 
 },
 onComplete:function(){

  load = 'credit';
	load = document.getElementById(load);
	load.style.display = 'none';
	Element.hide('ajax-loader');
	new Effect.Appear(load, {duration: 0.5});
	
}
});	


}

function envoiecontactpret(prix_de_vente){

var apport_personnel = document.getElementById('apport_personnel').value;
var temps_credit = document.getElementById('temps_credit').value;
var taux_global = document.getElementById('taux_global').value;

var nom = document.getElementById('nom').value;
var prenom = document.getElementById('prenom').value;
var tel = document.getElementById('tel').value;
var mail = document.getElementById('mail').value;
var commentaire = document.getElementById('commentaire').value;

var prix_de_vente;

if(nom==""){
alert('erreur le champ nom n\'a pas été renseigné');
}
if(prenom==""){
alert('erreur le champ prenom n\'a pas été renseigné');
}
if(tel==""){
alert('erreur le champ telephone n\'a pas été renseigné');
}
if(mail==""){
alert('erreur le champ email n\'a pas été renseigné');
}

if(nom!="" && prenom!="" && tel!="" && mail!=""){

new Ajax.Updater('contactpret', 'index.php?xhttp=1&form=envoiecontactpret&nom='+nom+'&prenom='+prenom+'&tel='+tel+'&mail='+mail+'&commentaire='+commentaire+'&prix_de_vente='+prix_de_vente+'&apport_personnel='+apport_personnel+'&temps_credit='+temps_credit+'&taux_global='+taux_global,
 {asynchronous:true,  
 onLoading:function(){
  Element.show('ajax-loader');},
 onFailure: function(){
 
 },
 onComplete:function(){

  load = 'contactpret';
	load = document.getElementById(load);
	load.style.display = 'none';
	Element.hide('ajax-loader');
	new Effect.Appear(load, {duration: 0.5});
	
}
});	

}
}

function envoiecontactgestion(){

var nom = document.getElementById('gnom').value;
var prenom = document.getElementById('gprenom').value;
var tel = document.getElementById('gtel').value;
var mail = document.getElementById('gmail').value;
var commentaire = document.getElementById('gcommentaire').value;

if(nom==""){
alert('erreur le champ nom n\'a pas été renseigné');
}
if(prenom==""){
alert('erreur le champ prenom n\'a pas été renseigné');
}
if(tel==""){
alert('erreur le champ telephone n\'a pas été renseigné');
}
if(mail==""){
alert('erreur le champ email n\'a pas été renseigné');
}

if(nom!="" && prenom!="" && tel!="" && mail!=""){

new Ajax.Updater('contactgestion', 'index.php?xhttp=1&form=envoiecontactgestion&nom='+nom+'&prenom='+prenom+'&tel='+tel+'&mail='+mail+'&commentaire='+commentaire,
 {asynchronous:true,  
 onLoading:function(){
  Element.show('ajax-loader');},
 onFailure: function(){
 
 },
 onComplete:function(){

  load = 'contactgestion';
	load = document.getElementById(load);
	load.style.display = 'none';
	Element.hide('ajax-loader');
	new Effect.Appear(load, {duration: 0.5});
	
}
});	

}
}

function envoiecontactbien(id_bien){


var nom = document.getElementById('bnom').value;
var prenom = document.getElementById('bprenom').value;
var tel = document.getElementById('btel').value;
var mail = document.getElementById('bmail').value;
var commentaire = document.getElementById('bcommentaire').value;

if(nom==""){
alert('erreur le champ nom n\'a pas été renseigné');
}
if(prenom==""){
alert('erreur le champ prenom n\'a pas été renseigné');
}
if(tel==""){
alert('erreur le champ telephone n\'a pas été renseigné');
}
if(mail==""){
alert('erreur le champ email n\'a pas été renseigné');
}

if(nom!="" && prenom!="" && tel!="" && mail!=""){

new Ajax.Updater('contactbien', 'index.php?xhttp=1&form=envoiecontactbien&nom='+nom+'&prenom='+prenom+'&tel='+tel+'&mail='+mail+'&commentaire='+commentaire+'&id_bien='+id_bien,
 {asynchronous:true,  
 onLoading:function(){
  Element.show('ajax-loader');},
 onFailure: function(){
 
 },
 onComplete:function(){

  load = 'contactbien';
	load = document.getElementById(load);
	load.style.display = 'none';
	Element.hide('ajax-loader');
	new Effect.Appear(load, {duration: 0.5});
	
}
});	
}

}


