this technique should work, but this question belongs in the javascript forum. just pass the source of the image to startPreview (i only tested this in IE5.5):
Global_imageviewer = false;
function previewImage(isrc)
{
var height,width,str,spcs;
if(imagedimensions.readyState=="complete"

{
clearInterval(imgint_)
spcs = " "
str = "about:"+spcs+"<body leftmargin=0 topmargin=0><img src='"+isrc+"'></body>"
primgbutton.innerText = "Preview Image";
primgbutton.disabled=false;
height = imagedimensions.height;
width = imagedimensions.width;
Global_imageviewer = window.open(str,"imagepreview_window","width="+width+",height="+height)
}
}
function startPreview(isrc)
{
if(Global_imageviewer){if(!Global_imageviewer.closed)Global_imageviewer.close()}
imagedimensions.src=isrc;
primgbutton.innerText = "(please wait)";
primgbutton.disabled=true;
imgint_ = setInterval(function(){previewImage(isrc)},1);
}
jared@eae.net -