$(document).ready(function() {
    // Activate the nav block accordion
    $("#nav").accordion({
        collapsible: true,
        header: 'h3',
        animated: false,
        fillSpace: true
    });
    
    $('.title:first', 'body')
        .andSelf()
        .contents()
        .filter(function(){
            return this.nodeType === 3;
        })

    .filter(function(){
        // Only match when contains 'Portfolio' in a <span> tag
        return this.nodeValue.indexOf('Portfolio:') != -1;
    })

    .each(function(){
        $("#nav").accordion({
            active: 1
        });
    });

    // Assign a hrefs to prettyPhoto JQuery plugin
    $('a.lightbox').lightBox({
        overlayBgColor: '#000',
        overlayOpacity: 0.6,
        imageLoading: 'http://motobug.com/images/lightbox-ico-loading.gif',
        imageBtnClose: 'http://motobug.com/images/lightbox-btn-close.gif',
        imageBtnPrev: 'http://motobug.com/images/lightbox-btn-prev.gif',
        imageBtnNext: 'http://motobug.com/images/lightbox-btn-next.gif',
        containerResizeSpeed: 350,
        txtImage: 'Portfolio Image',
        txtOf: 'of'
    });
});
