// attention a bien faire du javascript non obtrusif

$(document).ready(function(){ 

	// fonction qui permet au clic des trois thumbs de remplacer l'image principale et de recuperer la legende
	$(".thumbs a").click(function(){
		  var largePath = $(this).attr("href");
		  var largeAlt = $(this).attr("title");
		  $("#largeImg").attr({ src: largePath, alt: largeAlt });
		  $("em.credit").html(" " + largeAlt + ""); return false;
	});

	// share this like
	$("#partager a").click(function(){
		$("#on_partage").toggle("fast");
	});

	// highlight sur le formulaire
	$('#commentaires form input, #commentaires form textarea, #commentaires form select, #expat_form input, #expat_form textarea').focus(function(){
		$(this).parents('.row').addClass("over");
	}).blur(function(){
		$(this).parents('.row').removeClass("over");
	});

	// afficher et ou masquer le formulaire de commentaires
	
//  if ($(".bloc_comment").length == 0) {
    //$("#insert_post").show();
  //}
  //else {
    //$("#insert_post").hide();
  //}

	$("#title_comment").click(function(){
		$("#insert_post").slideToggle("slow");
		$(this).css('visibility','hidden');
	});

	// rollover sur le bouton commentaire
	$("#title_comment").hover(function() {
	    $(this).attr("src", $(this).attr("src").split(".").join("-hover."));
	  }, function() {
	    $(this).attr("src", $(this).attr("src").split("-hover.").join("."));
	});

	// Formulaire envoyer a un ami
	$('#envoyer_ami input, #envoyer_ami textarea').focus(function(){
		$(this).parents('li').addClass("over");
	}).blur(function(){
		$(this).parents('li').removeClass("over");
	});
	
	// vive les sondages
	$("#list_nav li h3").parents("li").children("div").hide();

	$("#list_nav li h3 a").click (function () {
    $("#list_nav li h3").parents("li").children("div").hide();
    $(this).parents("h3").parents("li").children("div").slideDown();
  });

});
