function emphasised_products_scroller(containerId,normalSlideSpeed,buttonSlideSpeed,delay,div_size)
{
	//this.slideTimeBetweenSteps = 30;	// General speed variable (Lower = slower)
	
	var scrollingContainer = document.getElementById(containerId);
	scrollingContainer.emphasised_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';
	
	this.containerId=containerId;
	this.objRef = scrollingContent;
	this.contentWidth = scrollingContent.offsetWidth;
	this.containerWidth = scrollingContainer.clientWidth;
	this.slideSpeed = div_size;
	this.originalSlideSpeed = normalSlideSpeed;
	this.buttonSlideSpeed = buttonSlideSpeed;
	this.divSize=div_size;
	this.delay=delay;
	this.autosliding=false;
	this.currentProductIndex=0;
	
	if (this.products.length < 2 || this.containerWidth >= this.contentWidth)
	{
		this.originalSlideSpeed=0;
		this.buttonSlideSpeed=0;
		this.slideSpeed=0;
	}
	else
	{
		//this.autoSlideStart();
	}
}

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

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

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

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

emphasised_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;
		
		var reordered=false;
		
		if (this.slideSpeed != 0)
		{
		
		while (leftPos < -this.products[this.currentProductIndex].offsetWidth)
		{
			leftPos+=this.products[this.currentProductIndex].offsetWidth;
			this.currentProductIndex++;
			
			if (this.currentProductIndex >= this.products.length)
			{
				this.currentProductIndex=0;
			}
			
			reordered=true;
			
		}
		
		while (leftPos > 0)
		{
			leftPos-=this.products[this.currentProductIndex].offsetWidth;
			this.currentProductIndex--;
			
			if (this.currentProductIndex < 0)
			{
				this.currentProductIndex=this.products.length-1;
			}
			
			reordered=true;
			
		}
		
		}
		
		if (reordered)
		{
		
			var cleft=0;
			var cright=0;
			
			for (var i=0; i< this.products.length; i++)
			{
				if (i < this.currentProductIndex)
				{
					cleft+=this.products[i].offsetWidth;
				}
				else
				{
					cright+=this.products[i].offsetWidth;
				}
			}
			
			var ctotal=cleft+cright;
			cleft=cleft%ctotal;
			cright=cright%ctotal;
			
			for (var i=0; i< this.products.length; i++)
			{
				if (i >= this.currentProductIndex)
				{
					this.products[i].style.left=(-cleft)+'px';
				}
				else
				{
					this.products[i].style.left=cright+'px';
				}
			}
			
		}
		
		if (this.autosliding && reordered)
		{
			leftPos=0;
			this.stopSliding();
		}
		
		if(leftPos/1 + this.contentWidth/1<0 && this.slideSpeed != 0)
		{
			leftPos = this.containerWidth;
			
		}
		this.objRef.style.left = leftPos + 'px';
		
		if (this.slideSpeed != 0)
		{
			var cdelay=this.buttonSlideSpeed;
			if (this.autosliding)
			{
				cdelay=this.normalSlideSpeed;
			}
			setTimeout('document.getElementById("'+this.containerId+'").emphasised_products_scroller.slideContinue()',cdelay);
		}
		else
		{
			this.slidelock--;
		}
		}
	}
	
emphasised_products_scroller.prototype.slideContinue = function() {
	this.slidelock--;
	this.slideContent();
}
	
emphasised_products_scroller.prototype.stopSliding = function() {
	this.slideSpeed = 0;
	//this.autoSlideStart();
}
	
emphasised_products_scroller.prototype.restartSliding = function(direction,autospeed)
	{
		if (this.products.length > 1)
		{
			this.slideSpeed = direction * this.divSize;
			this.slideContent();
		}
	}
	
emphasised_products_scroller.prototype.startSliding = function(direction) {
	//this.autoSlideStop();
	this.restartSliding(direction);
}
