// CLSistemas

function createXMLHttpRequest() {
	/*
		Interface gen?rica para acesso ao conector remoto.
	*/
   try{ return new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){}
   try{ return new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){}
   try{ return new XMLHttpRequest(); }catch(e){}
   alert("Seu navegador n?o tem suporte para essa tecnologia");
   return null;
}

var xhReq = createXMLHttpRequest();



function levaetraz(url,div){
	var vaiReq = createXMLHttpRequest();
     var dt = new Date();

     var anticache = dt.getSeconds()+dt.getMinutes()+dt.getMilleseconds;

     url += "?&anticache=" + dt.getSeconds()+dt.getDay();

	/*
		Consulta a pagina que foi passada ali na url e retorna tudo na div la embaixo

	*/
    vaiReq.open("GET",url,true);
	vaiReq.setRequestHeader("Content-Type","application/x-javascript; charset:ISO-8859-1");
    vaiReq.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
    vaiReq.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
    vaiReq.setRequestHeader("Pragma", "no-cache");
    vaiReq.onreadystatechange = do_readyStateChange;
    vaiReq.send(null);


	function do_readyStateChange(){
		/*
			verificar o estatus da requisacao
		*/
	if(vaiReq.readyState==1){
	// qualquer evento que voce quiser colocar enquanto as variaveis estiverem sendo carregadas


	}

		if (vaiReq.readyState != 4)  { return; }
		var pesquisa = document.getElementById(div);
		pesquisa.innerHTML = vaiReq.responseText ;


	}

}



//  APENAS PARA MANDARRR  AVARIAVEIS- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function leva(url){

		var vaiReq = createXMLHttpRequest();


		/*
			Consulta a pagina que foi passada ali na url e retorna tudo na div la embaixo

		*/
		vaiReq.open("GET",url,true);
		vaiReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
		vaiReq.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		vaiReq.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
		vaiReq.setRequestHeader("Pragma", "no-cache");
		vaiReq.onreadystatechange = do_readyStateChange;
		vaiReq.send(null);


		function do_readyStateChange(){
			/*
				verificar o estatus da requisacao
			*/
		if(vaiReq.readyState==1){
		// qualquer evento que voce quiser colocar enquanto as variaveis estiverem sendo carregadas


		}

			if (vaiReq.readyState != 4)  {
			return;
			}



		}

	}



/// - - - - - - - - - - - - - - - - - ## troca os modulos ## - - - - - - - - -

function trocamodulo(url,div){

	var vaiReq = createXMLHttpRequest();

	opacity('right',100,0,1);
	opacity('loading',0,100,1);

    var dt = new Date();
    var anticache = dt.getSeconds()+dt.getMinutes();

    url += "?&anticache=" + dt.getSeconds()+dt.getDay();

 	vaiReq.open("GET",url,true);
	vaiReq.setRequestHeader("Content-Type","application/x-javascript; charset:ISO-8859-1");
    vaiReq.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
    vaiReq.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
    vaiReq.setRequestHeader("Pragma", "no-cache");
	vaiReq.onreadystatechange = do_readyStateChange;
    vaiReq.send(null);




	function do_readyStateChange(){

		if(vaiReq.readyState==1){
		// qualquer evento que voce quiser colocar enquanto as variaveis estiverem sendo carregadas

		document.getElementById("right").style.display = 'none';
		document.getElementById("loading").style.display = 'block';

		}

		if (vaiReq.readyState != 4)  { return; }
		var pesquisa = document.getElementById(div);
		pesquisa.innerHTML = vaiReq.responseText ;

		var titulo = document.getElementsByTagName('h1')[1];
		titulo = titulo.innerHTML;
		titulo = titulo.replace('<span class="titulos_">','');
		titulo = titulo.replace('</span>','');
		titulo = titulo.replace('<span class="sub_tit_">','');
		titulo = titulo.replace('</span>','');
		document.title=titulo;




		opacity('loading',100,0,500);
		opacity('right',0,100,500);
		document.getElementById("right").style.display = 'block';
		document.getElementById("loading").style.display = 'none';

	}

}

