$(document).ready(function(){
    //small images
    $('.itemlist ul li a[class!=selected]').hover(function(){
        $(this).find('span.themesmall').animate({opacity: '1'}, 700);
    }, function(){
        $(this).find('span.themesmall').animate({opacity: '.3'}, 700);
    });

    var prevnextmargintop = Math.ceil(($('#mainphoto img').height() + $('.prevnext a').height())/2);
    if (prevnextmargintop > 0) {
        $('.prevnext a big').css('display','none');
        $('.prevnext a').css('marginTop','-'+prevnextmargintop+'px');
        $('.prevnext a.prevlink').css({'margin-left':'-40px'});
        $('.prevnext a.nextlink').css({'margin-right':'-55px'});
    }
    
    //string with *
    $('span.strong').append('<span class=\"strongstar\">*</span>');

    //footer 2 bottom;
    function fe_footer2bottom(){
        if ($('body').height() < $(window).height()) {
            $('#footer').css({'position': 'absolute', 'bottom': '0px'});
        } else {
            $('#footer').css({'position': 'relative', 'bottom': ''});
        }
    }

    fe_footer2bottom();
    $(window).resize(function(){
        fe_footer2bottom();
    });

    //comments
    $('#comments_count').html('<span class="openhide">'+$('#comments_count').text()+'</span>');
    $('#fe_comment_form_addblock').html('<span class="openhide">'+$('#fe_comment_form_addblock').text()+'</span>');
    $('#comments_list > dl').hide();
    if ($('#fe_errorflag').text() != '1') {
        $('#fe_comment_form').hide();
    }

    $('#comments_count').click(function(){
        $('#comments_list > dl').toggle('fast');
    });

    $('#fe_comment_form_addblock').click(function(){
        $('#fe_comment_form').toggle('fast');
    });

    $('#comments_list a').click(function(){
        var retr_id = $(this).attr('rel');
        $('#ee_comments_parent_id').val(retr_id);
        $('#comments_list > dl').hide();
        $('#fe_comment_form').show();
        return false;
    });

});
