//este js contém as chamadas as funções comuns a todo projeto


$(document).ready(function(){
	/*==============================================
	 GERAIS
	================================================*/
	
	//faz o preload das imagens linkadas no CSS
	//$.preloadCssImages();
	
	/*==============================================
	 HOME
	================================================*/
	/*Chamada da função para controlar o esconde/mostra dos cursos na home
	para cada box contendo o span "abrir", feche-o. */
	var arrayBoxCursos = $(".fechar");
	jQuery.each(arrayBoxCursos, function() {        
		if($(this).html() == "abrir") {
			$(this).parent().find("ul, a.txt-company").css("display", "none");
			if($(this).hasClass("verde")) { //troca o icone de menos para mais
				$(this).addClass("over-verde");
			} else {
				$(this).addClass("over-azul");
			};
			$(this).attr("title","Clique para mostrar os cursos");
		}
	});
	
	$(".fechar").click(
		 function(){
			$(this).parent().find("ul, a.txt-company").slideToggle("fast");
			
			if($(this).html() == "abrir") {
				$(this).html("fechar");
				$(this).attr("title","Clique para esconder os cursos");
				if($(this).hasClass("verde")) {
					$(this).removeClass("over-verde");
				} else {
					$(this).removeClass("over-azul");
				};
			} else {
				$(this).html("abrir");
				$(this).attr("title","Clique para mostrar os cursos");
				if($(this).hasClass("verde")) {
					$(this).addClass("over-verde");
				} else {
					$(this).addClass("over-azul");
				};
			}
		}
	);

	/*==============================================
	 FAQ
	================================================*/
	$(".tits-faq").toggle(
		 function(){
			$(this).parent().find("dd").slideToggle("fast");
			$(this).attr("title","Close/Fechar");
			$(this).addClass("aberta");
			$.ajax({
			  type: "GET",
			  url: $(this).attr("abbr"),
			  dataType: "script"
			});			
		},
		 function() {
			$(this).parent().find("dd").slideToggle("fast");	
			$(this).attr("title");
			$(this).removeClass("aberta");
		 }
	);	
	$(".toggle-faq").toggle(
			function(){      
				$(".tits-faq").parent().find("dd").css("display", "block");
				$(this).html("Fechar todas as perguntas");
			},
			function(){
				$(".tits-faq").parent().find("dd").css("display", "none");
				$(this).html("Abrir todas as perguntas");
			}
		);
  


});//fecha o documento.ready