var DEFAULT_BUSCAR_BLANCAS = "Nombres de personas o empresas";
var DEFAULT_BUSCAR_PERSONAS = "Nombre de persona";
var DEFAULT_BUSCAR_EMPRESAS = "Nombre de empresa";
var DEFAULT_BUSCAR_DIRECCION = "Dirección";


var updateTypeText = function(idInput, tipo){
	var textoDefault = "";
	if (tipo == "blancas"){
		textoDefault = DEFAULT_BUSCAR_BLANCAS;
	} else if (tipo == "personas"){
		textoDefault = DEFAULT_BUSCAR_PERSONAS;
	} else if (tipo == "empresas"){
		textoDefault = DEFAULT_BUSCAR_EMPRESAS;
	} else if (tipo == "direccion"){
		textoDefault = DEFAULT_BUSCAR_DIRECCION;
	}
	$Dom.get(idInput).value = $Dom.get(idInput).value.trim();
	if ($Dom.get(idInput).value == textoDefault) {
		onBlurText(idInput, tipo, true);
	} else {
		onFocusText(idInput, tipo, true);
	}
};

var onBlurText = function(idInput, tipo, update){
	if (update === undefined || update === null){
		update = false;
	}
	//$Dom.get(idInput).value = $Dom.get(idInput).value.trim();
	if (!update){
		if ($Dom.get(idInput).value.length > 0){
			return;
		}
	}
	var texto = "";
	if (tipo == "blancas"){
		texto = DEFAULT_BUSCAR_BLANCAS;
	} else if (tipo == "personas"){
		texto = DEFAULT_BUSCAR_PERSONAS;
	} else if (tipo == "empresas"){
		texto = DEFAULT_BUSCAR_EMPRESAS;
	} else if (tipo == "direccion"){
		texto = DEFAULT_BUSCAR_DIRECCION;
	} 
	
	$Dom.get(idInput).value = texto;
	/*
	if (DEFAULT_BUSCAR_DIRECCION != texto){
		$Dom.get(idInput).value = texto;
	} else {
		$Dom.get(idInput).value = "direcci" + String.fromCharCode(162);
	}
	*/
	
	$Dom.setStyle(idInput, 'color','#bfbfbf');
};
var onFocusText = function(idInput, tipo, update){
	if (update === undefined || update === null){
		update = false;
	}
	//$Dom.get(idInput).value = $Dom.get(idInput).value.trim();
	var texto = $Dom.get(idInput).value;
	var textoDefault = "";
	if (tipo == "blancas"){
		textoDefault = DEFAULT_BUSCAR_BLANCAS;
	} else if (tipo == "personas"){
		textoDefault = DEFAULT_BUSCAR_PERSONAS;
	} else if (tipo == "empresas"){
		textoDefault = DEFAULT_BUSCAR_EMPRESAS;
	} else if (tipo == "direccion"){
		textoDefault = DEFAULT_BUSCAR_DIRECCION;
	} 
	if (!update){
		if (texto != textoDefault){
			return;
		}
		$Dom.get(idInput).value = "";
	}	
	$Dom.setStyle(idInput, 'color','#000000');	
}