//  APAGANDO REGISTROS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function apaga_grid(url){
if(confirm('Deseja realmente EXCLUIR esse registro ? '))
{

		function do_readyStateChange2(){

			if(vaiReq2.readyState==1){
			// qualquer evento que voce quiser colocar enquanto as variaveis estiverem sendo carregadas

			}

				if (vaiReq2.readyState != 4)  {
					return;
				}

				var page= document.getElementById('query').value;
				var erro_total=vaiReq2.responseText;
				if(erro_total!=''){
					alert('falha ao excluir: '+erro_total);
				}else {
					levaetraz(page,'conteudo');
				}
			}


		var vaiReq2 = createXMLHttpRequest();


		/*
			Consulta a pagina que foi passada ali na url e retorna tudo na div la embaixo

		*/
		vaiReq2.open("GET",url,true);
		vaiReq2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
		vaiReq2.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		vaiReq2.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
		vaiReq2.setRequestHeader("Pragma", "no-cache");
		vaiReq2.onreadystatechange = do_readyStateChange2;
		vaiReq2.send(null);

	}
}


//  APAGANDO REGISTROS internos - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function apaga_conteudo(url,atualiza,query){
if(confirm('Deseja realmente EXCLUIR esse registro ? '))
{
		//alert(url);
		function do_readyStateChange2(){

			if(vaiReq2.readyState==1){
			// qualquer evento que voce quiser colocar enquanto as variaveis estiverem sendo carregadas

			}
				if (vaiReq2.readyState != 4)  {
					return;
				}
				//alert(url);
				levaetraz(query,atualiza);
			}
		var vaiReq2 = createXMLHttpRequest();


		/*
			Consulta a pagina que foi passada ali na url e retorna tudo na div la embaixo

		*/
		vaiReq2.open("GET",url,true);
		vaiReq2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
		vaiReq2.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		vaiReq2.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
		vaiReq2.setRequestHeader("Pragma", "no-cache");
		vaiReq2.onreadystatechange = do_readyStateChange2;
		vaiReq2.send(null);


	}
}

//  Efetuando Buscas - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function faz_busca(obj,obj2,url){

	document.getElementById('ok_bt').disabled=true;
	if(obj=='' || obj2==''){
		alert('Digite o que deseja buscar');
		document.getElementById('ok_bt').disabled=false;

	}
	else {
		if(document.getElementById('filtro')){
			document.getElementById('filtro').reset();
		}
        //alert(obj2);
		levaetraz(url+'?busca='+obj+'&campo='+obj2,'conteudo');
		document.getElementById('ok_bt').disabled=false;
		document.getElementById('limpa_busca').style.display='inline';
	}
}

//function faz_busca2(obj5,obj,obj2,obj4,obj3,url, busca){
  function faz_busca2(obj,obj2,obj4,obj3,url, busca){
    //alert(obj+'" - "'+obj2+'""- "'+obj3);
    if(obj2 != "" && obj4 != ""){
        levaetraz(url+'?operacao='+obj+'&dtinicio='+obj2+"&dtfinal="+obj4+"&ctamov="+obj3+"&busca="+busca,'conteudo');
    	document.getElementById('limpa_busca').style.display='inline';
    }
    else{
        alert("Data inicial e Data Final, são campos Obrigatórios!");
    }
}


function faz_busca_data(obj,obj2,url){

	document.getElementById('ok_bt').disabled=true;
	if(obj=='' || obj2==''){
		alert('Digite o intervalo de datas');
		document.getElementById('ok_bt').disabled=false;

	}
	else {
		document.getElementById('filtro').reset();
		levaetraz(url+'?dt_inicio='+obj+'&busca=sim&dt_fim='+obj2,'conteudo');
		document.getElementById('ok_bt').disabled=false;
		document.getElementById('limpa_busca').style.display='inline';
	}
}

function limpa_busca(){

	document.forms['busca'].reset();
	document.getElementById('limpa_busca').style.display='none';
}

