/**
 * [jQuery-Plugin] マウスオーバー時に画像を入れ替えるプラグイン(MM_系のJSをエミュレートするプラグイン)
 * 
 * @package jQuery-Plugin
 * @author Hideyuki Kagasawa <kagasawa@web-prom.net>
 * @copyright Copyright (C) 2008 Fusic Co., Ltd , All Rights Reserved.
 */

/*
	[特徴]
	Dreameweaver特有のMM系JSを使う事でbodyタグのonloadイベントでイメージをロードし、
	各素材単位でmouseoverやmouseoutイベントを定義しますが、これだとソースをかなり汚す上に、
	onloadイベントを使っているので、他のJSを組み込んだ際に問題が発生する可能性があります(onloadイベントは併記できないので)。
	このプラグインを使うことでこれらの問題が全て解決します。

	[使い方]
	1.jQueryとjQuery_over(本プラグイン)を読み込む
		<script language="JavaScript" src="./js/jquery-1.2.6.js"></script>
		<script language="JavaScript" src="./js/jquery_over.js" charset="utf-8"></script>
	2.IMGタグに ref="over" を追加
		<img src="./images/image.gif" ref="over" id="Image1" border="0" height="41" width="174" />
	3.マウスオーバ用の画像を「画像名_over.画像拡張子」で準備する
		./images/image_over.gif

	[制限事項]
	iepngfix.jsとの併用は出来ません。
	ref="over"を指定したIMGタグにclass="iepngfix"は設定しないで下さい。
*/

$(function(){
	$("img[@ref=over]")
		.mouseover(function () {
			this.src = this.src.replace(/^(.+)\.(.+?)$/, "$1_over.$2");
		})
		.mouseout(function () {
			this.src = this.src.replace(/^(.+)_over\.(.+?)$/, "$1.$2");
		})
		.each(function () {
			this.preloaded = new Image;
			this.preloaded.src = this.src.replace(/^(.+)\.(.+?)$/, "$1_over.$2");
	});
});

