// JavaScript Document
function formatar_mascara(src, mascara) {
	var campo = src.value.length;
	var saida = mascara.substring(0,1);
	var texto = mascara.substring(campo);
	if(texto.substring(0,1) != saida) {
		src.value += texto.substring(0,1);
	}
}

function ValidaEmail2(){
	 var error = '';
	 var valor = "";
	 var nome = document.form_aniversario.nome.value;
	 var email = document.form_aniversario.email.value;
	 var telefone = document.form_aniversario.telefone.value;
	 var data = document.form_aniversario.data.value;
	 var festa = document.form_aniversario.festa.value;
	 

  if (nome == "") {
  
  error+='- O campo nome está vazio. \n';
  valor = "1";
  }  
  
  if (email.indexOf("@")==-1 || email.indexOf(".")==-1 || email.indexOf(";")!=-1 || email.length < 7)
  {
error+='- O campo e-mail esta vazio ou incorreto \n';
document.form_aniversario.email.focus();
valor = "1";
  }
  
  if (telefone == "") {
  
  error+='- Por favor colocar telefone. \n';
  valor = "1";
  }
  
  if (data == "") {
	  
	  error+='- Por favor informe a data de aniversário. \n';
      valor = "1";
  } 
  
   if (festa == "") {
	  
	  error+='- Por favor informe a data da festa. \n';
      valor = "1";
  } 
  
  if (valor == "1") {
	alert('Os Seguintes erros ocorreram:\n'+error+'\n Preencha os campos corretamente por favor.');
	document.form_aniversario = (error == '');
  }
  
else if (error == ""){ 
	document.form_aniversario.submit();
}  

}




