function preloadHoverImages() {
  $("img").each(function() {
  
    var src = $(this).attr("src");
    if(src && src.indexOf("base") != -1) {
    
      var img = new Image();
      img.src = src.replace(/base/, "hover");
    }
  });
}

function preloadDetailImages() {
  $("img").each(function() {
  
    var src = $(this).attr("src");
    if(src && src.indexOf("thumbs") != -1) {
    
      var img = new Image();
      img.src = src.replace(/thumbs/, "details");
    }
  });
}


$(document).ready(function() {
 
   // load the hover images
   preloadHoverImages();

   // load the images for the detail page
   preloadDetailImages();

   // assign the rollover code
   $(".ro").hover(
     function() {
       var src = $(this).attr("src");
       if (src) {
         $(this).attr("src", src.replace(/base/, "hover"));
       }
     },
     function() {
       var src = $(this).attr("src");
       if (src) {
         $(this).attr("src", src.replace(/hover/, "base"));
       }
     }
   );

});
