$(document).ready(function (){

    $(".back").click(function(e){
        e.preventDefault();
        history.back()
    })

   $(".print").click(function(e){
       e.preventDefault();
       window.print();
   });

	$(".text").focus(function (){
	    $(this).val("");
	});

	//$('#password').show();
	$('#text-password').hide();
	//$('#password').hide();
	//$('#text-password').show();


	$('#password').focus(function() {
	    $('#password').hide();
	    $('#text-password').show();
	    $('#text-password').focus().val("");
	});

	$('#text-password').blur(function() {
	    if($('#text-password').val() == '') {
	        $('#password').show();
	        $('#text-password').hide();
	    }
	});


    var uneTabLeftH = $(".uneTab .left").height();
    var uneTabRightH = $(".uneTab .right").height();

    if (uneTabLeftH < 231){
        $(".uneTab .left").height(232);
    }
if (uneTabRightH > uneTabLeftH ){
	        $(".uneTab .left").height(uneTabRightH);
    }


 var mainContentH= $("#mainContent").height();
 var pageH= $("#page").height();
 var bodyID = $("body").attr("id");
 switch(bodyID){
    case "id1":
    $("#ombre").height(mainContentH+19);
    break;
    case "id360":
    $("#ombre").height(pageH);
    break;
    case "id487":
    $("#ombre").height("782");
    break;
    default : $("#ombre").height(pageH-35);
 }
 
	$(".ditto1recetteAccueil .slide:nth-child(2n)").addClass("even");
	
		
	$(".ditto1recetteAccueil .slider .slide").each(function(index) {
		var displaySlideQty = 2;

		if(index % displaySlideQty == 0) {
				$(this).before("<div class=\"slide-group\"></div>");
		}

		$(this).appendTo($(this).prev());
	});
		
	$(".slider").each(function(index) {
		if($(this).children().length > 0) {
			var selector = "";
			var slider = $(".slider").get(index);
			
			var prefix = "";
			if(!slider.id) slider.id = prefix + "slider" + (index + 1);
			selector = "[id=" + slider.id + "]";
			
			$("#categoriesRecettes .slider" + selector + ", .apercuRecettes .slider" + selector).bxSlider({
				mode: 'horizontal',
				controls: true,
				pager: true,
				speed: 1000,
				easing:'easeOutCubic'
			});

			$(".ditto1recetteAccueil .slider" + selector).bxSlider({
				mode: 'horizontal',
				controls: true,
				speed: 1000,
				easing:'easeOutCubic',
				onBeforeSlide:function() {
					$(".ditto1recetteAccueil .background").fadeOut(500,function(){$(".ditto1recetteAccueil .background").fadeIn(500)});
				}
			});
		}
	});

	$("#categoriesRecettes .bx-pager").css({
		left:function() {
			return ($(this).offsetParent().width() - $(this).width()) / 2;
		}
	})
});
