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

	this.arrItems = new Array();
	this.nCurrItem = -1;
	
    this.elemContentText = this.options.elemContent.down('.contenttext');
    this.contentTextFade = new EggFade({elemContent:this.elemContentText});
    
    this.elemPDFText = this.options.elemContent.down('.pdftext');
    this.PDFTextFade = new EggFade({elemContent:this.elemPDFText});    
    
    var elemItems = this.options.elemContent.select('.contentimage');
    var item;	
    for (var nItem = 0; nItem < elemItems.length; nItem++) {
      item = new ViewMediaZoomItemPage({elemContent:elemItems[nItem]});        
      this.arrItems.push(item);
    }		        
  },
    
  getNumPages: function() {
    return this.arrItems.length;
  },
  
  show: function() {
    this.nCurrItem = 0;	  
	this.contentTextFade.show();
	this.PDFTextFade.show();
	this.arrItems[this.nCurrItem].show();	
  },

  hide: function() {
	this.contentTextFade.hide();
	this.PDFTextFade.hide();
	this.arrItems[this.nCurrItem].hide();	
  },

  hideNow: function() {
	this.contentTextFade.hideNow();
	this.PDFTextFade.hideNow();
	this.arrItems[this.nCurrItem].hideNow();	
  },
  
  showPrevious: function() {
	var nSlide = this.arrItems.length-1;
	  
   	if (this.nCurrItem-1 >= 0) {
   	  nSlide = this.nCurrItem - 1;
   	}
   	if (this.nCurrItem >= 0) {
  	  this.arrItems[this.nCurrItem].hide();
    }
	this.nCurrItem = nSlide;
	  
    this.arrItems[this.nCurrItem].show();
  },
  
  showNext: function() {
	var nSlide = 0;
	  
   	if (this.nCurrItem+1 < this.arrItems.length) {
   	  nSlide = this.nCurrItem + 1;
   	}
   	if (this.nCurrItem >= 0) {
  	  this.arrItems[this.nCurrItem].hide();
    }
	this.nCurrItem = nSlide;

    this.arrItems[this.nCurrItem].show();
  }
  
});
