﻿var __imageZoomHostPrefix= function(){return ''};
var _imageZoomHostPrefix='';

/*******************************************************/
function galleryImageZoomShow(rowId) {
  try {
    //Hide them all 
    for (var i=1; i<=_maxImages; i++) {
      try {
        ls_getElementById('table' + i).style.display = 'none';
      } catch(e) {}
    }
    
    ls_getElementById('table' + rowId).style.display = 'inline';
    galleryImageZoomPosition(rowId);

    ls_getElementById(_imageZoomPanel).style.display = 'inline';
  } catch (e) {}
}

/*******************************************************/
function galleryImageZoomPosition(rowId) {
  var iLeft;
  var iZoomOffsetTop;
  var dImageWidth;
  try {
    dImageWidth = ls_getElementPosition(ls_getElementById('imgZoom'  + rowId)).width;

    if ((dImageWidth * 0.9) > ls_getElementPosition(ls_getElementById('imgZoom' + rowId)).height) {
      iZoomOffsetTop = 40;
    } else {
      iZoomOffsetTop = 4;
    }
      
    iLeft = ls_getElementPosition(document.body).width;
    iLeft = iLeft / 2;
    iLeft = iLeft - ((dImageWidth + 250) / 2);

    ls_SetElementY(ls_getElementById(__imageZoomHostPrefix() + _imageZoomPanel), ls_GetScrollY() + iZoomOffsetTop); 
    ls_SetElementX(ls_getElementById(__imageZoomHostPrefix() + _imageZoomPanel), iLeft);
      
  } catch (e) {}
}

