function module_selection_change_img_page(val)
{
		id = document.getElementById("curseur").value;
		if(val == 1)
		{
			id = parseInt(id)-1;
		}
		else
		{
			id = parseInt(id)+1;			
		}
		module_selection_change_img(id);
}

function module_selection_goto_fiche_bien()
{
	id = document.getElementById("curseur").value;
	locsation_href = document.getElementById("liens_"+id).value;
	window.location.href = locsation_href;
}

function module_selection_change_img(id)
{
	document.getElementById("curseur").value = id;
	var img = document.getElementById("img_"+id).value;
	var nom_city = document.getElementById("nom_city_"+id).value;
	var nom_quartier = document.getElementById("nom_quartier_"+id).value;
	var nom_typeNbPcs = document.getElementById("nom_typeNbPcs_"+id).value;
	var nom_typeBien = document.getElementById("nom_typeBien_"+id).value;
	var liens = document.getElementById("liens_"+id).value;	
	
	for(i=1; i<7; i++)
	{
		if(id == i)
		{
			document.getElementById("menu_selection_item_"+i).className = "module_selection_selected_item";
		}
		else
		{
			document.getElementById("menu_selection_item_"+i).className = "module_selection_item";
		}
	}
	
	if(id == 1)
	{
		document.getElementById("fleche_gauche").src = "/images/fleche_gauche_gris.png";
	}
	else
	{	
		document.getElementById("fleche_gauche").src = "/images/fleche_gauche.png";	
	}
	if(id == 6)
	{
		document.getElementById("fleche_droite").src = "/images/fleche_droite_gris.png";			
	}
	else
	{	
		document.getElementById("fleche_droite").src = "/images/fleche_droite.png";				
	}		
	
	document.getElementById("img_principale").src = img;
	text_selection_commentaire = "<span onclick='javascript:window.location.href = \""+liens+"\"'>";			
	text_selection_commentaire += "<span style='font-size:13px'>";
	text_selection_commentaire += nom_city;
	text_selection_commentaire += "</span>";	
   	if(nom_quartier != '')
	{
		text_selection_commentaire += "<span style='font-size:10px'>";		
		text_selection_commentaire += " "+nom_quartier;
		text_selection_commentaire += "</span>";			
	}
	text_selection_commentaire += "<br />"+nom_typeBien+" "+nom_typeNbPcs+" pi&egrave;ces";
	text_selection_commentaire += "</span>";		
	document.getElementById("selection_commentaire").innerHTML = text_selection_commentaire;
	document.getElementById("liens_images").href = liens;
}

/*Function qui permet de voire la liste des biens d'une agence*/
function Goto_Liste_bien_agence(id_agence)
{
	document.getElementById("id_agence_page").value = id_agence;
	document.getElementById("frm_acces_bien").submit();	
}

/*Function qui permet de changer le tri sur la liste de resultat des biens */
function liste_bien_change_order(id)
{
		document.frm_liste.order.value = id;
		document.getElementById("frm_liste").submit();
}

/*Function qui permet de changer la page sur la liste de resultat des biens */
function liste_bien_change_page(id)
{
		document.frm_liste.page.value = id;
		document.getElementById("frm_liste").submit();
}

