preloading images
I've updated my website to contain a photo gallery. Each of the photos are stored on their own html page with links to previous and next html page, so that the viewer can see all the thumbnails on the gallery homepage and when they click on one photo it opens in a new window, which they can use to scroll through the larger images.
I am wanting to get it working so that when you are viewing one image, it pre loads the previous and next image. I have used the following code - which appears to work but it only seems to work once.
For example, if i open page1.html it displays pic1.jpg and pre-loads pic2.jpg - so when i scroll through to page2.html, the photo is already loaded. However, page2.html does not seem to pre load the pic3.jpg
The code i am using on each html page is :
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- hide from none JavaScript Browsers
Image1= new Image($imagewidth,$imageheight)
Image1.src = "$pic"
// End Hiding -->
</SCRIPT>
</head>
where $pic is the image filename and $imagewidth and $imageheight are the width and height of the image
Does my problem come from the fact that each page is using the same name Image1?
or is it something else? Like i need to call something in the onload method?

