function lunchCarrouselpartenaires(){

	var items = $$('ul#bottompartenaires li'); // The different elements, this is an array
	var wrapper = $('carrousel_horizontal_partenaires'); // The outer wrapper
	var carrousel = $('bottompartenaires'); // The inner wrapper
	var itemwidth = 81; // The full width of a single item (incl. borders, padding, etc ... if there is any)
	var maxmargin = items.length * itemwidth - itemwidth;
	
	
	if(carrousel){
		carrousel.setStyle("width",maxmargin);
		
		if($$('#bottompartenaires li').length > 12)
		movenext.periodical(6000);

		var animation = new Fx.Tween(carrousel, { duration: 1000,onComplete:cloneFirst});
	}
	function movenext(){
		var position = (carrousel.getStyle('left'))?parseInt(carrousel.getStyle('left')):0;
		var width = parseInt(carrousel.getStyle('width'));
		carrousel.setStyle("width",width + itemwidth );
		animation.start('left', position-itemwidth);
	}

	function cloneFirst(){
		var first = carrousel.getFirst();
		var last = carrousel.getLast();
		var cloned = first.clone();
		
		cloned.cloneEvents(first).inject(last,'after');
		first.destroy();
		var position = (carrousel.getStyle('left'))?parseInt(carrousel.getStyle('left')):0;
		carrousel.setStyle("left",position+itemwidth);
		carrousel.setStyle("width",maxmargin);
	}	
}


document.addEvent("domready",lunchCarrouselpartenaires);
