I used the search and saw that this topic came up a couple times, but those threads couldn't help me.

I need a auto resizing window for my image gallery.

I've tried this:

<script language="javascript" type="text/javascript">
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no';
var optIE='scrollbars=no';
function popPic(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...<\/title><style>body{margin:0px;}<\/style><meta http-equiv="imagetoolbar" content="no">');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Micro soft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=122-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');
writeln('window.innerWidth=document.images["up"].width;');writeln('window.innerHeight=document.images["up"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('<\/sc'+'ript>');
writeln('<\/head><body bgcolor="000000" scroll="no" onload="reSizeToImage();doTitle();self.focus()" onClick="self.close()">');
writeln('<img alt="Klicke um Fenster zu schliessen" name="up" src='+imageURL+' style="display:block"><\/body><\/html>');
close();
}}
</script>

and it works fine in IE, but doesn't work in FF. When I first tried it in FF, it worked, then I clicked my thumbnail again, and the popup cut a bit off at the side. I clicked again, it cut off more. Now when I click on it, it just shows a small portion of the window.

I also tried this:

http://gil.davis.home.att.net/openit_example.htm

Also works in IE, but doesn't work in FF - it keeps showing the 'Loading' text. I've tried it lots of times, and twice it showed up fine, but the rest of the time I just get 'Loading'. The image on the example page also works in FF.


I did everything exactly like it's in the examples, so why isn't it working? Does anyone know a script for this that will work in IE and FF?