// This code is executed after the page is rendered (including images).
// Requires jQuery.

$(window).load(function()
{
	//****************************************************************************
	// Applique un carousel (jCarousel Lite) tag UL dont le bloc parent possede la classe 'carousel_container'.
	$(".carousel_container").jCarouselLite({
		btnNext: ".carousel_next",
		btnPrev: ".carousel_prev",
		start: 0,
		speed: 600,
		loop: false,
		circular: false,
		visible: 5,
		scroll: 1
	});


	
	// Utilisation du plugin "prettyPhotos" pour l'affichage des versions agrandies des images.
	$("a[rel^='prettyPhoto']").prettyPhoto({
		animationSpeed: 'normal',		/* fast/slow/normal */
		opacity: 0.7,						/* Value between 0 and 1 */
		showTitle: true,					/* true/false */
		allowresize: true,					/* true/false */
		default_width: 500,
		default_height: 344,
		counter_separator_label: ' sur ',	/* The separator for the gallery counter 1 "of" 2 */
		theme: 'facebook',				/* light_rounded / dark_rounded / light_square / dark_square / facebook */
		hideflash: false,					/* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
		wmode: 'opaque',					/* Set the flash wmode attribute */
		autoplay: true,					/* Automatically start videos: True/False */
		modal: false,
		ie6_fallback: true,
		social_tools:false
	});
	
	
	// Utilisation du plugin "Nivo Slider" pour le slideshow de l'entete.
	var total = $('#main_slideshow img').length;
	var rand = Math.floor(Math.random()*total);
	$('#main_slideshow').nivoSlider(
	{
        effect:'fold', // Specify sets like: 'fold,fade,sliceDown'
        slices:15, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed:500, // Slide transition speed
        pauseTime:4000, // How long each slide will show
        startSlide:rand, // Set starting Slide (0 index)
        directionNav:true, // Next & Prev navigation
        directionNavHide:true, // Only show on hover
        controlNav:true, // 1,2,3... navigation
        controlNavThumbs:false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, // Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', // Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav:false, // Use left & right arrows
        pauseOnHover:true, // Stop animation while hovering
        manualAdvance:false, // Force manual transitions
        captionOpacity:0.8, // Universal caption opacity
        prevText: 'Pr&eacute;c&eacute;dent', // Prev directionNav text
        nextText: 'Suivant', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function()
		{
			//$('#main_slideshow').data('nivoslider').stop();
		}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    });
});