/*Fonction qui permet l'envoie du mail de contact sur la fiche de bien*/
function fiche_bien_contact(mail)
{
	document.getElementById("err_callback_nom").innerHTML = "";
	document.getElementById("err_callback_mail").innerHTML = "";
	document.getElementById("err_callback_tel").innerHTML = "";	
	
	var callback_nom 			= document.getElementById("callback_nom").value;
	var callback_mail 			= document.getElementById("callback_mail").value;
	var callback_tel 			= document.getElementById("callback_tel").value;
	var callback_par 			= document.getElementById("callback_par").value;
	var callback_mail_agence 	= document.getElementById("callback_mail_agence").value;
	var err = 0;
	
	if(callback_nom == "")
	{
		document.getElementById("err_callback_nom").innerHTML = "Le champ 'Nom' est obligatoire.";
		err = 1;
	}
	if(callback_mail == "")
	{
		document.getElementById("err_callback_mail").innerHTML = "Le champ 'Mail' est obligatoire.";
		err = 1;		
	}		
	if(callback_tel == "")
	{
		document.getElementById("err_callback_tel").innerHTML = "Le champ 'Tel' est obligatoire.";
		err = 1;		
	}	
	
	if(err != 1)
	{
			$("#coll_back_content").animate({ 
				opacity: 0.0
			  }, 1000, "linear", function(){
			$.post("ajax_send_contact.cfm",
			   { callback_nom: callback_nom, callback_mail: callback_mail, callback_tel: callback_tel, callback_par:callback_par, callback_mail_agence: callback_mail_agence },
			   function(data){ 
			   
   					coll_back_content = '<table cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#FFFFFF">';
				   	coll_back_content += '<tr>';
           		   	coll_back_content += '<td width="10px" rowspan="17">&nbsp;</td>';
           		   	coll_back_content += '<td height="5px">&nbsp;</td>';
		   			coll_back_content += '<td width="10px" rowspan="17">&nbsp;</td>';
                    coll_back_content += '</tr>';
                    coll_back_content += '<tr>';
                    coll_back_content += '<td class="menu_left_label">Merci a bientot.</td>';
                    coll_back_content += '</tr>';
				   	coll_back_content += '<tr>';
           		   	coll_back_content += '<td height="5px">&nbsp;</td>';
                    coll_back_content += '</tr>';					
					coll_back_content += '</table>';
					
					
					document.getElementById("coll_back_content").innerHTML = coll_back_content;
					$("#coll_back_content").animate({ 
						opacity: 1.0
					 }, 1000 );
			   });
			});
	}
}

/*Fonction qui sert a afficher ou faire disparaitre le moteur de recherche carto*/
function affichage_recherche_carto()
{
	if(document.getElementById("moteur_recherche_carto").style.display == 'none')	
	{
		$("#moteur_recherche_carto").animate({ 
			"height": "toggle",
			"opacity": "toggle"
		}, "slow" );		
		document.getElementById("titre_aff_recherche_carto").innerHTML = "> Masquer le moteur de recherche";	
	}
	else
	{
		$("#moteur_recherche_carto").animate({ 
			"height": "toggle",
			"opacity": "toggle"
		}, "slow" );
		document.getElementById("titre_aff_recherche_carto").innerHTML = "> Afficher le moteur de recherche";		
	}
}


/*Fonction qui sert a faire scroller le module des actu immobiliere*/
var slideTimeBetweenSteps = 1;	// General speed variable (Lower = slower)


var scrollingContainer = false;
var scrollingContent = false;
var containerHeight;
var contentHeight;	

var contentObjects = new Array();
var originalslideSpeed = false;
function slideContent(containerId)
{
	var topPos = contentObjects[containerId]['objRef'].style.top.replace(/[^\-0-9]/g,'');
	topPos = topPos - contentObjects[containerId]['slideSpeed'];
	if(topPos/1 + contentObjects[containerId]['contentHeight']/1<0)topPos = contentObjects[containerId]['containerHeight'];
	contentObjects[containerId]['objRef'].style.top = topPos + 'px';
	setTimeout('slideContent("' + containerId + '")',100);
	
}

function stopSliding()
{
	var containerId = this.id;
	contentObjects[containerId]['slideSpeed'] = 0;	
}

