/*

	para usar a função
	
	onsubmit="return valida(this);"

*/

function isEmpty(pStrText){
	   var   len = pStrText.length;
	   var pos;
	   var vStrnewtext = "";
	
	   for (pos=0; pos<len; pos++){
		  if (pStrText.substring(pos, (pos+1)) != " "){
			 vStrnewtext = vStrnewtext + pStrText.substring(pos, (pos+1));
		  }
	   }
	
	   if (vStrnewtext.length > 0)
		  return false;
	   else
		  return true;
}


function isEmail(text){
   var    arroba = "@",
			  ponto = ".",
			 posponto = 0,
			 posarroba = 0;
	   
	if (text =="") return false;
	   
	for (var indice = 0; indice < text.length; indice++){
	   if (text.charAt(indice) == arroba) {
			  posarroba = indice;
				break;
		   }
		}
	   
	   for (var indice = posarroba; indice < text.length; indice++){
		  if (text.charAt(indice) == ponto) {
			 posponto = indice;
			   break;
		  }
	   }
	   if (posponto == 0 || posarroba == 0) return false;
	   if (posponto == (posarroba + 1)) return false;
	   if ((posponto + 1) == text.length) return false;
	   return true;
	}
	
	
function isNumber(numero){
   var CaractereInvalido = false;

   for (i=0; i < numero.length; i++){
	  var Caractere = numero.charAt(i);
	  if(Caractere != "." && Caractere != "," && Caractere != "-"){
		 if (isNaN(parseInt(Caractere))) CaractereInvalido = true;
	  }
   }
	   return !CaractereInvalido;
	}


function validaContato(form) {
	
	
	if (isEmpty(form.nome01.value))
	{
		alert('Não esqueça de informar seu nome!');	
		form.nome01.focus();
		return false;	
	}

	if (isEmpty(form.email01.value))
	{
		alert('Informe seu e-mail!');	
		form.email01.focus();
		return false;	
	}
		
	if (!isEmail(form.email01.value))
	{
		alert('Informe um e-mail válido!');	
		form.email01.focus();
		return false;	
	}

	if (isEmpty(form.mensagem01.value))
	{
		alert('Digite sua mensagem!');	
		form.mensagem01.focus();
		return false;
	}

	
		return true;

}




function validaCurriculo(form) {
	
	
	if (isEmpty(form.nome02.value))
	{
		alert('Não esqueça de informar seu nome!');	
		form.nome02.focus();
		return false;	
	}

	if (isEmpty(form.email02.value))
	{
		alert('Informe seu e-mail!');	
		form.email02.focus();
		return false;	
	}
		
	if (!isEmail(form.email02.value))
	{
		alert('Informe um e-mail válido!');	
		form.email02.focus();
		return false;	
	}

	
		return true;
}









