<!--

/***********************************************
* Required field(s) validation v1.10- By NavSurf
* Visit Nav Surf at http://navsurf.com
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function formCheck(formobj){
	// Enter name of mandatory fields
	var fieldRequired = Array("nome", "sobrenome");
	// Enter field description to appear in the dialog box
	var fieldDescription = Array("nome", "sobrenome");
	// dialog message
	var alertMsg = "Please complete the following fields:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}
// -->
/***********************************************
* Email Validation script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i

function checkmail(e){
var returnval=emailfilter.test(e.value)
if (returnval==false){
alert("Por favor, digite um endereço de e-mail válido.")
e.select()
}
return returnval
}

function Valida_Campos() {
	var VerificaData; 
		
	if (document.form1.nome.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.nome.focus(); 
		return(false); 
	}
	 
	if (document.form1.sobrenome.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.sobrenome.focus(); 
		return(false); 
	} 
	
	if (document.form1.endereco.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.endereco.focus(); 
		return(false); 
	} 
	
	if (document.form1.numero.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.numero.focus(); 
		return(false); 
	} 
	
	if (document.form1.cidade.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.cidade.focus(); 
		return(false); 
	} 
	
	if (document.form1.cep.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.cep.focus(); 
		return(false); 
	} 
	
	if (document.form1.bairro.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.bairro.focus(); 
		return(false); 
	} 
	
	if (document.form1.nascimento.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.nascimento.focus(); 
		return(false); 
	} 
	
	if (document.form1.cel.value == "") { 
		if (document.form1.fone.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
			document.form1.fone.focus(); 
			return(false); 
		} 	
	}
	
	if (document.form1.rg.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.rg.focus(); 
		return(false); 
	} 
	
	if (document.form1.cpf.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.cpf.focus(); 
		return(false); 
	} 
	
	if (document.form1.cpf.value != "") {
		var i; 
		s = document.form1.cpf.value; 
		var c = s.substr(0,9); 
		var dv = s.substr(9,2); 
		var d1 = 0; 
		for (i = 0; i < 9; i++)	{ 
			d1 += c.charAt(i)*(10-i); 
		} 
		
		if (d1 == 0) { 
			alert("CPF Invalido") 
			return(false); 
		} 
	
		d1 = 11 - (d1 % 11); 
		
		if (d1 > 9) d1 = 0; 
		
		if (dv.charAt(0) != d1)	{ 
			alert("CPF Invalido") 
			return(false); 
		} 
		
		d1 *= 2; 
		  
		for (i = 0; i < 9; i++) { 
			d1 += c.charAt(i)*(11-i); 
		} 
		
		d1 = 11 - (d1 % 11); 
		  
		if (d1 > 9) d1 = 0; 
		  
		if (dv.charAt(1) != d1)	{ 
			alert("CPF Invalido") 
			return(false); 
		} 
	}
			
	if (document.form1.sexo.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.sexo.focus(); 
		return(false); 
	} 	
	
	if (document.form1.email.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.email.focus(); 
		return(false); 
	} 
	
	if (document.form1.formacao.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.formacao.focus(); 
		return(false); 
	} 

	if (document.form1.ano_graduacao.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.ano_graduacao.focus(); 
		return(false); 
	} 
	
	if (document.form1.profissao.value == "") { 
		alert("O preenchimento de alguns campos é obrigatório ! "); 
		document.form1.profissao.focus(); 
		return(false); 
	} 
	
}
function Tecla(e) {
	if (document.all) // Internet Explorer
		var tecla = event.keyCode;
	else if(document.layers) // Nestcape
		var tecla = e.which;
		if (tecla > 47 && tecla < 58) // numeros de 0 a 9
			return true;
		else
		{
			if (tecla != 8) // backspace
				event.keyCode = 0;
				//return false;
			else
				return true;
		}
}