function restartSliding()
{
	var containerId = this.id;
	contentObjects[containerId]['slideSpeed'] = contentObjects[containerId]['originalSpeed'];
	
}
function initSlidingContent(containerId,slideSpeed)
{
	scrollingContainer = document.getElementById(containerId);
	scrollingContent = scrollingContainer.getElementsByTagName('DIV')[0];
	
	scrollingContainer.style.position = 'relative';
	scrollingContainer.style.overflow = 'hidden';
	scrollingContent.style.position = 'relative';
	
	scrollingContainer.onmouseover = stopSliding;
	scrollingContainer.onmouseout = restartSliding;
	
	originalslideSpeed = slideSpeed;
	
	scrollingContent.style.top = '0px';
	
	contentObjects[containerId] = new Array();
	contentObjects[containerId]['objRef'] = scrollingContent;
	contentObjects[containerId]['contentHeight'] = scrollingContent.offsetHeight;
	contentObjects[containerId]['containerHeight'] = scrollingContainer.clientHeight;
	contentObjects[containerId]['slideSpeed'] = slideSpeed;
	contentObjects[containerId]['originalSpeed'] = slideSpeed;
	
	slideContent(containerId);
	
}


function format(valeur,decimal,separateur) {
// formate un chiffre avec 'decimal' chiffres après la virgule et un separateur
	var deci=Math.round( Math.pow(10,decimal)*(Math.abs(valeur)-Math.floor(Math.abs(valeur)))) ; 
	var val=Math.floor(Math.abs(valeur));
	if ((decimal==0)||(deci==Math.pow(10,decimal))) {val=Math.floor(Math.abs(valeur)); deci=0;}
	var val_format=val+"";
	var nb=val_format.length;
	for (var i=1;i<4;i++) {
		if (val>=Math.pow(10,(3*i))) {
			val_format=val_format.substring(0,nb-(3*i))+separateur+val_format.substring(nb-(3*i));
		}
	}
	if (decimal>0) {
		var decim=""; 
		for (var j=0;j<(decimal-deci.toString().length);j++) {decim+="0";}
		deci=decim+deci.toString();
		val_format=val_format+"."+deci;
	}
	if (parseFloat(valeur)<0) {val_format="-"+val_format;}
	return val_format;
}

/*Fonction qui permet l'envoie du mail de contact sur la fiche de bien*/
function estimation_contact()
{
	document.getElementById("err_contact_nom").innerHTML = "";	
	document.getElementById("err_contact_prenom").innerHTML = "";	
	document.getElementById("err_contact_mail").innerHTML = "";	
	document.getElementById("err_contact_tel").innerHTML = "";	
	document.getElementById("err_contact_desc").innerHTML = "";	
	document.getElementById("err_contact_adresse").innerHTML = "";	
	
	var contact_civ 	= document.getElementById("contact_civ").value;
	var contact_nom 	= document.getElementById("contact_nom").value;
	var contact_prenom 	= document.getElementById("contact_prenom").value;
	var contact_mail 	= document.getElementById("contact_mail").value;
	var contact_tel 	= document.getElementById("contact_tel").value;
	var contact_desc 	= document.getElementById("contact_desc").value;
	var contact_adresse = document.getElementById("contact_adresse").value;
	var contact_par 	= document.getElementById("contact_par").value;	
	
	var err = 0;
	
	if(contact_nom == "")
	{
		document.getElementById("err_contact_nom").innerHTML = "Le champ 'Nom' est obligatoire.";
		err = 1;
	}	
	if(contact_prenom == "")
	{
		document.getElementById("err_contact_prenom").innerHTML = "Le champ 'Pr&eacute;nom' est obligatoire.";
		err = 1;
	}		
	if(contact_mail == "")
	{
		document.getElementById("err_contact_mail").innerHTML = "Le champ 'Mail' est obligatoire.";
		err = 1;
	}			
	if(contact_tel == "")
	{
		document.getElementById("err_contact_tel").innerHTML = "Le champ 'T&eacute;l&eacute;phone' est obligatoire.";
		err = 1;
	}				
	if(contact_desc == "")
	{
		document.getElementById("err_contact_desc").innerHTML = "Le champ 'Description' est obligatoire.";
		err = 1;
	}					
	if(contact_adresse == "")
	{
		document.getElementById("err_contact_adresse").innerHTML = "Le champ 'Adresse' est obligatoire.";
		err = 1;
	}	
	
	if(err != 1)
	{
			$("#contact_content").animate({ 
				opacity: 0.0
			  }, 1000, "linear", function(){
			$.post("ajax_estimation_contact_send.cfm",
			   { contact_civ: contact_civ, contact_nom: contact_nom, contact_prenom: contact_prenom, contact_mail:contact_mail, contact_tel: contact_tel, contact_desc: contact_desc, contact_adresse: contact_adresse,  contact_par: contact_par },
			   function(data){ 
			   
   					contact_content = '<table cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#FFFFFF">';
				   	contact_content += '<tr>';
           		   	contact_content += '<td width="10px" rowspan="17">&nbsp;</td>';
           		   	contact_content += '<td height="5px">&nbsp;</td>';
		   			contact_content += '<td width="10px" rowspan="17">&nbsp;</td>';
                    contact_content += '</tr>';
                    contact_content += '<tr>';
                    contact_content += '<td class="menu_left_label">Votre demande a bien été prise en compte et une agence membre vous contactera dans les meilleurs délais afin de réaliser votre estimation. </td>';
                    contact_content += '</tr>';
				   	contact_content += '<tr>';
           		   	contact_content += '<td height="5px">&nbsp;</td>';
                    contact_content += '</tr>';					
					contact_content += '</table>';
					
					//document.getElementById("contact_content").innerHTML = contact_content;
					document.getElementById("contact_content").innerHTML = data;
					$("#contact_content").animate({ 
						opacity: 1.0
					 }, 1000 );
			   });
			});
	}

}

