var orig = true;function swap(obj,img1,img2){ orig = !orig; if(orig) obj.src = img1; else obj.src = img2;}......<img src="img1.gif" alt="" onmouseover="swap(this,'img1.gif','img2.gif')" onmouseout="swap(this,'img1.gif','img2.gif')"/>
try something like that. Did you really need preloading of images?