var httpRequestObj;


function CacheImagens() {
	cacheArr = new Array(
					"../imagens/login-empresas-hover.gif"
					);
	imageCache = new Array();
	
	for (a = 0; a < cacheArr.length; a++) {
		imageCache[a] = new Image();
		imageCache[a].src = cacheArr[a];
	}
}

CacheImagens();


function Janela(e, w, h, p) {
	try {
		param = "";
		if (p != null)
			param = ", " + p;

		centrox = (screen.width / 2) - (w / 2);
		centroy = (screen.height / 2) - (h / 2);

		if (navigator.appName.indexOf("Opera") != -1) {
			test = (screen.height - (screen.height * 0.25));
			centroy = (test / 2) - (h / 2);
		}
		if (navigator.appName.indexOf("Explorer") != -1) {
			w -= 20;
		}

		window.open(e.href, '', "left=" + centrox + ", top=" + centroy + ", width=" + w + ", height=" + h + "" + param);

		if (window.event)
			event.returnValue = false;
	}
	catch(e) {
		if (window.event)
			event.returnValue = true;
		
	}
	return false;
}

function Janela2(e, w, h, p) {
	try {
		param = "";
		if (p != null)
			param = ", " + p;

		centrox = (screen.width / 2) - (w / 2);
		centroy = (screen.height / 2) - (h / 2);

		if (navigator.appName.indexOf("Opera") != -1) {
			test = (screen.height - (screen.height * 0.25));
			centroy = (test / 2) - (h / 2);
		}
		if (navigator.appName.indexOf("Explorer") != -1) {
			w -= 20;
		}

		window.open(e, '', "left=" + centrox + ", top=" + centroy + ", width=" + w + ", height=" + h + "" + param);

		if (window.event)
			event.returnValue = false;
	}
	catch(e) {
		if (window.event)
			event.returnValue = true;
		
	}
	return false;
}

function ValidarFormulario(Form) {

	Campos = Form.getElementsByTagName("select");
	for (a = 0; a < Campos.length; a++) {
		if (Campos[a].getAttribute("obrigatorio") != null && Campos[a].options[Campos[a].selectedIndex].value.length == "") {
			alert("Campo de preenchimento obrigatório.");
			Campos[a].focus();
			return false;
		}
	}

	Campos = Form.getElementsByTagName("input");
	for (a = 0; a < Campos.length; a++) {
		if (Campos[a].type == "text" && Campos[a].getAttribute("obrigatorio") != null && Campos[a].value.length == 0) {
			alert("Campo de preenchimento obrigatório.");
			Campos[a].focus();
			return false;
		}
	}
	
	
	Campos = Form.getElementsByTagName("textarea");
	for (a = 0; a < Campos.length; a++) {
		if (Campos[a].getAttribute("obrigatorio") != null && Campos[a].value.length == 0) {
			alert("Campo de preenchimento obrigatório.");
			Campos[a].focus();
			return false;
		}
	}
	
	return true;
}


/* Oculta texto do campo */

function campoFocusValueClass(obj) {

	obj.onfocus = function() {

		if (this.campoFocusValor == null){
			this.campoFocusValor = this.value;
			this.value = "";
		}
		else {
			if (this.value == this.campoFocusValor)
				this.value = "";
		}
	}
	
	obj.onblur = function() {
		if (this.value == ""){
			this.value = this.campoFocusValor;
		}	
	}

}



function fsize(size,unit,id){
	var vfontsize = document.getElementById(id);
	if(vfontsize){
		vfontsize.style.fontSize = size + unit;
	}
}


function loginEmpresasHome(img) {
	imagem = document.getElementById("imagemLoginEmpresas");
	imagem.src = img;
}

function Enderecos(obj) {
	url = obj.options[obj.selectedIndex].value;

	if (url != "") {
		document.location.href = url;
	}
}



/* Oculta texto do campo */

function campoFocusValueClass(obj) {
	obj.onfocus = function() {

		if (this.campoFocusValor == null){
			this.campoFocusValor = this.value;
			this.value = "";
		}
		else {
			if (this.value == this.campoFocusValor)
				this.value = "";
		}
	}
	
	obj.onblur = function() {
		if (this.value == ""){
			this.value = this.campoFocusValor;
		}	
	}
}



function IsNumeric(sText) {
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;

	for (i = 0; i < sText.length && IsNumber == true; i++) { 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) {
			IsNumber = false;
		}
	}
	return IsNumber;

}

