// JavaScript Document

/*
	Author : Lynn
	Summary: トップへ戻るボタンの位置をリセットする。
*/
function resetSlideTop(){
	//Reset Slide top height
	var objFlash = document.getElementById("flash");
	var objHeader = document.getElementById("header");
	var objPage = document.getElementById("page");
	var objSlide = document.getElementById("slide");
	var topHeight = 0;
	var nBrowserH = getWindowHeight();

	if(objFlash!=null)
	{
		topHeight = topHeight + objFlash.offsetHeight;
	}
	if(objHeader!=null)
	{
		topHeight = topHeight + objHeader.offsetHeight;
	}
	if(objPage!=null)
	{
		topHeight = topHeight + objPage.offsetHeight;
	}

	if(nBrowserH > topHeight)
	{
		topHeight = nBrowserH - topHeight;
	}
	else
	{
		topHeight = 0;
	}
	objSlide.style.top = topHeight + "px";
	objSlide.style.visibility = "visible";
	
	return topHeight;
}
/*
	Author : Lynn
	Summary: 右側メニューの背景がを自動で設定する。
*/
function resetHeight(){

	//Reset Slide top height
	resetSlideTop();

	// Reset div height(inbody_main_common)
	var nDivMain = document.getElementById("inbody_main").offsetHeight;
	var objDiv   = document.getElementById("inbody_main_common");
	var objImg   = document.getElementById("inbody_main_image");
	var objMenu   = document.getElementById("top_menu");

	var nHeight = nDivMain;
	if(objImg!=null)
	{
		nHeight = nHeight - objImg.offsetHeight;
	}
	if(objMenu!=null)
	{
		nHeight = nHeight - objMenu.offsetHeight;
	}
	//nHeight = nHeight-25;
	
	objDiv.style.height = nHeight + "px";

}

/*
	Author : Lynn
	Summary: トップページで、解像度によって、FLASHの高さを設定する。
*/
function resetFlashSize(){

	var nWidth = document.body.clientWidth;
	var nHeight = (nWidth/1280)*615;
	var objFlash = document.getElementById("flash");

	objFlash.style.width = nWidth + "px";
	objFlash.style.height = nHeight + "px";
}

/*
	Author : Lynn
	Summary: マウスオーバー時、画像を表示する。
*/
function mouse_over(id,bool){
	if(bool==1)
	{
		document.getElementById(id).style.display = "inline";
	}
	else
	{
		document.getElementById(id).style.display = "none";
	}
}

/*
	Author : Lynn
	Summary: 各ブラウザのHEIGHTを取得する。
*/
function getWindowHeight()
{
	//var winW;
	var winH;
	if(window.innerHeight) // all except IE
	{	
		//winW = window.innerWidth;
		winH = window.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) // IE Strict Mode
	{
		//winW = document.documentElement.clientWidth; 
		winH = document.documentElement.clientHeight;
	} else if (document.body) // other
	{
		//winW = document.body.clientWidth;
		winH = document.body.clientHeight;
	}
	
	//alert('\nparseInt( $( window ).height()='+parseInt( $( window ).height() )
	//	+'\nwindow.innerHeight='+window.innerHeight
	//	+'\nwindow.screen.availHeight='+window.screen.availHeight
	//	+'\ndocument.body.offsetHeight='+document.body.offsetHeight
	//	+'\ndocument.documentElement.clientHeight='+document.documentElement.clientHeight);

	return parseInt(winH);
}
