function large_products_scroller(containerId,normalSlideSpeed,buttonSlideSpeed,delay,div_size,direction)
{
	this.slideTimeBetweenSteps = 30;	/* General speed variable (Lower = slower) */
	
	var scrollingContainer = document.getElementById(containerId);
	scrollingContainer.large_products_scroller=this;
	var scrollingContent = scrollingContainer.getElementsByTagName('DIV')[0];
		
	scrollingContainer.style.position = 'relative';
	scrollingContainer.style.overflow = 'hidden';
	scrollingContent.style.position = 'relative';
	scrollingContent.style.left = '0px';
	
	this.slidelock=0;
	this.autoslidelock=0;
	
	this.products=new Array();
	var content=scrollingContent.getElementsByTagName('DIV');
	for (var i=0; i<content.length; i++)
	{
		if (content[i].className=='div_product')
		{
			this.products.push(content[i]);
			content[i].style.position = 'relative';
			content[i].style.width = div_size + 'px';
		}
	}
	
	var cleft=0;		
	/*
	for (var i=0; i< this.products.length; i++)
		{
			cleft+=this.products[i].offsetWidth;
		}
	*/
	cleft=this.products.length * div_size;
	scrollingContent.style.width = cleft+'px'; /* largeur contenu */
	
	this.containerId=containerId;
	this.objRef = scrollingContent;
	this.contentWidth = scrollingContent.offsetWidth;
	this.containerWidth = scrollingContainer.clientWidth; /* largeur du contenant */
	this.slideSpeed = normalSlideSpeed;
	this.originalSlideSpeed = -normalSlideSpeed;
	this.buttonSlideSpeed = -buttonSlideSpeed;
	this.delay=delay;
	this.autosliding=false;
	this.currentProductIndex=0;
	
	if(direction == false){
		scrollingContent.style.left = -(cleft-this.containerWidth)+'px';
	} 
	
	if (this.products.length < 2 || this.containerWidth >= this.contentWidth)
	{
		this.originalSlideSpeed=0;
		this.buttonSlideSpeed=0;
		this.slideSpeed=0;
	}
	else
	{
		this.autoSlideStart();
	}
}

large_products_scroller.prototype.autoSlideStart = function()
{
	this.autosliding=true;
	
	this.autoslidelock++;
	
	if (this.autoslidelock == 1)
	{
		setTimeout('document.getElementById("'+this.containerId+'").large_products_scroller.autoSlideContinue()',this.delay*1000);
	}
	else
	{
		this.autoslidelock--;
	}
}

large_products_scroller.prototype.autoSlideStop = function()
{
	this.autosliding=false;
}

large_products_scroller.prototype.autoSlideContinue = function()
{
	this.autoslidelock--;

	if (this.autosliding)
	{
		this.restartSliding(-1,true);
	}
}

large_products_scroller.prototype.slideContent = function()
	{
	
		if (this.slidelock ==0)

		{
			this.slidelock++;
			
			var leftPos = this.objRef.style.left.replace(/[^\-0-9]/g,'');
			leftPos = leftPos - this.slideSpeed;
			
			if(leftPos/1 + this.contentWidth/1<this.containerWidth && this.slideSpeed != 0)
			{
				leftPos = this.containerWidth - this.contentWidth;
				
				/*this.slideSpeed = 0; // empeche de repartir vers la droite */
				
				if (this.autosliding)
				{
					this.slideSpeed = -this.slideSpeed;
				}
				else
				{
					this.slideSpeed=0;
				}
				
			} else if (leftPos > 0)
			{
				leftPos=0;
				if (this.autosliding)
				{
					this.slideSpeed = -this.slideSpeed;
				}
				else
				{
					this.slideSpeed = 0;
				}
			}
			
			
			this.objRef.style.left = leftPos + 'px';
			
			if (this.slideSpeed != 0)
			{
				setTimeout('document.getElementById("'+this.containerId+'").large_products_scroller.slideContinue()',this.slideTimeBetweenSteps);
			}
			else
			{
				this.slidelock--;
			}
		}
	}
	
large_products_scroller.prototype.slideContinue = function()
{

	this.slidelock--;
	this.slideContent();

}
	
large_products_scroller.prototype.stopSliding = function()
	{
		this.slideSpeed = 0;
		this.autoSlideStart();
	}
	
large_products_scroller.prototype.mouseStopSliding = function()
	{
		this.slideSpeed = 0;
		this.autoSlideStop();
	}
	
large_products_scroller.prototype.restartSliding = function(direction,autospeed)
	{
		if (autospeed)
		{
			this.slideSpeed = direction * this.originalSlideSpeed;
		}
		else
		{
			this.slideSpeed = direction * this.buttonSlideSpeed;
		}
		this.slideContent();
	}
	
large_products_scroller.prototype.startSliding = function(direction)
	{
		this.autoSlideStop();
		this.restartSliding(direction);
	}
