jQuery(document).ready(function($) {
    $('.archive').bind('click', function(ev) {
        if (ev.target.tagName != 'A') { 
            $(this).find('.month').slideToggle();
            $(this).find('.archivemore').toggle();
        }
    });
        
    $('.month').hide();
    $('.archive').append('<div class="archivemore">[click for more]</div>');
});

shorten = function(text) {
    if (text.length > 100) {
        return text.substr(0,99);
    }
    return text;
}
jQuery(function($){
    $.getScript('http://platform.twitter.com/anywhere.js?9lQf95mNQVDMwVpovv0OhA', function() {
        twttr.anywhere.config('9lQf95mNQVDMwVpovv0OhA');
        twttr.anywhere("pre", function(twitter) {
            twitter('.tweetbox').tweetBox({
                label: 'Tweet this',
                defaultContent: 'Just reading '+shorten(document.title)+' '+short_url+' by @bruntonspall'
            });

            twitter('.entry').hovercards();
            twitter('.link').hovercards();
            twitter('#twitter-followme').followButton('@bruntonspall');
            if (twitter.isConnected()) {
            } else {
                twitter('#twitter-user-box').connectButton();
            }
        });
    });
});
