var cycle_count = 0;
			
//Callback de Ticker notícias (muda a contagem do scroll)
function change_cycle_count(){
	cycle_count = cycle_count != 2 ? ++cycle_count : 1;	
	$('#cycle-noticias-count').html(cycle_count);
}

$(document).ready(function() {
	//==== Adiciona exemplo ao input de pesquisa no rodapé ====
	$('#footer-search').example('Pesquisar no site...');
	
	//==== Abrir as janelas facebox ====
	$('a[rel*=facebox]').facebox();
	
	//==== Fechar a janela de alerta ====
	$('#close-alert').click(function(){			
		$("#top-alert").slideUp('slow');
	});
	
	//==== Scroll to top ====
	$('.scrollTop').click(function(){			
		$.scrollTo('#body', 600);
	});
	
	//==== Ticker - últimas notícias ====
	/*$('#ultimas-noticias').cycle({ 
		fx:     'scrollUp', 
		timeout: 7000, 
		delay:  -2000,
		pause:   1,
		after:   change_cycle_count
	});*/
	
	//==== Ticker - empresas ====
	$('#empresas-cycle-loading').hide();
	$('#empresas-cycle').show();
	$('#empresas-cycle').cycle({ 
		fx:     'fade', 
		timeout: 3000,
		pause:   1,
		speed:   1000
	});
	
	//==== Aumentar/diminuir fonte da notícia ====
	var range = 2;
	var max_size = 13 + (2 * range);
	var min_size = 13 - (2 * range);
	
	// Increase Font Size
	$(".increaseFont").click(function(){
		var currentFontSize = $('#texto-noticia').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		if(currentFontSizeNum >= max_size) return false;
		
		var newFontSize = currentFontSizeNum + range;
		$('#texto-noticia').css('font-size', newFontSize);
		return false;
	});
	// Decrease Font Size
	$(".decreaseFont").click(function(){
		var currentFontSize = $('#texto-noticia').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		if(currentFontSizeNum <= min_size) return false;
		
		var newFontSize = currentFontSizeNum - range;
		$('#texto-noticia').css('font-size', newFontSize);
		return false;
	});
	
	//==== Desabilita clique com o botão direito nas imagens selecionadas ====
	$('img.noRightClick').noContext();
	
	//==== Adiciona flag de publicidade nos anúncios ====
	$('.publicidade').append('<a href="publicidade" class="publicidade-flag" target="_blank" title="Anúncios na Comunidade Mais">Publicidade</a>');
})

//Script que faz com que as mensagens desapareçam após um certo tempo
/*setTimeout(function(){
	$(".msg.hideable").slideUp('slow');
}, 5000);*/
