$(function(){
    
    // Go to the top
    $('.top').click(function(){
        $('html, body').animate({scrollTop:0},1000);
        return false;
    });
    
    //Author comments capability in IE7 and IE8
    $('#comments li, #comments li li, #comments li li li').each(function() {
        if( !$(this).hasClass('bypostauthor') ) {
            $(this).children('.comment-box').addClass('guest');
        }
    });
    
    $('#content .block-one .post p a img').parent().css({
        'border':0,
        'padding':0
    });
    
    // Sidebar widgetizing
    $('.side-content').each(function(){
        var list = $(this).children().hasClass('list');
        var others = $(this).children().hasClass('others');
        var adv = $(this).children().hasClass('adv');
        var scriptPositionOne = $(this).children().children().is('script');
        var scriptPositionTwo = $(this).children().children().children().is('script');
        
        if((list == false) && (others == false) && (adv == false) && (scriptPositionOne == false) && (scriptPositionTwo == false)) {
            var contain = $(this).html();
                
                if($(this).children().is('form') || $(this).children().is('select') || $(this).children().is('div, a') ) {
                    $(this).html('<div class="other">'+ contain +'</div>');
                }
                if($(this).children().is('ul')) {
                    $(this).html('<div class="list">'+ contain +'</div>');
                }
        }
    });
    
    // Navigation effects
    if(!$.browser.msie) {
        //Subnavigation effects
        $('#navigation ul li').hover(function(){
            $(this).children('ul').stop().css({
                'display':'block',
                'opacity':0
            }).animate({
                'opacity':0.9
            },500);
    
        },function(){
            $(this).children('ul').stop().animate({
                'opacity':0
            },500).css('display','none');
        });
    }
    
    // Browser problems fixed
    if($.browser.opera) {
        $('#content .block-one .post p, #content .block-one.archive p, #comments li .comment-box .content p').css('text-align','right');
    }
    
});
