
/*** Valida formulário ***/
var txt_nome
var txt_mail
var txt_telefone
var txt_mais
function verifica_campos()
{
	txt_nome = document.frm_fale.txt_nome
	txt_mail = document.frm_fale.txt_mail
	txt_telefone = document.frm_fale.txt_telefone
	txt_mais = document.frm_fale.txt_mais

	if(txt_nome.value=="")
	{
		alert("O campo NOME está em branco.\nPor favor, informe seu nome.");
		/*document.write.span("O campo NOME está em branco.\nPor favor, informe seu nome.");*/
		txt_nome.focus();
		return false;
	}

	if(txt_mail.value=="")
	{
	alert("O campo E-Mail está em branco.\nPor favor, informe seu e-mail.");
		txt_mail.focus();
		return false;
	}


   if (txt_mail.value.indexOf ('@',0) == -1 || txt_mail.value.indexOf ('.',0) == -1)
      {
      alert("O campo de E-mail necessita de \"@\" e \".\" em seu conteúdo.\nPor favor, escreva novamente seu E-mail.")
      txt_mail.select();
      txt_mail.focus();
      return false;
      }

	if(txt_telefone.value=="")
	{
		alert("O campo TELEFONE está em branco.\nPor favor, informe seu telefone.");
		txt_telefone.focus();
		return false;
	}
	
	/*if (checkNum(txt_telefone.value,false,"") == false)
	{
		alert ("O campo TELEFONE só aceita números!");
		txt_telefone.focus();
		txt_telefone.select();
		return false;
	}*/
	
	if(txt_mais.value=="")
	{
		alert("O campo Observação está em branco.\nPor favor, informe sua observação.");
		txt_mais.focus();
		return false;
	}
	document.frm_fale.submit()
}

function checkNum (campo, flgChar, charac)
 {
  for (var i = 0; i < campo.length; i++)
     {
      var ch = campo.substring(i, i + 1)
      // campo aceita algum outro caracter
      if (flgChar == true)
             {
                   if (ch != charac)
                 {  
           if (ch < "0" || ch > "9")
              return false;
          }
        }
      else
        {
         if (ch < "0" || ch > "9")
           return false; 
        }
     }
  return true;
 }

