(function($) {
	$.fn.imgChange = function(options) {
		// elementに格納
		var element = $(this);
		// 初期オプション
		var conf = $.extend({
			// アニメーション設定 "" or "ON"
			animate: "",
			animateOpacity: 0.5,
			animateSpeed: 600,
			// 追加するホバーイメージ名
			hoverImage: "_on"
		}, options);

		element.each(function(){
			var thisSrc = this.src;
			// ON画像指定
			if(thisSrc.indexOf("_off.") > 1){
				var hoverSrc = thisSrc.replace("_off",conf.hoverImage);
			}

			// ホバー処理
			$(this).hover(function (){
				$(this).attr("src",hoverSrc);
				if(conf.animate) {
					$(this).stop().animate({opacity: conf.animateOpacity}, 0).animate({opacity: 1}, conf.animateSpeed);
				}
			},function (){
				$(this).attr("src",thisSrc);
			});
		});



		return this;
	}
})(jQuery);

// 実行処理
$(function (){
	$("a img").imgChange({animate: "yes"});
	$("input.inputBt").imgChange({animate: "yes"}); /*- #2用 -*/
	$("input.submitBt").imgChange({animate: "yes"});
});

