function verificarCampos(sigServico, idItem)
{
	mensagem = "";
	
	//Verifica se ao menos um dos campos foi preenchido
	if (document.getElementById("palavraChave").value == "" || document.getElementById("palavraChave").value == null)
	{
		mensagem = mensagem + "\nInforme o argumento de pesquisa";
	}
		

	if (mensagem == "")	
	{
		document.getElementById("formularioPesquisa").action="../cms/listarResultadoPesquisa.asp?servicoGrupoPesquisa="+sigServico+"&idItem="+idItem;
		document.getElementById("formularioPesquisa").submit();
		document.getElementById("divCarregando").innerHTML = "<img src='../util/imagem/loading.gif' width='16' height='16' align='left' alt='' border='0'>&nbsp;Aguarde...";
		return true;
	}
	else
	{
		alert(mensagem);
	}
}

function enviarComEnter(e, sigServico, idItem)
{
	
	if (!e)
	{
		var e = window.event
	}

	if (e.keyCode)
	{
		code = e.keyCode;
	}

	else if (e.which) 
	{
		code = e.which;
	}

	if(code == 13)
	{
		if (verificarCampos(sigServico, idItem))
		{		
			document.getElementById("formularioPesquisa").action="../cms/listarResultadoPesquisa.asp?servicoGrupoPesquisa="+sigServico+"&idItem="+idItem;
			document.getElementById("formularioPesquisa").submit();
			document.getElementById("divCarregando").innerHTML = "<img src='../util/imagem/loading.gif' width='16' height='16' align='left' alt='' border='0'>&nbsp;Aguarde...";
			return true;
		}
	}
}

$(document).ready(function() {
	$('#abrirOpcaoAvancada').click(function() {
		$('#opcoesAvancadas').toggle();			
		$("#abrirOpcaoAvancada img").toggle(); 
		if ($("#pesquisaConteudo").css("height") == "30px"){
			$("#pesquisaConteudo").css("height", "57px");
			}else{
			$("#pesquisaConteudo").css("height", "30px");
		}
	});	
});


