$(document).ready(function() {
	

	$page = jQuery.url.attr("source");
	if(!$page) {
		$page = '/';
	}
	$('a').each(function(){
		var $href = $(this).attr('href');
		if ( ($page.indexOf($href) != -1) || ($href == '') ) {
			$(this).addClass('on');
		} else {
			$(this).removeClass('on');
		}
	});
	
	$(".morelink").live("click", function(e) {
		$(this).parent().children(".more").slideDown("slow");
		$(this).addClass("reduceMore").removeClass("moreLink").text("Fermer");
		e.preventDefault();
	})
	
	$(".reduceMore").live("click", function(e) {
		$(this).parent().children(".more").slideUp("slow");
		$(this).addClass("moreLink").removeClass("reduceMore").text("Plus de détails");
		e.preventDefault();
	})
	
	$(".filter").click(function(e){
		$(".hiddenlist").hide();
		$(".filter").removeClass("active");
		var divtoopen = "#hl" + $(this).attr("href");
		$(divtoopen).show();
		$(this).addClass("active");
		e.preventDefault();
		console.log(divtoopen);
	})
	
		
	$(window).resize(function() {
		var taille2 = $(window).height() - 89 - 156 - 66;
			$("#content").css("min-height", taille2);
	})
	
	var taille = $(window).height() - 89 - 156 - 66;
	if ($("#content").height() < taille) {
		$("#content").css("min-height", taille);
	}
	
	$(function(){ 
			$("label").inFieldLabels(); 
			$("input").attr("autocomplete","off");
	});
	
	$(".listadder li a").click(function() {
		$("#Message").append($(this).text() + "\n");
		$(this).parent().hide("slow");
	})
	
	$("input[name='flash']").change(function(){
       $("#Message").val($("input[name='flash']:checked").val());
   });
	

	

});
