there's also an older article about this on
a list apart. it's written in PHP, so even if your visitors have javascript turned off, they'll still be able to see and click on the images. (that's assuming of course, you have PHP installed on your server.)