$(document).ready(function() {
	// Ouvre dans un nouvel onglet ou nouvelle fenetre
	$("a.lien_externe").click(function() {
		window.open(this.href); return false;
	});
	// Force les styles css pour IE
	$("#footer_nav1 div:last-child").css({ "border-right" : "0px", "margin-right" : "0px" });

	// Formulaire
	$(".civilite_radio_label").click(function(){
		$(".civilite_radio_label_selected:not(:checked)").removeClass("civilite_radio_label_selected");
		$(this).addClass("civilite_radio_label_selected");
	});
	$(".moyen_contact_radio_label").click(function(){
		$(".moyen_contact_radio_label_selected:not(:checked)").removeClass("moyen_contact_radio_label_selected");
		$(this).addClass("moyen_contact_radio_label_selected");
	});
	
	$("#label_telephone").click( function() {							// SI on clique "Telephone"
		$("#etoile_moyen_contact_telephone").css("display", "inline");
		$(".telephoneformError").css("display", "inline");
		$("#telephone").addClass("validate[required,custom[telephone]]");
	});
	$("#label_email").click( function() {							// SI on clique "Email"
		$("#etoile_moyen_contact_telephone").css("display", "none");
		$(".telephoneformError").css("display", "none");
		$("#telephone").removeClass();
	});
	
	$("area").hover(function(){		
		if(!$('dot_select').is(':visible')){	
			var coords = $(this).attr('coords').split(',');
			$('#dot_select').css({'top':coords[1]+'px','left':coords[0]+'px'})
			$('#dot_select a').attr('onClick',$(this).attr('onClick'));
			$('#dot_select a').attr('title',$(this).attr('title'));
			$('#dot_select').show();
		}
	});
	$("#dot_select").mouseleave(function(){
		$('#dot_select').hide();
	});	
	 $("#carousel").featureCarousel({
		'autoPlay':0,
		movedToCenter: function($feature) {
			var imageAction = $feature.find('.carousel-image').parent().attr('onClick');
			eval(imageAction);
		}
	 });
	 
	 $( "#accordion" ).accordion({
			autoHeight: false,
			navigation: true,
			active:false,
			collapsible: true
		});
});

function afficherAstuce(id){
	$('.astuce_item').hide();
	$('#astuce_'+id).show();
	$('#edito_content_texte h2').html($('#astuce_'+id).children('h3').html());
	return false;
}
function afficherMaison(id){
	$('.maison_item').hide();
	$('#maison_'+id).show();
	/*$('.maison_general').attr('href','img/plans/general_'+ id +'.pdf');*/
	$('#edito_content_header_title h1').html($('#maison_'+id).children('h3').html());
	return false;
}
sfHover = function() {  var sfEls = document.getElementById("menu").getElementsByTagName("LI"); 
		for (var i=0; i<sfEls.length; i++) {  
			sfEls[i].onmouseover=function() {   
				this.className+=" sfhover";     
			}                       
			sfEls[i].onmouseout=function() {       
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");  
			}    
		}       
	}       
	if (window.attachEvent) window.attachEvent("onload", sfHover);  
