It looks to me as if you’re overcomplicating this. I don’t usually use a function for simple image rollovers anymore because it’s rarely necessary. Wouldn’t this do what you need?
<img src="smallimage.jpg" onmouseover="this.src=’bigimage.jpg’" onmouseout="this.src=’smallimage.jpg’" />
Granted, you can probably get nicer effects is you use jQuery or another library and a plugin, but sometimes simple is best.
Well these are actually remote rollovers, so they don’t change themselves they change a larger image above.
Remote rollovers are not all that different a concept:
<img src="smallimage.jpg" id="myimage" />
<p><a href="#" onmouseover="myimage.src='bigimage.jpg'" onmouseout="myimage.src='smallimage.jpg'" onclick="return false">show big image</a></p>
<img src="bigimage.jpg" style="display:none" />
You could use slightly different syntax for compatibility with very old browsers, but I wouldn’t bother since this works in IE6.
The second image tag is just to preload the big version; I’ve had better luck preloading that way than with JavaScript, but both will work.
Question: Don’t you want to show big images in each color?
I see. Looks nice. I assume that you’re going to change those big swatch images before you’re totally done so they’re not so pixelated (you could just add big- before the image placeholder and upload big versions of those swatches)?
Do you have photos of every product in every color? I would think that would be the best thing to show in the rollover display, rather than just a bigger swatch. I’ll send you a link to something I did a while back via PM as an example (it uses jQuery, thickbox, and Ajax, but it’s basically the same concept).