I do mine in an extremely complex and dynamic manner. If you are doing yours dynamically as well. You may want to think about doing something like this.
Create a javascript function that looks similar to this.
function MM_preloadImages() {
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
That is my javascript function. Then I proceed to call it like this.
<body onLoad="MM_preloadImages('image1.jpg','image2.jpg','image3.jpg');"
Doing this makes it really easy to dynamically specify all the images you are going to need.