	window.status="Vale Sul"

function toggleColor(objElement)
{
  if (objElement.className=='normal')
    objElement.className='focus';
  else
    objElement.className='normal';
}



//Valida Login e Senha
function validar_cpf_senha(Form) 
 {
	 
   if ( document.form1.cpf.value.length <= 13 )
      { 
	  	alert( "Informe o CPF...")
    	document.form1.cpf.focus() 
	    return false 
      }

   if ( document.form1.cpf.value.length > 13 )
	{

   		var cpf = document.form1.cpf.value;
	    var filtro = /^\d{3}.\d{3}.\d{3}-\d{2}$/i;
   		if(!filtro.test(cpf))
		  {
     		window.alert("CPF inválido. Tente novamente.");
   	 		document.form1.cpf.focus(); 
	 		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.");
   	  		document.form1.cpf.focus(); 
	  		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.");
	   	    document.form1.cpf.focus(); 
	 	    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.");
   	 		document.form1.cpf.focus(); 
			return false;
		  }
	}

	if ( document.form1.senha.value.length <= 5 )
	  { alert( "Informe a Senha...")
		document.form1.senha.focus() 
		return false 
	  }

	return true;

}
 
 

//Valida pop_up
function validar_pop_up(Form) 
 {
	 
   if ( document.form1.cpf.value.length <= 13 )
      { 
	  	alert( "Informe o CPF...")
    	document.form1.cpf.focus() 
	    return false 
      }

   if ( document.form1.cpf.value.length > 13 )
	{

   		var cpf = document.form1.cpf.value;
	    var filtro = /^\d{3}.\d{3}.\d{3}-\d{2}$/i;
   		if(!filtro.test(cpf))
		  {
     		window.alert("CPF inválido. Tente novamente.");
   	 		document.form1.cpf.focus(); 
	 		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.");
   	  		document.form1.cpf.focus(); 
	  		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.");
	   	    document.form1.cpf.focus(); 
	 	    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.");
   	 		document.form1.cpf.focus(); 
			return false;
		  }

		return true;
	}
 }
 
 
 
 
 //Valida pop_up Esqueci Senha
function validar_pop_up_esqueci_senha(Form) 
 {
	 
   if ( document.form1.cpf.value.length <= 13 )
      { 
	  	alert( "Informe o CPF...")
    	document.form1.cpf.focus() 
	    return false 
      }

   if ( document.form1.cpf.value.length > 13 )
	{

   		var cpf = document.form1.cpf.value;
	    var filtro = /^\d{3}.\d{3}.\d{3}-\d{2}$/i;
   		if(!filtro.test(cpf))
		  {
     		window.alert("CPF inválido. Tente novamente.");
   	 		document.form1.cpf.focus(); 
	 		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.");
   	  		document.form1.cpf.focus(); 
	  		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.");
	   	    document.form1.cpf.focus(); 
	 	    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.");
   	 		document.form1.cpf.focus(); 
			return false;
		  }

	}
	

if ( document.form1.E_mail.value.length <= 3 )
      { alert( "Informe o E-mail")
    	document.form1.E_mail.focus() 
	    return false 
	  }

//Valida e-mail se estiver preenchido
	if (document.form1.E_mail.value != "")
	{
		prim = document.form1.E_mail.value.indexOf("@")
		if(prim < 2) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("@",prim + 1) != -1) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf(".") < 1) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf(" ") != -1) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("zipmeil.com") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("hotmeil.com") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf(".@") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("@.") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf(".com.br.") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("/") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("[") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("]") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("(") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf(")") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("..") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
	return true;
	}
}
 
 
 
 
function validar_tela_01(Form) 
//valida tela dos dados pessoais
 {

   if ( document.form1.nome.value.length <= 3 )
      { alert( "Informe seu Nome...")
    	document.form1.nome.focus() 
	    return false }

   if ( document.form1.data_nascimento.value.length <= 9 )
      { alert( "Informe a Data de Nascimento...")
    	document.form1.data_nascimento.focus() 
	    return false }
		
   if (document.form1.estado_civil.selectedIndex == 0) 
    { alert('Informe o Estado Civil...');
	  document.form1.estado_civil.focus()
      return false;
	}

   if ( document.form1.logradouro.value.length <= 3 )
      { alert( "Informe seu Endereço...")
    	document.form1.logradouro.focus() 
	    return false }


  if ( document.form1.bairro.value.length <= 3 )
      { alert( "Informe o Bairro...")
    	document.form1.bairro.focus() 
	    return false }

  if ( document.form1.cep.value.length <= 8 )
      { alert( "Informe o Cep...")
    	document.form1.cep.focus() 
	    return false }

  if ( document.form1.cidade.value.length <= 3 )
      { alert( "Informe a Cidade...")
    	document.form1.cidade.focus() 
	    return false }

   if (document.form1.uf.selectedIndex == 0) 
    { alert('Informe a UF...');
	  document.form1.uf.focus()
      return false;
	}

  if ( document.form1.pai.value.length <= 3 )
      { alert( "Informe o nome do Pai...")
    	document.form1.pai.focus() 
	    return false }

  if ( document.form1.mae.value.length <= 3 )
      { alert( "Informe o nome da Mãe...")
    	document.form1.mae.focus() 
	    return false }

  if ( document.form1.telefone.value.length <= 12 )
      { alert( "Informe o Telefone...\n Formato: (xx) xxxx-xxxx")
    	document.form1.telefone.focus() 
	    return false 
	  }


  if ( document.form1.E_mail.value.length <= 3 )
      { alert( "Informe o E-mail")
    	document.form1.E_mail.focus() 
	    return false 
	  }


//Valida e-mail se estiver preenchido
	if (document.form1.E_mail.value != "")
	{
		prim = document.form1.E_mail.value.indexOf("@")
		if(prim < 2) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("@",prim + 1) != -1) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf(".") < 1) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf(" ") != -1) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("zipmeil.com") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("hotmeil.com") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf(".@") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("@.") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf(".com.br.") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("/") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("[") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("]") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("(") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf(")") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
		if(document.form1.E_mail.value.indexOf("..") > 0) {
			alert("O e-mail informado parece não estar correto.");
			document.form1.E_mail.focus();
			document.form1.E_mail.select();
			return false;
		}
	


  if ( document.form1.rg.value.length <= 3 )
      { alert( "Informe a seu Registro Geral...")
    	document.form1.rg.focus(); 
	    return false;
	  }

  if ( document.form1.rg_orgao.value.length <= 0 )
      { alert( "Informe o Orgão Expedidor...")
    	document.form1.rg_orgao.focus(); 
	    return false;
	  }

  if ( document.form1.rg_emissao.value.length <= 9 )
      { alert( "Informe a Data de Expedição...")
    	document.form1.rg_emissao.focus(); 
	    return false;
	  }


