function printIt(getSlug){
$('.txt *').removeClass().attr('style','');
    $.post($('base').attr('href')+"print.php",{
        title: $('h1').html(),
        content: $('.txt').html(),
        siteName: $('title').text(),
        siteURL: $('base').attr('href').substring(0,$('base').attr('href').length-1),
        slug: getSlug
    },function(html){
        $('body *').css('display','none');
        $('body').css('background','transparent none');
        $('body').append('<div id="print"><!-- --></div>');
        $('#print').css('display','block');
        $('#print').html(html);
    });
}
$(document).ready(function(){
    if($('.fancybox').size())
        $('.fancybox').fancybox();
        $('.suggest').fancybox({type:'iframe', width: 600, height: 500 });
        $('.map').fancybox({type:'iframe', width: 901, height: 511 });
    $('a[rel=external]').attr('target','_blank');
    if(!jQuery.support.htmlSerialize)
        $('a[rel=sidebar]').click(function(){ bookmarksite(this); });
    $('a[rel=back]').click(function(){ history.go(-1); });
    $('a[rel=top]').click(function(){ window.scrollTo(0,0); });
    $('a[rel=print]').click(function(){printIt(location.pathname);return false;});
    $('a[rel=increasetext]').click(function(){$.FontSizer.IncreaseSize();return false;});
    $('a[rel=decreasetext]').click(function(){$.FontSizer.DecreaseSize();return false;});
    //ie6 png fix
    if(typeof(DD_belatedPNG)!='undefined'){
        DD_belatedPNG.fixPng($('.box_banner img.pag_tribuna').get(0));
    }
    var $li = $('#cabecalho > ul  > li');
    var $sli;
    $li.each(function(){
        if($(this).hasClass('selected'))
           $sli = $(this);     
    });
    $li.hover(
        function(){
            $(this).addClass('selected');
            if(this!=$sli.get(0))
                $sli.removeClass('selected');
        },
        function(){
            $(this).removeClass('selected');
            $sli.addClass('selected');
        }
    );
    $('body').append('<div class="dbanner-overlay"><!-- --></div><div class="dbanner-content"><div class="dbanner-demo"><div class="dbanner-width"></div><div class="dbanner-height"></div></div><div class="dbanner-title"><!-- --></div><div class="dbanner-desc"><!-- --></div><a href="javascript:;" class="dbanner-close">Fechar&nbsp;X</a></div>');
    $('.dbanner').click(function(){
        var $this = $(this);
        var $parentTR = $this.parent().parent();
        var width = $parentTR.find('td').eq(1).text().split('x')[0];
        var height = $parentTR.find('td').eq(1).text().split('x')[1];
        var desc = 'Nome: '+$this.text()+' <br />'+'Formato em pixel: '+$parentTR.find('td').eq(1).text()+'<br />'+'Peso (Kb): '+$parentTR.find('td').eq(2).text();
        //$('html').css('overflow','hidden');
        window.scrollTo(0,0);           
        $('.dbanner-overlay').css({height: $('body').height(), width: $('body').width() }).fadeIn(1000, function(){
            $(this).css('opacity', '0.9');
            $('.dbanner-width').text(width+'px');
            $('.dbanner-height').text(height+'px');
            $('.dbanner-demo').css({width: width+'px', height: height+'px', top: $(this).height()/2-height/2+'px', left: $(this).width()/2-width/2+'px' });
            $('.dbanner-title').css({ top: $('body').height()/2-height/2-40+'px', left: $('body').innerWidth()/2-width/2+'px' }).html($this.text());
            $('.dbanner-close').css({ top: $('body').height()/2-height/2-80+'px', left: $('body').width()/2+width/2-50+'px' });
            $('.dbanner-desc').css({ top: $('body').height()/2+height/2+20+'px', left: $('body').width()/2-width/2+'px' }).html(desc);
            $('.dbanner-content').css('display','block');
            window.scrollTo(0, $('body').height()/2-height/2-100);
        });
    });
    $('.dbanner-overlay, .dbanner-close').click(function(){
        $('.dbanner-overlay, .dbanner-content').fadeOut(1000, function(){
            $('html').css('overflow','auto');
        });
        return false;                                
    });
});
$(window).load(function(){
    if((location.href).search("version=print")!=-1)
        $('a[rel=print]').click();
});
