// -----------------------------------------------------------------------------
// Cufon
// -----------------------------------------------------------------------------

// Replacing headings h1-h3 with Univers Light
Cufon.replace('h1, h2, h3');

//-----------------------------------------------------------------------------
// jQuery
//-----------------------------------------------------------------------------

jQuery(function($)
{
    // -------------------------------------------------------------------------
    // Global
    // -------------------------------------------------------------------------

    // Assign external links to class 'external'
    $('a[href^="http://"]:not([href*="kflorence.com"],[href*="kyleflorence.com"])')
        .addClass("external").click(function() {
        window.open($(this).attr('href'));
        return false;
    });

    // Bind elements to expandCollapse
    $('.details').expandCollapse({ startHidden : true });

    // -------------------------------------------------------------------------
    // Navigation
    // -------------------------------------------------------------------------

    // Me
    $('#subnav-me').expandCollapse({
        updateText        : false,
        updateClass       : false,
        startHidden       : ($('body#me').length ? false : true),
        triggerEvent      : "click",
        triggerElement    : $('#trigger-me'),
        expandDuration    : "fast",
        collapseDuration  : "slow"
    });

    // Work
    $('#subnav-work').expandCollapse({
        updateText        : false,
        updateClass       : false,
        startHidden       : ($('body#work').length ? false : true),
        triggerElement    : $('#trigger-work'),
        expandDuration    : "fast",
        collapseDuration  : "slow"
    });

    // Play
    $('#subnav-play').expandCollapse({
        updateText        : false,
        updateClass       : false,
        startHidden       : ($('body#play').length ? false : true),
        triggerElement    : $('#trigger-play'),
        expandDuration    : "fast",
        collapseDuration  : "slow"
    });
});