function create_select_ville()
{
	var id_agence = document.getElementById("id_agence").value;
	//var search_type_bien = document.getElementById("search_type_bien").value;
	var search_type_bien = document.getElementsByName('search_type_bien');
	var ids = new Array();
	for(var i=0;i<search_type_bien.length;i++) {
	  if(search_type_bien[i].checked) ids[ids.length] = i+1;
	}
	var type_bien = ids.join(',');

	if(type_bien == "")
	{
		type_bien = "-1";
	}	
	
	var first_search_city_bien = document.getElementById("first_search_city_bien").value;
	$.post("ajax_select_ville_create.cfm", { id_agence:id_agence, search_type_bien:type_bien },
	function(data){ 
		var elSel = document.getElementById('search_city_bien');
		
		for (i = elSel.length - 1; i>=0; i--) {
			elSel.remove(i);
		}
		tab = data.split("|;|");
		for(i=0; i < tab.length - 1; i++)
		{
			val = tab[i].split("|:|");
			var elOptNew = document.createElement('option');
			elOptNew.text = val[1];
			elOptNew.value = val[0];
			
			if(first_search_city_bien == val[0])
			{
				elOptNew.selected = true;
			}
			
			try {
				elSel.add(elOptNew,null); // standards compliant; doesn't work in IE
			}
			catch(ex) {
				elSel.add(elOptNew); // IE only
			}
		}
	});		
}


function aff_live_result(search_city_bien)
{
	if(typeof(search_city_bien)=='undefined'){
		var search_city_bien = document.getElementById("search_city_bien").value;
	}
	
	var id_agence = document.getElementById("id_agence").value;
	//var search_type_bien = document.getElementById("search_type_bien").value;
	var search_prix_deb = document.getElementById("search_prix_deb").value;
	var search_prix_end = document.getElementById("search_prix_end").value;
	var search_surf_deb = document.getElementById("search_surf_deb").value;
	var search_surf_end = document.getElementById("search_surf_end").value;	
	
	var search_rayon = document.getElementById("search_rayon").value;		
	
	var search_type_bien = document.getElementsByName('search_type_bien');
	var ids = new Array();
	for(var i=0;i<search_type_bien.length;i++) {
	  if(search_type_bien[i].checked) ids[ids.length] = i+1;
	}
	var type_bien = ids.join(',');

	if(type_bien == "")
	{
		type_bien = "-1";
	}	
	
	var search_nb_piece = document.getElementsByName('search_nb_piece');
	var ids = new Array();
	for(var i=0;i<search_nb_piece.length;i++) {
	  if(search_nb_piece[i].checked) ids[ids.length] = i+1;
	}
	var nb_piece = ids.join(',');

	if(nb_piece == "")
	{
		nb_piece = "-1";
	}
	
	$.post("ajax_live_result.cfm", { id_agence:id_agence, search_type_bien:type_bien, search_prix_deb:search_prix_deb, search_prix_end:search_prix_end, search_surf_deb:search_surf_deb, search_surf_end:search_surf_end, search_city_bien:search_city_bien, nb_piece:nb_piece, search_rayon:search_rayon  },
	function(data){ 
		document.getElementById("LIVE_RESULT").innerHTML = data;
	});			
}



