
$(document).ready(function(){	// START ready

/*footer bound 使用停止
	$("#footer").animate(
		{ marginTop:"-1000px" },
		{duration:0,
			complete: function(){
				$(this).animate(
					{ marginTop:"0" },
					{duration:500,easing:"easeOutExpo"}
				);
			}
		}
	)
*/
		
/* == a:hover effect == */						   
	$("#contents a, #sitemap a, #footer a").hover(
		function(){$(this).fadeTo(150,0.6);},
		function(){$(this).fadeTo(150,1);}
	);

/* == #logo:hover effect == */		   
	$("#logo a").hover(
		function(){
			$("#logo .arrow").animate(
				{marginLeft:"-4px"},
				{duration:300}
			)
		},
		function(){
			$("#logo .arrow").animate(
				{marginLeft:"0px"},
				{duration:300}
			)
		}
	);

/* == #menu:hover effect == */		   
	$("#menu a:not(#concept #menu .concept a, #project #menu .project a, #company #menu .company a, )").hover(
		function(){
			$(this).animate(
				{marginTop:"0px"},
				{duration:550,easing:"easeOutBounce"}
			)
		},
		function(){
			$(this).animate(
				{marginTop:"-112px"},
				{duration:300,easing:"easeInOutCubic"}
			)
		}
	);
	

/* tab */
  $("#tabNavi a").click(function() {
    $($("#tabNavi a.sel").attr("href")).hide();
    $("#tabNavi a.sel").removeClass("sel");
    $(this).addClass("sel");
    $($(this).attr("href")).fadeIn("fast");
    return false;
  });
  
/* smooth scroll */


});	// END ready



  
/* クエリid取得でロード時に開いているタブを変更 ★タブ3枚まで。汎用版ではありません */
loadFileName = 	location.href;

if(loadFileName.match('id=')){
	str = loadFileName.split('id='); 
	str2 = str[1];
	if(str2.match('#')){	//アンカー対策
		str3 = str2.split('#'); 
		strFix = str3[0];
	} else {
		strFix = str2;
	}
	tabId = strFix; // クエリで指定された id を抽出
	//alert(tabId);
	// タブメニューとタブページ切り替え実行
	$("#tabNavi a.sel").removeClass("sel");
	$("#tabNavi a:eq("+tabId+")").addClass("sel");
	$("#tab0,#tab1,#tab2:not(#tab"+tabId+")").hide();
	$("#tab"+tabId).show();
} else {
}




/* == smooth scroll == */
/*
HTML 内のタグ記述例
<a href="target_label" onclick="return SmoothScroll('header');">Page Top</a>
*/

function SmoothScroll(targetID){
	if( !document.getElementById ) {return true;}
	var step=1;
	var max=200;
	var accel=5;
	var interval=30;
	var current_y = document.body.scrollTop	|| document.documentElement.scrollTop;
	var element=document.getElementById(targetID);
	if (!element){return true;}
	var target_y = 0;
	for (i = element;i.offsetParent;i=i.offsetParent ){
		target_y += i.offsetTop;
	}
	var count=0;
	if ( current_y > target_y ){ step = -(step); accel = -(accel);}
	var timerid = setInterval( function(){
		if (step<max) step += (count*accel);
		if ( Math.abs(current_y-target_y) < Math.abs(step) ){
			window.scrollTo((document.body.scrollTop || document.documentElement.scrollTop),target_y);
			clearInterval(timerid);
			return false;
		}else{
			window.scrollBy(0,step);
			current_y += step;
			count++;
		}
	},interval);
	return false;
}