// se o usuário preencher alguns desses campos ele terá que preencher todos referente e Habilitação
	if ( document.form1.carteira_habilitacao.value != "" || document.form1.carteira_habilitacao_categoria.value != "" || 
 		 document.form1.carteira_habilitacao_emissao.value != "" || document.form1.carteira_habilitacao_primeira_hab.value != "" || 
		 document.form1.carteira_habilitacao_validade.value != "" )
		 {
			 
			   if ( document.form1.carteira_habilitacao.value.length <= 0 )
      			{ alert( "Informe sua Carteira de Habilitação...")
		    	  document.form1.carteira_habilitacao.focus(); 
			      return false;
				}

			   if ( document.form1.carteira_habilitacao_categoria.value.length <= 0 )
      			{ alert( "Informe a Categoria da sua Carteira de Habilitação...")
		    	  document.form1.carteira_habilitacao_categoria.focus(); 
			      return false;
				}

			   if ( document.form1.carteira_habilitacao_emissao.value.length <= 9 )
      			{ alert( "Informe a Data de Emissão da sua Carteira de Habilitação...")
		    	  document.form1.carteira_habilitacao_emissao.focus(); 
			      return false;
				}

			   if ( document.form1.carteira_habilitacao_primeira_hab.value.length <= 9 )
      			{ alert( "Informe a Data da Primeira Habilitação...")
		    	  document.form1.carteira_habilitacao_primeira_hab.focus(); 
			      return false;
				}

			   if ( document.form1.carteira_habilitacao_validade.value.length <= 9 )
      			{ alert( "Informe a Data de Validade da sua Carteira de Habilitação...")
		    	  document.form1.carteira_habilitacao_validade.focus(); 
			      return false;
				}

		 }

   if (document.form1.possui_carro.selectedIndex == 0) 
    { alert('Você possui Carro...');
	  document.form1.possui_carro.focus()
      return false;
	}


   if (document.form1.possui_carro.selectedIndex == 1) 
    { 
	
   		if (document.form1.carro_pode_ser_usado.selectedIndex == 0) 
    		{ alert('Seu Carro pode ser usado para Trabalho...');
	  		document.form1.carro_pode_ser_usado.focus()
      		return false;
			}
	}

		return true;
	}
 }
 
 
  function validar_tela_02(Form) 
