function preload(src) {  a = new Image; a.src=src; }

 $(document).ready(function() {
   $('img.swapimage')
   .attr('onmouseout', 'this.src=$(this).attr(\'osrc\')')
   .attr('onmouseover', 'this.src=$(this).attr(\'hsrc\')')
   .each(function(i){
     $(this).attr('osrc', this.src);
     preload($(this).attr('hsrc'));
   })
 });