/**
 * ViewCollectionDetailScroller
 */
var ViewCollectionDetailScroller = Class.create({
  /**
   * Init ViewCollectionDetailScroller
   */	
  initialize: function() {
	this.options = Object.extend({
	  elemContent : null
	}, arguments[0] || { });		

	this.arrItems = new Array();
	this.nCurrItem = -1;
	
    var elemItems = this.options.elemContent.select('.item');
    
    var item;	
    for (var nItem = 0; nItem < elemItems.length; nItem++) {
      item = new ViewCollectionDetailScrollItem({elemContent:elemItems[nItem]});        
      this.arrItems.push(item);
    }
  },  

  getCurrItem: function() {
	return this.nCurrItem;
  },

  getCurrItemContent: function() {
	return this.arrItems[this.nCurrItem].getContent();
  },
  
  show: function(nItem) {
	if (nItem != undefined) {
	  if (this.nCurrItem != -1) {
		this.arrItems[this.nCurrItem].hideNow();	
	  }	
	  this.nCurrItem = nItem;
	}
	  
	this.options.elemContent.style.visibility = "visible";
    this.arrItems[this.nCurrItem].show();   
  },

  hide: function() {
    this.arrItems[this.nCurrItem].hide();   
  },
  
  showPrevious: function() {
	if (this.nCurrItem == 0) {
	  return;
	}  
	 
	this.arrItems[this.nCurrItem].hide();
	
	this.nCurrItem--;
	
	this.arrItems[this.nCurrItem].show();
  },
  
  showNext: function() {
	if (this.nCurrItem == this.arrItems.length-1) {
	  return;
	}  
	  
	this.arrItems[this.nCurrItem].hide();
	
	this.nCurrItem++;
	
	this.arrItems[this.nCurrItem].show();
  }

});
