$(document).ready(function(){

	/* Flowplayer + BOX */
	
	$(".lightbox-demo").overlay({

		// setup exposing (optional operation);
		onBeforeLoad: function() {
			this.getBackgroundImage().expose({api: true}).load();	
		},				
		
		onLoad: function(content) {
			// find the player contained inside this overlay and load it
			this.getContent().find("a.player").flowplayer(0).load();
		},
		
		onClose: function(content) {
			$f().unload();
			
			// close exposing
			this.getBackgroundImage().expose().close();
		}
	});	
	
	$(function() { 
    	$("#message").overlay() 
	});
	
	// install flowplayers
	$("a.player").flowplayer("js/flowplayer/flowplayer-3.1.1.swf"); 
	
	
	/* Toggle de la sidebar */
	
			   
	$("#partenaire").hide();
	$("#informations").hide();
	$(".informations").click(function(){
	   $("#informations").toggle("slow");
	}); 
	$(".partenaire").click(function(){
	   $("#partenaire").toggle("slow");
	}); 
	
	jQuery('#mycarousel').jcarousel({
        auto: 6,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
	
							
});

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

