// JavaScript Document

$(document).ready(function(){
	$("#carregando").hide()
	$("#etiqueta").hide()
	GaleriaFotos()
	GaleriaLogBook()
	ConteudoBlog()
});

// Página de Agenda
var tabAtual = 1
 
		mudarTab = function(numeroTab) {
			$("#tab_"+tabAtual).toggle()
			$("#tab_"+numeroTab).toggle()
			tabAtual = numeroTab
}

// Página Galeria de Fotos
function GaleriaFotos(){
		$("#conteudo_galeria").html("<p class='carregando'>Carregando...</p>")
		$.ajax({ 
			type: "POST",
			url: "/calypso/ajaxgaleria",
			data: "ID=" + $('#lista-galeria li a').attr('rel'),
			success: function(msg){
					$("div#conteudo_galeria").html(msg)
			}
		});
		
		$('#lista-galeria li a').click(function(){
				$("#conteudo_galeria").html("<p class='carregando'>Carregando...</p>")
				var ID = $(this).attr('rel')
				$.ajax({
					type: "POST",
					url: "/calypso/ajaxgaleria",
					data: "ID=" + ID,
					success: function(msg){
								$("#conteudo_galeria").html("<p class='carregando'>Carregando...</p>")
								$("#conteudo_galeria").html(msg)
							}
					});
			})
}


// Página LogBook
function GaleriaLogBook(){
	$(document).ready(function(){
		$("#conteudo_logbook").html("<p class='carregando'>Carregando...</p>")
		$.ajax({ 
			type: "POST",
			url: "/calypso/ajaxlogbook",
			data: "ID=" + $('#lista-logbook li a').attr('rel'),
			success: function(msg){
					$("div#conteudo_logbook").html(msg);
			}
		});
		
		$('#lista-logbook li a').click(function(){
				$("#conteudo_logbook").html("<p class='carregando'>Carregando...</p>")
				var ID = $(this).attr('rel')
				$.ajax({
					type: "POST",
					url: "/calypso/ajaxlogbook",
					data: "ID=" + ID,
					success: function(msg){
								$("#conteudo_logbook").html("<p class='carregando'>Carregando...</p>")
								$("#conteudo_logbook").html(msg)
							}
					});
			})
	})
}


// Página Blog
function ConteudoBlog(){
	$(document).ready(function(){
		$("#conteudo_blog").html("<p class='carregando'>Carregando...</p>")
		$.ajax({ 
			type: "POST",
			url: "/calypso/ajaxblog",
			data: "ID=" + $('#lista-news li a').attr('rel'),
			success: function(msg){
					$("div#conteudo_blog").html(msg);
			}
		});
		
		$('#lista-news li a').click(function(){
				$("#conteudo_blog").html("<p class='carregando'>Carregando...</p>")
				var ID = $(this).attr('rel')
				$.ajax({
					type: "POST",
					url: "/calypso/ajaxblog",
					data: "ID=" + ID,
					success: function(msg){
								$("#conteudo_blog").html("<p class='carregando'>Carregando...</p>")
								$("#conteudo_blog").html(msg)
							}
					});
			})
	})
}
