
var activeNo_M = 2;
var maxNo_M = 2;
var showTime_M = 100;
var hiddenTime_M = 40;
var tempShowTime_M = 0;
var tempHiddenTime_M = 10;

var flagVariation_M = -1;
var variationValue_M = 1;
var alphaValue_M = 0;
var intervalValue_M = 40;

//setInterval("changeMidashi()",intervalValue_M);//
setInterval("welcome()",intervalValue_M);

function welcome(){
	strBuf = "welcome";
	if (flagVariation_M == 0){
		alphaValue_M = alphaValue_M - variationValue_M;
		if (alphaValue_M <= 0){
			alphaValue_M = 0;
			document.getElementById(strBuf).style.display = "none";
			tempHiddenTime_M = hiddenTime_M;
			flagVariation_M = 3;
		}else{
			setAlpha_M(document.getElementById(strBuf));
		}
	}
	if (flagVariation_M == 1){
		alphaValue_M = alphaValue_M + variationValue_M;
		if (alphaValue_M >= 10){
			alphaValue_M = 10;
			tempShowTime_M = showTime_M + 1;
			flagVariation_M = 2;
		}
		setAlpha_M(document.getElementById(strBuf));
	}
	if (flagVariation_M == -1){
		tempHiddenTime_M = tempHiddenTime_M - 1;
		if (tempHiddenTime_M <= 0){
			tempHiddenTime_M = 0;
			setAlpha_M(document.getElementById(strBuf));
			document.getElementById(strBuf).style.display = "block";
			flagVariation_M = 1;
		}
	}
	if (flagVariation_M == 2){
		tempShowTime_M = tempShowTime_M - 1;
		if (tempShowTime_M <= 0){
			tempShowTime_M = 0;
			flagVariation_M = 0;
		}
	}
}

function changeMidashi(){
	strBuf = "midashi" + activeNo_M;
	if (flagVariation_M == 0){
		alphaValue_M = alphaValue_M - variationValue_M;
		if (alphaValue_M <= 0){
			alphaValue_M = 0;
			document.getElementById(strBuf).style.display = "none";
			tempHiddenTime_M = hiddenTime_M;
			flagVariation_M = -1;
		}else{
			setAlpha_M(document.getElementById(strBuf));
		}
	}
	if (flagVariation_M == 1){
		alphaValue_M = alphaValue_M + variationValue_M;
		if (alphaValue_M >= 10){
			alphaValue_M = 10;
			tempShowTime_M = showTime_M + 1;
			flagVariation_M = 2;
		}
		setAlpha_M(document.getElementById(strBuf));
	}
	if (flagVariation_M == -1){
		tempHiddenTime_M = tempHiddenTime_M - 1;
		if (tempHiddenTime_M <= 0){
			tempHiddenTime_M = 0;
			if (activeNo_M == maxNo_M) {
				activeNo_M = 0;
			} else {
				activeNo_M = activeNo_M + 1;
			}
			strBuf = "midashi" + activeNo_M;
			setAlpha_M(document.getElementById(strBuf));
			document.getElementById(strBuf).style.display = "block";
			flagVariation_M = 1;
		}
	}
	if (flagVariation_M == 2){
		tempShowTime_M = tempShowTime_M - 1;
		if (tempShowTime_M <= 0){
			tempShowTime_M = 0;
			flagVariation_M = 0;
		}
	}
}

function setAlpha_M(mId){
	mId.style.filter = 'alpha(opacity=' + (alphaValue_M * 10) + ')';
   	mId.style.MozOpacity = alphaValue_M / 10;
   	mId.style.opacity = alphaValue_M / 10;
}
