function B1_OnClick() {

   var  erro = 0;

   if ( (document.ValidForm.optSuporte[0].visible) && (! document.ValidForm.optSuporte[0].checked) && (! document.ValidForm.optSuporte[1].checked) && (! document.ValidForm.optSuporte[2].checked) )
	{
		alert ("Marque uma opção 'sobre'");
		erro = 1;
        return false;
	}

    if ((document.ValidForm.cmbReferencia.selectedIndex==0) || (document.ValidForm.cmbReferencia.selectedIndex<0))
	{
		alert ("Informe a opção 'refere-se a'");
		erro = 1;
        return false;
	}


	if (document.ValidForm.nome.value.length < 3 )
	{
		alert ("Informe o nome");
		erro = 1;
        return false;
	}

	if (document.ValidForm.email.value.length < 4)
	{
		alert ("Informe o e-mail.");
		erro = 1;
        return false;
	}

	if ((document.ValidForm.email.value.length >0)  && (ValidaEmail(document.ValidForm.email.value) == false))
    {
        alert("e-mail inválido !");
		erro = 1;
        return false;
    }

	if (document.ValidForm.mensagem.value.length < 3 )
	{
		alert ("Escreva sua mensagem");
		erro = 1;
        return false;
	}

	if (erro == 0) document.ValidForm.submit();
}


function B3_OnClick() {

   var  erro = 0;

	if (document.frmCadastro.txtNomeF.value.length < 3 )
	{
		alert ("Informe o nome");
		erro = 1;
        return false;
	}

	if (document.frmCadastro.txtEmailF.value.length < 4)
	{
		alert ("Informe o e-mail para ser avisado.");
		erro = 1;
        return false;
	}

	if ((document.frmCadastro.txtEmailF.value.length >0)  && (ValidaEmail(document.frmCadastro.txtEmailF.value) == false))
    {
        alert("e-mail inválido !");
		erro = 1;
        return false;
    }


	if (erro == 0) document.frmCadastro.submit();
}


function Verifica_Tipo_Contato()
{

    el0 = document.getElementById('CONT');
    el1 = document.getElementById('SUPO');
    el2 = document.getElementById('DEPO');

	if (document.ValidForm.optSuporte[0].checked)
    {
        el0.style.display = "inline";
        el1.style.display = "none";
        el2.style.display = "none";
    }
    else if (document.ValidForm.optSuporte[1].checked)
    {
        el0.style.display = "none";
        el1.style.display = "inline";
        el2.style.display = "none";
    }
    else if (document.ValidForm.optSuporte[2].checked)
    {
        el0.style.display = "none";
        el1.style.display = "none";
        el2.style.display = "inline";

        el3 = document.getElementById('site_depoimento');
    	if (document.ValidForm.chkSite.checked)
        {
            el3.style.display = "inline";
        }
        else
        {
            el3.style.display = "none";
        }

    }


}



function ValidaEmail(mail){
   var ret = false;
   if (typeof(mail) != "undefined"){
      mail = mail.match(/(\w+)@(.+)\.(\w+)$/);
      if (mail != null){
         if ((mail[3].length==2) || (mail[3].length==3))
            ret = true;
         }
      }
   return ret;
}
