function janela2(codigo,pasta,w,h)
{
 window.open("include_foto.asp?codigo="+codigo+"&pasta="+pasta,codigo,"resizable=no,scrollbars=no,location=no,top=20,left=20,width="+w+",height="+h)
}

  function janela(URL,w,h)
    {
      window.open(URL,"popup","resizable=no,scrollbars=no,location=no,top=20,left=20,width="+w+"px,height="+h+"px")
    }

  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 grupos(objeto,grupo)
    {
      for (i=0; i<document.form1.length; i++)
         if(document.form1.elements[i].type == "checkbox" && document.form1.elements[i].id == grupo)
            if (objeto.checked)
               document.form1.elements[i].checked = true
            else
               document.form1.elements[i].checked = false;
    }
    
  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;
         document.form1.submit();
        }
    }
    
  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 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+":";  	
}
