/**
 *	@filename		lib.js
 *	@charset		utf-8
 *	@modified		April 6, 2010
 *	@description	共通js
 */
(function(){



//
//	高速化＠IE
//
var document = window.document;



//
//	ルートパス
//
var s = document.createElement("script"),
	h = document.getElementsByTagName("head")[0];
h.appendChild(s);
h.removeChild(s);
s = h = null;
var rootPath = document.getElementsByTagName("script");
rootPath = rootPath[rootPath.length - 1].src.replace(/\/js\/common\/lib\.js/, "");



//
//	スクロール用
//
var anchorTopHandler = function(){
	var y = document.body.scrollTop || document.documentElement.scrollTop,
		//target = Math.floor(y - (y / 8));
		target = ((y << 3) - y) >> 3;
	if(target > 0){
		scrollTo(0, target);
		setTimeout(arguments.callee, 10);
	}
	return false;
};



////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	DOM読み込み完了後に実行
//
////////////////////////////////////////////////////////////////////////////////////////////////////
$(function(){



//
//	このページの先頭へボタン動作
//
$(".btn_pageTop a").click(anchorTopHandler);
$("#btn_pageTop a").click(anchorTopHandler);



//
//	IE用objectタグ関係
//
if(document.all && !window.opera){
	$("object").each(function(){
		this.removeAttribute("data");
		this.outerHTML = this.outerHTML;
	});
}



//
//	ポップアップリンク
//
$(".popup").click(function(){
	window.open(this.href);
	return false;
});



//
//	input@type=image & a img マウスオーバー
//
//	マウスオーバー画像（と推測される）画像が存在する場合、マウスオーバー時にsrcを切り替えます。
//
$("input:image, a img").each(function(){
	var self = this,
		src = this.src,
		src_ov = this.src.replace(/^(.*)(\..*)$/, "$1_ov$2"),
		loader = new Image();
	loader.onload = function(){
		$(self).hover(function(){
			this.src = src_ov;
		},function(){
			this.src = src;
		});
		self = loader.onload = loader = null;
	};
	loader.src = src_ov;
});



//
//	リンクの点線を消す
//
$(document.links).focus(function(){
	this.blur();
});



});

////////////////////////////////////////////////////////////////////////////////////////////////////

})();