function ShowMenu() {
	var StdContainer = document.getElementById( "StdContainer" );
	var bgMenu = document.getElementById( "bgMenu" );
	
	bgMenu.Opacity = 0;

	with( bgMenu.style ) {
		top = "-700px";
		height = "700px";
	}
	
	ShowMenuStep();
}

function ShowMenuStep() {
	var StdContainer = document.getElementById( "StdContainer" );
	var bgMenu = document.getElementById( "bgMenu" );
	
	bgMenu.Opacity += 1;
	
	with( StdContainer.style ) {
		opacity = ( 100 - bgMenu.Opacity ) / 100;
		filter = "alpha(opacity=" + ( 100 - bgMenu.Opacity ) + ")";
	}

	with( bgMenu.style ) {
		opacity = bgMenu.Opacity / 100;
		filter = "alpha(opacity=" + bgMenu.Opacity + ")";
	}

	if( bgMenu.Opacity < 100 ) setTimeout( "ShowMenuStep()", 1 );
}

function StartTextMode() {
	window.TextMode = true;
	
	document.getElementById( 'btnStopTextMode' ).className = "imgBTNShow";
	document.getElementById( 'btnStartTextMode' ).className = "imgBTNHide";
	
	ShowText();
}

function StopTextMode() {
	window.TextMode = false;
	
	document.getElementById( 'btnStopTextMode' ).className = "imgBTNHide";
	document.getElementById( 'btnStartTextMode' ).className = "imgBTNShow";
	
	HideText();
}

function ShowText() {
	var StdText = document.getElementById( 'StdText' );
	
	clearTimeout( StdText.TO );
	if( StdText.Opacity == undefined ) StdText.Opacity = 0;
	StdText.Opacity += 2;
	if( StdText.Opacity > 100 ) StdText.Opacity = 100;
	
	with( StdText.style ) {
		opacity = StdText.Opacity / 100;
		filter = "alpha(opacity=" + StdText.Opacity + ")";
	}

	if( StdText.Opacity < 60 ) StdText.TO = setTimeout( "ShowText()", 1 );
}

function HideText() {
	var StdText = document.getElementById( 'StdText' );
	
	clearTimeout( StdText.TO );
	if( StdText.Opacity == undefined ) StdText.Opacity = 60;
	StdText.Opacity -= 2;
	if( StdText.Opacity < 0 ) StdText.Opacity = 0;
	
	with( StdText.style ) {
		opacity = StdText.Opacity / 100;
		filter = "alpha(opacity=" + StdText.Opacity + ")";
	}

	if( StdText.Opacity > 0 ) StdText.TO = setTimeout( "HideText()", 1 );
}

function StopPlayMode() {
	window.PlayMode = false;
	
	document.getElementById( 'btnStopPlayMode' ).className = "imgBTNHide";
	document.getElementById( 'btnStartPlayMode' ).className = "imgBTNShow";
	
	document.getElementById( 'StdPhoto' ).Opacity = 100;
	PlayPhoto();
}

function StartPlayMode() {
	window.PlayMode = true;
	
	document.getElementById( 'btnStopPlayMode' ).className = "imgBTNShow";
	document.getElementById( 'btnStartPlayMode' ).className = "imgBTNHide";
	
	document.getElementById( 'StdPhoto' ).Opacity = 0;
	PlayPhoto();
}

function ShowPhoto() {
	var StdPhoto = document.getElementById( 'StdPhoto' );
	var aImgs = StdPhoto.getElementsByTagName( 'img' );

	StdPhoto.CurPhoto = aImgs.length == 0 ? null : aImgs[0];
	StdPhoto.PrevPhoto = null;
	StdPhoto.Opacity = 0;
	PlayPhoto();
}

function PlayPhoto() {
	var StdPhoto = document.getElementById( 'StdPhoto' );
	
	if( !StdPhoto.CurPhoto ) return;
	
	clearTimeout( StdPhoto.TO );
	if( StdPhoto.Opacity == undefined ) StdPhoto.Opacity = 0;
	StdPhoto.Opacity += 1;
	if( StdPhoto.Opacity > 100 ) StdPhoto.Opacity = 100;
	
	with( StdPhoto.CurPhoto.style ) {
		opacity = StdPhoto.Opacity / 100;
		filter = "alpha(opacity=" + StdPhoto.Opacity + ")";
	}

	if( StdPhoto.PrevPhoto ) {
		with( StdPhoto.PrevPhoto.style ) {
			opacity = ( 100 - StdPhoto.Opacity ) / 100;
			filter = "alpha(opacity=" + ( 100 - StdPhoto.Opacity ) + ")";
		}
	}

	if( StdPhoto.Opacity < 100 ) {
		StdPhoto.TO = setTimeout( "PlayPhoto()", 1 );
		return;
	}
	
	if( !window.PlayMode ) return;
	
	StdPhoto.Opacity = 0;
	
	StdPhoto.PrevPhoto = StdPhoto.CurPhoto;
	var aImgs = StdPhoto.getElementsByTagName( 'img' );
	var i = 0;
	while( aImgs[i] != StdPhoto.CurPhoto ) i++;
	if( i + 1 < aImgs.length ) StdPhoto.CurPhoto = aImgs[i+1];
	else StdPhoto.CurPhoto = aImgs[0];
	
	StdPhoto.TO = setTimeout( "PlayPhoto()", 3000 );
}

