content['sitePrintItem'] = Class.create({

  THREAD_ID: null,
  EXEC_UID: null,
  arrParams:  null,

  initialize: function(arrInstVars, arrParams, arrLang)
  {
    this.THREAD_ID    = arrInstVars.THREAD_ID;
    this.EXEC_UID     = arrInstVars.EXEC_UID;
    
	
    this.arrImages = $$('a[_name="preview"]');
    this.arrImages.each(function(el)
    {
        el.observe('click', this._showMediumPhoto.bind(this))
    }.bind(this));
	
	
	this.arrImages = $$('div#'+this.EXEC_UID+'-galleryContent a[_name="preview"]');
	
    if($('pictureLink')) $('pictureLink').observe('click', this._showGallery.bind(this));
    if($('slideShowLink')) $('slideShowLink').observe('click', this._showGallery.bind(this));
	
	
	
	this._resizePage();
	
  },
  
  
  _resizePage: function(evt)
  {
    this.pageHeight = $(this.EXEC_UID+'-pageTable').getHeight();
	
	if( this.pageHeight && this.pageHeight > 1500 )		// is more than 2 pages
	{
		this.galContainerHeight = $(this.EXEC_UID+'-galleryContent').getHeight();
		if( 1500 - this.pageHeight + this.galContainerHeight < 280 )	// hide preview if there is no enough space
		{
			$(this.EXEC_UID+'-galleryContent').setStyle(
			{
				display: 'none'
			});
		}else{
			$(this.EXEC_UID+'-galleryContent').setStyle(
			{
				height: '240px',
				overflow: 'hidden'
			});
		}
	}
  },
  
  _showGallery: function(evt)
  {
    evt.stop();
    $(document).fire('slideShow:start', {intStartImgNum: evt.findElement('a[_num]').getAttribute('_num'), arrImagesElements: this.arrImages});
  },
  
  _showMediumPhoto: function(evt)
  {
    evt.stop();
    
  }
});
arrJsLoaded['content.sitePrintItem.js']=true;init.jsLoaded("content.sitePrintItem.js");