function limpa_forms(divz,valor){

	if(divz!='form_endereco'){

		var elimina = document.getElementById('form_endereco');
		elimina.innerHTML = '&nbsp;' ;


	}
	if(divz!='form_email'){

		var elimina = document.getElementById('form_email');
		elimina.innerHTML = '&nbsp;' ;

	}
	if(divz!='form_fone'){

		var elimina = document.getElementById('form_fone');
		elimina.innerHTML = '&nbsp;' ;

	}
	if(divz!='form_cliente'){

		levaetraz('../clie/grid_juridico.php?valor='+valor,'form_cliente');

	}

}


//========================================================================
function FormataReais(fld, milSep, decSep, e) {

if(e.which == 8 || e.keycod == 8){
    return true;
}else{
    var sep = 0;
    var key = '';
    var i = j = 0;
    var len = len2 = 0;
    var strCheck = '0123456789';
    var aux = aux2 = '';
    var whichCode = (window.Event) ? e.which : e.keyCode;

    if (whichCode == 13) return true;
    key = String.fromCharCode(whichCode);// Valor para o código da Chave
    if (strCheck.indexOf(key) == -1) return false; // Chave inválida
    len = fld.value.length;

    for(i = 0; i < len; i++)
    if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != decSep)) break;
    aux = '';
    for(; i < len; i++)
    if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i);
    aux += key;
    len = aux.length;
    if (len == 0) fld.value = '';
    if (len == 1) fld.value = '0'+ decSep + '0' + aux;
    if (len == 2) fld.value = '0'+ decSep + aux;
    if (len > 2) {
    aux2 = '';
    for (j = 0, i = len - 3; i >= 0; i--) {
    if (j == 3) {
    aux2 += milSep;
    j = 0;
    }
    aux2 += aux.charAt(i);
    j++;
    }

    fld.value = '';
    len2 = aux2.length;
    for (i = len2 - 1; i >= 0; i--)
    fld.value += aux2.charAt(i);
    fld.value += decSep + aux.substr(len - 2, len);
    }
    return false;

    }
}

//FUNCAO PARA 3 CASAS DECIMAIS==================================================================================



//FUNCAO QUE CHAMA O CALENDARIO======================================================
function Calendario(obj, x, y)
{
      //alert(obj);
      window.open('../calendario/index.php?obj='+obj,'Calendario','resize=no,statusbar=no,scrollbars=no,toolbar=no,personalbar=no,directories=no,menubar=no,width=200,height=187,top='+x+',left='+y+'');
}


//  Efetuando Buscas==================================================================
function faz_busca_embalagem(obj, url){
    //document.getElementById('ok_bt').disabled=true;
	if(obj==''){
		alert('Escolha um produto para buscar suas respectivas embalagens!');
		//document.getElementById('ok_bt').disabled=false;
	}
	else {
		levaetraz(url+'?produto='+obj,'busca_embalagem');
		//document.getElementById('limpa_busca').style.display='inline';
	}
}

//FUNCAO PARA VALIDAR CNPJ==============================================================
function validaCNPJ(obj, nomeid) {


        CNPJ = obj;
        erro = new String;

        if (CNPJ.length < 18) erro += "É necessarios preencher corretamente o numero do CNPJ! \n\n";
        if ((CNPJ.charAt(2) != ".") || (CNPJ.charAt(6) != ".") || (CNPJ.charAt(10) != "/") || (CNPJ.charAt(15) != "-")){
            if (erro.length == 0) erro += "É necessarios preencher corretamente o numero do CNPJ! \n\n";
        }


        //substituir os caracteres que nao sao numeros
        if(document.layers && parseInt(navigator.appVersion) == 4){
            x = CNPJ.substring(0,2);
            x += CNPJ.substring(3,6);
            x += CNPJ.substring(7,10);
            x += CNPJ.substring(11,15);
            x += CNPJ.substring(16,18);
            CNPJ = x;
        } else {
            CNPJ = CNPJ.replace(".","");
            CNPJ = CNPJ.replace(".","");
            CNPJ = CNPJ.replace("-","");
            CNPJ = CNPJ.replace("/","");
        }
        var nonNumbers = /\D/;
        if (nonNumbers.test(CNPJ)) erro += "A verificacao de CNPJ suporta apenas numeros! \n\n";
        //document.getElementById(nomeid).focus();
        var a = [];
        var b = new Number;
        var c = [6,5,4,3,2,9,8,7,6,5,4,3,2];
        for (i=0; i<12; i++){
            a[i] = CNPJ.charAt(i);
            b += a[i] * c[i+1];
        }
        if ((x = b % 11) < 2) { a[12] = 0 } else { a[12] = 11-x }
        b = 0;
        for (y=0; y<13; y++) {
            b += (a[y] * c[y]);
        }
        if ((x = b % 11) < 2) { a[13] = 0; } else { a[13] = 11-x; }
        if ((CNPJ.charAt(12) != a[12]) || (CNPJ.charAt(13) != a[13])){
            erro +="Digito verificador com problema!";
        }
        if (erro.length > 0){
            alert(erro);
            document.getElementById(nomeid).value = "";
            return false;
        } 
        return true;
    }
    
