var loaded = false;
$(document).ready(function() {
    if (!loaded) {
        $('.entry').click(function(event) {
            if (!$(event.target).is('a')) {
                window.location = $('h2 a', this).attr('href');
            }
        }).hover(function(event) {
            $(this).addClass('hover');
        }, function(event) {
            $(this).removeClass('hover');
        });

        $('label').each(function() {
            if (!$(this).next('select').size()) {
                $(this).overlabel();  
            }
        });

        var tagList = $('#tags li');
        var visibleTagMax = 5;
        tagList.slice(visibleTagMax).hide();
        if (tagList.size() > visibleTagMax) {
            $('#tags').after('<p id="show-all-tags">+ <a href="#">More...</a></p>');
            $('#show-all-tags a').click(function(event) {
                event.preventDefault();
                tagList.show();
                $(this).parents('p').hide();
            });
        }
        loaded = true;
    }
});
