I have a simple script I need.
User clicks on product picture thumbnail, which opens up a new window with a larger version of this picture. The new window also contains a dynamic number of new thumbnails (up to 4) which when hovered over, display another larger picture in the same new window.
However, the window needs to be resized so that it's large enough to fit the image with the largest width and the image with the largest height. I guess I could just make the new windows HUGE by default, but i don't want to.

Anyway, i'm "preloading" the images using

image[i] = new image();
image[i].src = 'source';

then i check to see if image[i]'s width and height are the maxium.

But the problem i'm having I think is that the images width's and heights aren't available sometimes before they are used.
So how do you properly preload the images (i.e. halt execution of the javascript until the large images are 100% loaded?)

many thanks.