/**
 *	@filename		lib.js
 *	@charset		utf-8
 *	@created		August 21, 2009
 *	@lastmodified	October 14, 2009
 *	@description	共通js
 */
(function(){



var document = window.document;



//
//	ルートパス取得
//
var path = document.getElementsByTagName("script");
path = path[path.length-1].src.replace(/\/js\/common\/lib\.js$/, "/");



//
//	スクロール用
//
var moveObject = function(){
	var y = document.body.scrollTop || document.documentElement.scrollTop;
	var target = Math.max(Math.floor(y - (y / 8)));
	scrollTo(0, target);
	if(target > 0){
		setTimeout(moveObject,10);
	}
};



//
//	IE用objectタグ関係
//
var removeData = function(obj){
	var data = obj.getAttribute("data");
	if(data){
		obj.removeAttribute("data");
	}
};



//
//	リンクの点線を消す
//
var disableLinkOutline = function() {
	$(document.links).each(function(){
		$(this).focus(function(){
			this.blur();
		});
	});
};



//
//	フォントサイズ変更
//
var FSC=function(){this.id="_FSC_";this.fl={};this.fl.change=[];this.fl.smaller=[];this.fl.larger=[];this.init();this.ir=true;var ms=100,os=this.gcs(),ocs=this.gccs(),me=this;this.timer=setInterval(function(){if(me.ir){var cs=me.gcs(),ccs=me.gccs();if(os!=cs){me.cf("change");if(os>cs){me.cf("smaller");}else if(os<cs){me.cf("larger");}}else if(ocs!=ccs){me.cf("change");if(ocs>ccs){me.cf("smaller");}else if(ocs<ccs){me.cf("larger");}}os=cs;ocs=ccs;}},ms);};FSC.prototype.init=function(){var _de=document.getElementById(this.id);if(_de){this.de=_de;}else{this.de=document.createElement("span");this.de.style.display="block";this.de.style.visibility="hidden";this.de.style.position="absolute";this.de.style.zIndex="-9999";this.de.style.left="-9999px";this.de.style.top="-9999px";this.de.style.margin="0";this.de.style.padding="0";this.de.style.minWidth="1px";this.de.style.minHeight="1px";if(document.all&&!window.opera&&!window.XMLHttpRequest){this.de.style.height="1px";}this.de.style.lineHeight="1em";this.de.style.overflow="visible";this.de.style.fontSize="1000%";this.de.style.textIndent="0";this.de.innerHTML="B";this.de.setAttribute("id",this.id);var body=document.getElementsByTagName("body").item(0);body.appendChild(this.de);}};FSC.prototype.addListener=function(en,f){if(en=="change"||en=="smaller"||en=="larger"){if(typeof f!="function"){return;}else{this.fl[en].push(f);}}};FSC.prototype.cf=function(en){this.ir=false;for(var i=0;i<this.fl[en].length;i++){if(typeof this.fl[en][i]=="function"){(this.fl[en][i])();}}this.ir=true;};FSC.prototype.gcs=function(){return this.de.clientHeight;};FSC.prototype.gccs=function(){if(document.defaultView){return document.defaultView.getComputedStyle(this.de,null).getPropertyValue("font-size");}else{return 0;}};FSC.prototype.removeListener=function(en){if(en=="change"||en=="smaller"||en=="larger"){this.fl[en]=null;}};






////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	DOM読み込み完了後に実行
//
////////////////////////////////////////////////////////////////////////////////////////////////////
$(function(){



//
//	このページの先頭へボタン動作
//
$(".anchorTop a").click(function(){
	moveObject();
	return false;
});
$("#anchorTop a").click(function(){
	moveObject();
	return false;
});



//
//	IE用objectタグ関係
//
if(document.all && !window.opera){
	$("object").each(function(){
		removeData(this);
		this.outerHTML = this.outerHTML;
	});
}



//
//	リンクの点線を消す
//
disableLinkOutline();



//
//	ポップアップリンク用
//
$(".popup").click(function(){
	var url = this.href;
	if(url){
		var win = window.open(url);
		win.focus();
	}
	return false;
});



//
//	各種 ストライプ
//
$("dl.stripe").each(function(){
	$("dd:even", this).addClass("odd");
});

$("table.stripe").each(function(){
	$("tr:even", this).addClass("even");
});

$("ul.stripe").each(function(){
	$("li:even", this).addClass("even");
});

$("ol.stripe").each(function(){
	$("li:even", this).addClass("even");
});







});
////////////////////////////////////////////////////////////////////////////////////////////////////



})();
