var format = "ft";
var offre = "ot";
var duree = "dt";
var zone = "zf";
var profil = "pa";
var offre_abo = $("#abo li:hidden").size(); 

$(function(){
	$("#abo li").hide();
    $("#abo li."+format+"."+offre+"."+duree+"."+zone+"."+profil).show();
	
    $('.format').each(function() {
        $(this).click(function() {
			// alert ($(this).attr("name"));
			format = $(this).val();
			$("#abo li").hide();
			if ( $(".profil").is(':checked')) {
                profil="pe";
				$("#abo li."+format+"."+offre+"."+duree+"."+zone).show();
            } else {
                profil="pa";
				$("#abo li."+format+"."+offre+"."+duree+"."+zone+"."+profil).show();
            }
			offre_abo = $("#abo li:hidden").size();
            if($("#abo li").size()-offre_abo<1){
                $("#abo li.not").show();
            }else{
                $("#abo li.not").hide();
            }
        })
    });
	$('.zone').each(function() {
        $(this).click(function() {
			zone = $(this).val();
			$("#abo li").hide();
			if ( $(".profil").is(':checked')) {
                profil="pe";
				$("#abo li."+format+"."+offre+"."+duree+"."+zone).show();
            } else {
                profil="pa";
				$("#abo li."+format+"."+offre+"."+duree+"."+zone+"."+profil).show();
            }
			offre_abo = $("#abo li:hidden").size();
            if($("#abo li").size()-offre_abo<1){
                $("#abo li.not").show();
            }else{
                $("#abo li.not").hide();
            }
        })
    });
	$('.offre').each(function() {
        $(this).click(function() {
			offre = $(this).val();
			$("#abo li").hide();
			if ( $(".profil").is(':checked')) {
                profil="pe";
				$("#abo li."+format+"."+offre+"."+duree+"."+zone).show();
            } else {
                profil="pa";
				$("#abo li."+format+"."+offre+"."+duree+"."+zone+"."+profil).show();
            }
			offre_abo = $("#abo li:hidden").size();
            if($("#abo li").size()-offre_abo<1){
                $("#abo li.not").show();
            }else{
                $("#abo li.not").hide();
            }
        })
    });
	$('.duree').each(function() {
        $(this).click(function() {
			duree = $(this).val();
			$("#abo li").hide();
			if ( $(".profil").is(':checked')) {
                profil="pe";
				$("#abo li."+format+"."+offre+"."+duree+"."+zone).show();
            } else {
                profil="pa";
				$("#abo li."+format+"."+offre+"."+duree+"."+zone+"."+profil).show();
            }
			offre_abo = $("#abo li:hidden").size();
            if($("#abo li").size()-offre_abo<1){
                $("#abo li.not").show();
            }else{
                $("#abo li.not").hide();
            }
        })
    });
	$('.profil').each(function() {
        $(this).click(function() {
			
			$("#abo li").hide();
			if ( $(".profil").is(':checked')) {
                profil="pe";
				$("#abo li."+format+"."+offre+"."+duree+"."+zone).show();
            } else {
                profil="pa";
				$("#abo li."+format+"."+offre+"."+duree+"."+zone+"."+profil).show();
            }
			offre_abo = $("#abo li:hidden").size();
            if($("#abo li").size()-offre_abo<1){
                $("#abo li.not").show();
            }else{
                $("#abo li.not").hide();
            }
        })
    });

    
    if($('#carousel-en-image').length){
		$('#carousel-en-image').jcarousel({'scroll':2});
	}
	
	if($('#slider').length){
    $('#slider').s3Slider({
        timeOut: 3000
    });
	}
	if($('#gallery').length){
    $('#gallery a').lightBox({
	imageLoading: 'http://www.magazine-litteraire.com/images/lightbox-0.5/lightbox-ico-loading.gif',
	imageBtnClose: 'http://www.magazine-litteraire.com/images/lightbox-0.5/lightbox-btn-close.gif',
	imageBtnPrev: 'http://www.magazine-litteraire.com/images/lightbox-0.5/lightbox-btn-prev.gif',
	imageBtnNext: 'http://www.magazine-litteraire.com/images/lightbox-0.5/lightbox-btn-next.gif',
	containerResizeSpeed: 350,
	txtImage: 'Image',
	txtOf: 'sur'
    });
	}
});