var smoothScrollCoreshopDiv = new Class({
	Implements: [Options, Events],
	options: {
		scrollTarget: $empty,
		pixelsPerScroll: 0,
		leftHandelEle: $empty,
		leftHandelEleOnImg: $empty,
		leftHandelEleOffImg: $empty,
		rightHandelEle: $empty,
		rightHandelEleOnImg: $empty,
		rightHandelEleOffImg: $empty
	},
	initialize: function(options, passedNumPages) {
		this.setOptions(options);
		this.numPages = parseInt(passedNumPages);
		$(this.options.rightHandelEle).set('src', this.options.rightHandelEleOnImg);
		$(this.options.leftHandelEle).addEvent('click', this.scrollLeft.bind(this));
		$(this.options.leftHandelEle).setStyle('cursor', 'pointer');
		$(this.options.rightHandelEle).addEvent('click', this.scrollRight.bind(this));
		$(this.options.rightHandelEle).setStyle('cursor', 'pointer');
	},
	currentPageNum: 1,
	numPages: 0,
	scrollLeft: function() {
		if(this.currentPageNum <= 1)
			return false;
		this.currentPageNum -= 1;
		var myElement = $(this.options.scrollTarget);
		var myFx = new Fx.Scroll(myElement).start((this.currentPageNum-1)*this.options.pixelsPerScroll, 0);
		
		this.updateScrollHandels(this.currentPageNum);
		return false;
	},
	scrollRight: function() {
		if(this.currentPageNum >= this.numPages)
			return false;
		var myElement = $(this.options.scrollTarget);
		//alert(this.currentPageNum*this.options.pixelsPerScroll);
		var myFx = new Fx.Scroll(myElement).start(this.currentPageNum*this.options.pixelsPerScroll, 0);	
		this.currentPageNum += 1;
		
		this.updateScrollHandels(this.currentPageNum);
		
		return false;
	},
	updateScrollHandels: function(passedCurrPageNum) {
		if(passedCurrPageNum >= (this.numPages)) {
			$(this.options.rightHandelEle).setStyle('cursor', 'default');
			$(this.options.rightHandelEle).set('src', this.options.rightHandelEleOffImg);
		}
		else {
			$(this.options.rightHandelEle).setStyle('cursor', 'pointer');
			$(this.options.rightHandelEle).set('src', this.options.rightHandelEleOnImg);
		}		
		if(passedCurrPageNum <= 1) {
			$(this.options.leftHandelEle).setStyle('cursor', 'default');
			$(this.options.leftHandelEle).set('src', this.options.leftHandelEleOffImg);
		}
		else {
			$(this.options.leftHandelEle).setStyle('cursor', 'pointer');
			$(this.options.leftHandelEle).set('src', this.options.leftHandelEleOnImg);
		}
		
	}
});