//valida tela de Escolaridade
 {


   if (document.form1.grau_escolaridade_01.selectedIndex == 0) 
    { alert( "Informe seu Grau de Escolaridade...")
	  document.form1.grau_escolaridade_01.focus()
      return false;
	}


	if ( document.form1.curso_01.value.length <= 2 )
      { alert( "Informe o Nome do Curso...")
    	document.form1.curso_01.focus() 
	    return false 
	  }

	if ( document.form1.instituicao_01.value.length <= 2 )
      { alert( "Informe o Nome do Instituição...")
    	document.form1.instituicao_01.focus() 
	    return false 
	  }


	// se o usuário preencher alguns desses campos ele terá que preencher todos referente ao Segundo Grau de Escolaridade
	if ( document.form1.grau_escolaridade_02.selectedIndex != 0 || document.form1.curso_02.value != "" || 
 		 document.form1.instituicao_02.value != "" )
		 {
			 
			   if (document.form1.grau_escolaridade_02.selectedIndex == 0) 
			    { alert( "Informe seu Grau de Escolaridade...")
				  document.form1.grau_escolaridade_02.focus()
			      return false;
				}

				if ( document.form1.curso_02.value.length <= 2 )
			      { alert( "Informe o Nome do Curso...")
			    	document.form1.curso_02.focus() 
				    return false 
				  }

				if ( document.form1.instituicao_02.value.length <= 2 )
			      { alert( "Informe o Nome do Instituição...")
			    	document.form1.instituicao_02.focus() 
				    return false 
				  }

		 }

}


 
 
 function validar_tela_03(Form) 
//valida tela de Escolaridade & Informções Gerais
 {

   if (document.form1.situacao_atual.selectedIndex == 0) 
    { alert('Informe sua Situação Atual...');
	  document.form1.situacao_atual.focus()
      return false;
	}

   if (document.form1.area_interesse.selectedIndex == 0) 
    { alert('Informe seu Área de Interesse...');
	  document.form1.area_interesse.focus()
      return false;
	}
	
	// se o usuário preencher alguns desses campos ele terá que preencher todos referente a Experiencia Profissional
	if ( document.form1.data_entrada_emprego_01.value != "" || document.form1.data_saida_emprego_01.value != "" 
		|| document.form1.nome_empresa_01.value != "" || document.form1.telefone_empresa_01.value != "" 
		|| document.form1.cargo_01.value != "" 	|| document.form1.chefe_01.value != "" 	|| document.form1.atribuicao_01.value != "" )
		 {
			 
				if ( document.form1.data_entrada_emprego_01.value.length <= 9 )
			      { alert( "Informe a Data de Entrada na Empresa...")
			    	document.form1.data_entrada_emprego_01.focus() 
				    return false 
				  }

				if ( document.form1.nome_empresa_01.value.length <= 3 )
			      { alert( "Informe o Nome da Empresa...")
			    	document.form1.nome_empresa_01.focus() 
				    return false 
				  }

				if ( document.form1.telefone_empresa_01.value.length <= 12 )
      			  { alert( "Informe o Telefone...\n Formato: (xx) xxxx-xxxx")
    				document.form1.telefone_empresa_01.focus() 
	    			return false 
	  			  }

				if ( document.form1.cargo_01.value.length <= 3 )
			      { alert( "Informe seu cargo na Empresa...")
			    	document.form1.cargo_01.focus() 
				    return false 
				  }

				if ( document.form1.chefe_01.value.length <= 3 )
			      { alert( "Informe o Nome do seu Chefe Imediato...")
			    	document.form1.chefe_01.focus() 
				    return false 
				  }

				if ( document.form1.atribuicao_01.value.length <= 3 )
			      { alert( "Informe as Atribuições / Realizações do seu Cargo...")
			    	document.form1.atribuicao_01.focus() 
				    return false 
				  }

		 }
		
 }



 function validar_tela_04(Form) 
//valida tela de Senha
 {

	if ( document.form1.senha_01.value.length <= 5 )
	  { alert( "Informe a Senha...")
		document.form1.senha_01.focus() 
		return false 
	  }

	if ( document.form1.senha_02.value.length <= 5 )
	  { alert( "Confirma a Senha...")
		document.form1.senha_02.focus() 
		return false 
	  }


	if ( document.form1.senha_01.value.length >= 6 &&  document.form1.senha_02.value.length >= 6)
	  {

				if ( document.form1.senha_01.value != document.form1.senha_02.value)
				  { alert( "A Senha não confere...")
					document.form1.senha_01.focus() 
					return false 
				  }
		  
	  }
		
 }


