<!--
//----|Validar numeros|----//
function Numero(e){
    if (window.event){   	//IE
        tecla = e.keyCode;
    } else if (e.which){ 	//FF
        tecla = e.which;
    }
    //teclas dos numemros(0 - 9) de 48 a 57
    //tecla==8 é para permitir o backspace funcionar para apagar
	//tecla==13 é para permitir o backspace funcionar para apagar
	if ( (tecla >= 48 && tecla <= 57)||(tecla == 8 )||(tecla == 13 ) ) {
		return true;
	}else{
		return false;
	}
}

//----|valida cpf|----//
function Verifica_campo_CPF(campo) {
	//Filtrando para pegar apenas numeros
	cpf=campo.value;
	var num_cpf = '';
	var inti = 0;
	var msg_erro = 'CPF Inválido !!!';
	while (inti < cpf.length){
		if(cpf.charAt(inti)=='0'||cpf.charAt(inti)=='1'||cpf.charAt(inti)=='2'||cpf.charAt(inti)=='3'||cpf.charAt(inti)=='4'||cpf.charAt(inti)=='5'||cpf.charAt(inti)=='6'||cpf.charAt(inti)=='7'||cpf.charAt(inti)=='8'||cpf.charAt(inti)=='9') {
			num_cpf = num_cpf + cpf.charAt(inti);
		}
		inti++;
	}
	//Preenchendo com zeros a Esquerda se necessario
	//num_cpf = str_pad(num_cpf, 11, '0', 'STR_PAD_LEFT');

	//Validando o CPF
	if(num_cpf=='00000000000'||num_cpf=='11111111111'||num_cpf=='22222222222'||num_cpf=='33333333333'||num_cpf=='44444444444'||num_cpf=='55555555555'||num_cpf=='66666666666'||num_cpf=='77777777777'||	num_cpf=='88888888888'||num_cpf=='99999999999' ){
		alert(msg_erro);
		return false;
	}

	//Calculando o Digito
	for (t=9;t<11;t++) {
		for ( d=0,c=0; c<t ;c++ ) {
			d += num_cpf.charAt(c)*((t+1)- c);
		}
		d=((10 * d)%11)%10;
		
		//Validando o digito
		if (num_cpf.charAt(c)!=d) {
			alert(msg_erro);
			return false;
		}
	}
	return true;
}


function validaform(form1) {
	if( (document.getElementById("email").value=='')&&(document.getElementById("cpf").value=='')&&(document.getElementById("codigo").value=='') ) {
		alert('ATENÇAO!\nDigite um E-Mail ou um CPF ou um Código de Certificado para o acesso.');
		return false;
	}else if (document.getElementById("email").value!='') {
		//Validando o E-Mail
		str = document.getElementById("email").value;
		var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
		if((!filter.test(str))&&(document.getElementById("email").value!="")){
		  alert("O endereço de e-mail digitado nao é válido!");
		  return false;
		}else{
		  return true;
		}
	}else if (document.getElementById("cpf").value!='') {
		return Verifica_campo_CPF(document.getElementById("cpf"));
	}
	return true;
}
//-->