/************************************************************************/
/* Wilfried BELLON                                           12/10/2009 */
/* Gestion des slides avec des ranges customizable                      */
/************************************************************************/

var palier1 = 50;/*0 - 250 000*/
var palier_value1 = 5000;
var palier2 = 150;/*250 000 - 1 250 000*/
var palier_value2 = 10000;
var palier3 = 180;/*1 250 000 - 1 700 000*/
var palier_value3 = 15000;
var palier4 = 200;/*1 700 000 - 2 700 000*/
var palier_value4 = 40000;

var totalpalier1 = palier1*palier_value1;
var totalpalier2 = totalpalier1 + (palier2-palier1)*palier_value2;
var totalpalier3 = totalpalier2 + (palier3-palier2)*palier_value3;
var totalpalier4 = totalpalier3 + (palier4-palier3)*palier_value4;

function slide_range(value)
{
	if(value <= palier1)
	{
		new_value = value*palier_value1;	
	}
	else
	{
		if(value <= palier2)
		{
			new_value = totalpalier1 + (((palier2-palier1)-(palier2-value))*palier_value2);
		}
		else
		{
			if(value <= palier3)
			{
				new_value = totalpalier2 + (((palier3-palier2)-(palier3-value))*palier_value3);
			}
			else
			{
				new_value = totalpalier3 + (((palier4-palier3)-(palier4-value))*palier_value4);
			}		
		}
	}
	return Math.round(new_value);
}

function slide_range_reverse(value)
{
	new_value = palier4;
	if(value < totalpalier4)
	{
		if(value > totalpalier3)
		{
				new_value = palier4-((totalpalier4-value)/palier_value4);
		}
		else
		{
			if(value > totalpalier2)
			{
					new_value = palier4-((palier4-palier3)+((value-totalpalier2)/palier_value3));
			}
			else
			{
				if(value > totalpalier1)
				{
						new_value = palier1+((value-totalpalier1)/palier_value2);
				}
				else
				{
						new_value = value/palier_value1;
				}					
			}					
		}			
	}
	return Math.round(new_value);	
}

function validation(email)
{
 var verif = /^[\w\-]+(\.[\w\-]+)*@[\w\-]+(\.[\w\-]+)*\.[\w\-]{2,}$/;
 if (verif.exec(email) == null)
 {
	 return false;
 }
 else
 {
	 /*alert("Votre email est correcte");*/
	 return true;
 }
} 



/*************************************************************************/
/*                      Function cartographie                            */
/*************************************************************************/
function carto_affiche(id)
{
	switch(id)
	{
		case 1:
			//document.getElementById("aff_rech").style.display = "";
			document.getElementById("aff_result").style.display = "none";
			document.getElementById("aff_photos").style.display = "none";
			document.getElementById("map").style.display = "";
		break;
		
		case 2:
			//document.getElementById("aff_rech").style.display = "";
			document.getElementById("aff_result").style.display = "";
			document.getElementById("aff_photos").style.display = "none";
			document.getElementById("map").style.display = "";			
			document.getElementById("menu2").className = "carto_menu";			
			document.getElementById("menu1").className = "carto_menu_select";
		break;
		
		case 3:
			//document.getElementById("aff_rech").style.display = "";
			document.getElementById("aff_result").style.display = "none";
			document.getElementById("aff_photos").style.display = "";
			document.getElementById("map").style.display = "";			
			document.getElementById("menu2").className = "carto_menu_select";			
			document.getElementById("menu1").className = "carto_menu";			
		break;

		case 4:
			//document.getElementById("aff_rech").style.display = "";
			document.getElementById("aff_result").style.display = "";
			document.getElementById("aff_photos").style.display = "none";
			document.getElementById("map").style.display = "none";			
		break;		
		case 5:
			//document.getElementById("aff_rech").style.display = "";
			document.getElementById("aff_result").style.display = "none";
			document.getElementById("aff_photos").style.display = "none";
			document.getElementById("map").style.display = "";			
		break;				
		
		
		default:
			//document.getElementById("aff_rech").style.display = "";
			document.getElementById("map").style.display = "";
			document.getElementById("aff_result").style.display = "none";
			document.getElementById("aff_photos").style.display = "none";
		break;						
	}
}