//FUNCAO QUE VALIDA CPF
function validaCPF (obj, nomeid)
{

    Z = obj.replace(".", ""); // retira o primeiro ponto
    Z = Z.replace(".", ""); // retira o segundo ponto
    Z = Z.replace("-", ""); // retira o hifem
    numcpf = Z;
   
    x = 0;
	soma = 0;
	dig1 = 0;
	dig2 = 0;
	texto = "";
	numcpf1="";
	len = numcpf.length; x = len -1;
	// var numcpf = "12345678909";
	for (var i=0; i <= len - 3; i++) {
		y = numcpf.substring(i,i+1);
		soma = soma + ( y * x);
		x = x - 1;
		texto = texto + y;
	}
	dig1 = 11 - (soma % 11);
	if (dig1 == 10) dig1=0 ;
	if (dig1 == 11) dig1=0 ;
	numcpf1 = numcpf.substring(0,len - 2) + dig1 ;
	x = 11; soma=0;
	for (var i=0; i <= len - 2; i++) {
		soma = soma + (numcpf1.substring(i,i+1) * x);
		x = x - 1;
	}
	dig2= 11 - (soma % 11);
	if (dig2 == 10) dig2=0;
	if (dig2 == 11) dig2=0;
	//alert ("Digito Verificador : " + dig1 + "" + dig2);
	if ((dig1 + "" + dig2) == numcpf.substring(len,len-2)) {
		return true;
	}
	alert ("Numero do CPF invalido !!!");
	document.getElementById(nomeid).value = "";
	return false;
   
}

//funcao que traz campo obs nota
function ObsCampo(obj, div){

    if (obj == "Outros"){
        //alert(obj +" - "+div);
        levaetraz('../pedido/camponota.php', 'div_obs_nota');
    }
    else{
        levaetraz('../pedido/branco.php', 'div_obs_nota');
    }
}


//funcao que escreve a div que eu desejo-------------------------------------------
function EscreveDiv(obj, campocompara, div, url){
	if (obj == campocompara){
        //alert(obj +" - "+div);
		document.getElementById(div).style.display = 'block';
        levaetraz(url, div);
    }
    else{
        levaetraz('../inc/branco.php', div);
		document.getElementById(div).style.display = 'none';
    }
}
//-------------------------------------------------------------------------------->


//funcao que leva valor no campo
function LevaValue(obj, div){
  document.getElementById(div).value = obj;
}
//funcao que verifica a qtde certa da embalagem
function CalculaQtde(div, obj1, obj2){
    //alert(div+' - '+obj1+' - '+obj2);
    
    vl = "ok";
    
    result = obj1 % obj2.substring(0,2);
    
    if (result > 0){
        if(confirm('A quantidade cadastrada está dando caixa quebrada.  Arredondar para cima?')){
            certo = parseFloat(obj1) + (parseFloat(obj2) - parseFloat(result));
            document.getElementById(div).value = "";
            document.getElementById(div).value = parseFloat(certo);
        }
    }
   
}

