codice:
function prewiewImage (url, name, title, alt, bgcolor, link, comment)
{
if (url == null) return null;
var gap = 30;
var img = new Image();
img.src = url;
(name == null) && (name = "_blank");
(title == null) && (title = url);
(alt == null) && (alt = "");
(bgcolor == null) && (bgcolor = "#ffffff");
var x = (screen.width - (img.width + gap)) / 2;
var y = (screen.height - (img.height + gap)) / 2;
var param = "height=" + (img.height + gap) + ",width=" + (img.width + gap) +
",top=" + y + ",left=" + x + ",screenY=" + y + ",screenX=" + x +
",location=no,menubar=no,directories=no,status=" + (comment != null ? "yes" : "no") +
",resizable=yes,scrollbars=no,toolbar=no";
var popup = window.open ("", name, param);
if (popup != null && !popup.closed) {
var tmp = "<html><head><title>" + title + "</title></head>" +
"<body bgcolor=\"" + bgcolor + "\"><table height=\"100%\" width=\"100%\" " +
"align=\"center\"><tr><td height=\"100%\" width=\"100%\" align=\"center\" " +
"valign=\"middle\">" + (link != null ? "<a href=\"" + link + "\">" : "") +
"<img border=\"0\" src=\"" + url + "\" alt=\"" + alt + "\">" + (link != null ? "</a>" : "") +
"</td></tr></table></body></html>";
popup.document.open ("text/html");
popup.document.write (tmp);
popup.document.close();
(comment != null) && (popup.status = popup.defaultStatus = comment);
popup.focus();
}
return popup;
}