var WindT;

function popup(link,width,height,title,scroll) {

    var w, h, fixedW, fixedH, diffW, diffH,prms;

    if (!title) title='Picture';

    prms='toolbar=no, location=no, directories=no, status=no, menubar=no,'
      +' scrollbars='+(scroll? 'yes':'no')+', resizable=no,width='+width+',height='+height;

    if (WindT) WindT.close();
    WindT=window.open('/null.html','WindT',prms);
    WindT.document.open();
    WindT.document.write(
      "<html>\n<head>\n<title>"+title+"</title>\n</head>\n"+
      "<body style=\"margin: 0px; padding: 0px;\">\n"+
      "<img src=\""+link+"\" border=0>\n"+
      "</body>\n</html>"
    );
    WindT.document.close();
    WindT.focus();

    if (document.all) {
        fixedW = WindT.document.body.clientWidth;
        fixedH = WindT.document.body.clientHeight;
        WindT.resizeTo(fixedW, fixedH);
        diffW = fixedW - WindT.document.body.clientWidth;
        diffH = fixedH - WindT.document.body.clientHeight;
    } else {
        fixedW = WindT.innerWidth;
        fixedH = WindT.innerHeight;
        WindT.resizeTo(fixedW, fixedH);
        diffW = fixedW - WindT.innerWidth;
        diffH = fixedH - WindT.innerHeight;
    }
    w = fixedW + diffW;
    h = fixedH + diffH;
    if (h >= screen.availHeight) w += 16;
    if (w >= screen.availWidth)  h += 16;
    w = Math.min(w,screen.availWidth);
    h = Math.min(h,screen.availHeight);
    WindT.resizeTo(w,h);
    WindT.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
}
