var aboutOn = new Image();
aboutOn.src = 'aboutOn.gif';
var aboutOff = new Image();
aboutOff.src = 'aboutOff.gif';
function on(img){
document[img].src = eval(img + 'On').src;
}
function off(img){
document[img].src = eval(img + 'Off').src;
}
When you place the script in the <head> section of a document, the browser will load the images into memory before processing the <body> element. Be careful, thoughthe more images you preload, the longer it will take your users to see any content at all.