function checa()
{
	if (window.document.fEditar.strNome.value=='')
	{
		alert("Preencha o nome");
		window.document.fEditar.strNome.focus();
		return false;
	}
	if (window.document.fEditar.strRG.value=='')
	{
		alert("Preencha o rg");
		window.document.fEditar.strRG.focus();
		return false;
	}
	if (window.document.fEditar.strCPF.value=='')
	{
		alert("Preencha o cpf");
		window.document.fEditar.strCPF.focus();
		return false;
	}
	if (!chkCpf(document.fEditar.strCPF,document.fEditar.strCPF.value))
	{
		return false;
	}
	if (window.document.fEditar.strEmail.value == "")
	{
		alert("Preencha o email");
		window.document.fEditar.strEmail.focus();
		return false;
	}
	if (!isEmailValid(document.fEditar,'strEmail'))
	{
		alert("Preencha corretamente o email");
		window.document.fEditar.strEmail.focus();
		return false;
	}	
	return true;
}

function enviar()
{
	if ( checa() )
	{
		window.document.fEditar.submit();
	}
}

function chkCpf (campo,valor) 
{
	strcpf = valor;
	str_aux = ""; 
	for (i = 0; i <= strcpf.length - 1; i++)
	if ((strcpf.charAt(i)).match(/\d/)) 
		str_aux += strcpf.charAt(i);
	else if (!(strcpf.charAt(i)).match(/[\.\-]/)) 
	{
	 	alert ("O campo CPF apresenta caracteres inválidos !!!");
	 	campo.focus();
	 	return false;
	}	
	if (str_aux.length != 11) 
	{
		alert ("O campo CPF deve conter 11 dígitos !!!");
		campo.focus();
		return false;
	}
	soma1 = soma2 = 0;
	for (i = 0; i <= 8; i++) 
	{
		soma1 += str_aux.charAt(i) * (10-i);
		soma2 += str_aux.charAt(i) * (11-i);
	}
	d1 = ((soma1 * 10) % 11) % 10;
	d2 = (((soma2 + (d1 * 2)) * 10) % 11) % 10;
	if ((d1 != str_aux.charAt(9)) || (d2 != str_aux.charAt(10))) 
	{
		alert ("O CPF digitado é inválido !!!");
		campo.focus();
		return false;
	}
	return true;
}