$(document).ready(function () {
    setInterval("assurePositionBloc()", 3000);
    var animActuActive = false;
    activateHistory();
    rewriteURLAJAX();
    mouseRolloverMenu();
    mouseRolloverActu();
    Cufon.replace("#menu", {
        fontFamily: "casadoamnei",
		hover: {
			color: '#225997'
			}
    });
    Cufon.replace(".zonetitre .titre", {
        fontFamily: "casadoamnei"
        
    });
    Cufon.replace(".zonetitre .soustitre", {
        fontFamily: "casadoamnei"
    });
	Cufon.replace("h2", {
        fontFamily: "casadoamnei"
    });
	Cufon.replace(".texte h3 ", {
        fontFamily: "casadoamnei"
    });
	Cufon.replace(".texte h4 ", {
        fontFamily: "casadoamnei"
    });
	Cufon.replace(".texte h5 ", {
        fontFamily: "casadoamnei"
    });
		Cufon.replace("#listeactu h3 ", {
        fontFamily: "casadoamnei"
    });
	Cufon.replace("#listeactu h4 ", {
        fontFamily: "casadoamnei"
    });
	Cufon.replace("#listeactu h5 ", {
        fontFamily: "casadoamnei"
    });
    Cufon.replace(".actu_entier h3 ", {
        fontFamily: "casadoamnei"
    });
	Cufon.replace(".actu_entier h4 ", {
        fontFamily: "casadoamnei"
    });
	Cufon.replace(".actu_entier h5 ", {
        fontFamily: "casadoamnei"
    });
    startAnimHome();
  //  $("#main1").jScrollPane({
//        scrollbarWidth: 20,
//        wheelSpeed: 100
//    });
       
         var  newMain = $(window).height();
		var actMain =  $("#main").height();
		 $("#main").stop().css({'overflow' : 'auto'});
	$(".contenubarre_fond").css("height", actMain - newMain + "px" )
		 $(".goTop").click(function () {
        $("#contenupage").animate({
            scrollTop: 0
        }, 300);
        return false
    });

    $(".texte1").jScrollPane({
        scrollbarWidth: 17,
        wheelSpeed: 20,
        scrollbarMargin: -30,
        dragMaxHeight: 41,
        animateTo: true
    });
	$("#rezervare_btn ").mouseover(function(){
      $(this).addClass("mouse_over");
    }).mouseout(function(){
      $(this).removeClass("mouse_over");
    });

    $(".actu_entier .bloctexte1").jScrollPane({
        scrollbarWidth: 17,
        wheelSpeed: 20,
        scrollbarMargin: 4,
        dragMaxHeight: 41
    });
	//F11 animation
			var browserh = $(window).height();
	        $("body").append('<div id="full_screen"><div id="slide" class="reverse"></div><div id="close_slide"></div><div id="mess"></div></div>');
			$("#full_screen").css('top', browserh/2);
			  $("#slide").click(function () {
               $("#full_screen").stop().animate({
                    left: "0px"
                }, 200);
				$(this).addClass("reverse");
        return false;
    });
	$("#close_slide").click(function () {
               $("#full_screen").stop().animate({
                    left: "-174px"
                }, 200);
				$('#slide').removeClass("reverse");
        return false;
    });
			$(window).resize(function () {
				var newbrowserh = $(window).height();
				$("#full_screen").css('top', newbrowserh/2);
			});
			
	//@end
    $(window).resize(function () {
       // $("#main1").jScrollPaneRemove();
//        $("#main1").jScrollPane({
//            scrollbarWidth: 20,
//            wheelSpeed: 100
//        });
    });
	$(window).resize(function () {
	var contentHeight = $(window).height();
	var divHeight = $("#blocpage").height();
	var mainBar = $("#barremain").height();
	var postHeight = $("#blocactu").height();
	if( divHeight > contentHeight ){
	$("#blocpage").css("height",  mainBar).css({'overflow' : 'auto', 'width' : '534px', 'margin-right' : '8px'});
		} else if( divHeight < contentHeight ){
		$("#blocpage").css("height", contentHeight).css({'overflow' : 'auto', 'width' : '534px', 'margin-right' : '8px'});
		
		} else if( divHeight = contentHeight ){
		$("#blocpage").css("height", contentHeight).css({'overflow' : 'auto', 'width' : '534px', 'margin-right' : '8px'});
		} ;
		});
		$(window).resize(function () {
	       var contentHeight = $(window).height();
	      var mainBar = $("#barremain").height();
	       var postHeight = $("#blocactu").height();
		if( postHeight > contentHeight ){
	    $("#blocactu").css("height", mainBar).css({'overflow' : 'auto', 'width' : '507px', 'margin-right' : '0px'});
		} else if( postHeight< contentHeight ){
		$("#blocactu").css("height", contentHeight).css({'overflow' : 'auto', 'width' : '507px', 'margin-right' : '0px'});
		
		} else if( postHeight = contentHeight ){
		$("#blocactu").css("height", contentHeight).css({'overflow' : 'auto', 'width' : '507px', 'margin-right' : '0px'});
		} ;
	 });
    sounds.init();
    $("#rezervare_btn").click(function () {
        sounds.playSon1();
        nobei_futurebox("", "", '<iframe frameborder="0" style="border:none;" src="http://casadoamnei.ro/booking/frontend/" width="420" height="425"></iframe>', false, 1000);
    });
    manageMadmimi();
});

var sounds = new function () {
        var sound_souffle;
        this.init = function () {
            if (checkVersionValidHTML5()) {
                sound_souffle = new SoundClass("souffle_air", true, true, true);
            }
        };
        this.playSon1 = function () {
            if (checkVersionValidHTML5()) {
                sound_souffle.playDelay(50);
            }
        };
    };
