/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/
// $(document).ready(function () {});
var compteur = 0;
var tableauCouleur = new Array ("#0f4a71", "#d21a23", "#ecb303");

function slideSwitch() 
{
    var $active = $('#slideshow img.active');
		
    if ( $active.length == 0 ) {
		$active = $('#slideshow img:last');
	}
	
    // use this to pull the images in the order they appear in the markup
	var $next = ($active.next().length) ?  $active.next(): $('#slideshow img:first');
	
	switch (compteur)
	{
		case 0 : 
		$(".index_selected").css("background", tableauCouleur[0]);
		$(this).fadeIn('slow');
		$(this).fadeOut('slow');
		break;
		
		case 1 :
		$(".index_selected").css("background", tableauCouleur[1]);
		$(this).fadeIn('slow');
		$(this).fadeOut('slow');
		break;
		
		case 2 :
		$(".index_selected").css("background", tableauCouleur[2]);
		$(this).fadeIn('slow');
		$(this).fadeOut('slow');
		compteur = -1;
		break;
	}
	
	compteur++;
	


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() 
		{
            $active.removeClass('active last-active');
			
		 });
	
		
}