//subvalida cnpj ou cpf
function Subvalida(obj){
    if(obj.length == 18 || obj.length == 14){

        if(obj.length == 18){
            validaCNPJ(obj, 'cnpj');
        }

        if(obj.length == 14){
               validaCPF(obj, 'cnpj');
        }
        
    }
    else{
        alert('CNPJ/CPF inválido!');
        document.getElementById('cnpj').value = "";
    }
}

//---FUNÇÃO PARA CALCULAR A DISTANCIA
function Distancia(obj1, obj2){
  var tot = obj1 - obj2;
  if(tot > 0){
    document.getElementById('distancia').value = obj1 - obj2;
  }
}

//CALCULA O PERCENTUAL AUTOMATICO
function CalcPerc(obj1, obj2){
	//alert(obj1+' - '+obj2);
    if(obj1 != "" && obj2 != 0){

        obj1 = obj1.replace(".","");
        obj1 = obj1.replace(",",".");

        tot_ped = parseFloat(obj1) / parseFloat(obj2) * 100;
        //alert(tot_ped);

        //a = tot_ped.toString();
        //a.split(",");
        //vl = a[0]+a[1]+','+a[3]+a[4];
        //alert(parseFloat(vl));
        
        a = tot_ped.toString();
        a = a.substring("0","4");
        a = a.replace(".",",");

        document.getElementById('cad_form').percentual.value = a;
    }
    
}

//FUNCAO PARA IMPRIMIR O RELATORIO DE COMISSOES-----------------------------------------------
function RelComissao(obj1, obj2, vend){
  //alert('../relcomissao/relcomissao.php?vend='+vend+"&dtinicial="+obj1+"$dtfinal="+obj2,'right');
  //trocamodulo('../relcomissao/relcomissao.php?vend='+vend+"&dtinicial="+obj1+"&dtfinal="+obj2,'right');
  levaetraz('../relcomissao/relcomissao.php?vend='+vend+"&dtinicial="+obj1+"&dtfinal="+obj2,'conteudo');
}

//FUNCAO PARA IMPRIMIR O RELATORIO DE DADOS CLIENTES------------------------------------------
function RelClienteDados(cli, uf, detalhado){  
  if(detalhado == "nao"){
  	levaetraz('../relclientesdados/relclientesdados.php?cli='+cli+"&uf="+uf,'conteudo');
  }
  else{
	 if(cli!= ""){
	 	levaetraz('../relclientesdados/relclientesdadosd.php?cli='+cli+"&uf="+uf,'conteudo'); 
	 }else{
		 alert('Cliente e um campo obrigatorio!')
	 }
  }
}

//FUNCAO QUE CONTROLA REL CLIENTE DADOS  CAMPOS INATIVOS--------------------------------------
function BloqueiaCampo(valor, id){
	if(valor != ""){			
		document.getElementById(id).style.display = 'none';
	}else{
		document.getElementById(id).style.display = 'block';
	}
}

//FUNCAO QUE CONTROLA REL CLIENTE DADOS  CAMPOS INATIVOS--------------------------------------
function DesbloqueiaCampo(cliente, id){
	document.getElementById(id).disabled = false;	
}

//FUNCAO PARA IMPRIMIR O RELATORIO DE CLIENTES INATIVOS---------------------------------------
function RelCliInativos(tempo){
  if(tempo != ""){
  	levaetraz('../relclientesinativos/relclientesinativos.php?tempo='+tempo,'conteudo');
  }else{
	alert('Período Inválido!');  
  }
}

//FUNCAO PARA IMPRIMIR O RELATORIO DE RESUMO DO MES-------------------------------------------
function RelResumoMes(mes, ano){
  if(mes != "" && ano != ""){
  	levaetraz('../relresumomes/relresumomes.php?mes='+mes+"&ano="+ano,'conteudo');
  }else{
	alert('Mês e Ano são Campos Obrigatórios!');  
  }
}


//FUNCAO PARA IMPRIMIR O RELATORIO DE EXTRATO BANCARIO----------------------------------------
function RelExtrato(obj1, obj2, conta){
  //alert('../relcomissao/relcomissao.php?vend='+vend+"&dtinicial="+obj1+"$dtfinal="+obj2,'right');
  //trocamodulo('../relcomissao/relcomissao.php?vend='+vend+"&dtinicial="+obj1+"&dtfinal="+obj2,'right');
  levaetraz('../relextrato/relextrato.php?ctamov='+conta+"&dtinicial="+obj1+"&dtfinal="+obj2,'conteudo');
}

