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

    this.contentFade = new EggFade({elemContent:this.options.elemContent});
	
	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 ViewCollectionZoomItem({elemContent:elemItems[nItem]});        
      elemItems[nItem].observe('item:click', this.itemClick.bind(this));	  
      this.arrItems.push(item);
    }		        
  },
    
  show: function(nItem) {
	if (this.nCurrItem != -1) {
	  this.arrItems[this.nCurrItem].hideNow();	
	}	
	this.nCurrItem = nItem;
	  
	this.options.elemContent.style.visibility = "visible";
	  
	this.contentFade.show();
    this.arrItems[this.nCurrItem].show();   
  },

  hide: function() {
	this.contentFade.hide();
  },

  itemClick: function(evt) {
	// fire event
	this.options.elemContent.fire("viewzoom:click");	
  }
  
});
