var caption = new Array();

function showZoom(imgSrc,imgWidth,imgHeight,caption){

    var cache = document.getElementById('cache');
    var zoom = document.getElementById('zoom');
    var zoom_a = document.getElementById('zoom_a');
    var zoom_img = document.getElementById('zoom_img');
    var zoom_caption = document.getElementById('zoom_caption');
	
    
	if ( caption )
	{
		zoom_caption.innerHTML = caption;
	}
	else
	{
		zoom_caption.innerHTML = "";
	}
	
	
    // zoom_a.setAttribute('href','javascript:hideZoom()');
    zoom_img.setAttribute( 'src', imgSrc );
    zoom_img.setAttribute( 'border', 0 );
     
    if( /MSIE [567]/.test( navigator.appVersion ) )
    {
        var yPos = (( document.documentElement.clientHeight / 2 ) + document.documentElement.scrollTop )-(imgHeight/2+50);
        var xPos = (( document.documentElement.clientWidth / 2 ) + document.documentElement.scrollLeft)-(imgWidth/2);
        var cacheHeight = document.documentElement.clientHeight + document.documentElement.scrollTop-20;
        var cacheWidth = document.documentElement.clientWidth + document.documentElement.scrollLeft-20;
    }
    else
    {
        var yPos = (( window.innerHeight / 2 ) + window.pageYOffset)-(imgHeight/2+50);
        var xPos = (( window.innerWidth / 2 ) + window.pageXOffset)-(imgWidth/2);
        var cacheHeight = window.innerHeight + window.pageYOffset-20;
        var cacheWidth = window.innerWidth + window.pageXOffset-20;
    }
     
    cache.style.width=cacheWidth+'px';
    cache.style.height=cacheHeight+'px';

    cache.style.display='block';

    // fadeIn('cache',0);
    
    // zoom_caption.innerHTML = caption[objID];
    
    zoom.style.top=yPos+'px'; 
    zoom.style.left=xPos+'px'; 
    zoom.style.display='block';
}


function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}


function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 50) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 0,05);
    }
  }
}




function hideZoom(){
    document.getElementById('zoom').style.display='none';
    document.getElementById('cache').style.display='none'; 
    zoom_img=document.getElementById('zoom_img'); 
    zoom_img.setAttribute( 'src', '');
}
