<!--//

function comentarios_onBlur()
{
	if (window.document.formContato.comentarios.value.length > 512)
	{
		alert("O campo comentários deve ter até 512 caracters!");
		window.document.formContato.comentarios.focus();
		return(false);
	}
	alert("Retornou Verdadeiro");
	return(true);
	
}



function ValidFormContato(theForm)
{
	if(theForm.txtnome.value == "")
	{
		alert("Favor preencha o campo Nome!");
		window.document.formContato.txtnome.focus();
		return(false);
	}    
	if(theForm.txtendereco.value == "")
	{
		alert("Favor preencha o campo do endereço!");
		theForm.txtendereco.focus();
		return(false);
	}
	if(theForm.txtbairro.value == "")
	{
		alert("Favor preencha o campo do bairro!");
		theForm.txtbairro.focus();
		return(false);
	}

	if(theForm.txtcep.value == "")
	{
		alert("Favor preencha o campo do cep!");
		theForm.txtcep.focus();
		return(false);
	}
	if(theForm.txtcidade.value == "")
	{
		alert("Favor preencha o campo da cidade!");
		theForm.txtcidade.focus();
		return(false);
	}
	if(theForm.txtestado.value == "")
	{
		alert("Favor preencha o campo do estado!");
		theForm.txtestado.focus();
		return(false);
	}
	if(theForm.txtfone.value == "")
	{
		alert("Favor preencha o campo Telefone!");
		theForm.txtfone.focus();
		return(false);
	}    

	if(theForm.txtDDD.value == "")
	{
		alert("Favor preencha o campo DDD!");
		theForm.txtDDD.focus();
		return(false);
	}    
    
   s = limpa_string(theForm.txtCPF.value);
   if (s.length == 11) 
   {
	   if (valida_CPF(theForm.txtCPF.value) == false )  
      {
           alert("O CPF não é válido !");
           theForm.txtCPF.focus();
           return false;
	   }
   }
   else if (s.length == 14) 
   {
      if (valida_CGC(theForm.txtCPF.value) == false ) 
      {
	      alert("O CGC não é válido !");
         theForm.txtCPF.focus();
         return false;
	   }
   } 
   else
   {
      alert("O CPF/CGC não é válido !");
		theForm.txtCPF.focus();
      return false;
   }

	if(theForm.txtcontato.value == "")
	{
		alert("Favor preencha o campo do contato!");
		theForm.txtcontato.focus();
		return(false);
	}

	if(theForm.txtemail.value == "")
	{
		alert("Favor preencha o campo e-mail corretamente, uma cópia do pedido será enviada para esse endereço !");
		theForm.txtemail.focus();
		return(false);
	}

	if(theForm.txtsenha.value == "")
	{
		alert("Senha incorreta !");
		theForm.txtsenha.focus();
		return(false);
	}

	if(theForm.txtsenha.value != theForm.txtsenha1.value)
	{
		alert("Senha redigitada incorreta !");
		theForm.txtsenha1.focus();
		return(false);
	}
	
	// consiste endereco de entrega
	if(!theForm.chkentrega.checked)
	{
		if(theForm.txtenderecoEntrega.value == "")
		{
			alert("Favor preencha o campo do endereço de entrega!");
			theForm.txtenderecoEntrega.focus();
			return(false);
		}
		if(theForm.txtbairroEntrega.value == "")
		{
			alert("Favor preencha o campo do bairro de entrega!");
			theForm.txtbairroEntrega.focus();
			return(false);
		}

		if(theForm.txtcepEntrega.value == "")
		{
			alert("Favor preencha o campo do cep de entrega!");
			theForm.txtcepEntrega.focus();
			return(false);
		}
		if(theForm.txtcidadeEntrega.value == "")
		{
			alert("Favor preencha o campo da cidade de entrega!");
			theForm.txtcidadeEntrega.focus();
			return(false);
		}
		if(theForm.txtestadoEntrega.value == "")
		{
			alert("Favor preencha o campo do estado de entrega!");
			theForm.txtestadoEntrega.focus();
			return(false);
		}
	}

	return(true);
}


function ValidaContato(theForm)
{

	if(theForm.txtnome.value == "")
	{
		alert("Favor preencha o campo Nome!");
		theForm.txtnome.focus();
		return(false);
	}    
	
	if(theForm.txtemail.value == "")
	{
		alert("Favor preencha o campo e-mail corretamente !");
		theForm.txtemail.focus();
		return false;
	}
	
	if(theForm.txtassunto.value == "")
	{
		alert("Favor preencha o campo do Assunto!");
		theForm.txtassunto.focus();
		return(false);
	}

	if(theForm.edtmensagem.value == "")
	{
		alert("Favor preencha a mensagem!");
		theForm.edtmensagem.focus();
		return(false);
	}
	
	return(true);
}
