function chamar_cep()
{
  window.open("consulta_cep.html","chamar_cep","resizable=no,scrollbars=no,location=no,top=20,left=20,width=355,height=320")
}
  function aviso_iframe(msg)
    {
      document.all['total'].innerHTML=msg
    }
    
  function janela(URL,w,h)
    {
      window.open(URL,"popup","resizable=no,scrollbars=yes,location=no,top=20,left=20,width="+w+",height="+h)
    }
    
  function clikker(block,arrow)
    {
      if (block.style.display =='') 
         {
           block.style.display = 'none'
         }
      else 
         {
           block.style.display='';
         }
    }

  function calculadora()
    {
      window.open("calculadora.html","calculadora","resizable=no,scrollbars=no,location=no,top=20,left=20,width=190,height=160")
    }

  function aviso(msg)
    {
      document.all['aviso'].innerHTML=msg
    }

  function todos()
    {
      for (i=0; i<document.form1.length; i++)
         if(document.form1.elements[i].type == "checkbox")
            if (document.form1.selecionar.checked)
               {
               if (document.form1.elements[i].name=='deletar')
                  document.form1.elements[i].checked = true;
               }
            else
               {
               if (document.form1.elements[i].name=='deletar')
                  document.form1.elements[i].checked = false;
               }
    }
    
    
  function todos2()
    {
      for (i=0; i<document.form1.length; i++)
         if(document.form1.elements[i].type == "checkbox")
            if (document.form1.selecionar2.checked)
               {
               if (document.form1.elements[i].name=='deletar2')
                  document.form1.elements[i].checked = true;
               }
            else
               {
               if (document.form1.elements[i].name=='deletar2')
                  document.form1.elements[i].checked = false;
               }
    }

  function imprimir_personalizado()
    {
    	var objetos
    	objetos="0"
       if (document.form1.boleto_selecao[0].checked == true)
          {
             for (i=0; i<document.form1.deletar.length; i++)
                {
                   if (document.form1.deletar[i].checked == true)
                   objetos=objetos+","+document.form1.deletar[i].value;
                }
             janela('Boleto'+document.form1.banco_nome.value+'.asp?codigos='+objetos,710,600);
          }
       if (document.form1.boleto_selecao[1].checked == true)
          janela('Boleto'+document.form1.banco_nome.value+'.asp?codigos=0',710,600);
    }
  function submeter()
    {
      document.form1.submit();
    }

  
  function submeter2()
    { 
      var codigos=0
      for (i=0; i<document.form1.length; i++)
        {
          if (document.form1.elements[i].checked)
             var codigos=codigos+','+document.form1.elements[i].value;
        }
      parent.location.href="imprimir_etiquetas.asp?codigo="+codigos
    }

  function confirma(valor,acao) 
    {
      if (confirm("Tem certeza que deseja "+acao+"ativar o(s) registro(s) selecionado(s)?")==true)
         {
         for (i=0; i<document.form1.length; i++)
            if (document.form1.elements[i].value==valor)
               document.form1.elements[i].checked = true;
         submeter()
        }
    }
    
  function confirma2(valor,acao) 
    {
      if (confirm("Tem certeza que deseja "+acao+"ativar o(s) registro(s) selecionado(s)?")==true)
         {
         location.href=valor
        }
    }

  function Numero() 
    { 
      if (event.keyCode == '13') 
         {} 
      else if (event.keyCode < '48' || event.keyCode > '58') 
         {
           event.keyCode = '127'; 
         } 
    } 
 function Moeda(obj)
  {
   var objeto,valor,valor2,formatado
   valor=""
   valor2=""
   formatado=""
   obj.value=obj.value.replace(",","")
   obj.value=obj.value.replace(".","")
   obj.value=obj.value.replace(".","")
   obj.value=obj.value.replace(".","")
   objeto=obj.value.substr(0,obj.value.length-2)
   if (obj.value.length >= 6)
     {
       for (i=1;i<=objeto.length;i++)
         {
           if ((i-1)%3==0 && i!=1)
              {
                valor="."+objeto.substr(objeto.length-i+1,3)+valor;
                valor2=objeto.substr(0,objeto.length-i+1);
                formatado=valor2+valor;
              }
         }
      obj.value=formatado+obj.value.substr(obj.value.length-2,obj.value.length)
     }
   if(obj.value.length >= 3)
      obj.value = obj.value.substr(0,obj.value.length-2)+","+obj.value.substr(obj.value.length-2,obj.value.length);
  }
  
  
  function Moeda2(obj)
  {
   var objeto,valor,valor2,formatado
   valor=""
   valor2=""
   formatado=""
   obj.value=obj.value.replace(",","")
   obj.value=obj.value.replace(".","")
   obj.value=obj.value.replace(".","")
   obj.value=obj.value.replace(".","")
   objeto=obj.value.substr(0,obj.value.length-4)
   if (obj.value.length >= 8)
     {
       for (i=1;i<=objeto.length;i++)
         {
           if ((i-1)%3==0 && i!=1)
              {
                valor="."+objeto.substr(objeto.length-i+1,3)+valor;
                valor2=objeto.substr(0,objeto.length-i+1);
                formatado=valor2+valor;
              }
         }
      obj.value=formatado+obj.value.substr(obj.value.length-4,obj.value.length)
     }
   if(obj.value.length >= 5)
      obj.value = obj.value.substr(0,obj.value.length-4)+","+obj.value.substr(obj.value.length-4,obj.value.length);
  }

function CEP(obj)
  {
   if(obj.value.length == 2)
      obj.value = obj.value+".";
   if(obj.value.length == 6)
      obj.value = obj.value+"-";
  }
  
function CPF(obj)
  {
   if(obj.value.length == 3)
      obj.value = obj.value+".";
   if(obj.value.length == 7)
      obj.value = obj.value+".";
   if(obj.value.length == 11)
      obj.value = obj.value+"-";
  }
  
function DATA(obj)
  {
   if(obj.value.length == 2)
      obj.value = obj.value+"/";
   if(obj.value.length == 5)
      obj.value = obj.value+"/";
  }
function HORA(obj){
  if(obj.value.length==2)
    obj.value = obj.value+":";  	
}
function Contrato(obj){
   if(obj.value.length == 4)
      obj.value = obj.value+".";
   if(obj.value.length == 12)
      obj.value = obj.value+".";
   if(obj.value.length == 15)
      obj.value = obj.value+".";	
}

function COMPETENCIA(obj){
   if(obj.value.length == 2)
      obj.value = obj.value+"/";	
}
