$(document).ready(function(){

	//rotation automatique des sliders
	slides = new Array("tabs-1", "tabs-2", "tabs-3", "tabs-4");
	tem = 1;
	vitesse_rotation  = 5000;
	slider_interval = setInterval(slider_rotate,vitesse_rotation);
	init_pause();
	
	//slider clic
	$('#tabsOnglet .active').show();
	jQuery.each($("#pagnum li "),function() {
		$(this).click(function(){
			$('#pagnum li').removeClass('active');
			$(this).addClass('active');
			id = $(this).attr('id');
			/*$('.slide').hide();
			$('#slide-'+id).show();*/
			$('.slide').removeClass('active');
			$('#slide-'+id).addClass('active');
			return false;
		});
	});
	
	//$("#latabsOnglet").slideDown(500);
	$("#tabsOnglet").mouseover( function() { 
		clearInterval(slider_interval);
	});
	$("#tabsOnglet").mouseout( function() { 
		slider_interval = setInterval(slider_rotate,vitesse_rotation);
	});
	
});

function slider_rotate()
{
	$('#pagnum li').removeClass('active');
	$('#'+slides[tem]).addClass('active');
	/*$('.slide').hide();
	$('#slide-'+slides[tem]).show();*/
	$('.slide').removeClass("active");
	$('#slide-'+slides[tem]).addClass('active');
	tem++;
	if(tem==slides.length)tem=0;
}
function init_pause()
{
	$('a.pause').click(function(){
		$(this).removeClass('pause');
		$(this).addClass('play');
		$(this).html('reprendre');
		clearInterval(slider_interval);
		init_play();
		return false;
	});
}
function init_play()
{
	$('#laune a.play').click(function(){
		$(this).removeClass('play');
		$(this).addClass('pause');
		$(this).html('pause');
		clearInterval(slider_interval);
		slider_interval = setInterval(slider_rotate,vitesse_rotation);
		init_pause();
		return false;
	});
}
