/**
 * @author tayane
 */
var isBlog;
$(document).ready(function() {
	
	// Estilo do menu
	$('li li.current_page_item').parent().parent().addClass('current_page_item');	

	$("#destaque-principal").jCarouselLite({
	    btnNext: ".next",
	    btnPrev: ".prev",
	    visible: 1,
		auto: 6000,
	    speed: 800,	
		pauseOnHover: true,
		beforeStart: function(){
			$('.descricao-destaque').fadeOut(function(){
				if(jQuery.browser.msie && jQuery.browser.version <= 6)
					$(this).css('background','#f6de0e');
			});
			$('.link-destaque').fadeOut();
		},
		afterEnd: function(){
			$('.descricao-destaque').fadeIn();
			$('.link-destaque').fadeIn();
		}		
	});
	
	
		
	$('.children').each(function() {
		html = $(this).html();
		$(this).html('<li class="seta-menu"></li>'+ html);		
	});
	$('.children ul.children').each(function() {
		html = $(this).html();
		$(this).html('<li class="seta-menu"></li>'+ html);		
	});

	if(isBlog != undefined){
		$('.page-item-338').addClass('current_page_item');
	}

	submenu();
	subsubmenu();
	tirarBordaUltimoLi();
	overIcones();
	
});
/* LightBox */
function miniFlickrLoaded(){
	$('.flickr-mini-gallery a').colorbox({
		current: "imagem {current} de {total}",
		previous: "voltar",
		next: "avançar",
		close: "fechar",
		opacity: 0.7
	});
}

function submenu() {
	var sfEls = $("lista-menu li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" over";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" over\\b"), "");
		}
	}
}

function subsubmenu() {
	var sfEls = $("lista-menu ul.children li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" over";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" over\\b"), "");
		}
	}
}

function tirarBordaUltimoLi() {	
	$('#barra-lateral-direita #lista-sidebar li:last-child').addClass('ultimo');
}

function overIcones() {
	$('#balao-social li a img').hover(function(){
		overImg = $(this).attr('src').replace('.png', '_over.png');
		$(this).attr('src', overImg);
	}, function(){
		overImg = $(this).attr('src').replace('_over.png', '.png');
		$(this).attr('src', overImg);
	});
	/*
	$('#balao-social li a img').each(function(){
		var imagem=$(this);
		var src1= imagem.attr('src'); // initial src
		var newSrc = src1.substring(0, src1.lastIndexOf('.'));
		imagem.hover(function(){
			$(this).attr('src', newSrc+ '_over.' + /[^.]+$/.exec(src1));
			//console.log(newSrc + '_over.' + /[^.]+$/.exec(src1));
		}, function(){
			$(this).attr('src', newSrc + '.' + /[^.]+$/.exec(src1));
		});
	});
	*/
}

