var stScroller = Class.create({
	startFrom: 0,
	currPage: null,
	perPage: 1,
	scrollElmPrefix: null,
	totalHits: null,
	previousElm: null,
	nextElm: null,
	initialize: function(idPrefix, total){
		
		this.currPage = this.startFrom;
		this.totalHits = total;
		this.scrollElmPrefix = idPrefix;
		
	},
	nextPage : function(){
		var currPageElmName = this.scrollElmPrefix + this.currPage;
		if((this.currPage + 1)  >= (this.totalHits/this.perPage)) 
		{
		  this.currPage = this.startFrom;
		}
		else
		{ 
		  this.currPage += 1; 
		}  
		var nextPageElmName = this.scrollElmPrefix + this.currPage;
		$(currPageElmName).hide();
		new Effect.Appear(nextPageElmName, {duration:0.8});
//		alert(this.currPage);
		

	},
	previousPage: function(){
		var currPageElmName = this.scrollElmPrefix + this.currPage;
		if(this.currPage == this.startFrom) 
		{
		  this.currPage = ((this.totalHits/this.perPage).ceil()) - 1;
		}
		else
		{ 
		  this.currPage -= 1; 
		}  
		var nextPageElmName = this.scrollElmPrefix + this.currPage;
		$(currPageElmName).hide();
		new Effect.Appear(nextPageElmName, {duration:0.8});

	}
});
