Frank: "window resize"-Funktion klappt nicht so wie es soll....

Hallo !

Ich habe ein Problem mit folgendem Script:

....
var parameter = location.search;
var anfang = parameter.indexOf("=");
var sel_img = parameter.substr(anfang+1, parameter.length);
var sizeToSet = 150;

var firstbild = 1
var lastbild = 16

var i = sel_img;
images = new Array;
images[1] = "../../pics/bazubis_1998/beilfuss.jpg";
images[2] = "../../pics/bazubis_1998/blatt.jpg";
images[3] = "../../pics/bazubis_1998/bouyardan.jpg";
images[4] = "../../pics/bazubis_1998/duerkes.jpg";
images[5] = "../../pics/bazubis_1998/ernst.jpg";
images[6] = "../../pics/bazubis_1998/gemmerich.jpg";
images[7] = "../../pics/bazubis_1998/godawska.jpg";
images[8] = "../../pics/bazubis_1998/gollan.jpg";
images[9] = "../../pics/bazubis_1998/ilgenstein.jpg";
images[10] = "../../pics/bazubis_1998/kopp.jpg";
images[11] = "../../pics/bazubis_1998/ophoff.jpg";
images[12] = "../../pics/bazubis_1998/raschke.jpg";
images[13] = "../../pics/bazubis_1998/schoppet.jpg";
images[14] = "../../pics/bazubis_1998/schwarz.jpg";
images[15] = "../../pics/bazubis_1998/wawro.jpg";
images[16] = "../../pics/bazubis_1998/weiss.jpg";

var a = sel_img;
dername = new Array;
dername[1] = "Sabine Beilfuss";
dername[2] = "Christian Blatt";
dername[3] = "Nasiri Bouyardan";
dername[4] = "Anika Duerkes";
dername[5] = "Sonja Ernst";
dername[6] = "Mark Gemmerich";
dername[7] = "Michaela Godawska";
dername[8] = "Tanja Gollan";
dername[9] = "Thomas Ilgenstein";
dername[10] = "Benjamin Kopp";
dername[11] = "Julia Ophoff";
dername[12] = "Michael Raschke";
dername[13] = "Jörg Schoppet";
dername[14] = "Malin Schwarz";
dername[15] = "Marco Wawro";
dername[16] = "Anke Weiss";

function gallery()
 {
 if (i == firstbild)
  {
  document.gallery.previous.value="";
  }
 window.resizeTo(document.img.width,document.img.height + sizeToSet);
 }

function previmg()
 {
 if (i != firstbild)
  {
  i --;
  document.img.src = images[i];
  a --;
  document.all.meinname.innerHTML = dername[a];
  }
 if (i == firstbild)
  {
  document.gallery.previous.value="";
  }
 window.resizeTo(document.img.width,document.img.height + sizeToSet);
 }

function nextimg()
 {
 if (i != lastbild)
  {
  i ++;
  document.img.src = images[i];
  a ++;
  document.all.meinname.innerHTML = dername[a];
  }
 if (i == lastbild)
  {
  document.gallery.next.value="";
  }
 window.resizeTo(document.img.width,document.img.height + sizeToSet);
 }

function pickrand()
 {
 var imagenumber = lastbild ;
 var randomnumber = Math.random() ;
 var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1;
 var randimage = images[rand1]
 document.img.src = randimage
 document.all.meinname.innerHTML = dername[rand1];
 i = rand1
 if (i == firstbild)
  {
  document.gallery.previous.value="";
  }
 else
  {
  document.gallery.previous.value="< Vorheriges";
  }
 if (i == lastbild)
  {
  document.gallery.next.value="";
  }
 else
  {
  document.gallery.next.value="Nächstes >";
  }
 window.resizeTo(document.img.width,document.img.height + sizeToSet);
 }

function firstimg()
 {
 i = firstbild;
 a = firstbild;
 document.img.src = images[i];
 document.all.meinname.innerHTML = dername[a];
 document.gallery.previous.value="        ";
 document.gallery.next.value="Nächstes >";
 window.resizeTo(document.img.width,document.img.height + sizeToSet);
 }

function lastimg()
 {
 i = lastbild;
 a = lastbild;
 document.img.src = images[i];
 document.all.meinname.innerHTML = dername[a];
 document.gallery.next.value="    ";
 document.gallery.previous.value="< Vorheriges";
 window.resizeTo(document.img.width,document.img.height + sizeToSet);
 }

function stoperror()
 {
 return true;
 }

window.onerror=stoperror

// -->
</script>

<table border="0" height="100%">
 <tr valign="bottom">
 <td>
<div align="center">
 <img border="1" name="img" src="">

<script>
  document.img.src = images[sel_img];
  window.resizeTo(document.img.width +400,document.img.height + 400);
 </script>

<table border="0">
 <tr class="galerie_gross">
  <td width="200" height="30" id="meinname" background="../../images/hinter_schrift.jpg">
  <script>document.all.meinname.innerHTML = dername[sel_img];</script></td>
....

Das Problem ist, das ich Bilder verschiedener Größen habe, und das Fenster sich nicht an die Bildgröße anpasst wie es eigentlich soll. Woran könnte das liegen?