$(function(){
	$('div#header h1,div#header h2, .pngFix').pngFix();

	$('ul#nav li:not(.ativo)').mouseenter(function(){
		$(this).stop().animate({
			"padding-top": '0'
		});                                                                               
	}).mouseleave(function(){
		$(this).stop().animate({
			"padding-top": '12'
		});
	});

	$(".commentlist li:first").addClass('first');
	
	if($(".commentlist li:last").hasClass('even')){
		$('#respond').addClass('even-end');
	}else if($(".commentlist li:last").hasClass('odd')){
		$('#respond').addClass('odd-end');
	}	

	$('#widget-tags h3 a.botao').click(function() {
		$('#widget-tags h3 a.botao').removeClass('ativo');
		$(this).addClass('ativo');
		if ($('#widget-tags h3 a.lista').hasClass('ativo')) {
			$('#widget-tags #tags-lista').show();
			$('#widget-tags #tags-nuvem').hide();
		} else {
			$('#widget-tags #tags-lista').hide();
			$('#widget-tags #tags-nuvem').show();
		}
	});
	
	
	$('#widget-sociais-menu li a').click(function(el) {
		var widget;
		$('#widget-sociais-menu li a img').each(function() {
			$(this).attr('src', $(this).attr('src').replace('-ativo', ''));
		});
		$(this).children().each(function() {
			$(this).attr('src', $(this).attr('src').replace('.gif', '-ativo.gif'));
			widget = $(this).attr('id').replace('sociais-img-', '');
		});
		$('.sociais-widget .widget-sociais').hide();
		$('#widget-' + widget).show();
	});
	
	$("#commentform").validate({
		errorLabelContainer:  $("span#erros")
	});

	$('a > img', '#content').parent('a[href$=jpg]').colorbox();
	$('a[rel=flickr]').colorbox({
		close: 'Fechar',
		current: "Imagem {current} de {total}"
	});
	
	/* Destaques */
	$('div#img-list').cycle({
		fx: 'fade',
		after: function(current, next){
			$('ul#destaques-lista > li').removeClass('ativo');
			postID = $(next).attr('id').replace('img-', '');
			$('li#post-' + postID).addClass('ativo');
		}
	});
});