function popImage(img, title) {
 picfile = new Image();
 picfile.src = (img);
 fileCheck(img, title);
}

function fileCheck(img, title) {
 if( (picfile.width!=0) && (picfile.height!=0) ) {
 makeWindow(img, title);
 } else {
 funzione="fileCheck('"+img+"')";
 intervallo=setTimeout(funzione, 50);
 }
}

function makeWindow(img, title) {
 wd = picfile.width;
 ht = picfile.height;

 var isIE = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;
 var args = "resizable=yes";
 if (window.screen) {
 var avwd = screen.availWidth;
 var avht = screen.availHeight;

 if (avwd < wd || avht < ht) { args += ",scrollbars=yes"; }

 var xcen = (avwd > wd) ? (avwd - wd) / 2 : 0;
 var ycen = (avht > ht) ? (avht - ht) / 2 : 0;
 args += ",left=" + xcen + ",screenX=" + xcen;
 args += ",top=" + ycen + ",screenY=" + ycen;

 if (avwd < wd) {
 wd = avwd;
 if (isIE) wd -= 12;
 }
 if (avht < ht) {
 ht = avht;
 if (isIE) ht -= 32;
 }
 }
 args += ",width=" + wd + ",innerWidth=" + wd;
 args += ",height=" + ht + ",innerHeight=" + ht;

 popwin = window.open(img, 'fullSize', args);
 popwin.document.open();
 popwin.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
 popwin.document.write('<html>');
 popwin.document.write('<head>');
 popwin.document.write('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>');
 popwin.document.write('<title>'+title+'</title>');
 popwin.document.write('</head>');
 popwin.document.write('<body style="margin:0px"><a href="javascript:window.close()"><img src="'+img+'" border="0" alt="'+title+'"/></a></body>');
 popwin.document.write('</html>');
 popwin.document.close();
}