
// ************************ RESIZE
function resize() {
	var bg = $('.bg-resize');
		var imgW = $(bg).width();
		var imgH = $(bg).height();
		var ratio = imgW / imgH;
		var w = $(window).width();
		var h = $(window).height();
	
		if ((w/h) > ratio) {
			$(bg).width("100%");
			$(bg).height("");
		} else {
			$(bg).width("");
			$(bg).height("100%");
		}
}
setInterval('resize()', 100);

// ************************ ACCORDEON

$(document).ready( function () {
	$("h2").hover(function() {
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	});
	
    $(".content-general").hide();
    $("h2").click( function () {
        if ($(this).next("div.content-general:visible").length != 0) {
            $(this).next("div.content-general").slideUp("fast");
        }
        else {
			$("h2").removeClass('select');
            $("div.content-general").slideUp("fast");
			$("div.content-general").children(".move-content").animate({ 
			        left: "-"+951
			      }, 100 );
			$(this).addClass('select');
            $(this).next("div.content-general").slideDown("fast");
			$(this).next("div.content-general").children(".move-content").animate({ 
			        left: 0
			      }, 800 );
        	}
		
	});    
	$("h2").click(function(){
		if ($('.btn-menu-compagnie:visible').length != 0){
			$('.btn-menu-compagnie').animate({ 
		        top: "5px",
				opacity: 0
		      }, 200 );
		}
		else{
			$("h2").delay(1000,function(){

			$('.btn-menu-compagnie').animate({ 
		        top: "0px",
				opacity: 1
		      }, 200 );
		   });			
		}

	 });



		$(".actu").delay(1000,function(){
		   $(".actu").stop().animate({ 
		        top: "0px"
		      }, 200 );
	   });
		$(".actu").delay(6500,function(){
		   $(".actu").stop().animate({ 
		        top: "185px"
		      }, 200 );
	   });


	
	$('.contact').hover(function(){
	   $(this).stop().animate({ 
	        top: "0px"
	      }, 200 );
	 },function(){
	   $(this).stop().animate({ 
	        top: "-102px"
	      }, 200 );
	 });
	$('.actu').hover(function(){
	   $(this).stop().animate({ 
	        top: "0px"
	      }, 200 );
	 },function(){
	   $(this).stop().animate({ 
	        top: "185px"
	      }, 200 );
	 });
	
	
	
});		


$(document).ready(function(){		

	$("#btn-son").toggle(function(){
	   	$(this).parent("#block-sound").animate({
		   top: '0px'
		 }, "fast");
	 },function(){
	   	$(this).parent("#block-sound").animate({
		   top: -55+'px'
		 }, "fast");
	 });
	
	$("#pop").click(function(){
		popup('revue-presse.html');
	 });


});


$(document).ready(function(){	
	$(".content-spec").click(function(){
			$(this).parents().find('.block-present-spec').fadeOut('fast');
			var target = $(this).find("a").attr("href");
			$(target).fadeIn("slow");
			return false;
	});
	$(".content-spec").hover(function () {
			$(this).addClass('hover');
		}, function () {
			$(this).removeClass('hover');
		}
	);
	$('.back-voir-spectacle').click(function(){
			$(this).parent('.block-descri-spectacle').fadeOut('fast');
			$('.block-present-spec').fadeIn('fast');
	});
});






