var popUpWin=0;

function getImageZoomHTML(imageURL, imageWidth, imageHeight) {
	html = '<HTML>';
	html += '<HEAD>';
	html += '<META NAME="GENERATOR" CONTENT="ZOOM IMMAGINE">';
	html += '<TITLE>ZOOM</TITLE>';
	html += '</HEAD>';
	html += '<BODY LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">';
	html += '<IMG SRC="'+imageURL+'" WIDTH="'+imageWidth+'" HEIGHT="'+imageHeight+'">';
	html += '</BODY>';
	html += '</HTML>';
	return html;
}

function zoomImage(imageURL, imageWidth, imageHeight)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
	
	var defaultWidth = (screen.availWidth - 150);
  var defaultHeight = (screen.availHeight - 100);	
  var windowWidth = (defaultWidth < imageWidth) ? defaultWidth : imageWidth;
  var windowHeight = (defaultHeight < imageHeight) ? defaultHeight : imageHeight;
	var left = (screen.availWidth - windowWidth) / 2;
	var top = (screen.availHeight - windowHeight) / 2;
	var scrollbar = (defaultWidth < imageWidth || defaultHeight < imageHeight) ? 'yes' : 'no';

	popUpWin = window.open('', 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar='+scrollbar+',resizable=no,copyhistory=yes,width='+windowWidth+',height='+windowHeight+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');	
	popUpWin.document.write(getImageZoomHTML(imageURL, imageWidth, imageHeight));  	
}