/* ========================================
       Document ready events
   ======================================== */ 
$(document).ready(function() {
    /* Expand the "work" subnav */

    // If it's expanded when the page loads
    if ( $('.main-nav .work').siblings('ul').hasClass('visible') ) {
        $('.main-nav .work').toggle(function() {
            $(this).siblings('ul').slideUp('slow');
        }, function() {
            $(this).siblings('ul').slideDown('slow');
        });
    }
    // If it's collapsed when the page loads
    else {
        $('.main-nav .work').toggle(function() {
            $(this).siblings('ul').slideDown('slow');
            $(this).addClass('current');
        }, function() {
            $(this).siblings('ul').slideUp('slow');
            $(this).removeClass('current');
        });
    }
    /* Expand the "about" subnav */

    // If it's expanded when the page loads
    if ( $('.main-nav .about').siblings('ul').hasClass('visible') ) {
        $('.main-nav .about').toggle(function() {
            $(this).siblings('ul').slideUp('slow');
        }, function() {
            $(this).siblings('ul').slideDown('slow');
        });
    }
    // If it's collapsed when the page loads
    else {
        $('.main-nav .about').toggle(function() {
            $(this).siblings('ul').slideDown('slow');
            $(this).addClass('current');
        }, function() {
            $(this).siblings('ul').slideUp('slow');
            $(this).removeClass('current');
        });
    }

    /* Bio slideshow */

    // If the slideshow is on this page
    if ($('#bio-slideshow').length) {
        $('#bio-slideshow').cycle({ 
            pager:  '.bio-slideshow-nav',
            fit: true,
            height: 364
        }); 
    }
});

