// redefine Cycle's updateActivePagerLink function
$.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) {
    $(pager).find('a').removeClass('active')
        .filter('a:eq('+currSlideIndex+')').addClass('active');
};

$(function() {
		   
    $('#topBannerContainer').cycle({
        timeout: 7500,
        pager:  '#topBannerBtns',
        pagerAnchorBuilder: function(idx, slide) {
			idx = idx+1;
            return '<a href="#">'+idx+'</a>';
        }
    });
	
	$('#topBannerBtns a:not(:last)').after('|');
	
    $('#sliderContentColContainer').cycle({
        timeout: 3500,
        pager:  '#sliderContentColNav',
        pagerAnchorBuilder: function(idx, slide) {
			idx = idx+1;
            return '<a href="#"><img src="img/blank.gif" width="1" height="1"></a>';
        }
    });
	
});




$(document).ready(function() {
	// corrigir HR post secundário
	$('.secPostHrIn:last').css({'background' : 'none'});

	// menu lateral
	$('ul#nav > li div').hide();	
	$('ul#nav > li').hover(function() {
    $('div:first', this).show();
	}, function() {
    	$('div:first', this).hide();
  	});

	// SELECIONA CLASSE BODY E DEFINE CONFIGS //
	bodyClass = $("body").attr("class");
	
	if(bodyClass == "home"){  }
	
	if(bodyClass == "noticia" || bodyClass == "galeria"){
		$('a.nyroModal').nyroModal({ 
			zIndexStart: 999,
			galleryLinks: '<a href="#" class="nyroModalPrev" title="Anterior">Anterior</a><a href="#" class="nyroModalNext" title="Pr&oacute;xima">Pr&oacute;xima</a>', // Use .nyroModalPrev and .nyroModalNext to set the navigation link
			closeButton: '<a href="#" class="nyroModalClose" id="closeBut" title="Fechar">Fechar</a>', // Adding automaticly as the first child of #nyroModalWrapper 
			contentLoading: '<a href="#" class="nyroModalClose" title="Cancelar">Cancelar</a>', // Loading div content
			contentError: 'O conte&uacute;do solicitado n&atilde;o foi encontrado... tente novamente mais tarde.<br /><a href="#" class="nyroModalClose">Fechar</a>' // Content placed in the loading div in case of error
		});
		
		$('a.icoPrint').nyroModal({
			padding: 40,
			width: 700
		});
	}


});
