
var resId=0;
var imgWndw;

function imgOpen(imgLink,Title,imgdesc,descsize) {
  if (typeof(window.resizeBy)=='undefined') return true;
  imgWndw=window.open('',imgLink.target,'width=100,height=100,toolbar=no,menubar=no,location=no,status=no,resizable=yes,scrollbars=no,left='+(screen.width>>>2)+',top='+(screen.height>>>4));
  self.focus();
  var imgTitle=(Title)?Title:imgLink.href;
  with (imgWndw.document){
    open();
    write('<html><head><title>'+imgTitle+'</title></head><body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" style="margin:0;padding:0;position:fixed;overflow:none;" marginheight="0"><img src="'+imgLink.href+'" border="0"  alt="'+imgTitle+'" title="'+imgTitle+'" class="r">');
    sp=0;
    if (imgdesc) {write('<br><span style="font-family: tahoma, arial, verdana, sans-serif;	font-size: 12px; color: #909090;">'+imgdesc+'</span>'); sp=50; if (descsize) {sp=descsize};};
    write('</body></html>');
    close();
  }
  resId=setInterval('imgResize()',100);
  return false
}

function imgResize() {
  var w=imgWndw.document.images[0].width;
  if (w>screen.availWidth) w=screen.availWidth;
  var h=imgWndw.document.images[0].height;
  if (h>screen.availHeight) h=screen.availHeight;
  if (w>50 && h>50) {

    var ww=(imgWndw.innerWidth)?imgWndw.innerWidth:((document.body)?
      imgWndw.document.body.clientWidth:null);
    var wh=(imgWndw.innerHeight)?imgWndw.innerHeight:((document.body)?
      imgWndw.document.body.clientHeight:null);
    opera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false 
    mozilla=(navigator.userAgent.indexOf("Mozilla/5")!=-1)?true:false 
    if(opera){sp=sp+0;}
    if(mozilla){sp=sp+0;}
    if (ww && wh) {imgWndw.resizeBy(w-ww,h-wh+sp);}
    imgWndw.focus();
    clearInterval(resId)
  }
}