//FUNCAO PARA IMPRIMIR O RELATORIO DE PEDIDOS-------------------------------------------------
function RelPedido(obj1, obj2, cliente, forma_pg, cond_pg, transporte, ctacontabil, vendedor, centrocusto){
  if(obj1 != "" || obj2 != ""){
    levaetraz('../relpedidos/relpedido.php?cliente='+cliente+"&dtinicial="+obj1+"&dtfinal="+obj2+"&forma_pg="+forma_pg+"&cond_pg="+cond_pg+"&transporte="+transporte+"&ctacontabil="+ctacontabil+"&vendedor="+vendedor+"&centrocusto="+centrocusto,'conteudo');
  }
  else{
    alert("Os campos Data inical e Data final são Obrigatorios!");
    document.getElementeById('dtfinal').focus();
  }
}
//--------------------------------------------------------------------------------------------


//FUNCAO PARA IMPRIMIR O RELATORIO DE PEDIDOS PRODUTOS----------------------------------------
function RelPedidosProd(obj1, obj2, item, embalagem){
  if(obj1 != "" || obj2 != ""){
    levaetraz('../relpedidosprod/relpedidosprod.php?item='+item+"&dtinicial="+obj1+"&dtfinal="+obj2+"&embalagem="+embalagem,'conteudo');
  }
  else{
    alert("Os campos Data inical e Data final são Obrigatorios!");
    document.getElementeById('dtfinal').focus();
  }
}
//--------------------------------------------------------------------------------------------

//FUNCAO PARA IMPRIMIR O RELATORIO DE PEDIDOS PRODUTOS----------------------------------------
function RelOrcamentosProd(obj1, obj2, item){
  if(obj1 != "" || obj2 != ""){
    levaetraz('../relorcamentosprod/relorcamentosprod.php?item='+item+"&dtinicial="+obj1+"&dtfinal="+obj2,'conteudo');
  }
  else{
    alert("Os campos Data inical e Data final são Obrigatorios!");
    document.getElementeById('dtfinal').focus();
  }
}
//--------------------------------------------------------------------------------------------

//FUNCAO PARA IMPRIMIR O RELATORIO DE ORCAMENTOS----------------------------------------------
function RelOrcamento(obj1, obj2, cliente, forma_pg, cond_pg, transporte, ctacontabil, vendedor, centrocusto){
  if(obj1 != "" || obj2 != ""){
    levaetraz('../relorc/relorcamento.php?cliente='+cliente+"&dtinicial="+obj1+"&dtfinal="+obj2+"&forma_pg="+forma_pg+"&cond_pg="+cond_pg+"&transporte="+transporte+"&ctacontabil="+ctacontabil+"&vendedor="+vendedor+"&centrocusto="+centrocusto,'conteudo');
  }
  else{
    alert("Os campos Data inical e Data final são Obrigatorios!");
    document.getElementeById('dtfinal').focus();
  }
}
//--------------------------------------------------------------------------------------------


//FUNCAO PARA IMPRIMIR O RELATORIO DE LIMITE DE CREDITO----------------------------------------------
function RelLimiteCredito(obj1, obj2){
  if(obj1 != ""){
    levaetraz('../rellimitecredito/rellimitecredito.php?cliente='+obj1+"&nome="+obj2,'conteudo');
  }
  else{
    alert("CLIENTE é um campo brigatorio!");
    document.getElementeById('cliente').focus();
  }
}
//--------------------------------------------------------------------------------------------



//FUNCAO PARA BLOQUEAR BAIXA DE CTA MOV 10 POR CTA RECEBER-------------------------------------------------
//function VerificaConta(cta, check,campo){
function VerificaConta(valor, campo){
    //alert(campo);
    if(valor == "10"){
        //alert(valor +' - '+ campo);
        document.getElementById(campo).value = "N";
    }
}
