var Carrousel = Class.create();
Carrousel.prototype = {
	
	Version: "1.0",
	sId: null,
	iCurrentStart: 0,
	iTotalEnd: 0,
	iReelWidth: 660,

	/**
	 * initialize the carrousel
	 * 
	 * @param sId
	 */
	initialize: function(sId) 
	{
		this.sId = sId;
	},
		
	prev: function(iTimes)
	{
		if(!iTimes)
		{
			iTimes = 1;
		}
		
		this.iCurrentStart = this.iCurrentStart - (iTimes * 4);

		if(this.iCurrentStart == 0)
		{
			$(this.sId + 'CarrouselPrevButton').style.visibility = 'hidden';
		}

		var iBack = this.iReelWidth * iTimes;

		new Effect.Move(this.sId + 'ReelSlider', { 	x: iBack, 
													y: 0, 
													mode: 'relative'
		});
	},
	
	next: function(iAmountOfItems, sType)
	{
		$(this.sId + 'CarrouselPrevButton').style.visibility = 'visible';

		this.iTotalEnd = this.iCurrentStart + 4;

		if(this.iTotalEnd >= iAmountOfItems)
		{
			this.prev((this.iCurrentStart / 4),this.Id);
		}
		else
		{
			this.iCurrentStart = this.iTotalEnd;
			
			var oReel = $(this.sId + 'Reel');
			var iWidth = oReel.getWidth();
			oReel.style.width = iWidth + this.iReelWidth + 'px';
			
			new Effect.Move(this.sId + 'ReelSlider', { x: -this.iReelWidth, y: 0, mode: 'relative' });
		}
	}	
}
