// LIGNE 1

function slideSwitch(id) {
    var $active = $('#'+ id +' DIV.active');

    if ( $active.length == 0 ) $active = $('#'+ id +' DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#'+ id +' DIV:first');


    $active.addClass('last-active');
	$active.animate({opacity: 0.0}, 1000);

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

$(function() {
    var slideshowNbr = 35; // Modifie ce nombre pour ajouter autant de "SlideShow" que tu le souhaites ;)
    
   for(var i=1 ; i <= slideshowNbr ; i++) {
	  (function(i) {
		setTimeout(function() {
		  setInterval(function(){ slideSwitch('slideshow_'+ i); }, 9000 );
		}, i*1000);
	  })(i);
    }

});

// LIGNE 2

function slideSwitchB(id) {
    var $active = $('#'+ id +' DIV.active');

    if ( $active.length == 0 ) $active = $('#'+ id +' DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#'+ id +' DIV:first');


    $active.addClass('last-active');
	$active.animate({opacity: 0.0}, 1000);

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

$(function() {
    var slideshowNbrB = 23; // Modifie ce nombre pour ajouter autant de "SlideShow" que tu le souhaites ;)
    
   for(var i=1 ; i <= slideshowNbrB ; i++) {
	  (function(i) {
		setTimeout(function() {
		  setInterval(function(){ slideSwitchB('slideshowB_'+ i); }, 8000 );
		}, i*1000);
	  })(i);
    }

});