function senhasAlterarValidarCampo() {

	var campoExtrato = document.getElementById("campoReferenciaConsulta");
	var dvListagemSenhasItens = document.getElementById("dvListagemSenhasItens");
	
	if (campoExtrato.value.length < 7)
	{
		alert("Controle inválido.");
		campoExtrato.focus();
		return false;
	}

	if (dvListagemSenhasItens != null) {
		dvListagemSenhasItens.style.display = "none";
	}

	document.getElementById("dvAguarde").style.display = "block";

	



	return true;

}

function extratoValidarCampo() {

	campoExtrato = document.getElementById("campoReferenciaConsulta");
	
	if (campoExtrato.value.length < 7)
	{
		alert("Formato de data inválida");
		campoExtrato.focus();
		return false;
	}

	document.getElementById('dvAguarde').style.display = 'block';

	return true;

}

function dirfValidarCampo() {

	campoDirf = document.getElementById("campoReferenciaConsulta");
	
	if (campoDirf.value.length < 4)
	{
		alert("Formato de ano inválido");
		campoDirf.focus();
		return false;
	}

	document.getElementById('dvAguarde').style.display = 'block';

	return true;

}



function enviarFormularioWebmail() {

	campoEmail = document.getElementById("WebmailCampoEmail");
	campoSenha = document.getElementById("WebmailCampoSenha");

	if (campoEmail.value == "e-mail") {
		campoEmail.focus();
		alert("É necessário informar o seu nome de usuário.");
		return false;
	}
	if (campoSenha.value == "senha") {
		campoSenha.focus();
		alert("É necessário informar a sua senha.");
		return false;
	}

	if (campoEmail.value.indexOf("@uniodontosc.com.br") == -1) {
		campoEmail.value += "@uniodontosc.com.br";
	}

	document.getElementById("formularioWebmail").submit();
	
	campoEmail.value = "e-mail";
	campoSenha.value = "senha";

	return false;

}


function contatoEnderecos() {

	var ulEscritorios = document.getElementById("ulEscritorios");
	var dvCTCidades = document.getElementById("dvCTCidades");
	var dvFormularioEmail = document.getElementById("dvFormularioEmail");

	ulEscritorios.style.display = "block";
	dvCTCidades.className = "Cidades_Open";


	if (dvFormularioEmail != null)
	{
		dvFormularioEmail.style.display = "none";
	}




}


function senhaCooperadoValidar() {

	campoSenha = document.getElementById("campoSenha");
	campoSenha2 = document.getElementById("campoSenha2");
	campoSenha3 = document.getElementById("campoSenha3");
	
	if (campoSenha.value.length == 0)
	{
		alert("O campo 'Senha Atual' deve ser preenchido.");
		campoSenha.focus();
		return false;
	}

	if (campoSenha2.value.length == 0)
	{
		alert("O campo 'Nova Senha' deve ser preenchido.");
		campoSenha2.focus();
		return false;
	}

	if (campoSenha3.value.length == 0)
	{
		alert("Você deve repetir a sua nova senha.");
		campoSenha3.focus();
		return false;
	}

	if (campoSenha2.value != campoSenha3.value)
	{
		alert("Você deve repetir a senha corretamente.");
		campoSenha3.focus();
		return false;
	}

	return true;

}



function getPosition(element) {
	var left = 0;
	var top = 0;
	if(element.offsetParent) {
		while(element) {
			left += element.offsetLeft;
			top += element.offsetTop;
			element = element.offsetParent;
		}
	}
	return {offsetLeft: left, offsetTop: top};
}
function carregaGlosa(idLink, idGlosa, total) {

	tr = document.getElementById(idLink);

	posicaoLink = getPosition(tr);

	tr.style.cursor = "hand";

	for (a = 0; a < total; a++) {

		if (document.getElementById("dvGlosaFlutuante" + a) != null)
			document.getElementById("dvGlosaFlutuante" + a).style.display = "none";

	}

	topo = posicaoLink.offsetTop - 22;

	document.getElementById(idGlosa).style.top = topo + "px";
	document.getElementById(idGlosa).style.display = "block";

}

