$(document).ready(function() {
	
	$('#slideshow').cycle({
		pager: '.header_slider_pager',
		pagerAnchorBuilder: function(idx, slide) { 
			return '<a href="#">' + $(slide).attr("rel") + '</a>'; 
		} 
	});
						   
	$(".grille_wrapper").each(function(){
		var id_grille_wrapper = $(this).attr("id");
		var height_grille_wrapper = $(this).height();
		$("#"+id_grille_wrapper).children("div[rel='col']").css("height",height_grille_wrapper);
	});

	$(".ds_cat").click(function() {
		related_post_cat($(this).attr("rel"),"on");						
	});
	$(".ds_cat").mouseleave(function() {
		related_post_cat($(this).attr("rel"),"out");						
	});
	$("#slideshow").show();
	
	$(".thumbnail A").mouseover(function() {
		$(".single_g .div_vignette IMG").attr("src",$(this).attr("href"));
	});
	$("#s").focus(function() {
		if($(this).val()=="Rechercher..."){
			$(this).val("");
		}
	});
	$("#s").bind('focusout', function(){
		if($(this).val()==""){
			$(this).val("Rechercher...");
		}
	});
});
	
function related_post_cat(id,comment) {
	if(comment == "on") {
		$("#ds_cat_"+id).addClass("ds_cat_on");
		$("#related_post_cat_"+id).slideDown();
	}
	else {
		$("#ds_cat_"+id).removeClass("ds_cat_on");
		$("#related_post_cat_"+id).slideUp();
	}
}

