function addLoadListener(fn){ if(typeof window.addEventListener !='undefined'){ window.addEventListener('load',fn,false)} else if(typeof document.addEventListener !='undefined'){ document.addEventListener('load',fn,false)} else if(typeof window.attachEvent !='undefined'){ window.attachEvent('onload',fn)} else{ var oldfn=window.onload if(typeof window.onload !='function'){ window.onload=fn} else{ window.onload=function(){ oldfn() fn()}}}} function preloadImages(){ var button=document.getElementById('submit') var img=document.getElementById('searchImage') var newImg=new Image() newImg.src='images/search-over.gif' button.onmouseover=function(){ img.src=newImg.src img.style.cursor='hand'} button.onmouseout=function(){ img.src='images/search.gif'}} addLoadListener(preloadImages)