function carregaGlosaPericia(idLink, idGlosa, total) {

	tr = document.getElementById(idLink);

	posicaoLink = getPosition(tr);

	tr.style.cursor = "hand";

	for (a = 0; a < total; a++) {

		if (document.getElementById("dvGlosaFlutuante" + a) != null)
			document.getElementById("dvGlosaFlutuante" + a).style.display = "none";

	}

	//alert(posicaoLink.offsetTop);
	topo = posicaoLink.offsetTop;
	

	document.getElementById(idGlosa).style.left = "194px";
	document.getElementById(idGlosa).style.top = "284px";
	//document.getElementById(idGlosa).style.top = topo + "px";
	document.getElementById(idGlosa).style.display = "block";

}

function ocultaGlosas(total) {
	for (a = 0; a < total; a++) {
		if (document.getElementById("dvGlosaFlutuante" + a) != null)
			document.getElementById("dvGlosaFlutuante" + a).style.display = "none";

	}
}



function validaCPF(cpf) {
	var filtro = /^\d{3}.\d{3}.\d{3}-\d{2}$/i;
	if(!filtro.test(cpf)){
	 window.alert("CPF inválido. Tente novamente.");
	 return false;
	}

	cpf = remove(cpf, ".");
	cpf = remove(cpf, "-");

	if(cpf.length != 11 || cpf == "00000000000" || cpf == "11111111111" ||
	  cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" ||
	  cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" ||
	  cpf == "88888888888" || cpf == "99999999999"){
	  window.alert("CPF inválido. Tente novamente.");
	  return false;
	}

	soma = 0;
	for(i = 0; i < 9; i++)
	 soma += parseInt(cpf.charAt(i)) * (10 - i);
	resto = 11 - (soma % 11);
	if(resto == 10 || resto == 11)
	 resto = 0;
	if(resto != parseInt(cpf.charAt(9))){
	 window.alert("CPF inválido. Tente novamente.");
	 return false;
	}
	soma = 0;
	for(i = 0; i < 10; i ++)
	 soma += parseInt(cpf.charAt(i)) * (11 - i);
	resto = 11 - (soma % 11);
	if(resto == 10 || resto == 11)
	 resto = 0;
	if(resto != parseInt(cpf.charAt(10))){
	 window.alert("CPF inválido. Tente novamente.");
	 return false;
	}
	return true;
}

function remove(str, sub) {
	i = str.indexOf(sub);
	r = "";
	if (i == -1) return str;
	r += str.substring(0,i) + remove(str.substring(i + sub.length), sub);
	return r;
}


function calculaIdade(data) {

	data = data.split("/");

	dd = data[0];
	mm = data[1];
	yy = data[2];

	var thedate = new Date()
	var mm2 = thedate.getMonth() + 1;
	var dd2 = thedate.getDate();
	var yy2 = thedate.getFullYear();
	var yourage = yy2 - yy
	if (mm2 < mm) {
	yourage = yourage - 1;
	}
	if (mm2 == mm) {
	if (dd2 < dd) {
	yourage = yourage - 1;
	}
	}
	return yourage;
}


function diaFechamento() {
	$("#diaFechamento").show();
}
function diaFechamentoOff() {
	$("#diaFechamento").hide();
}

function diaFechamentoLista(tr) {

	tr = document.getElementById(tr);

	posicaoLink = getPosition(tr);

	document.getElementById("diaFechamentoLista").style.top = posicaoLink.offsetTop + "px";
	document.getElementById("diaFechamentoLista").style.display = "block";

	//alert(posicaoLink.offsetTop);

//	$("#diaFechamento").show();
}
function diaFechamentoListaOff() {
	$("#diaFechamentoLista").hide();
}


var quadrosIndice = 0;
var quadrosItens = new Array("Quadro0", "Quadro1");
var quadrosTimer;

function QuadroAvisosCooperado(indice) {

        clearTimeout(quadrosTimer);

        var item = quadrosItens[indice];
        var botao = $("#linkq" + indice);
        var quadro = $("#Quadro" + indice);
        var PromocaoBotao = $("#PromocaoBotao");

        $("#Quadro .Botoes a").removeClass("Sel");
        botao.addClass("Sel");

		$('#Quadro div[id*="Quadro"]').hide();
        
        //if (item[3] != "")
        //    PromocaoBotao.attr("href", item[3]);
        //else
        //    PromocaoBotao.attr("href", "javascript:void(0);");

        quadro.fadeIn(1500, function () {

            /*
            itemTexto.animate(
            {
            left: "0px"
            },
            { duration: 600, easing: 'easeInOutCirc' }
            );
            */


            if ((quadrosIndice + 1) < quadrosItens.length)
                quadrosIndice++;
            else
                quadrosIndice = 0;



            quadrosTimer = setTimeout(function() { QuadroAvisosCooperado(quadrosIndice) }, 30000);

        });
    }


