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

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

    // Enable javascript styles
    $('.portfolio').addClass('javascript');

    // Set up scrollable
    $(".portfolio .scrollable").scrollable({
        size : 1,
        clickable : false,

        // adjust item height on item change
        onBeforeSeek : function(targetIndex)
        {
            this.getRoot().animate({
                height: this.getItems().eq(targetIndex).outerHeight()
            }, this.getConf().speed);
        },

        // adjust item height on load
        onReload : function()
        {
            var self = this;
            var item = this.getItems().eq(0);

            // wait for the item to load first
            item.find('img').load(function()
            {
                self.getRoot().animate({
                    height: item.outerHeight()
                }, 0);
            });
        }
    }).circular().navigator();
});