/*
 * jquery.rollover v1.0
 * jQuery rollover plugin
 * http://www.tadaki-sys.jp/
 *
 * Copyright (c) 2010 Toshihide Tadaki
 *
 * Licensed under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Date: 19th May, 2010
 * Version : 1.0
 */ 

(function($){
  $.fn.rollover = function() {
    return $(this).each(function() {
      var img1 = $(this).attr("src");
      var img2 = img1.replace(/^(.+)(\.[a-z]+)$/, "$1_on$2");

      $(this).hover(
        function() { $(this).attr("src", img2); },
        function() { $(this).attr("src", img1); }
      ).click(function() { $(this).attr("src", img1); });

      $("<img>").attr("src", img2);
    });
  }
})(jQuery);


