// Easingの追加
jQuery.easing.quart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

/*-------------------------------------
 ページ読み込み中
-------------------------------------*/
jQuery(document).ready(function(){
	//
	// <a href="#***">の場合、スクロール処理を追加
	//
	jQuery('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			if(this.hash == "#header") {
				// ページTOPに戻る処理
				jQuery('html,body').animate({ scrollTop: 0 }, 1200, 'quart');
				return false;
			} else {
				var $target = jQuery(this.hash);
				$target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
				if ($target.length) {
					var targetOffset = $target.offset().top - 60;
					jQuery('html,body').animate({ scrollTop: targetOffset }, 1200, 'quart');
					return false;
				}
			}
		}
	});

	//
	// <a rel="blank">の時は別ウィンドウで表示させる
	//
	jQuery("a").each(function(){
		if(jQuery(this).attr("rel") == "blank") {
			jQuery(this).attr("target", "_blank");
		}
	});

	//
	// id = trackbackurl に処理を追加
	//
	jQuery("#trackbackurl").bind("click", function(){
  	jQuery(this).get(0).select();
	});

	//
	// サイドバーとコンテンツの高さを合わせる
	//
	if(jQuery("#content").height() > jQuery("#s_inner").height()) {
		jQuery("#s_inner").height(jQuery("#content").height());
	} else {
		jQuery("#content").height(jQuery("#s_inner").height());
	}

	//
	// Windowサイズ以下の場合はWindowサイズに揃える
	if(jQuery(window).height() > (jQuery("#s_inner").height() + 325)) {
		jQuery("#s_inner").height(jQuery(window).height() - 315);
		jQuery("#content").height(jQuery(window).height() - 285);
	}

	setUpArrow();

	//
	// ロールオーバーの処理
	//
	jQuery("img.rollover").mouseover(function(){
		jQuery(this).attr("src",jQuery(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2"));
	}).mouseout(function(){
		jQuery(this).attr("src",jQuery(this).attr("src").replace(/^(.+)_on(\.[a-z]+)$/, "$1$2"));
	}).each(function(){
		jQuery("<img>").attr("src",jQuery(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2"));
	});

	jQuery(window).resize(function() {
		setUpArrow();
	});

	//
	// テーブルのクラス追加処理
	//
	jQuery('#info-list tr:even').addClass('even');
	jQuery('#info-list tr:odd').addClass('odd');
	jQuery('#id-photoreport tr:even').addClass('even');
	jQuery('#id-photoreport tr:odd').addClass('odd');
});

//
// ページトップに戻る画像の表示処理
//
function setUpArrow() {
	if(jQuery(window).width() > 1020) {
		var t = jQuery(window).height() - 50;
		var l = jQuery("#h_inner").offset().left + 950;

		if(typeof document.documentElement.style.maxHeight != "undefined") {
			// 最近のブラウザー
			jQuery("#pageup").css({ top: t+"px", left: l+"px" });
		} else {
			// IE6
			jQuery("#pageup").get(0).style.setExpression("top", "eval(document.documentElement.scrollTop+" + t + ")");
			jQuery("#pageup").css("left", l+"px");
		}
		jQuery("#pageup").css("display", "block");
	} else {
			jQuery("#pageup").css("display", "none");
	}
}

