// JavaScript Document
var aindicator = {	
	Version					: '1.0',
	className				: 'aindicator',
	defaultDelay			: 5000,
	time_Erreur				: 10,
	timerErreur				: null,
	
	Display_All_Erreur		: false,
	Display_Minimum_Erreur	: true,
	Display_Middle_Erreur	: true,
	Display_Maximum_Erreur	: true,
	
	__moveIndicOnScroll		: true,
	__origineTop			: null,
				
	hideErreur: function(){
		var t = this;
		t._messageErreur();
		t._hideErreur();
		t._hideIndicateur();
	},
	
	is_importante: function( _importance ){
		var t = this;
		if (!t.Display_All_Erreur) return false;
		if (!_importance) _importance = 1;
		if (!t.Display_Minimum_Erreur && _importance==2) return false;
		if (!t.Display_Middle_Erreur && _importance==1) return false;
		if (!t.Display_Maximum_Erreur && _importance==0) return false;
		return true;
	},

	showErreur: function(message, _importance, _delay){//Importance 1 haute, 2 moyen, 3 minime -> default moyenne
		var t = this;
		if ( !t.is_importante( _importance ) ) return false;
		if (!_delay) _delay = t.time_Erreur;
		t._messageErreur( message );
		t._hide();
		t._showErreur();
		t._showIndicateur();
		t.timerErreur = setTimeout('aindicator._timerDisplay_Erreur_function()', _delay);	
	},
	
	hide: function(){
		var t = this;
		t._hide();
		t._hideErreur();
		t._hideIndicateur();
	},

	show: function(){
		var t = this;
		t._hideErreur();
		t._show();
		t._showIndicateur();
	},
	
	setTimerErreur: function( _message, _delay, _importance ){
		var t = this;
		if ( !t.is_importante( _importance ) ) return false;
		if ( !_delay ) _delay = t.defaultDelay;
		t._messageErreur( _message );
		t._hide();
		t._showErreur();
		t._showIndicateur();
		t.timerErreur = setTimeout( 'aindicator._timerErreur_function()', _delay );
	},
/**
 *		Private
 */
	_showErreur: function(){
		$( this.className +'_Erreur' ).show();
		//var Erreurobj = getById( this.className +'_Erreur' );
		//Erreurobj.thestyle=(navigatorTest('ie4||ns6'))? Erreurobj.style : Erreurobj;
		//Erreurobj.thestyle.visibility='visible';
	},
	
	_show: function(){
		$( this.className +'_Load_Indic' ).show();
		//var Erreurobj = getById( this.className +'_Load_Indic' );
		//Erreurobj.thestyle=(navigatorTest('ie4||ns6'))? Erreurobj.style : Erreurobj;
		//Erreurobj.thestyle.visibility='visible';
	},
	
	_hideErreur: function(){
		$( this.className +'_Erreur' ).hide();
		//var Erreurobj = getById( this.className +'_Erreur' );
		//Erreurobj.thestyle=(navigatorTest('ie4||ns6'))? Erreurobj.style : Erreurobj;
		//Erreurobj.thestyle.visibility=(navigatorTest('ie4||ns6'))? 'hidden' : 'hide';	
	},
	
	_hide: function(){
		$( this.className +'_Load_Indic' ).hide();
		//var Erreurobj = getById( this.className +'_Load_Indic' );
		//Erreurobj.thestyle=(navigatorTest('ie4||ns6'))? Erreurobj.style : Erreurobj;
		//Erreurobj.thestyle.visibility=(navigatorTest('ie4||ns6'))? 'hidden' : 'hide';	
	},
	
	_messageErreur: function( _message ){
		if ( !_message ) _message = '';
		var Erreurobjtext = $( this.className +'_Erreur_Text' );
		//var Erreurobjtext = getById( this.className +'_Erreur_Text' );
		Erreurobjtext.innerHTML = _message;			
	},
	
	_showIndicateur: function(){
		$( this.className +'Body' ).show();
		//var _object = getById( this.className +'Body' );/*id_AjaxCom_Control*/
		//_object.thestyle=(navigatorTest('ie4||ns6'))? _object.style : _object;
		//_object.thestyle.visibility='visible';
	},
	
	_hideIndicateur: function(){
		$( this.className +'Body' ).hide();
		//var _object = getById( this.className +'Body' );/*id_AjaxCom_Control*/
		//_object.thestyle=(navigatorTest('ie4||ns6'))? _object.style : _object;
		//_object.thestyle.visibility=(navigatorTest('ie4||ns6'))? 'hidden' : 'hide';	
	},	
	
	_moveIndicatorOnScroll: function ( event ){
		var _object = $( this.className +'Body' );
		if ( aindicator.__origineTop == null ) aindicator.__origineTop = _object.offsetTop;
		_object.style.top = ( AUtils.getBrowserInnerTop()+aindicator.__origineTop )+'px';
		//var _object = getById( this.className +'Body' );/*id_AjaxCom_Control*/
		//_object.thestyle=(navigatorTest('ie4||ns6'))? _object.style : _object;
		//if ( aindicator.__origineTop == null ) aindicator.__origineTop = _object.offsetTop;
		//_object.thestyle.top = ( AUtils.getBrowserInnerTop()+aindicator.__origineTop )+'px';
	},
	
/**
 *  Timer
 */
 	_timerDisplay_Erreur_function: function(){
		clearTimeout(this.timerErreur);
		//var Erreurobj = getById( this.className +'_Erreur_Text' );
		var Erreurobj = $( this.className +'_Erreur_Text' );
		Erreurobj.innerHTML = '';
		this.hideErreur();
	},
	
	_timerErreur_function: function(){
		clearTimeout(this.timerErreur);
		this.hide();
	}
};
