/*--(c) webgraph 2008 All Rights Reserved.--*/

/*--PRELOAD IMAGES--------------------------*/

function preloadHome(){
	data=new Array("img/btn_home_over.gif",
					"img/btn_menu_over.gif",
					"img/btn_shop_top_over.gif",
					"img/btn_shop_ayase_over.gif",
					"img/btn_shop_zama_over.gif",
					"img/btn_shop_aikou_over.gif",
					"img/btn_recruit_over.gif")
	preImg=new Array();
	for(i=0;i<data.length;i++){
		preImg[i]=new Image();
		preImg[i].src=data[i];
	}
}

function preload(){
	data=new Array("../img/btn_home_over.gif",
					"../img/btn_menu_over.gif",
					"../img/btn_shop_top_over.gif",
					"../img/btn_shop_ayase_over.gif",
					"../img/btn_shop_zama_over.gif",
					"../img/btn_shop_aikou_over.gif",
					"../img/btn_recruit_over.gif")
	preImg=new Array();
	for(i=0;i<data.length;i++){
		preImg[i]=new Image();
		preImg[i].src=data[i];
	}
}

/*--ROLL OVER & OUT-------------------------*/

function overHome(name){
	document.getElementById(name).src="img/" + name + "_over.gif";
}
function over(name){
	document.getElementById(name).src="../img/" + name + "_over.gif";
}

function outHome(name){
	document.getElementById(name).src="img/" + name + ".gif";
}
function out(name){
	document.getElementById(name).src="../img/" + name + ".gif";
}

/*--SET CENTER POSITION---------------------*/

function setCenter(){
	var windowY = document.documentElement.clientHeight;
	var footY = document.getElementById('FOOTER_BASE').offsetTop;
	if(windowY-footY<10){
		var targetY = 10;
	}else{
		var targetY = (windowY-footY)/2;
	}
	document.getElementById('BASE').style.margin = targetY + "px 0 0 0";
	document.getElementById('CENTER').style.visibility = "visible";
}

/*--SET BOTTOM POSITION---------------------*/

function infoBoxPos(){
	var targetY = document.getElementById('CLEAR').offsetTop;
	var tempY = document.getElementById('getHeight').offsetTop;
	targetY = (targetY - tempY)-10;
	document.getElementById('infoBox').style.margin = targetY + "px 0 0 15px";
	document.getElementById('infoBox').style.visibility = "visible";
}

/*--SET ALPHA-------------------------------*/

function setAlpha(targetarea,arg){
	if(window.opera) return;
	var ua = navigator.userAgent;
	if(ua.indexOf('Safari') != -1 || ua.indexOf('KHTML') != -1){
		document.getElementById(targetarea).style.opacity = arg;
	}else if(document.all){
		document.all(targetarea).style.filter = "alpha(opacity = 0)";
		document.all(targetarea).filters.alpha.opacity = (arg * 100);
	}else if(ua.indexOf('Gecko') != -1){
		document.getElementById(targetarea).style.MozOpacity = arg;
	}
}

function clearAlpha(name){
	setAlpha(name,0);
}

/*--FADE IN (2Times)------------------------*/

function fadeInEnd(){
	if(!window.fadeInEnd.counter) fadeInEnd.counter = 0;
	if(fadeInEnd.counter <= 9){
		var alphaNum = fadeInEnd.counter/10;
		setAlpha("fadeInArea3",alphaNum);
		setTimeout(fadeInEnd,50);
		fadeInEnd.counter++;
	}else{
		setAlpha("fadeInArea3",10);
	}
}

function fadeInMiddle(){
	if(!window.fadeInMiddle.counter) fadeInMiddle.counter = 0;
	if(fadeInMiddle.counter <= 9){
		var alphaNum = fadeInMiddle.counter/10;
		setAlpha("fadeInArea2",alphaNum);
		setTimeout(fadeInMiddle,50);
		fadeInMiddle.counter++;
	}else{
		setAlpha("fadeInArea2",10);
		setTimeout(fadeInEnd,50);
	}
}

function fadeInFirst(){
	if(!window.fadeInFirst.counter) fadeInFirst.counter = 0;
	if(fadeInFirst.counter <= 10){
		fadeInFirst.counter++;
		setTimeout(fadeInFirst,50);
	}else{
		if(fadeInFirst.counter <= 19){
			var alphaNum = fadeInFirst.counter/20;
			setAlpha("fadeInArea1",alphaNum);
			setTimeout(fadeInFirst,50);
			fadeInFirst.counter++;
		}else{
			setAlpha("fadeInArea1",10);
			setTimeout(fadeInMiddle,50);
		}
	}
}
