// SISTEMA MOTOBOYNET 
// SISTEMA MOTOBOYNET 
// SISTEMA MOTOBOYNET 
    var hh = 00;
    var mm = 00;
    var ss = 00;
    var IDtesteOK ;
	

var qtd_consulta='';
var Ids_consulta=''; 
	
function insert_br(text)
{
var normalized_Enters = text.replace(/\r|\n/g, "\r\n");
var text_with_br = normalized_Enters.replace(/\r\n/g, "!@34783233#");
var text_with_br1 = text_with_br.replace(/!@34783233#!@34783233#/g, "<br/>");
return text_with_br1;
}


function dahjjahspo(valor){
	if(valor==13){
		funcaohhGGsggs()
	}
}
	
	
function funcaohhGGsggs(){
	document.getElementById('Upload_Senha_msg').style.display  ='inline';
	ajaxGet('codigos.asp?local=D&A=' + document.getElementById('login').value + '&B=' + document.getElementById('senha').value + '&C=' + IDtesteOK, 'Upload_Senha_msg');
	document.getElementById('login').value='';
	document.getElementById('senha').value='';
	document.getElementById('HomeAreaRestritaSenha_IDsenha').innerHTML  ='';
}	
	
function funcaoYBcxvazoqsS31(){
    var campo = new Array;
    campo[0] = document.getElementById('inst_Campo0');
    campo[1] = document.getElementById('inst_Campo1');
    campo[2] = document.getElementById('inst_Campo2');
    campo[3] = document.getElementById('inst_Campo3');
    campo[4] = document.getElementById('inst_Campo4');
    campo[5] = document.getElementById('inst_Campo5');
    campo[6] = document.getElementById('inst_Campo6');
    campo[7] = document.getElementById('inst_Campo7');
	

	
	for(var i = 0; i < 8; i++)
    {		
       if(campo[i].value == '')
        {
            alert('Favor preencher TODOS os campos');
			document.getElementById('inst_div_senha').style.display  = 'none';
            return false;
        }
    }
	
	var txt_str;
	txt_str='';
   	for(var i = 0; i < 8; i++)
    {	
		txt_str =  txt_str + i + '=' + campo[i].value + '&';
	}
//	alert(txt_str);
	document.getElementById('inst_div_senha').style.display  = 'inline';
	ajaxGet('codigos.asp?local=X&' + txt_str, 'inst_div_senha');
}

function BoletoAvulsoInclusao(){
if(document.getElementById('boletoAvulso_clienteID').value=="0") {
	alert('Cliente em branco !!!');
	return false;
}
if(document.getElementById('boletoAvulso_DataVencimento').value=="") {
	alert('Data de Vencimento em branco !!!');
	return false;
}
if(document.getElementById('boletoAvulso_Valor').value=="") {
	alert('Valor do boleto em branco !!!');
	return false;
}
msg = 'Confirma a inclusão do boleto avulso ???';
if(confirm(msg))
{	
    var campo = new Array;
    campo[0] = document.getElementById('boletoAvulso_clienteID');
    campo[1] = document.getElementById('boletoAvulso_DataVencimento');
    campo[2] = document.getElementById('boletoAvulso_Valor');
    campo[3] = document.getElementById('boletoAvulso_ob1');
    campo[4] = document.getElementById('boletoAvulso_ob2');
    campo[5] = document.getElementById('boletoAvulso_ob3');
    campo[6] = document.getElementById('boletoAvulso_ob4');
    campo[7] = document.getElementById('boletoAvulso_ob5');
    campo[8] = document.getElementById('boletoAvulso_inst1');
    campo[9] = document.getElementById('boletoAvulso_inst2');
    campo[10] = document.getElementById('boletoAvulso_inst3');
    campo[11] = document.getElementById('boletoAvulso_inst4');
    campo[12] = document.getElementById('boletoAvulso_inst5');

	var txt_str;
	txt_str='';
   	for(var i = 0; i < 13; i++)
    {	
		txt_str =  txt_str + i + '=' + campo[i].value + '&';
	}
//	alert('codigos.asp?local=S&' + txt_str);
	ajaxGet('codigos.asp?local=U&' + txt_str, 'DIVboletoAvulsoNovo');

}

}




	
function salvarBaixaManual(ID){
if(document.getElementById('BaixaManualValorPago').value=="") {
	alert('Valor em branco !!!');
	return false;
}
if(document.getElementById('BaixaManualDataPagamento').value=="") {
	alert('Data em branco !!!');
	return false;
}
if(document.getElementById('BaixaManualBaixaManualDescricao').value=="") {
	alert('Data de DESCRICAO em branco !!!');
	return false;
}

msg = 'Confirma o pagamento MANUAL ???';
if(confirm(msg))
{	
    var campo = new Array;
    campo[0] = document.getElementById('BaixaManualValorPago');
    campo[1] = document.getElementById('BaixaManualDataPagamento');
    campo[2] = document.getElementById('BaixaManualBaixaManualDescricao');
    campo[3] = document.getElementById('BaixaManualNumBoleto');

	var txt_str;
	txt_str='';
	txt_str='ID=' + ID + '&';
   	for(var i = 0; i < 4; i++)
    {	
		txt_str =  txt_str + i + '=' + campo[i].value + '&';
	}
//	alert('codigos.asp?local=S&' + txt_str);
	ajaxGet('codigos.asp?local=T&' + txt_str, 'DIVBaixaManualID');

}

}

function salvarLanca3Ee23(){
if(document.getElementById('Editar_DataVencimento').value=="") {
	alert('Data de vencimento em branco !!!');
	return false;
}
ajaxGet('codigos.asp?local=R&a=' + document.getElementById('Editar_DataVencimento').value + '&b=' + document.getElementById('Editar_ID').value, 'DIVeditarLancamento');
}


function f3VvV99I(){
if(document.getElementById('NovaContraSenha').value=="") {
	alert('Nova contra-senha em branco !!!');
	return false;
	}
if(document.getElementById('clienteID').value=="0") {
	alert('Cliente nao foi selecionado !!!');
	return false;
}
msg = 'Confirma a inclusão da contra-senha ' + document.getElementById('NovaContraSenha').value + '???' ;
if(confirm(msg))	{	
	ajaxGet('codigos.asp?local=K&0=' + document.getElementById('clienteID').value + '&1=' + document.getElementById('NovaContraSenha').value, 'DIVmanutencaoCliente');
}
}

function funcaorWPLll1S(){
    var campo = new Array;
    campo[0] = document.getElementById('Login');
    campo[1] = document.getElementById('Senha');
    campo[2] = document.getElementById('SenhaConfirma');
	

	
	for(var i = 0; i < 3; i++)
    {		
        if(campo[i].value == "")
        {
  //          campo[i].focus();
            alert('Favor preencher TODOS os campos');
            return false;
        }
    }
	
	if (document.getElementById('SenhaConfirma').value==document.getElementById('Senha').value)
	{
	}
	else
	{
	alert("O campo Senha de Confirmação nao é a mesmo que o campo Senha")
	document.getElementById('senha').focus();
	return false
	}

	
	var txt_str;
	txt_str='';
   	for(var i = 0; i < 3; i++)
    {	
		txt_str =  txt_str + i + '=' + campo[i].value + '&';
	}
	ajaxGet('codigos.asp?local=J&' + txt_str, 'DivMsgSenha');
}


	
function trocar_imagem(obj,valor,esconder)
{
    var Id = document.getElementById(obj).style;
	if (esconder == 'sim')
	{
		Id.display = "none";
		return	
	}

    if (document.getElementById(valor).value == '' || document.getElementById(valor).value == '0')
      {
          Id.display = "inline";      
		  document.getElementById(obj).src= 'path/erro.gif' ;
     }
    else
      {
          Id.display = "inline";      
		  document.getElementById(obj).src= 'path/ok.gif';
     }  
}

	

function funcaoGF43W44w(){
    var campo = new Array;
    campo[0] = document.getElementById('Cre_campo0');
    campo[1] = document.getElementById('Cre_campo1');
    campo[2] = document.getElementById('Cre_campo2');
    campo[3] = document.getElementById('Cre_campo3');
	

	
	for(var i = 0; i < 4; i++)
    {		
        if(campo[i].value == "")
        {
  //          campo[i].focus();
            alert('Favor preencher TODOS os campos');
            return false;
        }
    }
	
	var txt_str;
	txt_str='';
   	for(var i = 0; i < 4; i++)
    {	
		txt_str =  txt_str + i + '=' + campo[i].value + '&';
	}
	ajaxGet('codigos.asp?local=I&' + txt_str, 'DivSenha');
}
function funcao39984566(){
	if(document.getElementById('NovoLotemes').value == ""){
		alert('Favor preencher o campo MES');
    	return false;
	}
	if(document.getElementById('NovoLoteano').value == ""){
		alert('Favor preencher o campo ANO');
    	return false;
	}
    if (confirm('Confirma a INCLUSAO de um novo LOTE')){
//		alert('codigos.asp?local=H&mes=' + document.getElementById('NovoLotemes').value + '&ano=' + document.getElementById('NovoLoteano').value);
		ajaxGet('codigos.asp?local=H&mes=' + document.getElementById('NovoLotemes').value + '&ano=' + document.getElementById('NovoLoteano').value, 'DIVmsgIncluirLote');
	}

}	
	
function esconder_div(divName,txt,imagem)
{
    var divId = document.getElementById(divName).style;
    if (divId.display == "inline")
      {
          divId.display = "none";
		  document.getElementById(txt).className= "texto style34";
		  document.getElementById(imagem).src= 'path/add.gif' ;
     }
    else
      {
          divId.display = "inline";      
		  document.getElementById(txt).className = "texto style44"; 
     	  document.getElementById(imagem).src= 'path/seta_01.gif'
 }  
}
	
	

function DeletarArquivo(arq)
{
   msg = "Deseja realmente excluir o arquivo " + arq;
   if (confirm(msg))
    {
	   msg = "TEM CERTEZA que deseja excluir o arquivo " + arq;
	   if (confirm(msg))
	    {
		ajaxGet('codigos.asp?local=C&DEL=' + arq, 'HomeDetalhe');
		}
    }			     
}


function EnviarEmail()
{
    var campo = new Array;
    campo[0] = document.getElementById('adepto');
    campo[1] = document.getElementById('Nome');
    campo[2] = document.getElementById('Telefone');
    campo[3] = document.getElementById('email');
    campo[4] = document.getElementById('empresa');
    campo[5] = document.getElementById('msg');
    campo[6] = document.getElementById('Conhecer');
	

	
	for(var i = 0; i < 7; i++)
    {		
        if(campo[i].value == "")
        {
  //          campo[i].focus();
            alert('Favor preencher TODOS os campos');
            return false;
        }
    }
	
	if (document.getElementById('email').value.indexOf('@', 0) == -1 || document.getElementById('email').value.indexOf('.', 0) == -1)
	{ 
	alert("E-mail inválido!");
	document.getElementById('email').value='';
	document.getElementById('email').focus();
	return false
	}


	var txt_str;
	txt_str='';
   	for(var i = 0; i < 7; i++)
    {	
		if(i==5){
		txt_str =  txt_str + i + '=' + insert_br(campo[i].value) + '&';
		}else{
		txt_str =  txt_str + i + '=' + campo[i].value + '&';
		}
	}
//	alert('codigos.asp?local=A&' + txt_str);
	ajaxGet('codigos.asp?local=A&' + txt_str, 'Msg_contato');
}

function ContatoLimpar()
{
document.getElementById('Nome').value = '';
document.getElementById('Telefone').value = '';
document.getElementById('email').value = '';
document.getElementById('empresa').value = '';
document.getElementById('msg').value = '';
document.getElementById('Conhecer').value = '';
document.getElementById('Nome').value = '';
}

meuAjax = function (){   
   try{   
        xmlhttp = new XMLHttpRequest(); 
    }catch(ee){   
        try{   
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");   
       }catch(e){   
            try{   
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");   
            }catch(E){   
                xmlhttp = false;   
            }   
        }   
   }   
} 


function funcao984213(ID)
{
    var campo = new Array;
    campo[0] = document.getElementById('Competencia');
    campo[1] = document.getElementById('MostrarLogo');
    campo[2] = document.getElementById('DiaVencimento');
    campo[3] = document.getElementById('DiaVencimentoStatus');
    campo[4] = document.getElementById('Ativado');
    campo[5] = document.getElementById('Valor');
    campo[6] = document.getElementById('ob2');
    campo[7] = document.getElementById('ob3');
    campo[8] = document.getElementById('ob4');
    campo[9] = document.getElementById('ob5');
    campo[10] = document.getElementById('inst4');
    campo[11] = document.getElementById('inst5');
    campo[12] = document.getElementById('Cedente');
    campo[13] = document.getElementById('RazaoSocial');
    campo[14] = document.getElementById('CNPJ');
    campo[15] = document.getElementById('Endereco');
    campo[16] = document.getElementById('Bairro');
    campo[17] = document.getElementById('Cidade');
    campo[18] = document.getElementById('Estado');
    campo[19] = document.getElementById('CEP');
    campo[20] = document.getElementById('Contato');
    campo[21] = document.getElementById('email');


	var txt_str;
	txt_str='';
	txt_str='ID=' + ID + '&';
   	for(var i = 0; i < 22; i++)
    {	
		txt_str =  txt_str + i + '=' + campo[i].value + '&';
	}
//	alert('codigos.asp?local=F&' + txt_str);
	ajaxGet('codigos.asp?local=F&' + txt_str, 'DIVmanutencaoBoletoPadrao');
}



function funcao4eE3jjlh(ID)
{
    var campo = new Array;
    campo[0] = document.getElementById('c_Cedente');
    campo[1] = document.getElementById('c_NomeFantasia');
    campo[2] = document.getElementById('c_RazaoSocial');
    campo[3] = document.getElementById('c_CNPJ');
    campo[4] = document.getElementById('c_Endereco');
    campo[5] = document.getElementById('c_Bairro');
    campo[6] = document.getElementById('c_Cidade');
    campo[7] = document.getElementById('c_Estado');
    campo[8] = document.getElementById('c_CEP');
    campo[9] = document.getElementById('c_Contato');
    campo[10] = document.getElementById('c_email');
    campo[11] = document.getElementById('c_ADM_OP');
    campo[12] = document.getElementById('c_NET');
    campo[13] = document.getElementById('c_bloqueado');
    campo[14] = document.getElementById('C_MostrarLogo');
    campo[15] = document.getElementById('c_LiberaJuros');


	var txt_str;
	txt_str='';
	txt_str='ID=' + ID + '&';
   	for(var i = 0; i < 16; i++)
    {	
		txt_str =  txt_str + i + '=' + campo[i].value + '&';
	}
//	alert('codigos.asp?local=F&' + txt_str);
	ajaxGet('codigos.asp?local=Q&' + txt_str, 'DIVcadastroCliente');
}


function funcao_editar_lan_2122Dy2(DIVdestino)
{
    var campo = new Array;
    campo[0] = document.getElementById('Editar_DataVencimento');
    campo[1] = document.getElementById('Editar_Valor');
    campo[2] = document.getElementById('Editar_ob1');
    campo[3] = document.getElementById('Editar_ob2');
    campo[4] = document.getElementById('Editar_ob3');
    campo[5] = document.getElementById('Editar_ob4');
    campo[6] = document.getElementById('Editar_ob5');
    campo[7] = document.getElementById('Editar_inst1');
    campo[8] = document.getElementById('Editar_inst2');
    campo[9] = document.getElementById('Editar_inst3');
    campo[10] = document.getElementById('Editar_inst4');
    campo[11] = document.getElementById('Editar_inst5');
    campo[12] = document.getElementById('Editar_ID');
    campo[13] = document.getElementById('Editar_FaturamentoGrupoID');
    campo[14] = document.getElementById('Editar_ValorOriginal');
    campo[15] = document.getElementById('Editar_DataVencimentoOriginal');
 


	var txt_str;
	txt_str='';
 	txt_str='destino=' + DIVdestino + '&';
  	for(var i = 0; i < 16; i++)
    {	
		txt_str =  txt_str + i + '=' + campo[i].value + '&';
	}
//	   txt_str =  txt_str.substring(0,(txt_str.length - 1));
//	document.getElementById(DIVdestino).innerHTML ='codigos.asp?local=S&' + txt_str;
	ajaxGet('codigos.asp?local=S&' + txt_str, DIVdestino);
//	alert('codigos.asp?local=S&' + txt_str);
}

function paRe12xz333(ID,boleto,origem)
{
   msg = "Deseja realmente excluir o boleto " + boleto;
   if (confirm(msg))
    {
	   msg = "TEM CERTEZA que deseja excluir o boleto " + boleto;
	   if (confirm(msg))
	    {
		ajaxGet('codigos.asp?local=V&0=' + ID + '&1=' + boleto + '&2=' + origem, 'reload');
		}
    }			     
}



ajaxGet = function( nomeUrl, divRetorno ){ 
	if (divRetorno == 'HomeDetalhe'){
		if (nomeUrl != 'HomeUploadSenha.asp'){
		   document.getElementById(divRetorno).innerHTML = '<br><div align="center"  class="style8" ><img src="path/aguarde.gif" width="32" height="32" vspace="2" /><font face="tahoma" size="2">  Aguarde, Carregando...</font></div><br><br>';
	   }
   }

   divInsereResposta = document.getElementById(divRetorno);   
	
    nomeUrl = antiCacheRand(nomeUrl);
      
    meuAjax();   
    xmlhttp.abort();   
    xmlhttp.open("GET", nomeUrl ,true);   
    xmlhttp.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");   
    xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
	xmlhttp.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
	xmlhttp.setRequestHeader("Pragma", "no-cache");
	
	
    xmlhttp.onreadystatechange = function() {   
           if( xmlhttp.readyState == 4 ){   
                var valorRetorno            = xmlhttp.responseText;   
                divInsereResposta.innerHTML = unescape(valorRetorno);   
					extraiScript(valorRetorno)
           }   
    }   
   
   
    xmlhttp.send( null )   
}  


function extraiScript(texto){

    var ini = 0;
    while (ini!=-1){
        ini = texto.indexOf('<script', ini);
        if (ini >=0){
            ini = texto.indexOf('>', ini) + 1;
            var fim = texto.indexOf('</script>', ini);
            codigo = texto.substring(ini,fim);
            //eval(codigo);
            novo = document.createElement("script")
            novo.text = codigo;
            document.body.appendChild(novo);
        }
    }
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


  function antiCacheRand(aurl){
        var dt = new Date();
        if(aurl.indexOf("?")>=0){// já tem parametros
            return aurl + "&" + encodeURI(Math.random() + "_" + dt.getTime());
        }else{ return aurl + "?" + encodeURI(Math.random() + "_" + dt.getTime());}
    }
	
    function Cronometro(DivRetorno,zerar){
    if(ss >= 60){
    ss = 00;
    mm = mm +1;
    if(mm >= 60){
    mm = 00;
    hh = hh + 1;
    if(hh >= 24){
    hh = 00;
    }}}
    ss = ss + 1;
    if(hh <= 9){
    xhh = "0" + hh;
    }else{
    xhh = hh;
    }
    if(mm <= 9){
    xmm = "0" + mm;
    }else{
    xmm = mm;
    }
    if (ss <= 9){
    xss = "0" + ss;
    }else{
    xss = ss;
    }
    document.getElementById(DivRetorno).innerHTML = xhh + ":" + xmm + ":" + xss ;
    setTimeout("Cronometro(DivRetorno,false)",1000);
    }
	
	
function horas(){

var hora, minuto,segundo,hoje;

hoje = new Date();

hora = hoje.getHours();
if(hora<=9){hora = "0" + hora;}

minuto = hoje.getMinutes();
if(minuto<=9){minuto = "0" + minuto;}

segundo = hoje.getSeconds();
if(segundo<=9){segundo = "0" + segundo;}

document.getElementById('span_relogio').innerHTML = hora + ":" + minuto + ":" + segundo;

setTimeout("horas()",1000);
}


