function show_image( obj )
{
  get_image( obj );
  PageSize = getPageSize();
  document.getElementById( 'show_image' ).style.top = ( getPageYpos() + 60 ) + 'px';
  set_opacity( document.getElementById( 'show_overlay_BG_image' ), 85 );
  document.getElementById( 'show_overlay_BG_image' ).style.height = ( PageSize.h + 150 ) + 'px';
  document.getElementById( 'show_overlay_BG_image' ).style.display = 'block';
  document.getElementById( 'show_image' ).style.display = 'block';
}

function hide_image()
{
  document.getElementById( 'show_image' ).style.display = 'none';
  document.getElementById( 'show_overlay_BG_image' ).style.display = 'none';
  document.getElementById( 'show_overlay_BG_image' ).style.height = '0px';
  document.getElementById( 'show_image' ).style.top = '0px';
  document.getElementById( 'show_image' ).innerHTML = '';
}

function get_image( obj )
{
  new Ajax.Request(
                    '/module/big_image.php?img_path=' + obj.src + '&img_title=' + obj.title,
                    { method: 'get', onComplete: show_image_big }
                  );
}

function show_image_big( originalRequest )
{
  $( 'show_image' ).innerHTML = originalRequest.responseText;
}

function getPageYpos()
{
  return ( window.pageYOffset != null ) ? window.pageYOffset : window.document.documentElement.scrollTop;
}

function getPageSize()
{
  var xS, yS;
  if( window.innerHeight && window.scrollMaxY ) { yS = window.innerHeight + window.scrollMaxY; xS = document.body.scrollWidth; }
  else if( document.body.scrollHeight > document.body.offsetHeight ) { yS = document.body.scrollHeight; xS = document.body.scrollWidth; }
  else { yS = document.body.offsetHeight; xS = document.body.offsetWidth; }
  var wH, wW;
  if( self.innerHeight ) { wH = self.innerHeight; wW = self.innerWidth; }
  else if( document.documentElement && document.documentElement.clientHeight ) { wH = document.documentElement.clientHeight; wW = document.documentElement.clientWidth; }
  else if( document.body ) { wH = document.body.clientHeight; wW = document.body.clientWidth; }
  if( yS < wH ) pH = wH; else pH = yS;
  if( xS < wW ) pW = wW; else pW = xS;
  var pos = { w:0, h:0 };
  pos.h = pH; pos.w = pW;
  PageSize = new Array( pW, pH )
  return pos;
}
