(function($){
 $.fn.overimage = function(){
  return this.each(function(){
   if(this.overimage_already==true){ return; }
   
   //overimage_alltime クラスの処理
   if($(this).hasClass('overimage_alltime')){
    if(this.src.match(/-out\.(gif|jpg|png)$/)){
     var ext = RegExp.$1;
     this.src = this.src.replace('-out.'+ext, '-over.'+ext);
    }
    return;
   }
   
   //カーソル化
   $(this).css('cursor','pointer');
   
   //先読み込み
   if(this.src.match(/-out\.(gif|jpg|png)$/)){
    var ext = RegExp.$1;
    var url = this.src.replace('-out.'+ext, '-over.'+ext);
    $('<img />').hide().attr('src', url).appendTo(document.body).load(function(){ $(this).remove(); }).error(function(){ $(this).remove(); });
   }
   
   $(this).hover(
    function(){
     if(this.src.match(/-out\.(gif|jpg|png)$/)){
      var ext = RegExp.$1;
      this.src = this.src.replace('-out.'+ext, '-over.'+ext);
     }
    },
    function(){
     if(this.src.match(/-over\.(gif|jpg|png)$/)){
      var ext = RegExp.$1;
      this.src = this.src.replace('-over.'+ext, '-out.'+ext);
     }
    }
   );
   this.overimage_already = true;
  });
 };
})(jQuery);

//ちらつき防止
try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {} 

