// JavaScript Document
$(document).ready(function(){
	rollOver();
	pageTop();
});

/*	ロールオーバー
-------------------------------------------------------------------------- */
function rollOver() {
	$("img[src*='_off.']").filter(function() { return $(this).parent().hasClass("non") ? false : true; }).hover( 
		setRollOver, setRollOut
	);
}

function setRollOver() {
	$(this).attr("src", $(this).attr("src").replace("_off.", "_on."));
}

function setRollOut() {
	$(this).attr("src", $(this).attr("src").replace("_on.", "_off."));
}


/*	スムーズスクロール
-------------------------------------------------------------------------- */
function pageTop() {
	var speed = 700;
	$("a.pn[href^='#']").click(function() {
		var target = $(this).attr('href').substr(1);
		var targetY = 0;
		var h = Math.max( document.body.clientHeight , document.body.scrollHeight );  
		h = Math.max( h , document.documentElement.scrollHeight );  
		h = Math.max( h , document.documentElement.clientHeight );
		var inH = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
		if(target != '') {
			targetY = $("*[name='"+target+"']").offset().top;
			if(targetY+inH > h) targetY = h-inH;
		}
		//if($('html').scrollTop() == 0) {
			//alert('test');
			$('html').animate({scrollTop:targetY}, speed, "easeInOutSine");
	//	} else{
			$('body').animate({scrollTop:targetY}, speed, "easeInOutSine");
		//}
		return false;
	});
}

/*	文字サイズ変更
-------------------------------------------------------------------------- 
function fontSize() {
	$("a.large").click(function(){
		$("body").css("font-size" , 14);
		$.cookie("THKC_fSize", 'large', {path:'/'});
		return false;
	});
	$("a.standard").click(function(){
		$("body").css("font-size" , 12);
		$.cookie("THKC_fSize", 'standard', {path:'/'});
		return false;
	});
	$("a.small").click(function(){
		$("body").css("font-size" , 10);
		$.cookie("THKC_fSize", 'standard', {path:'/'});
		return false;
	});
	var ck = $.cookie("THKC_fSize");
	if( ck ) {
		//alert(ck);
		if( ck == 'large') {
			$("a.large").trigger('click');
		}
	}
}
*/