function aff_resultat_requete_reverse()
{
	var center_cur = MaCarte.getCenter();
	var zoom_cur = MaCarte.getZoom();
	var bounds = MaCarte.getBounds();
	var SW = bounds.getSouthWest();
	var NE = bounds.getNorthEast();
	var SWLAT = SW.lat();
	var NELAT = NE.lat();	
	var SWLNG = SW.lng();
	var NELNG = NE.lng();		
	
	document.getElementById("SWLAT").value = SWLAT;
	document.getElementById("NELAT").value = NELAT;
	document.getElementById("SWLNG").value = SWLNG;
	document.getElementById("NELNG").value = NELNG;
	aff_resultat_requete(5);
}

function raz_carte()
{
	document.getElementById("SWLAT").value = 0;
	document.getElementById("NELAT").value = 0;
	document.getElementById("SWLNG").value = 0;
	document.getElementById("NELNG").value = 0;
}

function display_more(id)
{
	if(document.getElementById("more_"+id).style.display == "none")
	{
		document.getElementById("more_"+id).style.display = "";
		document.getElementById("more_title_"+id).innerHTML = "- <cfoutput>infos</cfoutput>";
	}
	else
	{
		document.getElementById("more_"+id).style.display = "none";
		document.getElementById("more_title_"+id).innerHTML = "+ <cfoutput>infos</cfoutput>";		
	}
}

