im currently creating a photo rotator similar to facebooks. I have so far gotten the browser history to work properly so that i dont have to refresh page for every photo, and the users can still bookmark the page and link it to their friends and also use the back button. Im using jquery to achieve this.

What im wondering about is its insane speed. Im guessing they are doing some kind of preloading of images in the background while people are watching. Maybe preload 1 or 2 images ahead and 1 prev or something, maybe direction depending on which next or prev buttons are pushed i dont know.

But here is my question. How can i preload images in js/jquery in a way that i know when the preload is done? Some sort of a callback. So that i can show a loading img while images are beeing loaded. Lets say i have an array of images i want to preload in js/jquery before i append some html to the side, how can i achieve this?

Best of regards,