// JavaScript Document



function slideSwitchAccueil() {
	
	var $active = $('#bannerAccueil div.active');
	$active.css({opacity: 1.0}).animate({opacity: 0.0}, 1600, function() {});

	if ( $active.length == 0 ) $active = $('#bannerAccueil div:last');

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

	// uncomment below to pull the divs randomly
	// var $sibs  = $active.siblings();
	// var rndNum = Math.floor(Math.random() * $sibs.length );
	// var $next  = $( $sibs[ rndNum ] );


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

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

$(function() {
	setInterval( "slideSwitchAccueil()", 3000 );
});


function slideSwitch() {
	
	var $active = $('#topPub div.active');
	$active.css({opacity: 1.0}).animate({opacity: 0.0}, 1600, function() {});

	if ( $active.length == 0 ) $active = $('#topPub div:last');

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

	// uncomment below to pull the divs randomly
	// var $sibs  = $active.siblings();
	// var rndNum = Math.floor(Math.random() * $sibs.length );
	// var $next  = $( $sibs[ rndNum ] );


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

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

$(function() {
	setInterval( "slideSwitch()", 3000 );
});
/*
function slideSwitch_marc(firstload) {
	var $active = $('#marc2 div.active');
	
	if (firstload) {
		$active.css({opacity: 0.0});
	} else {
		$active.css({opacity: 1.0}).animate({opacity: 0.0}, 1600, function() {});
	}
	
	

	if ( $active.length == 0 ) $active = $('#marc2 div:last');

	

	// uncomment below to pull the divs randomly
	 var $sibs  = $active.siblings();
	 var rndNum = Math.floor(Math.random() * $sibs.length );
	 var $next  = $( $sibs[ rndNum ] );


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

$(function() {
	$('#marc2 div').css({opacity: 0.0});
	slideSwitch_marc(1)
	setInterval( "slideSwitch_marc()", 80000 );
});
*/
