// JavaScript Document
function digitoVerificador(cpf) {
	erro = new String;
	
	if (cpf.length < 11) {
		//erro += "S&atilde;o necess&aacute;rios 11 d&iacute;gitos para verifica&ccedil;&atilde;o do CPF! \n\n"; 
		erro += "São necess&aacute;rios 11 d&iacute;gitos para verifica&ccedil;&atilde;o do CPF! \n\n"; 
	}
	var nonNumbers = /\D/;
	if (nonNumbers.test(cpf)) {
		erro += "A verifica&ccedil;&atilde;o de CPF suporta apenas n&uacute;meros! \n\n"; 
	}
	if (cpf == "00000000000" || 
		cpf == "11111111111" || 
		cpf == "22222222222" || 
		cpf == "33333333333" || 
		cpf == "44444444444" || 
		cpf == "55555555555" || 
		cpf == "66666666666" || 
		cpf == "77777777777" || 
		cpf == "88888888888" || 
		cpf == "99999999999") {
		erro += "N&uacute;mero Inv&aacute;lido"
	}
	var a = [];
	var b = new Number;
	var c = 11;
	for (i = 0; i < 11; i++) {
		a[i] = cpf.charAt(i);
		if (i < 9) {
			b += (a[i] * --c);
		}
	}
	if ((x = b % 11) < 2) { a[9] = 0 } else { a[9] = 11-x }
	b = 0;
	c = 11;
	for (y=0; y<10; y++) b += (a[y] * c--); 
	if ((x = b % 11) < 2) { a[10] = 0; } else { a[10] = 11-x; }
	if ((cpf.charAt(9) != a[9]) || (cpf.charAt(10) != a[10])) {
		erro += "Número de CPF inválido";
	}
	if (erro.length > 0) {
		alert(erro);
		return false;
	}
	return true;
}

// apenas numero

function Numero(e)
{
	navegador = /msie/i.test(navigator.userAgent);
	if (navegador)
		var tecla = event.keyCode;
	else
		
		var tecla = e.which;
	
	if(tecla > 47 && tecla < 58) // numeros de 0 a 9
		return true;
	else
	{
		if (tecla != 8) // backspace
		return false;
	else
	
		return true;
	}
}

