<!--################################# FUNCOES DO PAINEL DO USUÁRIO ########################################-->
function AbrirLocutores(){
	ajaxGet("paginalocutores.php", document.getElementById("divlocutores"),true);
	$("#divlocutores").show();
	$('#divlocutores').stop().animate({
		height: 'auto'
	}, 2000, function() {
		$('#btfechardiv').show();
	});
}
function FecharLocutores(){
	$("#divlocutores").hide();
}
function CriarLoginAutomatico(valor){
	ajaxGet("gerarLogin.php?valor="+valor, document.getElementById("gLogin"),false);
}

function CalculoPacote(id, personalizado){
	
	if(personalizado==1){
		
		var marcados = ''; 
		// Aqui voce referencia o objeto form 
		var chk = document.form; 
		// Aqui voce varre todos os elementos do form 
		t=0;
		for(i=0;i<chk.length;i++){ 
			// Aqui voce checa o nome do elemento e se ele esta checado, 
			if(chk.elements[i].name=='check[]' && chk.elements[i].checked==true){
				if(t==0){
					marcados += chk.elements[i].value; // se estiver checado pega o valor 
				}else{
					marcados += "," + chk.elements[i].value; // se estiver checado pega o valor 
				}
				t++;
			}
		}
		/*	alert(marcados); */
	}else{
		marcados=0;	
	}
	
	var qtdHomens			= document.getElementById("qtdHomens").value;
	var qtdMulheres			= document.getElementById("qtdMulheres").value;
	var duracao				= document.getElementById("duracao").value;
		
	if(qtdHomens == "" || qtdHomens == "" || duracao==""){
		
			alert("Os campos quantidade e Duração precisam ser preenchidos.\\n Caso não haja Homens ou Mulheres, coloquem '0'");
		
	}else{
			ajaxGet("calcularpacote.php?id="+id+"&qtdHomens="+qtdHomens+"&qtdMulheres="+qtdMulheres+"&duracao="+duracao+"&personalizado="+personalizado+"&itens="+marcados,document.getElementById("resCalculo"),false);	
	}

}
function autorizaCiclo(id_associado, ciclo, id_favorecido, valor){
	
	ajaxGet("autorizarciclos.php?id_associado="+id_associado+"&ciclo="+ciclo+"&id_favorecido="+id_favorecido+"&valor="+valor,document.getElementById("resultaCiclo"),false);	
}
function loginEscritorio(){
	var login			= document.getElementById("loginescritorio").value;
	var senha			= document.getElementById("senha").value;
		
	if(login == "" || senha == ""){
		
			alert("Os campos login e senha devem ser preenchidos.");
		
	}else{
			document.frmescritorio.submit();
	}

}
function alterarCadastro(){
	var nome			= document.getElementById("nome").value;
	var valorcpf		= document.getElementById("cpf").value;
	var valorrg			= document.getElementById("rg").value;
	var nascimento		= document.getElementById("nascimento").value;
	var endereco		= document.getElementById("endereco").value;
	var numero			= document.getElementById("numero").value;
	var bairro			= document.getElementById("bairro").value;
	var cidade			= document.getElementById("cidade").value;
	var estado			= document.getElementById("estado").value;
	var email			= document.getElementById("email").value;
	var telefone		= document.getElementById("telefone").value;
	var senha_cadastro	= document.getElementById("senha_cadastro").value;
	
	if(nome == "" || valorcpf == "" || valorrg == "" || nascimento == "" || endereco == "" || numero == "" || bairro == "" || cidade == "" || estado == "" || email == "" || telefone == "" || senha_cadastro == ""){
		
		alert("Observe os campos com '*', são campos obrigatórios no seu cadastro.");
		
	}else{
		document.form_cadastro.submit();	
	}
}
function cadastre_se(){
	var nome			= document.getElementById("nome").value;
	var valorcpf		= document.getElementById("cpf").value;
	var valorrg			= document.getElementById("rg").value;
	var nascimento		= document.getElementById("nascimento").value;
	
	var endereco		= document.getElementById("endereco").value;
	var numero			= document.getElementById("numero").value;
	var bairro			= document.getElementById("bairro").value;
	var cidade			= document.getElementById("cidade").value;
	var estado			= document.getElementById("estado").value;

	var email			= document.getElementById("email").value;
	var telefone		= document.getElementById("telefone").value;
	
	var login			= document.getElementById("login").value;
	var senha_cadastro	= document.getElementById("senha_cadastro").value;
	var senha_confere	= document.getElementById("senha_confere").value;
	
	if(senha_cadastro == senha_confere){
		
		if(nome == "" || valorcpf == "" || valorrg == "" || nascimento == "" || endereco == "" || numero == "" || bairro == "" || cidade == "" || estado == "" || email == "" || telefone == "" || login == "" || senha_cadastro == "" || senha_confere == ""){
		
			alert("Observe os campos com '*', são campos obrigatórios no seu cadastro.");
		
		}else{
			document.form_cadastro.submit();
		}

	}else{
	
		alert("A senha digitada nos dois campos estão diferentes. Digite novamente a senha e o campo para conferir.");
	
	}
}
function contatoEnvio(){
	var nome			= document.getElementById("nomeContato").value;
	var email			= document.getElementById("emailContato").value;
	var msg				= document.getElementById("mensagemContato").value;

	if(nome == "" || email == "" || msg == ""){
		
			alert("Todos os campos são obrigatórios.");
		
	}else{
		ajaxGet("envio_faleconosco.php?nome="+nome+"&email="+email+"&msg="+msg+"&post=1",document.getElementById("resultadoContato"),false);	
	}
}
function alterarFoto(){
	ajaxGet("campofoto.php",document.getElementById("campofoto"),false);				
}
function alterarMP3(){
	ajaxGet("campomp3.php",document.getElementById("campofoto"),false);				
}
function cadastroNewsletters(){
	var nome	= document.getElementById("nome").value;
	var email	= document.getElementById("email").value;	
	ajaxGet("cadastro_newsletters.php?nome="+nome+"&email="+email,document.getElementById("resultadoNewsletters"),true);	
}	
function ExibirIndique(){
	<!--################## FECHA O COMENTÁRIO #########################-->
	if(document.getElementById("DivComentarios").style.display == "block"){
		document.getElementById("DivComentarios").style.display = "none";	
	}
	<!--################## ABRE OU FECHA O INDIQUE #########################-->
	if(document.getElementById("indiqueAmigo").style.display == "block"){
		document.getElementById("indiqueAmigo").style.display = "none";	
	}else{
		document.getElementById("indiqueAmigo").style.display = "block";
	}
}
function ExibirComentar(){
	<!--################## FECHA O INDIQUE #########################-->
	if(document.getElementById("indiqueAmigo").style.display == "block"){
		document.getElementById("indiqueAmigo").style.display = "none";	
	}
	<!--############## ABRE OU FECHA O COMENTÁRIO #####################-->
	if(document.getElementById("DivComentarios").style.display == "block"){
		document.getElementById("DivComentarios").style.display = "none";	
	}else{
		document.getElementById("DivComentarios").style.display = "block";
	}
}
function ajaxComentar(idnoticia, tabela){
	var nomeCom = document.getElementById("nomeCom").value;
	var emailCom = document.getElementById("emailCom").value;
	var comentario = document.getElementById("comentario").value;
	
	if(nomeCom == "" || emailCom == "" || comentario == ""){
		alert ("Todos os campos devem ser preenchidos.");	
	}else{
		ajaxGet("adicionar_comentario.php?idnoticia="+idnoticia+"&nome="+nomeCom+"&email="+emailCom+"&comentario="+comentario+"&tabela="+tabela,document.getElementById("resultado"),false);		
	}
}
function ajaxIndicar(idnoticia, tabela){
	var nome = document.getElementById("nomeIndique").value;
	var email = document.getElementById("emailIndique").value;
	var nomeamigo = document.getElementById("nomeamigoIndique").value;
	var emailamigo = document.getElementById("emailamigoIndique").value;
	
	var noticia = idnoticia;

	if(nome == "" || email == "" || nomeamigo == "" || emailamigo == ""){
		alert ("Todos os campos devem ser preenchidos.");	
	}else{
		ajaxGet("email_indique.php?idnoticia="+noticia+"&nome="+nome+"&email="+email+"&nomeamigo="+nomeamigo+"&emailamigo="+emailamigo+"&tabela="+tabela,document.getElementById("resultadoIndique"),false);		
	}
}