/////////////////////////////////////////////////////////////// Segurança de Senha em %

var numeros="0123456789";
var letras="abcdefghyjklmnñopqrstuvwxyz";
var letras_maiusculas="ABCDEFGHYJKLMNÑOPQRSTUVWXYZ";

function tem_numeros(texto){
   for(i=0; i<texto.length; i++){
      if (numeros.indexOf(texto.charAt(i),0)!=-1){
         return 1;
      }
   }
   return 0;
} 

function tem_letras(texto){
   texto = texto.toLowerCase();
   for(i=0; i<texto.length; i++){
      if (letras.indexOf(texto.charAt(i),0)!=-1){
         return 1;
      }
   }
   return 0;
} 

function tem_minusculas(texto){
   for(i=0; i<texto.length; i++){
      if (letras.indexOf(texto.charAt(i),0)!=-1){
         return 1;
      }
   }
   return 0;
} 

function tem_maiusculas(texto){
   for(i=0; i<texto.length; i++){
      if (letras_maiusculas.indexOf(texto.charAt(i),0)!=-1){
         return 1;
      }
   }
   return 0;
} 

function seguranca_senha(senha_01){
	var seguranca = 0;
	if (senha_01.length!=0){
		if (tem_numeros(senha_01) && tem_letras(senha_01)){
			seguranca += 30;
		}
		if (tem_minusculas(senha_01) && tem_maiusculas(senha_01)){
			seguranca += 30;
		}
		if (senha_01.length >= 4 && senha_01.length <= 5){
			seguranca += 10;
		}else{
			if (senha_01.length >= 6 && senha_01.length <= 8){
				seguranca += 30;
			}else{
				if (senha_01.length > 8){
					seguranca += 40;
				}
			}
		}
	}
	return seguranca				
}	

function mostra_seguranca_senha(senha_01,formulario){
	seguranca=seguranca_senha(senha_01);
	formulario.seguranca.value=seguranca + "%";
}

/////////////////////////////////////////////////////////////// Fim Segurança de Senha
 
 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 Transforma_Minuscula(Texto)
 {
  var minuscula = Texto.value.toLowerCase()
  Texto.value = minuscula
 }
 
 
 function Transforma_Maiuscula(Texto)
 {
  var maiuscula = Texto.value.toUpperCase()
  Texto.value = maiuscula
 }

function validaNumero()
 {
  var tecla = window.event.keyCode;
   if ((tecla != 8 ) && (tecla !=46) && (tecla !=13) && (tecla !=9))  //codigo da tabela ASCII Backspace=8 delete=46  enter=13 tab=9
    { if ((tecla < 48 ) || (tecla > 57))
       { if ((tecla < 96 ) || (tecla > 105))
          { event.returnValue = false; }
       }
    }
 } 

function FormataCNPJ_mascara(Campo, teclapres){

   if(window.event){
    var tecla = teclapres.keyCode;
   }else  tecla = teclapres.which;

   var vr = new String(Campo.value);
   vr = vr.replace(".", "");
   vr = vr.replace(".", "");
   vr = vr.replace("/", "");
   vr = vr.replace("-", "");

   tam = vr.length + 1;

   
   if (tecla != 9 && tecla != 8){
      if (tam > 2 && tam < 6)
         Campo.value = vr.substr(0, 2) + '.' + vr.substr(2, tam);
      if (tam >= 6 && tam < 9)
         Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,tam-5);
      if (tam >= 9 && tam < 13)
         Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,tam-8);
      if (tam >= 13 && tam < 15)
         Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,4)+ '-' + vr.substr(12,tam-12);
      }
}



