﻿function closeZoomWindow()
{
    document.getElementById('light').style.display='none';
    document.getElementById('fade').style.display='none';
}
function showDetailImageWithScroll(url, imgheight, imgwidth,divWidth) {
    document.getElementById('light').style.display = 'block';
    document.getElementById('fade').style.display = 'block'
    document.getElementById('imageZoomImg').src = url;
    document.getElementById('imageZoomImg').width = imgwidth ;
    document.getElementById('imageZoomImg').height = imgheight ;
    document.getElementById('imageDetail').style.width = divWidth + "px";
    document.getElementById('imageDetail').style.overflow = "scroll";
    document.getElementById('imageDetail').style.overflowX = "scroll";
    document.getElementById('imageDetail').style.overflowY = "hidden";
    document.getElementById('light').style.width = (divWidth + 1) + "px";
    document.getElementById('light').style.height = (imgheight + 45) + "px";
    document.getElementById('fade').style.left = 0;
    document.getElementById('fade').style.top = 0;
    setWidthAndHeight();

    document.getElementById('btnClose1').style.width = (divWidth + 1) + "px";

}

function showDetailImage(url,imgheight,imgwidth)
{
 
 document.getElementById('light').style.display='block';
 document.getElementById('fade').style.display='block'   
  document.getElementById('imageZoomImg').src=url;
  document.getElementById('imageZoomImg').width = imgwidth ;
  document.getElementById('imageZoomImg').height = imgheight ;
  document.getElementById('imageDetail').style.width = imgwidth + "px";
  document.getElementById('light').style.width = (imgwidth + 20) + "px";
  document.getElementById('light').style.height = (imgheight + 37) + "px";
  document.getElementById('fade').style.left=0;
  document.getElementById('fade').style.top = 0;
  document.getElementById('imageDetail').style.overflow = "hidden";
  document.getElementById('imageDetail').style.overflowX = "hidden";
    setWidthAndHeight();

    document.getElementById('btnClose1').style.width = (imgwidth + 20) + "px";
    
    
}

function getWindowHeight()
{
 var functionReturn = 0;

 if ( (document.documentElement) && (document.documentElement.clientHeight) )
  functionReturn = document.documentElement.clientHeight;
 else if ( (document.body) && (document.body.clientHeight) )
  functionReturn = document.body.clientHeight;
 else if ( (document.body) && (document.body.offsetHeight) )
  functionReturn = document.body.offsetHeight;
 else if ( window.innerHeight )
  functionReturn = window.innerHeight - 18;

 functionReturn = parseInt(functionReturn);
 if ( (isNaN(functionReturn) == true) || (functionReturn < 0) )
  functionReturn = 0;

 return functionReturn;
};



function getWindowWidth()
{
 var functionReturn = 0;

 if ( (document.documentElement) && (document.documentElement.clientWidth) )
  functionReturn = document.documentElement.clientWidth;
 else if ( (document.body) && (document.body.clientWidth) )
  functionReturn = document.body.clientWidth;
 else if ( (document.body) && (document.body.offsetWidth) )
  functionReturn = document.body.offsetWidth;
 else if ( window.innerWidth )
  functionReturn = window.innerWidth - 18;

 functionReturn = parseInt(functionReturn);
 if ( (isNaN(functionReturn) == true) || (functionReturn < 0) )
  functionReturn = 0;

 return functionReturn;
};

function setWidthAndHeight()
{
    document.getElementById('fade').style.height=getWindowHeight();
    document.getElementById('fade').style.width=getWindowWidth();

}

window.onresize=setWidthAndHeight;
