<!--################################# FUNCOES DO PAINEL DO USUÁRIO ########################################-->
function multimida_paginacao(pag){
	ajaxGet("multimidia_altares.php?p="+pag, document.getElementById("fotosAltaRes"),true);
}
function multimida_clickFoto(foto, acao){
	if(acao=="exibir"){
		var senhaform = document.getElementById("senha").value;		
		ajaxGet("multimidia_altares.php?acao="+acao+"&foto="+foto+"&senha="+senhaform, document.getElementById("fotosAltaRes"),true);
	}else{
		ajaxGet("multimidia_altares.php?acao="+acao+"&foto="+foto, document.getElementById("fotosAltaRes"),true);
	}
}
function limparCampoNome(valor, labelNome){
	if(valor=="seu nome" || valor=="your name"){
		document.getElementById("nome").value = "";	
	}else if(valor==""){
		document.getElementById("nome").value = labelNome;	
	}else{
		document.getElementById("nome").value = valor;	
	}
}
function limparCampoEmail(valor, labelEmail){
	if(valor=="seu e-mail" || valor=="your email"){
		document.getElementById("email").value = "";	
	}else if(valor==""){
		document.getElementById("email").value = labelEmail;	
	}else{
		document.getElementById("email").value = valor;	
	}
}
function CriarLoginAutomatico(valor){
	ajaxGet("gerarLogin.php?valor="+valor, document.getElementById("gLogin"),false);
}
function ConteudoServicos(id){
	ajaxGet("conteudo_servicos.php?id="+id,document.getElementById("conteudo_servicos"),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("nome").value;
	var email			= document.getElementById("email").value;
	var telefone		= document.getElementById("telefone").value;
	var assunto			= document.getElementById("assunto").value;
	var msg				= document.getElementById("mensagem").value;

	if(nome == "" || email == "" || telefone == "" || msg == ""  || assunto == ""){
		
			alert("Todos os campos são obrigatórios.");
		
	}else{
		ajaxGet("contato.php?nome="+nome+"&email="+email+"&telefone="+telefone+"&msg="+msg+"&assunto="+assunto+"&post=1",document.getElementById("resultadoContato"),false);	
	}
}
function alterarFoto(){
	ajaxGet("campofoto.php",document.getElementById("campofoto"),false);				
}
function cadastroNewsletters(frase){
	var nome	= document.getElementById("nome").value;
	var email	= document.getElementById("email").value;	
	if(nome=="seu nome" || nome=="your name" || email=="seu e-mail" || email=="your email"){
		alert(frase);	
	}else{
		ajaxGet("cadastro_newsletters.php?nome="+nome+"&email="+email,document.getElementById("resultadoNewsletters"),false);	
	}
}	
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);		
	}
}
