This is the code I use to preload images, I\'m not sure if it\'s the best one.
My question is, how can I fire and event, for an example alert(); dialog after is has finished
Check out: http://engineeredweb.com/blog/09/12/preloading-images-jquery-and-javascript. It uses jQuery. In the comments, your direct issue is addressed by someone and a solution was posted there. I think it'll fit your needs.