var api;
// indicateur de chargement du détail d'une annonce
var loading_detail = false;
// id du détail affiché
var detail_id;
var vitesse_animations = 600;

var page_detailbien;

if (typeof console != "object") {
	var console = {
		'log':function(){}
	};
}
var locationPage = {
        put: function(hash, win) {
            (win || window).location.hash = encodeURIComponent(hash);
        },
        get: function(win) {
            var hash = ((win || window).location.hash).replace(/^#/, '');
            return $.browser.fx ? hash : decodeURIComponent(hash);
        }
};

$(document).ready(function(){

	// style des select
	$('.select').mSelect();
	// hover des select
	$(".mSelect").hover(    
	  function () {
		$(this).parent().removeClass('no_hover');
		$(this).parent().addClass('hover');
	  },
	  function () {
		$(this).parent().removeClass('hover');
		$(this).parent().addClass('no_hover');
	  }
	);
	// hover des options dans les select
	$(".mOption").hover(    
	  function () {
		$(this).css('color','#bc92c2');
	  },
	  function () {
		$(this).css('color','#FFF');
	  }
	);

	// recherche home
	$('#rechercheBTN').click(function(){
		var selection = $('#locationBTN').find('.mRadio[checked]').val();
		var type = $('#appartementBTN').find('.mSelect:visible').find('.mRadio[checked]').val();
		var surface = $('#surfaceBTN').find('.mRadio[checked]').val();
		var prix = $('#prixBTN').find('.mSelect:visible').find('.mRadio[checked]').val();
		
		var params = "?type="+type+"&surface="+surface+"&prix="+prix;
		
		if (selection == "location")
			window.location.replace(location_url+params);
		if (selection == "vente")
			window.location.replace(vente_url+params);
		if (selection == "prestige_location")
			window.location.replace(prestige_location_url+params);
		if (selection == "prestige_vente")
			window.location.replace(prestige_vente_url+params);
	});
	// affichage du select prix correspondant au type
	$('#select-prix-vente').hide();
	$('#locationBTN').find('.mOption').live('click', function(){
		var type = $('#locationBTN').find('.mRadio[checked]').val();
		$('#select-prix-vente').hide();
		$('#select-prix-location').hide();
		
		if (type == "location")
			$('#select-prix-location').show();
		if (type == "vente")
			$('#select-prix-vente').show();
		if (type == "prestige_location")
			$('#select-prix-location').show();
		if (type == "prestige_vente")
			$('#select-prix-vente').show();
	});
	// affichage du select catégorie correspondant au type
	$('#select-categorie-vente, #select-categorie-prestige').hide();
	$('#locationBTN').find('.mOption').live('click', function(){
		var type = $('#locationBTN').find('.mRadio[checked]').val();
		$('#select-categorie-location').hide();
		$('#select-categorie-vente').hide();
		$('#select-categorie-prestige').hide();
		if (type == "location")
			$('#select-categorie-location').show();
		if (type == "vente")
			$('#select-categorie-vente').show();
		if (type == "prestige_location")
			$('#select-categorie-prestige').show();
		if (type == "prestige_vente")
			$('#select-categorie-prestige').show();
	});
	

	if(page_id == 190){
		$('body').addClass('fond-prestige');
	}

	// séparation liens utiles
	// if ($(".lien-utile").length > 0){
		// $(".lien-utile:nth-child(5n+6)").css('background-color', '#DEDEDE').before("<div class='liens-separation'></div>");
	// }

	// google maps contact
	if ($("#google_map").length > 0)
		initialize_google_maps();

	// cufon
	
	// style des boutons
	$(".bouton").prepend("<div class='bouton-gauche'></div>").append("<div class='bouton-droite'></div>");

	// récupération et affichage des annonces
	if ($(".liste-biens").length > 0)
		get_annonces();
	
	//impression
	$('#btn_imprimer').live('click', function(){
		window.print();
		return false;
	});
	// criteres de selection
	$('#select-produit .mOption').click(function(){
		// redirection select location/vente
		var valeur = $(this).children('.mRadio').val();
		if (valeur == "tous")
			window.location.replace(location_url);
		else if (valeur == "meuble")
			window.location.replace(location_meuble_url);
		else if (valeur == "vide")
			window.location.replace(location_vide_url);
		else if(valeur == "prestige_location")
			window.location.replace(prestige_location_url);
		else if(valeur == "prestige_vente")
			window.location.replace(prestige_vente_url);
	});
	$('#select-type .mOption').click(function(){
		selection_critere();
	});
	$('#select-surface .mOption').click(function(){
		selection_critere();
	});
	$('#select-prix .mOption').click(function(){
		selection_critere();
	});
	
	// communauté
	if ($('#inter-communaute').length > 0){
	
		// twitter
	    $.jTwitter('Cabinet_Ravier', 1, function(data){
			// console.log(data);
			$.each(data, function(i, post){
				// console.log(post);
				var pos_lien = post.text.indexOf('http');
				console.log("plouf "+pos_lien);
				if (pos_lien != -1){
					var texte = post.text.substr(0,pos_lien);
					var lien = post.text.slice(pos_lien);
				}
				else{
					var texte = post.text;
					var lien = "";
				}
				
				$('#flux_twitter .text_fb_twitter').append(
					"<span class='violet'>"+texte+"</span><br />"+lien
				);
				
				// date
				if (lang === "fr")
					var date = parseTwitterDate_fr(post.created_at);
				else
					var date = parseTwitterDate_en(post.created_at);
				$('#flux_twitter .date-communaute').append(date);
			});
		});
	
		// flickr
		// id récuperable sur http://idgettr.com/
		// $('#flickrImages').flickrush({id:'45388767@N02', limit: 1, random: false});
	
	
		// facebook
		// fqlQuery();
		// FB.api({
			// method: 'fql.query',
			// query: 'SELECT actor_id, message FROM stream WHERE source_id = 565862940 limit 2'
			// },
			// function(response) {
				// console.log(response);
			// }
		// );
		
		// window.fbAsyncInit = function() {
			// FB.init({
				// appId: 220442631322354,
				// status: true,
				// cookie: true,
				// xfbml: true
			// });
			
			// FB.getLoginStatus(function(response) {
				// var query = FB.Data.query('SELECT actor_id, message FROM stream WHERE source_id = {0} limit 2', 565862940);
				// query.wait(function(rows) {
					// console.log(rows);
					// document.getElementById('flux_fb').innerHTML = 'Your name: ' + rows[0].message + "<br />";
				// });
			// });
		// };
		
		// FB.api('/me', function(response) {
			// var query = FB.Data.query('SELECT actor_id, message FROM stream WHERE source_id = {0} limit 2', 565862940);
			// query.wait(function(rows) {
				// console.log(rows);
				// document.getElementById('flux_fb').innerHTML = 'Your name: ' + rows[0].message + "<br />";
			// });
		// });
		
		// var query = FB.Data.query('SELECT actor_id, message FROM stream WHERE source_id = {0} limit 2', 565862940);
		// query.wait(function(rows) {
			// console.log("hop");
			// console.log(rows);
			// document.getElementById('flux_fb').innerHTML = 'message ' + rows[0].message;
		// });https://graph.facebook.com/me/feed/?access_token=VOTRE_ACCESS_TOKEN
		// $.get("https://graph.facebook.com/me/feed/?access_token=220442631322354%7C8cfeff758f1d5fabb899eae8.1-565862940%7CW5KlUT_DU5GAKztuu-c67ONNfNU&limit=1&callback=?", function(json){
			// console.log(json.data);
		// });
	}
	
	// form gerance
	$('#envoyer_form_gerance').click(function(){
		var login = $('#login_gerance').val();
		var password = $('#password_gerance').val();
		window.open('http://www.egiweb.net/admin/pwd.php?login='+login+'&amp;password='+password);
	});
	
	// form expertise
	var sending = false;
	$('#bouton-expertise').click(function(){
		if (!sending){
			if ($('input[name=nom]').val() == "" || $('input[name=prenom]').val() == "" || $('input[name=tel]').val() == "" || $('input[name=mail]').val() == "")
				alert("Merci de remplir tous les champs obligatoires");
			else{
				sending = true;
				
				var form_data = $('#expertise-form').find('form').serialize();
				var type = $('.big_select').find('.mRadio[checked]').val();
				
				$.ajax({
					type: "POST",
					url: "/wp-admin/admin-ajax.php",
					data: "action=mail_expertise&"+form_data+"&type="+type,
					success: function(data){
						$('#expertise-form').html(data);
						sending = false;
					}
				});
			}
		}
	});
	
});
	
function parseTwitterDate_en(stamp){
	var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
	var date = new Date(Date.parse(stamp));
	var day = date.getDate();
	var month = date.getMonth();
	var yy = date.getYear();
	var year = (yy < 1000) ? yy + 1900 : yy;

	return day + " " + months[month] + " " + year;
}
function parseTwitterDate_fr(stamp){
	// console.log(stamp);
	// var date = new Date(Date.parse(stamp)).toLocaleString();
	// date_tab = date.split(" ");
	// return date_tab[1]+" "+date_tab[2]+" "+date_tab[3];
	
	var months = new Array('Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Decembre');
	var date = new Date(Date.parse(stamp));
	var day = date.getDate();
	var month = date.getMonth();
	var yy = date.getYear();
	var year = (yy < 1000) ? yy + 1900 : yy;

	return day + " " + months[month] + " " + year;
}
	
function initialize_google_maps() {
	var latlng = new google.maps.LatLng(48.857018, 2.272528);
	var myOptions = {
		zoom: 17,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
		// mapTypeId: google.maps.MapTypeId.HYBRID 
	};
	var map = new google.maps.Map(document.getElementById("google_map"), myOptions);
	
	var ravier = new google.maps.LatLng(48.857018, 2.272528);
	var marker = new google.maps.Marker({
		position: ravier, 
		map: map,
		icon: template_url+'/images/marker_gmap.png'
	});
	
	// console.log($('#map_canvas > div > div > div > div').find('img'));
	
	// $('#map_canvas > div > div > div > div').each( function () {
				 
		// if($(this).css('zIndex') == '0'){
			// $(this).find('img').each( function() {
				// $(this).css({ opacity: '0.25' });
			// });
		// }

	// });
}

function init_annonces(){

	// préparation rotation IE
	$('.titre-fleche').rotate({
		animateTo: 0,
		duration: 0
	});
	
	// survol des vignettes
	$('.vignette:not(.actif)').mouseover(function(){
		$(this).addClass('hover');
	}).mouseout(function(){
		$(this).removeClass('hover');
	});
	$('.vignette').click(function(e){
		e.preventDefault();
		
		// click vignette => chargement détail
		$('.liste-biens').find('.tri-liste').fadeTo(0,1).css('cursor', 'pointer');
		$('#galleria').remove();
		var id = $(this).parents('.bien').children('.bien_id').val();
		if (!loading_detail){
			loading_detail = true;
			$('.detail-annonce').hide().empty();
			var detail = $(this).parents('.liste-biens').find('.detail-annonce');
			//var id = $(this).parents('.bien').data('id');
			$('.liste-biens').find('.vignette').removeClass('actif');
			
			if (id == detail_id){
				detail_id = 0;
				// detail.slideUp(vitesse_animations, function(){loading_detail = false;});
				detail.hide().empty();
				loading_detail = false;
			}
			else{
				$(this).parents('.liste-biens').find('.tri-liste').fadeTo(0,0.3).css('cursor', 'auto');
				$(this).addClass('actif');
				mode_scroll($(this).parents('.liste-biens'));
				detail_id = id;
				
				// $('.detail-annonce').html("<img src='"+template_url+"/images/loading.gif' />");
				
				// page détail prestige
				console.log($(this).parents('.bien').find('.bien_prestige'));
				
				var theme_url = '';
				if (page_id == 190 || $(this).parents('.bien').find('.bien_prestige').val() == "Oui"){
					var url = template_url+"/scripts/php/nobei.get-oneannonce-prestige.php";
					theme_url = template_url+'/scripts/js/galleria.prestige.js';
				}
				else{
					var url = template_url+"/scripts/php/nobei.get-oneannonce.php";
					theme_url = template_url+'/scripts/js/galleria.classic.js';
				}
				$.ajax({
					url: url,
					type: 'post',
					data: "annonce_id="+id+"&urlphp="+($(this).parents('.bien').find('.bien_urlphp').val())+"&lang="+lang,
					success: function(data){
						
						detail.html(data);
						if (detail.is(':hidden')){
							detail.stop().show();
						}
						// setTimeout(function(){loading_detail = false}, vitesse_animations);
						loading_detail = false;
						// if (page_id == 190)
							// $("#liste-biens-0 .conteneur-biens").css({'height':$("#liste-biens-0 #produit_left_prestige").height()+900+'px'});
						
						Galleria.removeinstance();
						
						// console.log(theme_url);
						Galleria.loadTheme(theme_url);
						$('#galleria').galleria({imageCrop:true,imagePan:true,showInfo:false});
						
						$('.title_desc').each(function(){
							console.log($(this));
							console.log($(this).next());
							console.log("-");
							
							$(this).next().height($(this).height());
						});
					}
				});
				
				locationPage.put($(this).parents('.liste-biens').attr('id'));
				//on désactive le vrai lien
				return false;
			}
		}
	});
	$('.croix').live('click', function(){
		var liste_biens = $(this).parents('.liste-biens');
	
		$(this).parents('.liste-biens').find('.tri-liste').fadeTo(0,1).css('cursor', 'pointer');
		$('#galleria').remove();
	
		$(this).parents('.liste-biens').find('.vignette').removeClass('actif');
		var detail = $(this).parents('.liste-biens').find('.detail-annonce');
		detail_id = 0;
		// detail.slideUp(vitesse_animations, function(){loading_detail = false;});
		detail.hide().empty();
		loading_detail = false;
		
		//au depart on ajute tout en mode liste
			mode_liste(liste_biens);
	
	});
	
	// Tri des annonces
	$('.tri-prix').click(function(){
		trier($(this).parents('.liste-biens').find('.biens-scrolling-area'), 'prix');
		$('.outils-tri div').removeClass('tri-on');
		$(this).addClass('tri-on');
	});
	$('.tri-surface').click(function(){
		trier($(this).parents('.liste-biens').find('.biens-scrolling-area'), 'surface');
		$('.outils-tri div').removeClass('tri-on');
		$(this).addClass('tri-on');
	});
	$('.tri-date').click(function(){
		trier($(this).parents('.liste-biens').find('.biens-scrolling-area'), 'date');
		$('.outils-tri div').removeClass('tri-on');
		$(this).addClass('tri-on');
	});
	
	// affichage des biens en liste avec ou sans scroll	
	$('.tri-scroll').hover(function(){
		// console.log('hover');
		$(this).addClass('tri-scroll-hover');
		// $(this).attr('src', $(this).attr('src').replace('.jpg', '-hover.jpg'));
	},function(){
		$(this).removeClass('tri-scroll-hover');
		// $(this).attr('src', $(this).attr('src').replace('-hover.jpg', '.jpg'));
	}).click(function(){
		mode_scroll($(this).parents('.liste-biens'));
	});
	
	$('.tri-liste').hover(function(){
		$(this).addClass('tri-liste-hover');
		// ('src', $(this).attr('src').replace('.jpg', '-hover.jpg'));
		// $(this).attr('src', $(this).attr('src').replace('.jpg', '-hover.jpg'));
	},function(){
		$(this).removeClass('tri-liste-hover');
		// $(this).attr('src', $(this).attr('src').replace('-hover.jpg', '.jpg'));
	}).click(function(){
		mode_liste($(this).parents('.liste-biens'));
	});
	
	//au depart on ajute tout en mode liste
	$('.liste-biens').each(function(){
		mode_liste($(this),true);
	});
	
	// $('.detail-annonce').each(function(){
		// if ($(this).is(':empty'))
			// $(this).hide();
	// });
	$('.detail-annonce').hide();
	$('.bien_id').each(function(){
		if ($(this).val() == detail_id)
			$(this).parents('.conteneur-biens').find('.detail-annonce').show();
	});
	
	// Développement des blocs annonces "x pièces"
	$('.titre-liste,.titre-fleche').bind('click', function(){
	
		var fleche = $(this).parents('.titre-outils').children('.titre-fleche');
		
		if (fleche.data('angle') == 180){
			angle = 0;
			$(this).parents('.liste-biens').find('.jspContainer').slideDown(vitesse_animations);
			$(this).parents('.liste-biens').find('.conteneur-biens').slideDown(vitesse_animations);
		}
		else{
			angle = 180;
			$(this).parents('.liste-biens').find('.jspContainer').slideUp(vitesse_animations);
			$(this).parents('.liste-biens').find('.conteneur-biens').slideUp(vitesse_animations);
		}
			
		fleche.data('angle', angle);		
		fleche.rotate({
			animateTo: angle,
			duration: vitesse_animations
		});
	});
}

function selection_critere(){
	// console.log("recherche");

	$('#liste-noresult').hide();
	
	$('.liste-biens').find('.jspContainer').show();
	$('.liste-biens').find('.conteneur-biens').show();
	$('.bien').show();
	$('.liste-biens').show();

	// type
	if ($('#select-type').find('.mRadio[checked]').length > 0){
		var type = $('#select-type').find('.mRadio[checked]').val();
		if (type != '-1'){
			$('.liste-biens:not(#liste-biens-'+type+')').hide();
		}
	}
	
	// surface
	if ($('#select-type').find('.mRadio[checked]').length > 0){
		var surface = $('#select-surface').find('.mRadio[checked]').val();
		if (surface != '-1'){
			// console.log("surface "+surface);
		
			if (surface[0] == '-'){
				var min = -1;
				var max = parseInt(surface.substring(1));
			}
			else if(surface[0] == '+'){
				var min = parseInt(surface.substring(1));
				var max = 3000;
			}
			else{
				var surface_tab = surface.split('-');
				var min = parseInt(surface_tab[0]);
				var max = parseInt(surface_tab[1]);
			}
			
			$('.bien').each(function(){
				var surface_bien = $(this).find('.bien_surface').val();
				if (surface_bien > max || surface_bien < min)
					$(this).hide();
			});
		}
	}
	
	// prix
	if ($('#select-prix').find('.mRadio[checked]').length > 0){
		var prix = $('#select-prix').find('.mRadio[checked]').val();
		if (prix != '-1'){
			// console.log("prix "+prix);
		
			if (prix[0] == '-'){
				var min = -1;
				var max = parseInt(prix.substring(1));
			}
			else if(prix[0] == '+'){
				var min = parseInt(prix.substring(1));
				var max = 1000000000000000000000;
			}
			else{
				var prix_tab = prix.split('-');
				var min = parseInt(prix_tab[0]);
				var max = parseInt(prix_tab[1]);
			}
			
			$('.bien').each(function(){
				var prix_bien = $(this).find('.bien_prix').val();
				console.log(prix_bien+" "+min+" "+max);
				if (prix_bien > max || prix_bien < min)
					$(this).hide();
			});
			
		}
	}
	
	// nettoyage
	$('.vignette').removeClass('actif');
	detail_id = 0;
	$('.detail-annonce').hide().html('');
	$('.liste-biens').each(function(){
		mode_scroll($(this));
	});
	// on cache les blocs qui n'ont plus d'annonces
	$('.liste-biens').each(function(){
		if ($(this).find('.bien:visible').length == 0)
			$(this).hide();
	});
	
	if($('.liste-biens').find('.bien:visible').length == 0)
		$('#liste-noresult').show();
}

function mode_liste(zone){
     mode_liste(zone,false)
}

function mode_liste(zone,firsttime){
	// console.log('liste');
	var biens = zone.children('.conteneur-biens').children('.biens');
	
	if (firsttime || zone.find('.conteneur-biens').is(':visible') && biens.find('.bien').length > 6 && zone.find('.detail-annonce').is(':hidden')){
		zone.find('.tri-scroll').removeClass('tri-scroll-on');
		zone.find('.tri-liste').addClass('tri-liste-on');
		
		var api = zone.find('.scroll-pane').data('jsp');
			
		if(!firsttime)
			api.scrollTo(0,0);
		
		zone.children('.conteneur-biens').css('width','100%');
		biens.find('.biens-scrolling-area').css('width','auto');
		// console.log(biens.find('.biens-scrolling-area').width());
		var hauteur = Math.ceil(biens.find('.bien').length/6)*(parseInt($('.bien:visible').css('margin-top'))+$('.bien:visible').height());
		hauteur = hauteur+5;
		biens.css({'width':'100%'});
		if(!firsttime){
			api.reinitialise();
			$('.jspVerticalBar').hide();
			biens.children('.jspContainer').animate({height:hauteur+'px'},vitesse_animations);
			biens.animate({height:hauteur+'px'},vitesse_animations,function(){
					api.reinitialise();
			});
		}
		else{
			biens.css({height:hauteur+'px'});
		}
	}
}

function mode_scroll(zone){
	var biens = zone.children('.conteneur-biens').children('.biens');
	
	if (zone.find('.conteneur-biens').is(':visible')){
		zone.find('.tri-liste').removeClass('tri-liste-on');
		zone.find('.tri-scroll').addClass('tri-scroll-on');
		
		var largeur = ($('.bien:visible').width()+parseInt($('.bien:visible').css('margin-right')))*(biens.find('.bien:visible').length);
		// console.log(zone.find('.titre-liste').html()+" "+biens.find('.bien:visible').length);
		// console.log(largeur);
		zone.children('.conteneur-biens').css('width','960px');
		
		biens.animate({'height':'166px'},vitesse_animations,function(){
			biens.find('.biens-scrolling-area').css('width',largeur+'px');
			var api = zone.find('.scroll-pane').jScrollPane().data('jsp');
			// api.reinitialise();
		});
	}
	
	zone.find('.jspHorizontalBar').show();
	if (biens.find('.bien:visible').length <= 6){
		// console.log(zone.find('.jspContainer'));
		zone.find('.jspHorizontalBar').hide();
	}
	else{
		// console.log('pas hide');
	}
}

function trier(zone, critere){

	function bien(critere, objet){
		this.critere = critere;
		this.objet = objet;
	}
	function tri(thisObject,thatObject) {
		if (critere != 'date'){
			if (thisObject.critere > thatObject.critere)
				return 1;
			else if (thisObject.critere < thatObject.critere)
				return -1;
		}
		else{
			if (thisObject.critere < thatObject.critere)
				return 1;
			else if (thisObject.critere > thatObject.critere)
				return -1;
		}
		return 0;
	}

	var biens = new Array();
	zone.find('.bien').each(function(){
		// console.log("date "+parseInt($(this).find('.bien_'+critere).val().replace(/-/gi, '')));
		 biens.push(new bien(parseInt($(this).find('.bien_'+critere).val().replace(/-/gi, '')), $(this)));
	});
	
	biens.sort(tri);
	
	$.each(biens, function(key, value){
		value.objet.appendTo(zone);
	});
}

function get_annonces(){
	// contenu-listes
	// $('.jspContainer').slideUp(vitesse_animations);
	// $('.conteneur-biens').slideUp(vitesse_animations);
	// $('.titre-fleche').rotate({
		// animateTo: 180,
		// duration: vitesse_animations
	// });
	$('#loading_all').height($('#contenu-listes').height()+20).fadeTo(200, 0.8);
	$('#loading_all').hide();
	$('.liste-biens').show();
	init_annonces();
	/*
	$.ajax({
		url: template_url+"/scripts/php/gimond.get-annonces.php",
		dataType: 'json',
		type: 'post',
		data: "produit="+$('#select-produit input[checked="checked"]').val()+"type="+$('#select-type input[checked="checked"]').val()+"&surface="+$('#select-surface input[checked="checked"]').val()+"&prix="+$('#select-prix input[checked="checked"]').val(),
		success: function(data){
			$('.liste-biens:visible').remove();
			$('#loading_all').hide();
			
			$.each(data, function() {
				var bloc = $('.liste-biens:first').clone().appendTo('#contenu-listes');
				bloc.find('.titre-liste').html(this.libelle);
				bloc.find('.bien').remove();
				$.each(this.annonces, function() {
					// création des vignettes
					var conteneur_biens = bloc.find('.biens-scrolling-area');
					var bien = $('.liste-biens:first').find('.bien').clone().prependTo(conteneur_biens);
					
					// données pour le tri
					bien.data('id', this.id);
					bien.data('prix', this.prix);
					bien.data('surface', this.surface);
					bien.data('date', this.date);
					
					// remplacement des infos
					bien.find('.vignette').css({"background-image":"url("+this.miniature+")"});
					bien.find('.nb_photos').prepend(this.nb_photos+" photos");
					bien.find('.vignette-desc .violet:first').text(this.surface+" m²");
					bien.find('.vignette-desc .violet:last').text(this.prix+" €");
					if (this.coeur == 1)
						bien.find('.vignette-desc').addClass('coeur');
					if (this.prestige == 1)
						bien.find('.vignette').append('<img src="'+template_url+'/images/liste-prestige-vignette.png" class="prestige-vignette" />');
				});
				bloc.show();
			});
			
			init_annonces();
		}
	});*/
}

	Cufon.replace('.titre', { fontFamily: 'Univers-condensedOfficial' ,	color: '-linear-gradient(#6c457a, #543363)'});
	Cufon.replace('#mail .cufon');
	Cufon.replace('#selection .cufon');
	Cufon.replace('#home-bottom-cadre .titre-bottom', {color: '#3E3E3E'});
	Cufon.replace('.titre-contact', {color: '#845296'});
	Cufon.replace('.texte-alerte', {color: '#FFFFFF'});

