﻿/* ===================================================================

JavaScript Information

 File name  :  common.js
 Style info :  共通で使用するライブラリをまとめています。

=================================================================== */


/*---------------------------------------------------------------
各要素指定
---------------------------------------------------------------*/


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

$(document).ready(function(){

		//フォント変更
		$("#fontsize a").textresizer({
			 target: "#page",
			 type: "fontSize",
			 sizes: ["10px","13px","16px"],
			 selectedIndex: 1
		});

		//タブ
    $("ul#tab").tabs(".tabContent", {
			onBeforeClick: function(event, tabIndex) { 
			this.getCurrentPane().addClass("current"); 
		} 
		});
		
		//アコーディオン
		$(".accordionContent").hide();
		$(".accordion").toggle(function(){
			$(this).addClass("active"); 
			}, function () {
			$(this).removeClass("active");
		});
		$(".accordion").click(function(){
			$(this).next(".accordionContent").slideToggle("normal");
		});

		//スムーススクロール
		$('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 }, 1200, 'quart');
					return false;
				}
			}
		});

		//ロールオーバー
		var postfix = '_over';
		$('a.rollover img').not('[src*="'+ postfix +'."]').each(function() {
		var img = $(this);
		var src = img.attr('src');
		var src_over = src.substr(0, src.lastIndexOf('.'))+ postfix+ src.substring(src.lastIndexOf('.'));
		$('<img>').attr('src', src_over);
		img.hover(
			function() {
				img.attr('src', src_over);
			},
			function() {
				img.attr('src', src);
			});
		});

		//ホバー※おもにIE6向け
		$(".hoving li").hover(function(){
			$(this).addClass("hover");
		},function(){
			$(this).removeClass("hover");
		});

		//ライトボックス
		$(function(){  
        $.superbox();  
    }); 

});
