/****************************************/
/*		VARIABLES COURANTES				*/
/****************************************/

	var TabJour					= new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
	var	TabMois					= new Array("janvier","f&eacute;vrier","mars","avril","mai","juin","juillet","aout","septembre","octobre","novembre","dé&eacute;embre");
	var urlSite					= "http://" + document.domain + "/";
	var urlComplete				= document.URL ;
	var tabUrl					= urlComplete.split( "#/" ) ;

	if ( tabUrl[ 1 ] != null )
	{
		window.location.href	= tabUrl[ 1 ] ;
	}


/****************************************/
/*		GESTION DES ERREURS				*/
/****************************************/
		
	var Apl_Display_Er			= false;
	var isPageParse				= false ;


/****************************************/
/*		FONCTIONS RECURENTES			*/
/****************************************/

	function erreurAjax()
	{
		alert( "Oups ! Une erreur est survenue, veuillez recharger la page." ) ;
	}

	function redirect( page )
	{
		document.location.href = page ;
	}

	function ouvreBoite( Boite )
	{
		Element.show( 'idFond' ) ;

		var urlTarget	= urlSite + "Ajax.php?f=" + Boite ;
		var options		= { 
							asynchronous:true ,
							method: "get" ,
							onSuccess: function ( xhr ) {
								$( 'popup' ).update( xhr.responseText ) ;	

								$( 'popup' ).setStyle( { 
														top: "50%" ,
														left: "50%" ,
														marginLeft: - ( ( $( 'popup' ).getWidth() / 2 ) - 40 ) + "px" ,
														marginTop: - ( ( $( 'popup' ).getHeight() / 2 ) + 150 ) + "px"
															
								} );

								Element.show( 'popup' ) ;
							}
						  } 		

		var ajaxCall	= new Ajax.Request( urlTarget, options );	

	}

	function fermeBoite( Boite )
	{
		Element.hide( 'idFond' ) ;
		Element.hide( 'popup' ) ;
	}

	function changeType( type ) {
		
		var Origine	= $( 'cnxPassword' );
		var New		= document.createElement( 'input' );
		
		New.id		= 'cnxPassword' ;
		New.title	= 'password' ;

		if( type == "text" ) {
			if( Origine.type != "text" ) {
				if( Origine.value == '' ) {					
					New.value		= 'Puis votre mot de passe' ;
					New.className	= 'input-search' ;
					New.type		= type ;
					New.onfocus		= function() { changeType( 'password' ); }
					New.onclick		= function() { changeType( 'password' ); }
					Origine.parentNode.replaceChild( New, Origine );
				}
				else {
					Origine.onclick		= function() { changeType( 'password' ); }
				}
			}
		}
		else if( type == "password" ) {
			if( Origine.type != "password" ) {
				New.className	= 'input-search input-search-txt' ;
				New.type		= type ;
				New.onblur		= function() { changeType( 'text' ); }
				Origine.parentNode.replaceChild( New, Origine );
				setTimeout( function() { New.focus(); }, 10 );
			}
			else {
				Origine.className	= 'input-search' ;
				Origine.value		= '' ;
			}
		}

		if( submitIdentification == true )	Event.observe( "cnxPassword", "keypress", obj.validate_elem);
	}
/*
	function initFirstscreen() {
	$$( '.firstscreen' ).each(function( e ) {
		if( $( e ).id )	Event.observe( e, "mouseover", function(){ switchToGif( e ); } );
	});
	}

	function switchToGif( e ) {
		Event.stopObserving( e );
		var idElt	= $( e ).id.replace( "jsDivFirstscreen_", "" ) ;
		if( $( "jsDivFirstscreen_" + idElt ) )	{
			var Firstscreen = new Image();
			Firstscreen.src = $( "jsAnimation_" + idElt ).value ;
			Firstscreen.onload = function() {
				$( e ).setStyle( { backgroundImage: 'url("' + $( "jsAnimation_" + idElt ).value + '")' } ) ;	
				Event.observe( e, "mouseout", function(){ switchToJpeg( e ); } );
				Event.observe( e, "click", function(){ switchToJpeg( e ); } );
			}
		}
	}

	function switchToJpeg( e ) {
		Event.stopObserving( e );
		var idElt	= $( e ).id.replace( "jsDivFirstscreen_", "" ) ;
		if( $( "jsDivFirstscreen_" + idElt ) )	{
			$( e ).setStyle( { backgroundImage: 'url("' + $( "jsFirstscreen_" + idElt ).value + '")' } ) ;
			Event.observe( e, "mouseover", function(){ switchToGif( e ); } );
		}
	}
*/
	var doChange	= new Array() ;
	var Firstscreen	= new Array() ;

	function initFirstscreen() {
		$$( '.firstscreen' ).each(function( e ) {
			if( $( e ).id )	{
				Event.observe( e, "mouseover", function(){ switchToGif( e ); } );
				Event.observe( e, "mouseout", function(){ switchToJpeg( e ); } );
				Event.observe( e, "click", function(){ switchToJpeg( e ); } );
			}
		});
	}

	function switchToGif( e ) {	
		var idElt	= $( e ).id.replace( "jsDivFirstscreen_", "" ) ;
		if( $( "jsDivFirstscreen_" + idElt ) )	{
			doChange[ $( e ).id ]	= true ;
			if( ! Firstscreen[ $( e ).id ] ) {
				Firstscreen[ $( e ).id ] = new Image();
			}
			Firstscreen[ $( e ).id ].src		= $( "jsAnimation_" + idElt ).value ;
			Firstscreen[ $( e ).id ].onload		= function() {
				if( doChange[ $( e ).id ] ) {
					$( e ).setStyle( { backgroundImage: 'url("' + $( "jsAnimation_" + idElt ).value + '")' } ) ;	
				}
			}
		}
	}

	function switchToJpeg( e ) {
		var idElt	= $( e ).id.replace( "jsDivFirstscreen_", "" ) ;
		if( $( "jsDivFirstscreen_" + idElt ) )	{
			doChange[ $( e ).id ]	= false ;
			$( e ).setStyle( { backgroundImage: 'url("' + $( "jsFirstscreen_" + idElt ).value + '")' } ) ;
		}
	}
