function ValidaCadastro()
	{

	var sMensagem;
	
	// Inicializo a mensagem com vazio
	sMensagem = "";
	
	// Agora vou testar se os campos obrigatórios estão preenchidos
	// Os que não estiverem, vou acumulando na mensagem de erro.
	if ( ( document.cadastro.fsNome.value == null) || ( document.cadastro.fsNome.value == "" ) )
		{
		sMensagem += "Favor preencher o nome.\n";
		}
		
	if ( ( document.cadastro.fsSexo[0].checked == false ) && ( document.cadastro.fsSexo[1].checked == false ) )
		{
		sMensagem += "Favor selecionar o sexo.\n";
		}
		
	if ( ( document.cadastro.fsEmail.value == null) || ( document.cadastro.fsEmail.value == "" ) )
		{
		sMensagem += "Favor preencher o e-mail.\n";
		}
	else
		{
		if ( ! checkmail(document.cadastro.fsEmail.value ) )
			{
			sMensagem += "E-mail inválido.\n";
			}
		}
	
	if ( ( document.cadastro.fsTelefone.value == null) || ( document.cadastro.fsTelefone.value == "" ) )
		{
		sMensagem += "Favor preencher o telefone ou celular.\n";
		}
		
	if ( ( document.cadastro.fsBairro.value == null) || ( document.cadastro.fsBairro.value == "" ) )
		{
		sMensagem += "Favor preencher o bairro.\n";
		}
		
	if ( ( document.cadastro.fsCidade.value == null) || ( document.cadastro.fsCidade.value == "" ) )
		{
		sMensagem += "Favor preencher a cidade.\n";
		}
		
	if ( ( document.cadastro.fsProfissao.value == null) || ( document.cadastro.fsProfissao.value == "" ) )
		{
		sMensagem += "Favor preencher a profissão.\n";
		}
	
	if ( ( document.cadastro.fsAniversario.value == null) || ( document.cadastro.fsAniversario.value == "" ) )
		{
		sMensagem += "Favor preencher o aniversário.\n";
		}
		
	if ( ( document.cadastro.fiTipoVinho[0].checked == false ) && ( document.cadastro.fiTipoVinho[1].checked == false ) && ( document.cadastro.fiTipoVinho[2].checked == false ) && ( document.cadastro.fiTipoVinho[3].checked == false ) && ( document.cadastro.fiTipoVinho[4].checked == false ) && ( document.cadastro.fiTipoVinho[5].checked == false ) && ( document.cadastro.fiTipoVinho[6].checked == false ) && ( document.cadastro.fiTipoVinho[7].checked == false ) && ( document.cadastro.fiTipoVinho[8].checked == false ) )
		{
		sMensagem += "Favor selecionar o(s) tipo(s) de vinho preferido(s).\n";
		}
		
	if ( ( document.cadastro.fsVinhoPreferido.value == null) || ( document.cadastro.fsVinhoPreferido.value == "" ) )
		{
		sMensagem += "Favor preencher o vinho preferido.\n";
		}
		
	if ( ( document.cadastro.fsVinhoPreco[0].checked == false ) && ( document.cadastro.fsVinhoPreco[1].checked == false ) && ( document.cadastro.fsVinhoPreco[2].checked == false ) && ( document.cadastro.fsVinhoPreco[3].checked == false ) )
		{
		sMensagem += "Favor selecionar a faixa de preço dos vinhos que costuma comprar.\n";
		}
		
	if ( ( document.cadastro.fsLocalCompra.value == null) || ( document.cadastro.fsLocalCompra.value == "" ) )
		{
		sMensagem += "Favor preencher o local onde costuma comprar seus vinhos.\n";
		}
		
	if ( ( document.cadastro.fsConviteDegustacao[0].checked == false ) && ( document.cadastro.fsConviteDegustacao[1].checked == false ) )
		{
		sMensagem += "Favor selecionar se deseja ser convidado para desgustações.\n";
		}
			
	if ( sMensagem != "" && sMensagem != null )
		{
		alert( sMensagem );
		return false;
		}
	else
	   {
		return true;
		}
	}	
	
	
	
/*------------------------------------------------------------------------
| FUNCAO:
|			checkmail()
|
| OBJETIVO:
|			Utilizada para criticar se campo de email esta correto
|
| RECEBE:
|       campo de email
------------------------------------------------------------------------*/
function checkmail(Email) 
{ 
	var find_ponto=false;
	var find_arroba=false;
	var find_caracter=true;
	var find_colon=true;
	for (var i=0; i< Email.length; i++) 
	{
		if (Email.charAt(i)=="@") find_arroba=true;
		else if (Email.charAt(i)==".") find_ponto=true;
		else if (Email.charAt(i)==" ") find_caracter=false;
		else if (Email.charAt(i)==",") find_colon=false;
	}
	return (find_ponto & find_arroba & find_caracter & find_colon);
}