function CooperadosLiberacaoSenhaProcedimento(Codigo) {

	if ($("#campoProcedimentoCodigo").val().length == 0)
	{
		return;
	}
	
	$("#campoProcedimentoDente").val("");
	$("#campoProcedimentoFace1").val("");
	$("#campoProcedimentoFace2").val("");
	$("#campoProcedimentoFace3").val("");
	$("#campoProcedimentoFace4").val("");
	$("#campoProcedimentoFace5").val("");
	$("#campoProcedimentoDente").val("");

	$("#campoProcedimentoQuantidade").focus();

	var usuarioCodigoTabela = $("#usuarioCodigoTabela").val();

	$.ajax({
	  url: 'liberacao.senha.procedimentos.php',
	  data: 'opcao=1&codigotabela=' + usuarioCodigoTabela + '&codigoprocedimento=' + Codigo,
	  success: function(data) {

			if (data == "")
			{
				alert("Código de procedimento inválido");
				$("#campoProcedimentoCodigo").val("");
				$("#campoProcedimentoCodigo").focus();
			}
		  
		  retorno = data.split(";");

			$("#campoProcedimentoDente_").val(retorno[2]);
			$("#campoProcedimentoSegmento").val(retorno[3]);
			$("#campoProcedimentoDataVigencia").val(retorno[4]);
			$("#campoProcedimentoNroUso").val(retorno[5]);

			$("#campoProcedimentoDescricao").val(retorno[0]);

			//$("#tabelaAtosFaces").hide();
			$("#campoProcedimentoFace1").attr('disabled', 'disabled');
			$("#campoProcedimentoFace2").attr('disabled', 'disabled');
			$("#campoProcedimentoFace3").attr('disabled', 'disabled');
			$("#campoProcedimentoFace4").attr('disabled', 'disabled');
			$("#campoProcedimentoFace5").attr('disabled', 'disabled');
			$("#campoProcedimentoDente").attr('disabled', 'disabled');

			$("#campoProcedimentoDente").addClass('campoDesativado');
			$("#campoProcedimentoFace1").addClass('campoDesativado');
			$("#campoProcedimentoFace2").addClass('campoDesativado');
			$("#campoProcedimentoFace3").addClass('campoDesativado');
			$("#campoProcedimentoFace4").addClass('campoDesativado');
			$("#campoProcedimentoFace5").addClass('campoDesativado');

			$("#Face1").val("");
			$("#Face2").val("");
			$("#Face3").val("");
			$("#Face4").val("");
			$("#Face5").val("");
			$("#dvDente").val("");

			if (parseInt(retorno[1]) != 0 || retorno[2] == "t") {
				//$("#tabelaAtosFaces").show();
			}

			//alert(retorno[2]);

			if (parseInt(retorno[1]) != 0 || retorno[2] == "t") {
				for (var c = 1; c < parseInt(retorno[1]) + 1; c++) {
					$("#campoProcedimentoFace" + c).removeAttr('disabled');
					$("#campoProcedimentoFace" + c).removeClass('campoDesativado');
				}
			}

			/* 
			alert(retorno[1]);

		  switch (parseInt(retorno[1]))
		  {
			case 1:
				$("#campoProcedimentoFace1").removeAttr('disabled');
			break;
			case 2:
				$("#campoProcedimentoFace1").removeAttr('disabled');
				$("#campoProcedimentoFace2").removeAttr('disabled');
			break;
			case 3:
				$("#campoProcedimentoFace1").removeAttr('disabled');
				$("#campoProcedimentoFace2").removeAttr('disabled');
				$("#campoProcedimentoFace3").removeAttr('disabled');
			break;
			case 4:
				$("#campoProcedimentoFace1").removeAttr('disabled');
				$("#campoProcedimentoFace2").removeAttr('disabled');
				$("#campoProcedimentoFace3").removeAttr('disabled');
				$("#campoProcedimentoFace4").removeAttr('disabled');
			break;
			case 5:
				$("#campoProcedimentoFace1").removeAttr('disabled');
				$("#campoProcedimentoFace2").removeAttr('disabled');
				$("#campoProcedimentoFace3").removeAttr('disabled');
				$("#campoProcedimentoFace4").removeAttr('disabled');
				$("#campoProcedimentoFace5").removeAttr('disabled');
			break;
		  
		  }

		  */

		  //$("#campoProcedimentoDente").val(retorno[2]);

		  if (retorno[2] == "t")
		  {
			  $("#campoProcedimentoDente").removeAttr('disabled');
			  $("#campoProcedimentoDente").removeClass('campoDesativado');
		  }
		  
		  if (retorno[3] == "t")
		  {
			  $("#dvDenteLabel").text("Segmento");
		  }
		  else {
			  $("#dvDenteLabel").text("Dente");
		  }

		  $("#botaoProcedimentoAdd").removeAttr('disabled');

		  //alert(retorno[1]);

	  }
	});

}

