// Source: JavaScript Codebook, Addison Wesley Verlag
function Popup4Image()
{
  this.lastWidth = 0;
  this.lastHeight = 0;
  this.childWin = null;

  this.showImageInSize = showImageInSize;
}

function showImageInSize(src, target, width, height)
{
  if(document.layers || window.opera)
  {
    var x=y=-8;
  } 
  else
  {
  	var x=y=-0;
  }

  var html='<HTML><HEAD><title>LUPE</title>' +
           ' <style type="text/css"> ' +
           '   body {margin-left:'+x+'px; margin-top:'+y+'px; ' +
           '         margin-right:0px; margin-bottom:0px; ' +
           '         text-align : center;} ' +
           ' </style> ' +
           '</HEAD>' +
           '<body>' +
           '<img src="' + src + '" border="0">' +
           '</body> </html>';

  if( this.childWin && !this.childWin.closed) 
  {
    diffX = width - this.lastWidth;
    diffY = height - this.lastHeight;
    this.childWin.resizeBy(diffX, diffY);
  } 
  else 
  {
    this.childWin = window.open(
                       "dummy.html",
                       target,
                       "width="+width+",height="+height+",resizable=1"
                                );
  }
  this.lastWidth = width;
  this.lastHeight = height;
  
  with(this.childWin.document)
  {
    open(); write(html); close();
  }
  this.childWin.resizeTo(width, height);
  this.childWin.focus();
}
var popup = new Popup4Image();
