/**
 * @fileOverview *************************
 * @version 0.0.1
 */
/* ----------------------------------------------------------------------------------- */


/**
 * @namespace 
 */
var KOYOU_HD_LIB = {};


/* ----------------------------------------------------------------------------------- */
/**
 * スムーススクロール処理。
 * @class スムーススクロール
 * @constructor
 */
KOYOU_HD_LIB.SmoothScroll = function () {

	/** イベントを設定する要素を指定。
	    @type jQuery Object @constant @private */
	this.selector    = $('a[href^=#], area[href^=#]');

	/** 「ページ先頭へ戻る」のリンクの場合は、URLからフラグメント識別子を削除。
	    @type String @constant @private */
	this.goToPageTop = "#header-area";

	/** アニメーション速度
	    @type Number @constant @private */
	this.speed       = 600;

	/** easing用キーワード
	    @type RegExp @constant @private */
	this.easing      = "easeInOutCubic";//"easeOutExpo";

	/** スクロールさせたくない場合に設定するclass属性値
	    @type String @constant @private */
	this.noScrollCName    = "no-scroll";

	if (this.selector.length) {
		this.init();
	}
}

/**
 * 初期化処理。とび先のid属性を持つ要素が無ければname属性を調べる。
 * ・アンカーリンク移動時の挙動
 * ・とび先がページの最下部付近の場合
 * @function
 * @return {Boolean} フラグメント識別子をURL末尾に付けるか否か。falseの場合は付けない。※falseの時は既に入っているものを消したい。
 */
KOYOU_HD_LIB.SmoothScroll.prototype.init = function () {
	var _this = this;
	this.selector.each(function () {
		if (!$(this).hasClass(_this.noScrollCName)) {
			var fi = $(this).attr("href");
			if (fi == "#") return false;
			var el = ($(fi).length) ? $(fi) : $("a[name="+fi.replace(/#/,"")+"]");
			if (el.length) {
				$(this).click(function(e) {
					e.preventDefault();
					var target = el[0];
					$.scrollTo(target, {
						speed   : _this.speed,
						easing  : _this.easing,
						axis    : "y",////////////////////////////////////
						onAfter : function() {
							if (!fi.match(_this.goToPageTop)) {
								location.href = fi;
							}/*
							else {
								location.href = "./";
							}*/
						}
						/*,
						onAfter: function() {
							return (fi == _this.goToPageTop) ? false : true;
						}*/
					});
					//return (fi == _this.goToPageTop) ? false : true;
					// フラグメント識別子を後付けしてあげる必要あり。
					// ブラウザ別に処理が必要。
					//return true;
					//
				});
			}
		}
	});
}




/* ----------------------------------------------------------------------------------- */
$(function() {

	/* for IE6 background image flicker */
	if (jQuery.browser.msie && jQuery.browser.version == 6) {
		try {
			document.execCommand("BackgroundImageCache", false, true);
		} catch(err) {}
	}

	/* Setup RolloverImages */
	var roi = new RolloverImages('rollover', 'on');

	/* Setup KOYOU_HD_LIB  */
	for (module in KOYOU_HD_LIB) {
		var obj = KOYOU_HD_LIB[module];
		if (obj && typeof obj == "function") {
			new KOYOU_HD_LIB[module]();
		}
	}

});




/* ----------------------------------------------------------------------------------- */
/**
 * TOPページTab制御
 */
$(function() {

	// タブ 初期設定

	// #tab-nav直下の全li要素の中から最初のli要素に.selectを追加
	$("#tab-nav > li:first").addClass("selected");

	// #tab-contents直下の全div要素を非表示にし、最初のdiv要素を表示
	$("#tab-contents > dl").hide();
	$("#tab-contents > dl:first").show();
	
	var TabNavs = $("#tab-nav > li");
	var TabContents = $("#tab-contents > dl");
	
	
	// タブ切替処理 1
	$("#tab-nav > li").click(function (e) {
		
		e.preventDefault();
		
		// #tabNav直下の全li要素のclass属性を削除
		TabNavs.removeClass("selected");
		
		// クリックしたli要素に.selectを追加
		$(this).addClass("selected");
		
		// #tabContents直下の全div要素を非表示
		TabContents.hide();
		
		// クリックしたタブのインデックス番号と同じdiv要素を表示
		TabContents.eq($("#tab-nav > li").index(this)).show();
	});

});

document.write(''
+ '<style  type="text/css" media="screen,print">'
+ '#news-group {display: none;}'
+ '</style>');




