/*
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ---- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
 AHDSS - Interaccion del buscador global.
 version:  d01-m04-a07.
 -- -- -- -- -- -- -- -- --
 Mauricio F. Tolezano - Acuataller (www.acuataller.com)
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ---- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
*/

org.mendezmende.general.InteraccionBuscadorGlobal = {	
	
	u 			: false,
	etiqueta 	: null,
	campoBuscar : null,
	
	
	iniciar : function (idEtiqueta)
	{
		if (!document.getElementById) return;
		
		this.u 				= new com.acuataller.utiles.Utiles();
		this.u.setClaseBandera('dom');
		this.etiqueta 		= document.getElementById( 'buscador-global-etiqueta' 	);
		this.campoBuscar 	= document.getElementById( this.etiqueta.htmlFor 		);
		
		if(this.campoBuscar.value){
			this.u.asignarEstilo(this.etiqueta, 'activo');
		}
		
		this.asignarEventos();
	},
	
	asignarEventos : function ()
	{
		var _this = this;
		this.campoBuscar.onfocus = function() 
		{
			_this.u.asignarEstilo(_this.etiqueta, 'activo') ;
		}
		this.campoBuscar.onblur = function() 
		{
			if (this.value === '') {
			  _this.u.eliminarEstilo(_this.etiqueta, 'activo') ;
			}
		}	
		// Para Safari.
		this.etiqueta.onclick = function() 
		{
			_this.campoBuscar.focus();	
		}
	}
}


ELO.functionsToCallOnload.push("org.mendezmende.general.InteraccionBuscadorGlobal.iniciar()");


