There are any number of rollover and image replacement scripts on the web. I've included some variants here that perform less-frequently called for types of rollovers.
Script configuration is localized in one spot.
All images are preloaded so that image replacement is instantaneous. Preloading of rollover images is done after the rest of the page has loaded so that the immediately visible content loads faster. Image replacement is attempted only if an image has been loaded, preventing error messages. There are no restrictions on image filenames. There are no restrictions on the number of images that can be used and the script scales easily to accomodate large numbers of images without requiring lots of code.