function procedimentosListagem() {

	$.ajax({
		url: 'liberacao.senha.procedimentos.php',
		data: 'opcao=3',
		success: function(data) {
//			alert(data);
			$("#tabelaListagemAtos").html(data);
		}
	});

}


function botaoProcedimentoAdd_Click() {
	
	var codemp = $("#usuarioCodEmp").val();
	var codusu = $("#usuarioCodUsu").val();
	var codsit = $("#usuarioCodSit").val();
	var patr = $("#usuarioPatr").val();
	var obs = $("#campoLiberacaoObs").val();
	var usuarioCodigoTabela = $("#usuarioCodigoTabela").val();

	var CodigoProcedimento = $("#campoProcedimentoCodigo").val();
	var Descricao = $("#campoProcedimentoDescricao").val();
	var DataVigencia = $("#campoProcedimentoDataVigencia").val();
	var Face1 = $("#campoProcedimentoFace1").val();
	var Face2 = $("#campoProcedimentoFace2").val();
	var Face3 = $("#campoProcedimentoFace3").val();
	var Face4 = $("#campoProcedimentoFace4").val();
	var Face5 = $("#campoProcedimentoFace5").val();
	var Dente = $("#campoProcedimentoDente").val();
	var NroUso = $("#campoProcedimentoNroUso").val();
	var Quantidade = $("#campoProcedimentoQuantidade").val();


	if ($("#campoProcedimentoCodigo").val().length == 0)
	{
		alert("Código do Procedimento Inválido");
		$("#campoProcedimentoCodigo").focus();
		return;
	}

	//alert('opcao=2&codigotabela=' + usuarioCodigoTabela + '&codigoprocedimento=' + CodigoProcedimento + '&descricao='+Descricao+'&face1='+Face1+'&face2='+Face2+'&face3='+Face3+'&face4='+Face4+'&face5='+Face5+'&dente='+Dente+'&datavigencia='+ DataVigencia + '&nrouso='+ NroUso + '&quantidade='+ Quantidade + '&obs='+ obs + '&codemp='+codemp+'&codusu='+codusu+'&codsit='+codsit+'&patr='+patr+'');

	$.ajax({
		type: "POST",
		url: 'liberacao.senha.procedimentos.php',
		data: 'opcao=2&codigotabela=' + usuarioCodigoTabela + '&codigoprocedimento=' + CodigoProcedimento + '&descricao='+Descricao+'&face1='+Face1+'&face2='+Face2+'&face3='+Face3+'&face4='+Face4+'&face5='+Face5+'&dente='+Dente+'&datavigencia='+ DataVigencia + '&nrouso='+ NroUso + '&quantidade='+ Quantidade + '&obs='+ obs + '&codemp='+codemp+'&codusu='+codusu+'&codsit='+codsit+'&patr='+patr+'',
	  success: function(data) {

			//alert(data); //return;

			retorno = data.split(";");

			if (retorno[0] == "erro")
			{
				alert(retorno[1]);
			}
			else {

				$("#campoProcedimentoCodigo").val("");
				$("#campoProcedimentoDescricao").val("");
				$("#campoProcedimentoDataVigencia").val("");
				$("#campoProcedimentoNroUso").val("");
				$("#campoProcedimentoQuantidade").val("1");
				$("#campoProcedimentoFace1").val("");
				$("#campoProcedimentoFace2").val("");
				$("#campoProcedimentoFace3").val("");
				$("#campoProcedimentoFace4").val("");
				$("#campoProcedimentoFace5").val("");
				$("#campoProcedimentoDente").val("");

				$("#campoProcedimentoFace1").attr('disabled', 'disabled');
				$("#campoProcedimentoFace2").attr('disabled', 'disabled');
				$("#campoProcedimentoFace3").attr('disabled', 'disabled');
				$("#campoProcedimentoFace4").attr('disabled', 'disabled');
				$("#campoProcedimentoFace5").attr('disabled', 'disabled');
				$("#campoProcedimentoDente").attr('disabled', 'disabled');

				$("#campoProcedimentoDente").addClass('campoDesativado');
				$("#campoProcedimentoFace1").addClass('campoDesativado');
				$("#campoProcedimentoFace2").addClass('campoDesativado');
				$("#campoProcedimentoFace3").addClass('campoDesativado');
				$("#campoProcedimentoFace4").addClass('campoDesativado');
				$("#campoProcedimentoFace5").addClass('campoDesativado');

				//$("#tabelaAtosFaces").hide();

				$("#botaoProcedimentoAdd").attr('disabled', 'disabled');

			}

			procedimentosListagem();
	  }
	});

}
function procedimentosRemover(Indice) {

	$.ajax({
		url: 'liberacao.senha.procedimentos.php',
		data: 'opcao=4&removerindice=' + Indice,
		success: function(data) {
			procedimentosListagem();
		}
	});

}

