
$(function() {
    $('.slideshow')
        .after('<div id="nav">')
        .cycle({
            fx: 'fade',
            speed: 500,
            timeout: 6500,
            pause: 1,
            pager: '#nav',
            // callback fn that creates a thumbnail to use as pager anchor
            pagerAnchorBuilder: function(idx, slide) {
                return '<li><a href="#"></a></li>';
            },
            before: function() {
                var $caption = $("#slideshow_caption");
                var html = $(this).find("span").slice(0).html();
                if (typeof(html) == "undefined") html = "";
                html ? $caption.show() : $caption.hide();
                $caption.html(html);
            }
        });
});
