You can reuse the source code from the site you mentioned.
Their code does the following;
1) It preloads the images into varialbes (preloadImg function)
2) It uses the onmouseover event to display a colored thumbnail of the image (onmouseover=”swapImg (‘imxx’, ‘gmMattDoylexx’);” ) xx is the image number.
3) It uses the onmouseout event to display the original, desaturated thumbnail (onmouseout=”swapImg (‘imxx’, ‘gmMattDoylexx_OFF’);” )
4) In the onclick event it calls the showPic function, with a reference to the <img> tag, to display the large version of the image.
Suggestion: use Firefox to read the source code. Firefox will color format the code so it’s easier to read.