$j(function(){

	/*Myspace Carousel*/
	$j("#actu span.next").click(function(){
		if(parseInt($j("#indexActu").html()) == parseInt($j("#maxActu").html()))
		{
			//ok
		}
		else
		{
			$j("#indexActu").html(parseInt($j("#indexActu").html())+1);
			thisLeft = $j("#actu ul").css("left");
			thisLeftPx = thisLeft.lastIndexOf("px");
			thisLeft = thisLeft.substring(thisLeftPx,0);
			newLeft = thisLeft - 366;
			
			maxLeftLength = $j("#actu li").length;
			maxLeft = maxLeftLength * 366;
			
			if(newLeft == -maxLeft){
				$j("#actu ul").animate({left: 0});
			} else {
				$j("#actu ul").animate({left: newLeft});
			}
		}
	});
	
	$j("#actu span.prev").click(function(){
	
		
		if(parseInt($j("#indexActu").html()) == 1)
		{
			//ok
		}
		else
		{
			$j("#indexActu").html(parseInt($j("#indexActu").html())-1);
			thisLeft = $j("#actu ul").css("left");
			thisLeftPx = thisLeft.lastIndexOf("px");
			thisLeft = thisLeft.substring(thisLeftPx,0);
			thisLeft = parseInt(thisLeft);
			newLeft = thisLeft + 366;
					
			if(newLeft == 366){
				$j("#actu ul").css("left",0);
			} else {
				$j("#actu ul").animate({left: newLeft});
			}
		}
	});

});
