
/* PAGE SCROLL */

// 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) {
			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;
			}
		}
	});

});



/* ROLL OVER */

function initRollOverImages() {
	var image_cache = new Object();
	$("#gNavi li a img,#hdNavi li a img,#pagetop a img").not("[src*='_on.']").each(function(i) {
		var imgsrc = this.src;
		var dot = this.src.lastIndexOf('.');
		var imgsrc_on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
		image_cache[this.src] = new Image();
		image_cache[this.src].src = imgsrc_on;
		$(this).hover(
			function() { this.src = imgsrc_on; },
			function() { this.src = imgsrc; }
		);
	});
}
$(document).ready(initRollOverImages);



/* TABLE */

jQuery(function(){
  jQuery('table tr:odd').addClass('even');
  jQuery('table tr:even').addClass('odd');
});


/* TAB */

$(function(){
	$("#priceList").each(function(){
		var TabAreaAmount = $(this).find("#priceTab").children("li").length;
		var ActiveTabNo;
		for(i=0;i<TabAreaAmount;i++){
			if($(this).find("#priceTab li").eq(i).attr("class") == "On"){
				ActiveTabNo = i;
			}
		}
		for(i=0;i<TabAreaAmount;i++){
			if(i!=ActiveTabNo){
				$(this).find(".priceTable").eq(i).hide();
			}
		}
		$(this).find("#priceTab li a").click(function(){
			$(this).parents("li").eq(0).addClass("Clicked");
			var ClickedTabNo;
			for(i=0;i<TabAreaAmount;i++){
				if(
					$(this).parents("#priceList").eq(0).find("#priceTab li").eq(i).attr("class")!=null
					&& $(this).parents("#priceList").eq(0).find("#priceTab li").eq(i).attr("class").indexOf("Clicked")!=-1
				){
					ClickedTabNo = i;
					$(this).parents("li").eq(0).removeClass("Clicked");
					$(this).parents("li").eq(0).addClass("On");
				}else if($(this).parents("#priceList").eq(0).find("#priceTab li").eq(i).attr("class")!=null){
					$(this).parents("#priceList").eq(0).find("#priceTab li").eq(i).removeClass("On");
				}
			}
			for(i=0;i<TabAreaAmount;i++){
				if(i!=ClickedTabNo){
					$(this).parents("#priceList").eq(0).find(".priceChange").eq(0).find(".priceTable").eq(i).hide();
				}
			}
			$(this).parents("#priceList").eq(0).find(".priceChange").eq(0).find(".priceTable").eq(ClickedTabNo).show();
			return false;
		});
	});
});

$(function(){
	$("#process").each(function(){
		var TabAreaAmount = $(this).find("#processTab").children("li").length;
		var ActiveTabNo;
		for(i=0;i<TabAreaAmount;i++){
			if($(this).find("#processTab li").eq(i).attr("class") == "On"){
				ActiveTabNo = i;
			}
		}
		for(i=0;i<TabAreaAmount;i++){
			if(i!=ActiveTabNo){
				$(this).find(".processTable").eq(i).hide();
			}
		}
		$(this).find("#processTab li a").click(function(){
			$(this).parents("li").eq(0).addClass("Clicked");
			var ClickedTabNo;
			for(i=0;i<TabAreaAmount;i++){
				if(
					$(this).parents("#process").eq(0).find("#processTab li").eq(i).attr("class")!=null
					&& $(this).parents("#process").eq(0).find("#processTab li").eq(i).attr("class").indexOf("Clicked")!=-1
				){
					ClickedTabNo = i;
					$(this).parents("li").eq(0).removeClass("Clicked");
					$(this).parents("li").eq(0).addClass("On");
				}else if($(this).parents("#process").eq(0).find("#processTab li").eq(i).attr("class")!=null){
					$(this).parents("#process").eq(0).find("#processTab li").eq(i).removeClass("On");
				}
			}
			for(i=0;i<TabAreaAmount;i++){
				if(i!=ClickedTabNo){
					$(this).parents("#process").eq(0).find(".processChange").eq(0).find(".processTable").eq(i).hide();
				}
			}
			$(this).parents("#process").eq(0).find(".processChange").eq(0).find(".processTable").eq(ClickedTabNo).show();
			return false;
		});
	});
});



/* OFFICE ENVIRONMENT -Internal environment- (http://www.combz.jp/office/index.html) ---------- */


