$(function(){

	function ImgOvAnimeFade(){

		var OvClass = "imgover", //ロールオーバーする要素のクラス名
		OvStr = "_on", //ロールオーバー後の画像に追加する文字列
		OvImg = "ovImg",
		Speed = 250; //アニメーションの速度

		//classがrolloverのimg要素に対しての処理
		//$("img."+OvClass).each(function(){
		$("."+OvClass).each(function(){

			var This = $(this),
			Url = This.attr("src").replace(/^(.+)(\.[a-z]+)$/,"$1"+OvStr+"$2");

			function OvElmLen(){ //ロールオーバー画像表示確認関数
				return This.prev("img."+OvImg).length;
			}

			//ホバーイベント
			This.hover(
			function(){
				if(!This.attr("src").match(OvStr+".")){
					if(!OvElmLen()){
						if(jQuery.support.checkOn && jQuery.support.htmlSerialize && !window.globalStorage){ //Operaバグ対策
							This.before("<span style='display:inline-block;' class='"+OvImg+"' ></span>");
						}
						This.css({position:"relative"}).before("<img style='position:absolute;' class='"+OvImg+"' src='"+Url+"' alt='' />");
					}
					This.stop().animate({opacity:"0"},Speed);
				}
			},
			function(){
				if(OvElmLen()){
					This.stop().animate({opacity:"1"},Speed,function(){
						This.css({position:"static"})
						.prevAll("."+OvImg).remove();
					});
				}
			})
			.each(function(){ //プリロード設定
				$("<img>").attr("src",Url);
			});

		});

	}

	ImgOvAnimeFade();

});



if(window.addEventListener) {
  //alert("load")
  window.addEventListener("unload", ImgOvAnimeFade,false)
  window.addEventListener("load", ImgOvAnimeFade, false);
}
else if(window.attachEvent) {
  window.attachEvent("onload", ImgOvAnimeFade);
}
function ImgOvAnimeFade(){
}
