//FUNCTION PARA VALIDAR FORMULÁRIO	  
function validaCampoContato() {
/*
  //Filial
  if (document.form1.ffilial.value == "") {
    alert("Informe a Filial.");
    document.form1.ffilial.focus();
    return (false);
  }

  //Setor
  if (document.form1.fsetor.value == "") {
    alert("Informe o setor.");
    document.form1.fsetor.focus();
    return (false);
  } */

  //Nome
  if (document.form1.fnome.value == "") {
    alert("Informe seu nome.");
    document.form1.fnome.focus();
    return (false);
  }
  
  //Fone	
  if (document.form1.ftelefone.value == "") {
   	alert("Informe seu telefone.");
    document.form1.ftelefone.focus();
    return (false);
  }	  
    
  //Email
  if (document.form1.femail.value.lastIndexOf("@") < 0) {
    alert("E-mail incorreto!");
    document.form1.femail.focus();
    return (false);
  }
  
  if (document.form1.femail.value.lastIndexOf(".") < 0) {
    alert("E-mail incorreto!");
    document.form1.femail.focus();
    return (false);
  }
  
  if (document.form1.femail.value.length < 5) {
    alert("E-mail incorreto!");
    document.form1.femail.focus();
    return (false);
  }
    
/*  if ( document.form1.ftelefone.value == "" ) {  
   	if ( document.form1.femail.value.lastIndexOf("@") < 0 ||  document.form1.femail.value.lastIndexOf(".") < 0 || document.form1.femail.value.length < 5 ) {
	  	  //Email
	  	  if (document.form1.femail.value.lastIndexOf("@") < 0) {
	  	    alert("E-mail incorreto!");
	  	    document.form1.femail.focus();
	  	    return (false);
	  	  }
	  	  
	  	  if (document.form1.femail.value.lastIndexOf(".") < 0) {
	  	    alert("E-mail incorreto!");
	  	    document.form1.femail.focus();
	  	    return (false);
	  	  }
	  	  
	  	  if (document.form1.femail.value.length < 5) {
	  	    alert("E-mail incorreto!");
	  	    document.form1.femail.focus();
	  	    return (false);
	  	  }
	  	  //Fone
	  } else if (document.form1.ftelefone.value == "" && document.form1.femail.value == "") {
	    	alert("Informe seu telefone.");
		    document.form1.ftelefone.focus();
		    return (false);
 	  }
   }*/
  
  //Comentário
  if (document.form1.fcomentario.value=='')
  {
	alert("Por favor, preencha o campo comentário.");		
	document.form1.fcomentario.focus();
	return(false);
  }
  
  return (true);
}


function Mascara (formato, keypress, objeto){
campo = eval (objeto);
// TELEFONE
if (formato=='TELEFONE'){
	separador = '-'; 
	separador2= '(0xx'
	separador3= ') '
	conjunto0 = 2
	conjunto1 = 12;
	if (campo.value.length == conjunto0){
		campo.value = separador2 + campo.value + separador3;}
	
		if (campo.value.length == conjunto1){
			campo.value = campo.value + separador;
		}
	}
}

function validaCampoConsorcio()
{
  //Comentário
  if (document.form1.fcomentario.value=='')
  {
	alert("Por favor, preencha o campo comentário.");
	document.form1.fcomentario.focus();
	return(false);
  }
  return (true);
}
