/*$(document).ready(function() {
	
	$("#top5 .corp ul li a:first").addClass("actif");
	$spaceactive = $("#top5 .corp ul li a:first");
	$spacedesactif = $("#top5 .corp ul li a:last"); 
	$spacetotal = $spacedesactif;
	
   $("#top5 .corp ul li a").click(function() {
		$spacedesactif = $spaceactive;
		$spaceactive = $(this);
		clearInterval(playspace); 
		spacerotate(); 
		spacerotateSwitch(); 
		return false;
	});
   
   spacerotateSwitch = function(){
		playspace = setInterval(function(){ 
			$spacedesactif = $spaceactive;
			//$active = $(".vignettes a.active").next(); 
			//alert(Number();
			if ($spaceactive.attr("rel")+1 > $spacetotal){
				$spaceactive = $("#top5 #vignetteSpace1"); 
			}else{
				$spaceactive = $("#top5 #vignetteSpace"+(Number($spaceactive.attr("rel"))));
			}
			//alert($active.val()+":"+$active.attr("rel")+":"+$desactif.attr("rel"));
			
			spacerotate();
		}, 7000); 
	};
	
	spacerotate = function(){
			
			if ( $spaceactive.length === 0) { 
				$spaceactive = $("#top5 .corp ul li a:first");
				$spacedesactif = $("#top5 .corp ul li a:last"); 
			}
			$("#teaserspace"+$spacedesactif.attr("rel")).fadeOut("slow");
			$("#top5 .corp ul li a").removeClass("actif"); 
			$spaceactive.addClass("actif");
			$("#teaserspace"+$spaceactive.attr("rel")).fadeIn("slow");
			alert("jedi");
	};
	
	spacerotateSwitch(); 
	
});

function none(){
	return false;
}*/





$(document).ready(function() {
	
	$("#top5 .corp ul li a:first").addClass("actif");
	$spaceactive = $("#top5 .corp ul li a:first");
	$spacedesactif = $("#top5 .corp ul li a:last"); 
	$spacetotal = $spacedesactif;
	
	
   $("#top5 .corp ul li a").click(function() {
		$spacedesactif = $spaceactive;
		$spaceactive = $(this);
		clearInterval(playspace); 
		spacerotate(); 
		spacerotateSwitch(); 
		return false;
	});
   
   spacerotateSwitch = function(){
		playspace = setInterval(function(){ 
			$spacedesactif = $spaceactive;
			
			if ($spaceactive.attr("rel")+1 > $spacetotal){
				$spaceactive = $("#top5 #vignettespace1"); 
			}else{
				/*alert(Number($spaceactive.attr("rel"))+1);*/
				$spaceactive = $("#top5 #vignettespace"+(Number($spaceactive.attr("rel"))+1));
			}
			spacerotate();
		}, 7000); 
	};
	
	spacerotate = function(){
			//alert($spaceactive.attr("rel")+":"+$spacedesactif.attr("rel"));
			if ( $spaceactive.length === 0) { 
				$spaceactive = $("#top5 .corp ul li a:first");
				$spacedesactif = $("#top5 .corp ul li a:last"); 
			}
			$("#teaserspace"+$spacedesactif.attr("rel")).fadeOut("slow");
			$("#top5 .corp ul li a").removeClass("actif"); 
			$spaceactive.addClass("actif");
			$("#teaserspace"+$spaceactive.attr("rel")).fadeIn("slow");
	};
	
	spacerotateSwitch(); 
	
});

function none(){
	return false;
}


