$(function()
{
    $('pre, code').addClass('prettyprint');
    prettyPrint();
    $('.box,pre,.related,.comment').corner('5px');
    $('.hf,.hfcont').corner('bl br 5px');
    $("#twitter").tweet(
    {
        username: "vegardlarsen",
        count: 1,
        auto_join_text_default: "I said,",
        auto_join_text_ed: "I",
        auto_join_text_ing: "I was",
        auto_join_text_reply: "I replied to",
        auto_join_text_url: "I was checking out",
        loading_text: "loading tweet..."
    });
    $('.article img').each(function()
    {
        var img = $(this).attr('src');
        var w = $(this).width();
        var h = $(this).height();
        var dw = 669;
        var thumb = '';
        if ($(this).hasClass('thumb'))
        {
            thumb = ' thumb';
            dw = 120;
        }
        if (w > dw)
        {
            nw = dw;
            nh = (dw / w) * h;
            $(this).wrap('<a class="lightbox'+thumb+'" href="' + img + '"></a>').width(nw + 'px').height(nh + 'px');
            $(this).parent('a').lightBox(
            {
                imageLoading: '/blog/css/lightbox/loading.gif',
                imageBtnClose: '/blog/css/lightbox/close.gif',
                imageBtnPrev: '/blog/css/lightbox/prev.gif',
                imageBtnNext: '/blog/css/lightbox/next.gif',
            }).corner("5px");
        }
    });
});
