function LimBuscaRapida(objCtrBuscaRapida) {

	this.setId("CtrBuscaRapida");
	this.setIdFormulario("formBuscaRapida");
	this.setLargura(380);
	this.setAltura(455);
	this.setTitulo("Busca R&aacute;pida");
	this.setHtml("commons/busca_rapida.html");
	this.setIdFoco("idCampoNome");

	this.setControlador(objCtrBuscaRapida);
	
	this.buscaRapida = function() {
		this.getControlador().efetuaBuscaRapida();
	}
	
	// VERIFICA SE O CLIENTE APERTOU O ATALHO 'ACIMA' OU 'ABAIXO'
	this.posicaoRealce = function(valor) {
		if (valor == "acima") {
			this.getControlador().posRealceAcima();
		} else {
			this.getControlador().posRealceAbaixo();		
		}
	}
	
	// LISTAGEM DOS REGISTROS
	this.setImprimeListagem = function(arrayRegistros) {
		this.limparMensagem();
		var divPesquisa = $("divPesquisaResp");
		divPesquisa.update();
	 	var conteudoListagem = "";
		var mouseOver = "#C4FFD7";

		for(var i = 0; i < arrayRegistros.length; i++) {
			conteudoListagem += "<table width='100%' border='0' cellpadding='2' cellspacing='1' class='fonte'>";
			conteudoListagem += "<tr style='cursor: pointer' height='16' onClick='aplicativo.getLimite(\"LimBuscaRapida\").retornaRegistroMouse(" + i + ");' id=\"idLinhaBuscaRapida"+ i +"\">"; 
			conteudoListagem += "<td width='50'>&nbsp;" + arrayRegistros[i].getCodigo() + "</td>";
			conteudoListagem += "<td width='240'>"+ arrayRegistros[i].getDescricao() +"</td>";
			conteudoListagem += "</tr>";
			conteudoListagem += "</table>";
		}

		divPesquisa.style.display = "";
	 	divPesquisa.innerHTML = conteudoListagem;
	 	
		this.realceValoresLista(0, 0);
	}
	
	// RETORNA O CODIGO E DESCRICAO DA INFORMACAO ESCOLHIDA
	this.retornaRegistro = function() {
		this.getControlador().cancelaTemporizadorBusca();
		eval("shortcut.remove('DOWN'); shortcut.remove('UP');");
		if(this.getControlador().getArrayRegistros() != null && this.getControlador().getArrayRegistros().length != 0) {
			this.getControlador().retornaRegistro();
		} else {
			this.getControlador().setFocoCampoAtualNoControladorRequisitante();
		}
		this.prototypeWindow.close();
	}
	
	this.retornaRegistroMouse = function(posicao) {
		this.getControlador().setPosicaoRealce(posicao);
		this.retornaRegistro();
	}
	
	//RESPONSAVEL POR COLOCAR NA LISTAGEM O REALCE
	this.realceValoresLista = function(posicaoRealce, posicaoAnterior) {
		eval("$(idLinhaBuscaRapida" + posicaoAnterior + ").bgColor='#FFFFFF'");
		eval("$(idLinhaBuscaRapida" + posicaoRealce + ").bgColor='#C4FFD7'");
	}
	
	this.limpaValoresDiarios = function() {
		$(divPesquisaResp).innerHTML = " ";
	}
	
		
	//GETS E SETS
	this.getCampoNome = function() {
		return $(this.getIdFormulario()).idCampoNome.value;
	}

	this.setCampoNome = function(valor) {
		$(this.getIdFormulario()).idCampoNome.value = valor;
	}
	
	this.posCarregamento = function() {
		
		// Aguarda um pouco para colocar o foco, para evitar ter de pressionar F10 duas vezes
		setTimeout("aplicativo.getControlador('CtrBuscaRapida').getLimite().colocaFoco()", 200);
		//this.colocaFoco();
		
		this.getControlador().inicializa();
	}
	
	this.iniciaTemporizadorBusca = function() {
		this.getControlador().iniciaTemporizadorBusca();
	}
	
}
LimBuscaRapida.prototype = new Limite;
