// Validaçao do formulário SAC
function validarSac() {
	path = document.formSac;
	if (path.ISCMNom.value.length <= 1){
		alert(dictionary[lang][1]);
		path.ISCMNom.focus();			
		return;
	}
	if (!Validar_Email(path.ISCMMail.value)){
		alert(dictionary[lang][2]);
		path.ISCMMail.focus();			
		return;
	}
	if (path.ISCMEnd.value.length <= 1){
		alert(dictionary[lang][3]);
		path.ISCMEnd.focus();			
		return;
	}
	if (path.ISCMNum.value.length <= 1){
		alert(dictionary[lang][4]);
		path.ISCMNum.focus();			
		return;
	}
	if (path.ISCMBai.value.length <= 1){
		alert(dictionary[lang][5]);
		path.ISCMBai.focus();			
		return;
	}
	if (path.ISCMCep.value.length <= 1){
		alert(dictionary[lang][6]);
		path.ISCMCep.focus();			
		return;
	}
	if (path.ISCMCid.value.length <= 1){
		alert(dictionary[lang][7]);
		path.ISCMCid.focus();			
		return;
	}
	if (path.ISCMUf.value.length <= 1){
		alert(dictionary[lang][8]);
		path.ISCMUf.focus();			
		return;
	}
	if (path.ISCMDddR.value.length <= 1){
		alert(dictionary[lang][9]);
		path.ISCMDddR.focus();			
		return;
	}
	if (path.ISCMFonR.value.length <= 1){
		alert(dictionary[lang][10]);
		path.ISCMFonR.focus();			
		return;
	}
	if (path.DES_ASSUNTO.value.length <= 1){
		alert(dictionary[lang][11]);
		path.DES_ASSUNTO.focus();			
		return;
	}
	if (path.ISCMObs.value.length <= 1){
		alert(dictionary[lang][12]);
		path.ISCMObs.focus();			
		return;
	}
	path.submit();
}
// Validaçao do formulário Clubinho
function validarClubinho() {
	path = document.formClubinho;
	if (path.ISCMNom.value.length <= 1){
		alert("Preencha o nome.");
		path.ISCMNom.focus();			
		return;
	}
	if (path.ISCMDtaN.value.length < 10){
		alert("Informe sua data de nascimento.");
		path.ISCMDtaN.focus();
		return;
	}
	if ((path.ISCMDtaN.value.length == 10) && (!validaIdade(path.ISCMDtaN.value))){
		return;
	}
	if (path.NOM_RESPONSAVEL.value.length <= 1){
		alert("Informe o nome do responsável.");
		path.NOM_RESPONSAVEL.focus();			
		return;
	}
	if (!Validar_Email(path.ISCMMail.value)){
		alert("Preencha o e-mail corretamente.");
		path.ISCMMail.focus();			
		return;
	}
	if (!Validar_Email(path.DES_EMAIL_RESPONSAVEL.value)){
		alert("Preencha o e-mail do responsável corretamente.");
		path.DES_EMAIL_RESPONSAVEL.focus();			
		return;
	}
	if (path.ISCMEnd.value.length <= 1){
		alert("Informe seu endereço.");
		path.ISCMEnd.focus();			
		return;
	}
	if (path.ISCMNum.value.length <= 1){
		alert("Informe o número.");
		path.ISCMNum.focus();			
		return;
	}
	if (path.ISCMBai.value.length <= 1){
		alert("Informe o bairro.");
		path.ISCMBai.focus();			
		return;
	}
	if (path.ISCMCep.value.length <= 1){
		alert("Informe o cep.");
		path.ISCMCep.focus();			
		return;
	}
	if (path.ISCMCid.value.length <= 1){
		alert("Informe a cidade.");
		path.ISCMCid.focus();			
		return;
	}
	if (path.ISCMUf.value.length <= 1){
		alert("Selecione o estado.");
		path.ISCMUf.focus();			
		return;
	}
	if (path.ISCMDddR.value.length <= 1){
		alert("Informe o DDD.");
		path.ISCMDddR.focus();			
		return;
	}
	if (path.ISCMFonR.value.length <= 1){
		alert("Informe o telefone para contato.");
		path.ISCMFonR.focus();			
		return;
	}
	if (path.DES_APELIDO.value.length <= 1){
		alert("Informe o apelido.");
		path.DES_APELIDO.focus();			
		return;
	}
	if (path.DES_SENHA.value.length <= 1){
		alert("Informe a senha.");
		path.DES_SENHA.focus();			
		return;
	}
	if (path.DES_SENHA2.value.length <= 1){
		alert("Repita a senha.");
		path.DES_SENHA2.focus();			
		return;
	}
	if (path.DES_SENHA2.value != path.DES_SENHA.value) {
		alert("As senhas informadas devem ser idênticas.");
		path.DES_SENHA2.focus();
		return;
	}
	path.submit();
}
function validaIdade(data) {
	// retorna a data atual
	hoje = new Date()
	dia = hoje.getDate()
	mes = hoje.getMonth()+1;
	ano = hoje.getFullYear()

	// quebra a data de nascimento
	var data_array=data.split("/");
	dia_nasc = data_array[0];
	mes_nasc = data_array[1];
	ano_nasc = data_array[2];

	idade_ano = ano - ano_nasc;
	
	if(idade_ano > 13) {
		alert(dictionary[lang][13]);
		path.DAT_NASC.focus();
		return false;
	} 
	else {
		if((mes_nasc < mes)&&(idade_ano == 13)) {
			alert(dictionary[lang][13]);
			path.DAT_NASC.focus();
			return false;
		} 
		else {
			if((mes_nasc == mes)&&(dia_nasc < dia)&&(idade_ano == 13)) {
				alert(dictionary[lang][13]);
				path.DAT_NASC.focus();
				return false;
			}
			else {
				return true;
			}
		} 
	}
}