/**
 * @fileOverview *************************
 * @version 0.0.1
 */
/* ----------------------------------------------------------------------------------- */



/**
 * @namespace 
 */
var TGLIB = {};


/* ----------------------------------------------------------------------------------- */

$(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');

});



/* ----------------------------------------------------------------------------------- */
$(function() {

	/* Setup TGLIB  */
	for (module in TGLIB) {
		var obj = TGLIB[module];
		if (obj && typeof obj == "function") {
			new TGLIB[module]();
		}
	}

});

/*
	スムーススクロール用
 */
 
$(document).ready(function() {
	// <a href="#***">の場合、スクロール処理を追加
	jQuery('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var $target = jQuery(this.hash);
			$target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				jQuery('html,body').animate({ scrollTop: targetOffset }, 600, 'easeOutExpo');
				return false;
			}
		}
	});
});


/*---------------------------------------------------------------------------*/
/**
 * @version  0.0.1_2009-06-29
 * @requires jquery.js
 * @requires styleswitcher.js
 * @requires rollover.js
 */

FONTSIZE_SELECTOR_ENABLED = true;
FONTSIZE_SELECTOR         = null;


if (FONTSIZE_SELECTOR_ENABLED) {

	$(function() {
		var config = {
			className      : "fontsize",
			blockId        : "fontsize-selector",
			buttonsSetting : {
					"default" : {
								styleId       : "fontsize-default",
								buttonId      : "fontsize-btn-default",
								title         : "文字サイズを「標準」に変更します",
								titleSelected : "現在選択中の文字サイズは「標準」です"
					},
					"large" : {
								styleId       : "fontsize-large",
								buttonId      : "fontsize-btn-large",
								title         : "文字サイズを「大」に変更します",
								titleSelected : "現在選択中の文字サイズは「大」です"
					}
			}
			,rollover : new RolloverImages("rollover-fsbutton", "on", "on")
		};

		FONTSIZE_SELECTOR = new FontSizeSelector(config);
	});

	// 
	document.write(''
	+ '<style  type="text/css" media="screen,print">'
	+ '#fontsize-selector {display: block !important;}'
	+ '</style>');
}

//スライド
$(function() {
$(".show").show();
$(".hide").hide();
$("div.answer-area").hide();
$('.contentsContainer > .qa-area > h2 > a').click(function(){
	$(this).parent().next().slideToggle('');
});
});


$(function() {
		   
	if($(".question").length) {
		
		var locationHash = location.hash;
		var target = $(".question");
		var closeIcon = "images/index_bt02.gif";
		var openIcon = "images/index_bt01.gif";
		
		
		//アンカーで飛んできた時の動作
		if(target.is(locationHash)){
			$(locationHash).next().show();
			$("img",target).attr("src",openIcon);
			$("img",locationHash).attr("src",closeIcon);
		}
		
		//開閉動作、アイコンの変更
		$("a",target).click(
			function(){
				if($("img",this).attr("src") == openIcon){
					$("img",this).attr("src",closeIcon);
				}
				else if($("img",this).attr("src") == closeIcon){
					$("img",this).attr("src",openIcon);
				}
				
				
				return false;
			}
		);
	};
});

