/**
 * @author Matthew Foster
 * @date   October 10th 2007
 */
 
 var PaginationIteration = Class.create();
		
Object.extend(Object.extend(PaginationIteration.prototype, Pagination.prototype),
				{
					
					initialize : function(options){
					
						Pagination.prototype.initialize.apply(this, arguments);
						this.index = 0;
					
					},
					setDataSet : function(set){
						
						Pagination.prototype.setDataSet.apply(this, arguments);
						this.index = 0;
						
					},
					reset : function(){ 
						
						this.index = 0;
					
					},
					getIndex : function(){
						
						return this.index;
						
					},
					setIndex : function(index){
						
						if(typeof this.dataset[index] == "undefined")
							return false;
						
						this.index = index;
						
						return true;
						
					},
					current : function(){
						
						return this.dataset[this.index];
						
					},
					next : function(){
						
						try{
							return this.dataset[++this.index];
						} 
						catch(e){
							this.index = 0;
							return this.dataset[this.index];								
						}
						
					},
					prev : function(){
						
						try{
							return this.dataset[--this.index];
						}
						catch(e){
							this.index = this.getLength() - 1;
							return this.dataset[this.index];								
						}
						
					},
					hasNext : function(){
						
						return (typeof this.dataset[this.index+1] == "undefined") ? false : true;
													
					},
					hasPrev : function(){
						
						return (typeof this.dataset[this.index-1] == "undefined") ? false : true;
						
					}
				
				}
			);