// JavaScript Document

function checa(nform) {
		
	if (nform.nome.value == "") {
		alert("Informe seu Nome.");
		nform.nome.focus();
		nform.nome.select();
		return false;
	}	
	
	if (nform.email.value == "") {
		alert("Informe seu e-mail.");
		nform.email.focus();
		nform.email.select();
		return false;
	} else {
		prim = nform.email.value.indexOf("@")
		if(prim < 2) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		if(nform.email.value.indexOf("@",prim + 1) != -1) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		if(nform.email.value.indexOf(".") < 1) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		if(nform.email.value.indexOf(" ") != -1) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		if(nform.email.value.indexOf("zipmeil.com") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		if(nform.email.value.indexOf("hotmeil.com") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		if(nform.email.value.indexOf(".@") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		if(nform.email.value.indexOf("@.") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		if(nform.email.value.indexOf(".com.br.") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		if(nform.email.value.indexOf("/") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		if(nform.email.value.indexOf("[") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		if(nform.email.value.indexOf("]") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		if(nform.email.value.indexOf("(") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		if(nform.email.value.indexOf(")") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		if(nform.email.value.indexOf("..") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.email.focus();
			nform.email.select();
			return false;
		}
		
		if (nform.telefone.value == "") {
		alert("Informe seu telefone.");
		nform.telefone.focus();
		nform.telefone.select();
		return false;
		}
		
		if (nform.celular.value == "") {
			alert("Informe seu celular.");
			nform.celular.focus();
			nform.celular.select();
			return false;
		}
		
		if (nform.senha.value == "") {
			alert("Informe sua senha.");
			nform.senha.focus();
			nform.senha.select();
			return false;
		}
		
	   if (nform.senha.value != nform.senha2.value) {
       alert("Os campos SENHA e CONFIRMAR SENHA, DEVEM ser iguais!");
       nform.senha.focus();
       return false;
	   }

	}
		return true;
}

function FormataCellphoneBr(obj,e)
{
	if (navigator.userAgent.indexOf("IE") != -1)
	{
		var keypress = window.event.keyCode;
		if (keypress > 47 && keypress < 58 && obj.value.length < 13)
			{
			if (obj.value.length == 0)
			   obj.value = "(" + obj.value;
			if (obj.value.length == 3)
			   obj.value = obj.value + ")";
			if (obj.value.length == 8)
			   obj.value = obj.value + "-";
			}
		else
			event.returnValue = false;
	}
	else
	{
		lineaux = obj.value;
		var keypress = e.which;
		if (keypress == 8)
			return true;
		if ((keypress < 48 || keypress > 57) || obj.value.length >= 13)
			return false;
		if (lineaux.length == 0)
			lineaux = "(";
		if (lineaux.length == 3)
			lineaux = lineaux + ")";
		if (lineaux.length == 8)
			lineaux = lineaux + "-";
		lineaux = lineaux + (keypress - 48);
		obj.value = lineaux;
		return false;
	}
	return true;
} 