function botaoSenhaAdd_Click() {


	var codemp = $("#usuarioCodEmp").val();
	var codusu = $("#usuarioCodUsu").val();
	var codsit = $("#usuarioCodSit").val();
	var patr = $("#usuarioPatr").val();
	var obs = $("#campoLiberacaoObs").val();
	var urlGuia = $("#urlGuia").val();
	var cartao = $("#campoUsuario").val();
	var codigoCooperado = $("#codigoCooperado").val();


	$.ajax({
		type: "POST",
		url: 'liberacao.senha.procedimentos.php',
		data: 'opcao=5&codemp='+codemp+'&codusu='+codusu+'&codsit='+codsit+'&patr='+patr+'&obs='+obs,
		success: function(data) {

			retorno = data.split(";");

			if (retorno[0] == "erro")
			{
				alert(retorno[1]);
			}
			else {
			}

			//alert(data);

			$("#campoLiberacaoObs").val("");

			procedimentosListagem();

			$("#controle").val(data);

			$("#tituloProcedimentos").hide();
			$("#tabelaAtos").hide();
			$("#tabelaAtosFaces").hide();
			$("#tbIncluirProcedimento").hide();
			$("#tabelaListagemAtos").hide();
			$("#dvObservacoes").hide();
			$("#botoesOpcoes").show();

			//alert("Solicitação enviada com sucesso.");

			//window.open(urlGuia + '?cartao=' + cartao + '&mes=&controle=' + data + '&codigocooperado=' + codigoCooperado, '', '');

			//document.location = 'liberacao.senha.php?opcao=1';

			
		}
	});


}

function botaoProcedimentoPesquisar_Click() {

	botaoProcedimentosPesquisar_Click();
	$("#dvPesquisaProcedimentos").show();
	
}

function botaoProcedimentosPesquisar_Click() {

	var pesquisa = $("#campoProcedimentoPesquisa").val();
	var usuarioCodigoTabela = $("#usuarioCodigoTabela").val();

	$.ajax({
		url: 'liberacao.senha.procedimentos.php',
		data: 'opcao=6&codigotabela=' + usuarioCodigoTabela + '&pesquisaProcedimento=' + pesquisa,
		success: function(data) {

			retorno = data.split(";");

			if (retorno[0] == "erro")
			{
				alert(retorno[1]);
			}
			else {

				$("#tabelaPesquisaAtos").html(data);

			}

			
		}
	});

}

function procedimentosPesquisaRetorno(codigoPesquisado) {

	$("#dvPesquisaProcedimentos").hide();
	$("#campoProcedimentoCodigo").val(codigoPesquisado);

	CooperadosLiberacaoSenhaProcedimento(codigoPesquisado);

	
	
}

function botaoVisualizarGTO_Click() {

	var urlGuia = $("#urlGuia").val();
	var cartao = $("#campoUsuario").val();
	var codigoCooperado = $("#codigoCooperado").val();
	var controle = $("#controle").val();

	window.open(urlGuia + '&cartao=' + cartao + '&mes=&controle=' + controle + '&codigocooperado=' + codigoCooperado, '', '');


}

function botaoNovaSolicitacao_Click() {

	document.location = 'liberacao.senha.php?opcao=1';

}

