function faq(o){
	$(".aberto", $(o).parent().parent()).removeClass("aberto");
	$(o).parent().addClass("aberto");
}

function agenda(mes, ano){
	$.get("agenda/lista.php", {mes:mes, ano:ano}, function(d){
		$(".agenda>div").html(d);
	});
}

function cursos(o){
	$.get("cursos/lista.php", {cidade: o}, function(d){
		$(".cursos ul").html(d);
	});
}

function cursosAbrir(o){
	$(".eventos", $(o).parent().parent()).hide();
	$(">p", $(o).parent().parent()).removeClass("abertos").removeClass("fechados").addClass("fechados");
	$(o).parent().removeClass("abertos").removeClass("fechados").addClass("abertos");
	$(o).parent().next().show();
} 

function cursosSlider(o){
	var slide =	$("ul", o).bxSlider({
		controls: false,
		mode: "fade"
	});
	
	$(".anterior", o).click(slide.goToPreviousSlide);
	$(".proximo", o).click(slide.goToNextSlide);
}

function twitter(screen_name){
	$.get("../common/twitter.php", {screen_name:screen_name}, function(d){
		$(".twitter>ul").html(d);
	});
}

function youtube(){
	if($(".youtube>ul").length > 0){
		$.get("../common/youtube.php", function(d){
			$(".youtube>ul").html(d);
		});
	}else{
		$.get("../common/youtube-player.php", function(d){
			$(".youtube").html(d);
		});
	}
}

function mudarCidade(o){
	var n = $("#ddlCurso").html('<option value="" selected="selected">Carregando...</option>').attr("disabled", "disabled");
	$.get("cursos/lista-drop.php", {cidade: o.value}, function(dados){
		n.html(dados).prepend('<option value="" selected="selected">Selecione</option>').removeAttr("disabled");
	});
}

function atendimento(){
	window.open(URL + "livezilla/chat.php", "", "width=590,height=580,left=10,top=10,resizable=yes,menubar=no,location=no,status=yes,scrollbars=yes"); 
}

function enviePorEmail(url){
	$("#envie").remove();
	$('<div id="envie"><iframe width="670" height="225" frameborder="0" scrolling="no" allowTransparency="true" src="envie-por-e-mail/?u=' + url + '"></iframe></div>').popup({width: 670, height: 225});
}

function enviePorEmailFechar(){
	$("#envie").popupClose();
}

function assineRSS(){
	$("#assine").remove();
	$('<div id="assine"><iframe width="560" height="632" frameborder="0" scrolling="no" allowTransparency="true" src="assine-nosso-rss/"></iframe></div>').popup({width: 560, height: 632});
}

function assineRSSFechar(){
	$("#assine").popupClose();
}