// Máscara de CNPJ, CPF, Data e Telefone em JavaScript
// <input name="cpf" type="text" maxlength="14" onKeyPress="Mascara('CPF',this,event);"> 
function Mascara(tipo, campo, teclaPress) {
	if (window.event)
	{
		var tecla = teclaPress.keyCode;
	} else {
		tecla = teclaPress.which;
	}
 
	var s = new String(campo.value);
	// Remove todos os caracteres à seguir: ( ) / - . e espaço, para tratar a string denovo.
	s = s.replace(/(\.|\(|\)|\/|\-| )+/g,'');
 
	tam = s.length + 1;
 
	if ( tecla != 9 && tecla != 8 ) {
		switch (tipo)
		{
		case 'CPF' :
			if (tam > 3 && tam < 7)
				campo.value = s.substr(0,3) + '.' + s.substr(3, tam);
			if (tam >= 7 && tam < 10)
				campo.value = s.substr(0,3) + '.' + s.substr(3,3) + '.' + s.substr(6,tam-6);
			if (tam >= 10 && tam < 12)
				campo.value = s.substr(0,3) + '.' + s.substr(3,3) + '.' + s.substr(6,3) + '-' + s.substr(9,tam-9);
		break;
 
		case 'CNPJ' :
 
			if (tam > 2 && tam < 6)
				campo.value = s.substr(0,2) + '.' + s.substr(2, tam);
			if (tam >= 6 && tam < 9)
				campo.value = s.substr(0,2) + '.' + s.substr(2,3) + '.' + s.substr(5,tam-5);
			if (tam >= 9 && tam < 13)
				campo.value = s.substr(0,2) + '.' + s.substr(2,3) + '.' + s.substr(5,3) + '/' + s.substr(8,tam-8);
			if (tam >= 13 && tam < 15)
				campo.value = s.substr(0,2) + '.' + s.substr(2,3) + '.' + s.substr(5,3) + '/' + s.substr(8,4)+ '-' + s.substr(12,tam-12);
		break;
 
		case 'TEL' :
			if (tam > 2 && tam < 4)
				campo.value = '(' + s.substr(0,2) + ') ' + s.substr(2,tam);
			if (tam >= 7 && tam < 11)
				campo.value = '(' + s.substr(0,2) + ') ' + s.substr(2,4) + '-' + s.substr(6,tam-6);
		break;
 
		case 'DATA' :
			if (tam > 2 && tam < 4)
				campo.value = s.substr(0,2) + '/' + s.substr(2, tam);
			if (tam > 4 && tam < 11)
				campo.value = s.substr(0,2) + '/' + s.substr(2,2) + '/' + s.substr(4,tam-4);
		break;
		}
	}
}




//valida tel no firefox

function txtBoxFormat(objeto, sMask, evtKeyPress) {
    var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;


if(document.all) { // Internet Explorer
    nTecla = evtKeyPress.keyCode;
} else if(document.layers) { // Nestcape
    nTecla = evtKeyPress.which;
} else {
    nTecla = evtKeyPress.which;
    if (nTecla == 8) {
        return true;
    }
}

    sValue = objeto.value;

    // Limpa todos os caracteres de formatação que
    // já estiverem no campo.
    sValue = sValue.toString().replace( "-", "" );
    sValue = sValue.toString().replace( "-", "" );
    sValue = sValue.toString().replace( ".", "" );
    sValue = sValue.toString().replace( ".", "" );
    sValue = sValue.toString().replace( "/", "" );
    sValue = sValue.toString().replace( "/", "" );
    sValue = sValue.toString().replace( ":", "" );
    sValue = sValue.toString().replace( ":", "" );
    sValue = sValue.toString().replace( "(", "" );
    sValue = sValue.toString().replace( "(", "" );
    sValue = sValue.toString().replace( ")", "" );
    sValue = sValue.toString().replace( ")", "" );
    sValue = sValue.toString().replace( " ", "" );
    sValue = sValue.toString().replace( " ", "" );
    fldLen = sValue.length;
    mskLen = sMask.length;

    i = 0;
    nCount = 0;
    sCod = "";
    mskLen = fldLen;

    while (i <= mskLen) {
      bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ":"))
      bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))

      if (bolMask) {
        sCod += sMask.charAt(i);
        mskLen++; }
      else {
        sCod += sValue.charAt(nCount);
        nCount++;
      }

      i++;
    }

    objeto.value = sCod;

    if (nTecla != 8) { // backspace
      if (sMask.charAt(i-1) == "9") { // apenas números...
        return ((nTecla > 47) && (nTecla < 58)); }
      else { // qualquer caracter...
        return true;
      }
    }
    else {
      return true;
    }
  }


function Formata_Cep(e,src,mask) {
    if(window.event) { _TXT = e.keyCode; } 
    else if(e.which) { _TXT = e.which; }
    if(_TXT > 47 && _TXT < 58) { 
 var i = src.value.length; var saida = mask.substring(0,1); var texto = mask.substring(i)
 if (texto.substring(0,1) != saida) { src.value += texto.substring(0,1); } 
    return true; } else { if (_TXT != 8) { return false; } 
 else { return true; }
    }
}
