//  Author: Christopher W. Baran
//
//  Written: December 6, 2008
//
//  Global Mouse Over Script
//  Based on jQuery


$(document).ready(function() {

  // *************** Button Mouse Over Swapping *******************
  // Any img tags on the page with src names that end in _off.gif
  //  will mouse over to the same base name _ovr.gif
  $('IMG[src$="_off.gif"]').each(function() {
    // Preload Images
    jQuery("<img>").attr("src", $(this).attr('src').replace( /_off\.gif/, '' ) + '_ovr.gif' );

    $(this).hover(function () {
      $(this).attr('src', $(this).attr('src').replace( /_off\.gif/, '' ) + '_ovr.gif' );
    },
    function () {
      $(this).attr('src', $(this).attr('src').replace( /_ovr\.gif/, '' ) + '_off.gif' );
    });
  });

  
  // Same routine for inputs ( add to cart is an input type image )
  $('INPUT[src$="_off.gif"]').each(function() {
    // Preload Images
    jQuery("<input>").attr("src", $(this).attr('src').replace( /_off\.gif/, '' ) + '_ovr.gif' );

    $(this).hover(function () {
      $(this).attr('src', $(this).attr('src').replace( /_off\.gif/, '' ) + '_ovr.gif' );
    },
    function () {
      $(this).attr('src', $(this).attr('src').replace( /_ovr\.gif/, '' ) + '_off.gif' );
    });
  });

});