function Validar(frm)
{
var i;
var cont = 0;
var str;
	if(frm.nome.value == "")
	{
		alert("O Campo Nome é obrigatório.")
		frm.nome.focus();
		return false;
	}
	else
	{
		cont = 0;
		str = frm.nome.value;
		for (i = 0; i < str.length; i++)
		{
			if(str.charAt(i) != " ")
			{
				cont = cont + 1; 
			}
		}
		if(cont < 1)
		{
			alert("O Campo Nome é obrigatório.");
			frm.nome.focus();
			return false;		
		}
	}
	if(frm.cpf.value == "11111111111" ||  frm.cpf.value == "111111111-11" || frm.cpf.value == "111.111.111-11")
	{
		alert("CPF invalido.");
		frm.cpf.focus();
		return false;		
	}
	if(frm.cpf.value == "")
	{
		alert("O Campo CPF é obrigatório.");
		frm.cpf.focus();
		return false;		
	}
		else
	{
		cont = 0;
		str = frm.cpf.value;
		for (i = 0; i < str.length ; i++)
		{
			if(str.charAt(i) != " ")
			{
				cont = cont + 1; 
			}
		}
		if(cont < 1)
		{
			alert("O Campo CPF é obrigatório.");
			frm.cpf.focus();
			return false;		
		}
	}
	if(frm.dia_nascimento.options[frm.dia_nascimento.selectedIndex].value == "-")
	{
		alert("O Campo Data de Nascimento é obrigatório.");
		frm.dia_nascimento.focus();
		return false;
	}
	if(frm.mes_nascimento.options[frm.mes_nascimento.selectedIndex].value == "-")
	{
		alert("O Campo Data de Nascimento é obrigatório.");
		frm.mes_nascimento.focus();
		return false;		
	}	
	if(frm.ano_nascimento.options[frm.ano_nascimento.selectedIndex].value == "-")
	{
		alert("O Campo Data de Nascimento é obrigatório.");
		frm.ano_nascimento.focus();
		return false;		
	}		
	if(frm.endereco.value == "")
	{
		alert("O Campo Endereço é obrigatório.");
		frm.endereco.focus();
		return false;		
	}
		else
	{
		cont = 0;
		str = frm.endereco.value;
		for (i = 0; i < str.length ; i++)
		{
			if(str.charAt(i) != " ")
			{
				cont = cont + 1; 
			}
		}
		if(cont < 1)
		{
			alert("O Campo Endereço é obrigatório.");
			frm.endereco.focus();
			return false;		
		}
	}
	if(frm.numero.value == "")
	{
		alert("O Campo Número é obrigatório.");
		frm.numero.focus();
		return false;		
	}
		else
	{

		cont = 0;
		str = frm.numero.value;
		for (i = 0; i < str.length ; i++)
		{
			if(str.charAt(i) != " ")
			{
				cont = cont + 1; 
			}
		}
		if(cont < 1)
		{
			alert("O Campo Número é obrigatório.");
			frm.numero.focus();
			return false;		
		}
	}
	if(frm.complemento.value == "")
	{
		alert("O Campo Complemento é obrigatório.")
		frm.complemento.focus();
		return false;		
	}
		else
	{
		cont = 0;
		str = frm.complemento.value;
		for (i = 0; i < str.length ; i++)
		{
			if(str.charAt(i) != " ")
			{
				cont = cont + 1; 
			}
		}
		if(cont < 1)
		{
			alert("O Campo Complemento é obrigatório.");
			frm.complemento.focus();
			return false;		
		}
	}
	if(frm.bairro.value == "")
	{
		alert("O Campo Bairro é obrigatório.")
		frm.bairro.focus();
		return false;		
	}
		else
	{
		cont = 0;
		str = frm.bairro.value;
		for (i = 0; i < str.length ; i++)
		{
			if(str.charAt(i) != " ")
			{
				cont = cont + 1; 
			}
		}
		if(cont < 1)
		{
			alert("O Campo Bairro é obrigatório.");
			frm.bairro.focus();
			return false;		
		}
	}	
	if(frm.cep.value == "")
	{
		alert("O Campo Cep é obrigatório.");
		frm.cep.focus();
		return false;		
	}
		else
	{
		cont = 0;
		str = frm.cep.value;
		for (i = 0; i < str.length ; i++)
		{
			if(str.charAt(i) != " ")
			{
				cont = cont + 1; 
			}
		}
		if( cont < 8 )
		{
			alert("O Campo Cep é obrigatório. Nâo há necessidade em digitar '.' ou '-'. Apenas números!");
			frm.cep.focus();
			return false;
		}
	}

	if(frm.uf.value == "-")
	{
		alert("O Campo Estado é obrigatório.");
		frm.uf.focus();
		return false;		
	}

	if(frm.cidade.value == "")
	{
		alert("O Campo Cidade é obrigatório.");
		frm.cidade.focus();
		return false;		
	}
		else
	{
		cont = 0;
		str = frm.cidade.value;
		for (i = 0; i < str.length ; i++)
		{
			if(str.charAt(i) != " ")
			{
				cont = cont + 1; 
			}
		}
		if(cont < 1)
		{
			alert("O Campo Cidade é obrigatório.");
			frm.cidade.focus();
			return false;		
		}
	}


	if(frm.email.value == "")
	{
		alert("O Campo Email é obrigatório.");
		frm.email.focus();
		return false;		
	}	
	else
	{
		cont = 0;
		str = frm.email.value;
		for (i = 0; i < str.length ; i++)
		{
			if(str.charAt(i) != " ")
			{
				cont = cont + 1; 
			}
		}
		if(cont < 1)
		{
			alert("O Campo Email é obrigatório.");
			frm.email.focus();
			return false;		
		}
	}
	if(frm.escolaridade.options[frm.escolaridade.selectedIndex].value == "-")
	{
		alert("O Campo Escolaridade é obrigatório.");
		frm.escolaridade.focus();
		return false;		
	}
	if(frm.ocupacao.options[frm.ocupacao.selectedIndex].value == "-")
	{
		alert("O Campo Ocupação é obrigatório.");
		frm.ocupacao.focus();
		return false;		
	}
	if(frm.fasciculo.options[frm.fasciculo.selectedIndex].value == "-")
	{
		alert("O Campo Fascículo é obrigatório.");
		frm.fasciculo.focus();
		return false;		
	}
  		
	return true;
}

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original:  Roman Feldblum (web.developer@programmer.net) -->

<!-- Begin
var n;
var p;
var p1;
function ValidatePhone(){
p=p1.value
if(p.length==4){
	//d10=p.indexOf('(')
	pp=p;
	d4=p.indexOf('=')
	d5=p.indexOf('=')
	if(d4==-1){
		pp=pp+"-";
	}
	//if(d5==-1){
//		pp=pp+")";
//	}
	//pp="("+pp+")";
	document.fdr.datanasc.value="";
	document.fdr.datanasc.value=pp;
}

if(p.length==7){
	pp=p;
	pp=pp+"-";
	document.fdr.datanasc.value="";
	document.fdr.datanasc.value=pp;
}
setTimeout(ValidatePhone,100)
}
function getIt(m)
{
	n=m.name;
	p1=m
	ValidatePhone();
}
//  End -->
