

$(document).ready(function()
{
   /** http://www.atlantajones.com/2007/09/27/easy-reusable-image-rollovers-with-jquery/ */
   //Preload rollovers
   $("#mainMenu img").each(function(){
      //Set the original src
      rollsrc = $(this).attr("src");
      rollON = rollsrc.replace(/.gif$/ig,"_mo.gif");
      $("<img>").attr("src", rollON);
   });
   
   //Show mouse-over if state is not already ON or ACTIVE
   $("#mainMenu a").mouseover(function(){
      imgsrc = $(this).children("img").attr("src");
      if (!imgsrc.match(/_mo/)  &&  !imgsrc.match(/_active/)) {
         imgsrcON = imgsrc.replace(/.gif$/ig,"_mo.gif"); // strip off extension
         $(this).children("img").attr("src", imgsrcON);
      }
   });
   
   //Reset original source on mouseOut
   $("#mainMenu a").mouseout(function(){
      $(this).children("img").attr("src", imgsrc);
   });
});

