

// *********************
// HOME SPECIAL EVENINGS
// *********************

$(function(){
		   
	$("#specialMenu a#specialButton").toggle(
	
	function() { 
		$("#specialMenu span.menuMore").fadeOut('fast');
		$("#specialMenu span.menuLess").fadeIn('fast');
		$("#specialMenu").animate({top: '366'}, 'fast');	
	},
	
	function() { 
		$("#specialMenu span.menuLess").fadeOut('slow');
		$("#specialMenu").animate({top: '415'}, 'normal');	
		$("#specialMenu span.menuMore").fadeIn('fast');
	});

});

//---------------
// Video
//---------------
$(function() {
	$("#videoTrigger a").click(function () {
		$('#videoContainer').flash({swf:'/video/home-player.swf',height:444,width:790});
		$("#videoContainer").fadeIn('fast');
		$(this).fadeOut('fast');
		return false;
	});
});

//---------------
// Menu image top
//---------------
$(function() {
	$('#middle #menu.soirM').append('<div class="imgIndicatif"></div>');
});

// ************
// LocalScroll calendrier
// ************

$(function() {
	$('#menuMonth').localScroll({
	target:'#calendrierWrapper',
	axis:'x',
  	queue:true,
	duration:500
	});
	
	$("#menuMonth a").click(function () {
		$('#menuMonth a').removeClass('active');
		$(this).addClass('active');
	}).filter(":first").click();
	
	$(".octobre a").click(function () {
		$('.octobre a').removeClass('active');
		$(this).addClass('active');
	}).filter(":first").click();
	
});



/*
$(window).bind('load', function () {
       $.preload( '#gallery img', {
			placeholder:'placeholder.jpg',
			notFound:'notfound.jpg'
		});
    });
 */
 
 $(document).ready(
   
    function(){
 
        $("#galNav a").click(function () {
				$("#galNav a").removeClass("active");
				$(this).addClass("active");
				return false;
			}).filter(":first").click();
       
        // On click events

        $(".section a").click (
			
            function() {   
				
				//Thumbnails effect
				$(".section a").removeClass('active');
				$(".section a").fadeTo("fast", 1)
				$(this).addClass('active');
				$(this).fadeTo("fast", 0.45);

				
               	//Set current image
				var currentImg = $("#photo2 img");
               
                //New image attributes
                var newImg = $(this).attr("href");
                var newAlt = $(this).attr("title");
               
                //Create new image
                var newPic = new Image();
                $(newPic).attr({ src: newImg, alt: newAlt });
               
                $("#photo1 img").remove();
                $("#photo2").hide('fast',loadContent);
                $("#photo1").append(currentImg);
				
				//Display Loader
				$('#loader').remove();
				$('#mainPhoto').append('<div id="loader">Chargement...</div>');
				$('#loader').fadeIn('normal');
               
                
				function loadContent() {
					$('#photo2').load(newPic,'',hideLoader())
				}
				function hideLoader() {
					$('#loader').fadeOut('normal',showNewContent());
				}
				function showNewContent() {
					$("#photo2 img").remove();
					$("#photo2").append(newPic);
					$("#photo2").fadeIn("slow");
				}
                return false;
            }
               
        ).filter(":first").click();

    }
);
