/////////////////////////////////////////////
// JAVA SCRIPT定義
/////////////////////////////////////////////
var n = 0;
var ITEMNAME="";
var ANCHORNAME="";
var X,Y;
var countEffect;
//////////////////////////////////////////////
//フェードインスタート
//////////////////////////////////////////////
function startfadein(NUMBER){
	n=0;
	ITEMNAME=NUMBER;
	var obj = document.getElementById(ITEMNAME);
	obj.style.display="";

	imgWidth=obj.offsetWidth;
	imgHeight=obj.offsetHeight;
	if(document.body.clientWidth){
		//IE
		//width=document.body.clientWidth;
		//height=document.body.clientHeight
		width=document.body.offsetWidth
		height=document.body.offsetHeight
		scrollLeft = document.body.scrollLeft;
		scrollTop = document.body.scrollTop;
	}
	else
	if(window.innerWidth){
		//Firefox
		width=window.innerWidth;
		height=window.innerHeight;
		scrollLeft = pageXOffset;
		scrollTop = pageYOffset;
	}
	//document.write("winw:"+width+" winh:"+height+" sL:"+scrollLeft+" sT:"+scrollTop);
	
	posX=(width-imgWidth)/2;
	if(posX<0){
		posX=0;
	}
	posY=(height-imgHeight)/2;
	if(posY<0){
		posY=0;
	}
	//位置移動
	if(document.body.clientWidth){
		//IE
		//obj.style.pixelTop=scrollTop+posY;
		obj.style.pixelLeft=posX;
	}
	if(window.innerWidth){
		//Firefox
		//obj.style.top=scrollTop+posY;
		obj.style.left=posX;
	}
	countEffect=0;
	//screenfade();
	fadein();
}
//////////////////////////////////////////////
//フェードイン
//////////////////////////////////////////////
function fadein(){
	var obj = document.getElementById(ITEMNAME);
	obj.style.opacity = n / 100;
	obj.style.mozOpacity = n / 100;
	obj.style.filter = "alpha(opacity="+n+")";
	n += 5;
	if (n < 100){
		setTimeout("fadein()",50);
	}
	else{
		obj.style.opacity = 1.0;
		obj.style.mozOpacity = 1.0;
		obj.style.filter = "alpha(opacity=100)";
	}
}
//////////////////////////////////////////////
//フェードアウトスタート
//////////////////////////////////////////////
function startfadeout(name){
	n=100;
	ITEMNAME=name;
	countEffect=0;
	fadeout();
}
//////////////////////////////////////////////
//フェードアウト
//////////////////////////////////////////////
function fadeout(){
	var obj = document.getElementById(ITEMNAME);
	obj.style.opacity = n / 100;
	obj.style.mozOpacity = n / 100;
	obj.style.filter = "alpha(opacity="+n+")";
	n -= 5;
	if (n > 0){
		setTimeout("fadeout()",50);
	}
	else{
		obj.style.opacity = 0.0;
		obj.style.mozOpacity = 0.0;
		obj.style.filter = "alpha(opacity=0)";
		var obj = document.getElementById(ITEMNAME);
		obj.style.display="none";
	}
}
//////////////////////////////////////////////
//
//////////////////////////////////////////////
function MoveMenu(NUMBER){
	ITEMNAME=NUMBER;
	var obj = document.getElementById(ITEMNAME);
	//情報収集
	imgWidth=obj.offsetWidth;
	imgHeight=obj.offsetHeight;
	if(document.body.clientWidth){
		//IE
		//width=document.body.clientWidth;
		//height=document.body.clientHeight
		width=document.body.offsetWidth
		height=document.body.offsetHeight
		scrollLeft = document.body.scrollLeft;
		scrollTop = document.body.scrollTop;
	}
	else
	if(window.innerWidth){
		//Firefox
		width=window.innerWidth;
		height=window.innerHeight;
		scrollLeft = pageXOffset;
		scrollTop = pageYOffset;
	}

	//位置移動
	if(document.body.clientWidth){
		//IE
		obj.style.pixelTop=scrollTop;
		obj.style.pixelLeft=1000;
	}
	if(window.innerWidth){
		//Firefox
		obj.style.top=scrollTop;
		obj.style.left=1000;
	}
	//
	startfadein(NUMBER);
}

//////////////////////////////////////////////
//画面全体を白くする
//////////////////////////////////////////////
function screenfade(){
	var d = document.createElement("div");
	d.id = "XFlash";

	if(document.body.clientWidth){
		//IE
		scrollTop = document.body.scrollTop;
	}
	else
	if(window.innerWidth){
		//Firefox
		scrollTop = pageYOffset;
	}


	with (d.style){
		position="absolute";
		top="0";
		left="0px";
		width="100%";
		//height="100%";
		height="100%";
		backgroundColor="white";
		opacity=".5";
		zindex="9999";

		mozOpacity = .5;
		filter = "alpha(opacity=50)";
	}
	document.body.appendChild(d);
//	window.setTimeout("document.getElementById(\"XFlash\").style.visibility=\"hidden\"" ,500);
}
//////////////////////////////////////////////
//画面を中央に移動する
//////////////////////////////////////////////
function centerimage(){
	if(document.getElementById) {     // for Netscape 6.*
    img = document.getElementById(ITEMNAME);
    img.style.position = "absolute";
    img.style.top = (window.innerHeight - img.height) / 2;
    img.style.left = (window.innerWidth - img.width) / 2;  
  }
}

