var g_objLogoImg = new Object();
var g_intLogoMaxId;
var g_intLogoMinId;
var g_intLoopMaxNumber;
var g_intLoopCounter;
var g_intLogoId;
var g_boolMusicPlaying = false;
var g_strLanguage = "fr";
function homeInit() {
	g_intLogoMaxId = 7;
	g_intLogoMinId = 1;
	g_intLoopMaxNumber = 10;
	g_intLoopCounter = 0;
	g_intLogoId = 0;
	for ( var l_intCount = 1; l_intCount <= g_intLogoMaxId; ++l_intCount ) {
		g_objLogoImg[l_intCount] = new Image();
		g_objLogoImg[l_intCount].src = 'img/logoAnim' + l_intCount + '.gif';
	}	
	showLogo( true );
}
function showLogo( p_boolAsc ) {
	if ( ++g_intLoopCounter < ( g_intLoopMaxNumber * g_intLogoMaxId * 2 + 1 ) ) {
		if ( p_boolAsc ) {
			if ( g_intLogoId < g_intLogoMaxId ) {
				document.getElementById( 'logo' ).src = g_objLogoImg[++g_intLogoId].src;
				setTimeout( 
					"showLogo( true );", 
					( g_intLogoId == g_intLogoMinId ? 1500 : g_intLogoId == g_intLogoMaxId ? 50 : 100 ) 
				);
			} else { // dernière Image du cycle
				setTimeout( "showLogo( false );", 100 );
			}
		} else {
			if ( g_intLogoId > g_intLogoMinId ) {
				document.getElementById( 'logo' ).src = g_objLogoImg[--g_intLogoId].src;
				setTimeout( 
					"showLogo( false );", 
					( g_intLogoId == g_intLogoMinId ? 1500 : g_intLogoId == g_intLogoMaxId ? 50 : 100 ) 
				);
			} else { // dernière Image du cycle
				setTimeout( "showLogo( true );", 100 );
			}
		}
	}
}
function showWelcomeMessage( p_strLanguage ) {
	//document.getElementById('welcomMessagePlace').innerHTML = document.getElementById(p_strLanguage).innerHTML;
	changerBorderColor( p_strLanguage+'Flag', true, 2 );
}
function outWelcomeMessage( p_strLanguage ) {
	changerBorderColor( p_strLanguage+'Flag', false, 2 );
}
function changerBorderColor( p_strId, p_boolMouseOver, p_intBorderWidth ) {
	document.getElementById(p_strId).style.border = ( p_boolMouseOver ? 'white '+p_intBorderWidth+'px solid' : 'black '+p_intBorderWidth+'px solid' );
}
function anim() {
	if ( g_intLoopCounter >= ( g_intLoopMaxNumber * g_intLogoMaxId * 2 + 1 ) ) {
		homeInit();
	}
}
function playSound() {
	if ( !g_boolMusicPlaying ) {
		document.getElementById('musicPlayer').src = 'music.wm';
		g_boolMusicPlaying = true;
	} else {
		document.getElementById('musicPlayer').src = '';
		g_boolMusicPlaying = false;
	}
}
function showSite( p_strLanguage ) {
	document.getElementById('body').style.background = '#9C0000';
	if ( document.getElementById('welcomePage') != null ) { document.getElementById('welcomePage').style.display = 'none'; }
	if ( document.getElementById('mainTable') != null ) { document.getElementById('mainTable').style.display = 'block'; }
	g_strLanguage = p_strLanguage;
	if ( document.getElementById('frFlagLite') != null ) { document.getElementById('frFlagLite').style.display = 'block'; }
	if ( document.getElementById('itFlagLite') != null ) { document.getElementById('itFlagLite').style.display = 'block'; }
	if ( document.getElementById('enFlagLite') != null ) { document.getElementById('enFlagLite').style.display = 'block'; }
	if ( document.getElementById(p_strLanguage+'FlagLite') != null ) { document.getElementById(p_strLanguage+'FlagLite').style.display = 'none'; }
	g_intLoopCounter = g_intLoopMaxNumber * g_intLogoMaxId * 2 + 1;
}
function goAdmin() {
	window.location.href = 'indexfe9f.html?admin=login&amp;lang=' + g_strLanguage;
}