function echeck(str) {

			 var at="@"
			 var dot="."
			 var lat=str.indexOf(at)
			 var lstr=str.length
			 var ldot=str.indexOf(dot)
			 if (str.indexOf(at)==-1){
			    alert("Email inválido")
				return false
			 }

			 if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
				 alert("Email inválido")
				 return false
			 }

			 if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
				 alert("Email inválido")
				 return false
			 }

			 if (str.indexOf(at,(lat+1))!=-1){
			    alert("Email inválido")
		 	   return false
			 }

		 	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		 	   alert("Email inválido")
		 	   return false
		 	}

		 	if (str.indexOf(dot,(lat+2))==-1){
		 	   alert("Email inválido")
		 	   return false
		 	}

		 	if (str.indexOf(" ")!=-1){
		 	   alert("Email inválido")
		  	  return false
		 	}

 		 	return true
		     }
function critica()
{
			//declarando as variáveis;

			var cmp1, cmp2, cmp3, valor, digits="0123456789", flag="F";
			cmp2 = document.falegeral.e_mail;
			cmp1 = document.falegeral.Nome;
			cmp3 = document.falegeral.DDD;
            cmp4 = document.falegeral.telefone;

            if(cmp1.value == ""){
			alert("Preencha  seu Nome");
			cmp1.focus();
			return;
			}
			

			if ((cmp2.value==null)||(cmp2.value==""))
			{
			 alert("Preencha o campo do seu e-mail.");
			 cmp1.focus();
			 return; 
			}
			else if (echeck(cmp2.value)==false)
			{
			 cmp2.value="";
			 cmp2.focus();
			 return;
			}
	        if( ((cmp3.value==null)||(cmp3.value=="")) && ((cmp4.value==null)||(cmp4.value=="")))
			{
			 flag="V"; 
			 document.falegeral.submit();
			}
			
			for (var i=0;i<cmp3.value.length;i++)
				 {
				  temp=cmp3.value.substring(i,i+1)
				  if (digits.indexOf(temp)==-1)
				   {
					alert("Os campos para DDD e telefone  devem ser preenchidos apenas com números!\n Ex: (011) 9999999")
					cmp3.value="";
					cmp3.focus();
					return;
				   }
				  }
       
       			for (var i=0;i<cmp4.value.length;i++)
				 {
				  temp=cmp4.value.substring(i,i+1)
				  if (digits.indexOf(temp)==-1)
				   {
					alert("Os campos para DDD e telefone  devem ser preenchidos apenas com números!\n Ex: (011) 9999999");
					cmp4.value="";
					cmp4.focus();
					return; 
				   }
			  }
			
			if(((cmp3.value==null)||(cmp3.value=="")) && ((cmp4.value!=null)||(cmp4.value!="")) && (flag!="V"))
			 {
			   alert("Preencha o campo o DDD.");
			   cmp3.focus();
			   return;
			 }
			if(((cmp4.value==null)||(cmp4.value=="")) && ((cmp3.value!=null)||(cmp3.value!="")) && (flag!="V") )
		   {
			  alert("Preencha o campo o Telefone.");
			  cmp4.focus();
			  return;
			}
			document.falegeral.submit();
}