function aff_resultat_requete(type_rech)
{
	//On gere le chargement de la fiche car sinon au chargement de la page on passe 5 fois ici donc 5 requete sql pour le serveur a cause des slide de prix et de surface
	if(type_rech != 2 || chargement_fiche == 4)
	{	
		MaCarte.clearOverlays();

		var search_city = document.getElementById("search_city_bien").value;
		//var search_type_bien = document.getElementById("search_type_bien").value;
		
		var search_type_bien = document.getElementsByName('search_type_bien');
		var ids = new Array();
		for(var i=0;i<search_type_bien.length;i++) {
		  if(search_type_bien[i].checked) ids[ids.length] = i+1;
		}
		var type_bien = ids.join(',');
	
		if(type_bien == "")
		{
			type_bien = "-1";
		}	
		
		var search_prix_deb = document.getElementById("search_prix_deb").value;
		var msg = "";
		var search_rayon = document.getElementById("search_rayon").value;		
		if (search_prix_deb != parseInt(search_prix_deb) && search_prix_deb != "")
		{
			document.getElementById("search_prix_deb").style.border = "1px solid red";
			msg = search_prix_deb + ' doit etre numérique';
		}
		var search_prix_end = document.getElementById("search_prix_end").value;
		if (search_prix_end != parseInt(search_prix_end) && search_prix_end != "")
		{
			document.getElementById("search_prix_end").style.border = "1px solid red";	
			msg = search_prix_end + ' doit etre numérique';
		}	
		var search_surf_deb = document.getElementById("search_surf_deb").value;						
		if (search_surf_deb != parseInt(search_surf_deb) && search_surf_deb != "")
		{
			document.getElementById("search_surf_deb").style.border = "1px solid red";	
			msg = search_surf_deb + ' doit etre numérique';
		}	
		var search_surf_end = document.getElementById("search_surf_end").value;
		if (search_surf_end != parseInt(search_surf_end) && search_surf_end != "")
		{
			document.getElementById("search_surf_end").style.border = "1px solid red";	
			msg = search_surf_end + ' doit etre numérique';
		}
	
		if(search_prix_end == 0)
		{
			search_prix_end = "";
		}
		if(search_surf_end == 0)
		{
			search_surf_end = 100000;
		}		
		
		var search_nb_piece = document.getElementsByName('search_nb_piece');
		var ids = new Array();
		for(var i=0;i<search_nb_piece.length;i++) {
		  if(search_nb_piece[i].checked) ids[ids.length] = i+1;
		}
		var val = ids.join(',');
	
		if(val == "")
		{
			val = "-1";
		}
	
		var SWLAT = document.getElementById("SWLAT").value;
		var NELAT = document.getElementById("NELAT").value;
		var SWLNG = document.getElementById("SWLNG").value;
		var NELNG = document.getElementById("NELNG").value;
		if(msg == "")
		{	
				$.post("ajax_recherche_carto_result.cfm", { search_type_bien: type_bien, search_city: search_city,  search_prix_deb:search_prix_deb, search_prix_end:search_prix_end, search_surf_deb:search_surf_deb, search_surf_end:search_surf_end, search_nb_piece:val, SWLAT:SWLAT, NELAT:NELAT, SWLNG:SWLNG, NELNG:NELNG, search_nbpage:NBTotal_Affichage, search_rayon:search_rayon, type_rech:type_rech},
					function(data){
						Arr = data.split('|;|');
						nbBien = Arr[1];
						
						document.getElementById("recherche_resultat").innerHTML = 'RESULTATS : '+nbBien;																	
						
						if(nbBien > 0)
						{
							if(nbBien > NBTotal_Affichage)
							{						
								document.getElementById("recherche_resultat").innerHTML = 'RESULTATS : +'+NBTotal_Affichage;																		
							}
							else
							{
								document.getElementById("recherche_resultat").innerHTML = 'RESULTATS : '+nbBien;																		
							}
							myHTMLdetails = Arr[2];
							document.getElementById("aff_result").innerHTML = myHTMLdetails + Arr[4];
							Arr2 = Arr[3].split('|*|');
							lat = 0;
							lng = 0;		
							for(i=1; i < (Arr2.length); i++)
							{
								Tab = Arr2[i].split('|:|');
								if (Tab[1] == 200)
								{
									carto_addMarker(Tab,i);
									lat += parseFloat(Tab[2]);
									lng += parseFloat(Tab[3]);
								}
							}
						}
						else
						{
							document.getElementById("aff_result").innerHTML = "Aucun résultat sur la carte.";						
						}
				});	
		}
		else
		{
			document.getElementById("aff_result").innerHTML = "Aucun résultat sur la carte.";
		}
	}
}

function showImage(id_bien)
{
	$.post("ajax_recherche_carto_media_result.cfm", { id_bien: id_bien},
			function(data){	
				carto_affiche(3);
				document.getElementById("aff_photos").innerHTML = data;
  	});							
}

function change_photo(src)
{
	document.getElementById("aff_bigone").innerHTML = '<img style="max-height:250px; max-width:250px" src="'+src+'" />';
}
function showDetails(num)
{
	carto_affiche(2);
	InfoWindowHtml = document.getElementById("InfoWindowHtml_"+num).innerHTML;
	myMarkers[num].openInfoWindowHtml(InfoWindowHtml);
} 
 
function carto_addMarker(Tab,num) {
	var marker = new GMarker(new GLatLng(Tab[2], Tab[3]),markerOptions);
	
	GEvent.addListener(marker, "click", function(latlng) {
		showDetails(Tab[0]);
	});	
		
	MaCarte.addOverlay(marker);
	myMarkers[Tab[0]] = marker;
}