// JavaScript Document
function ProductScroller()
{
	this._li = 0;
	this._products = 4;
	this._prev = '#prev';
	this._next = '#next';
	this._scroller = '#scroller';
}
ProductScroller.prototype.setScroller = function()
{
	var obj = this;
	$(obj._scroller).scrollTo(obj._li);
	
	$(obj._prev).unbind('click').click(function(){
		obj._li -= obj._products;
		if (obj._li < 0)
		{
			obj._li = 0;
		}
		/*obj._li = 0;*/
		obj.scrollNow();
	});
	
	$(obj._next).unbind('click').click(function(){
		var num = $(obj._scroller + '>ul>li').length;
		/*obj._li = num - 1;*/
		obj._li += obj._products;
		if (obj._li > num)
		{
			obj._li = Math.floor((num - 1) / obj._products) * obj._products;
		}
		obj.scrollNow();
	});
}
ProductScroller.prototype.scrollNow = function()
{
	var obj = this;
	
	$(obj._scroller).stop().scrollTo('li:eq(' + obj._li + ')', 800);
}