function mycarousel_itemLoadCallback(carousel, state) {
        // Check if the requested items already exist
        if (carousel.has(carousel.first, carousel.last)) {
        return;
        }
        jQuery.get(
        '/carousel/images?first=1&amp;last=6&amp;venue_id=22', {
        first: carousel.first,
        last: carousel.last
        },
        function (xml) {
        mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, xml);
        },
        'xml');
        };
        
        function mycarousel_itemAddCallback(carousel, first, last, xml) {
        var events = jQuery('event', xml);
        
        // Set the size of the carousel
        carousel.size(parseInt(jQuery('total', xml) .text()));
        
        /* jQuery('event', xml) .each(function (i) {
        carousel.add(first + i, mycarousel_getItemHTML(jQuery(this) .text()));
        });*/
        
        events.each(function (i) {
        carousel.add(first + i, mycarousel_getItemHTML(this));
        });
        };
        
        /**
        * Item html creation helper.
        */
        function mycarousel_getItemHTML(event) {
        return '&lt;a href="/event/' + jQuery('id', event) .text() + '"&gt; &lt;img src="/image.php?image=' + jQuery('image', event) .text() + '&amp;w=250&amp;h=250&amp;cw=250&amp;ch=160&amp;c=1" width="248" height="160" alt="' + jQuery('headline', event) .text() + '" /&gt; &lt;/a&gt; ' + '&lt;h1 class="summary"&gt; &lt;a href="/event/' + jQuery('id', event) .text() + '"&gt; &lt;strong&gt;' + jQuery('headline', event) .text() + '&lt;/strong&gt; &lt;span&gt;' + jQuery('support', event) .text() + '&lt;/span&gt; &lt;/a&gt; &lt;/h1&gt;' + '&lt;div class="description"&gt; &lt;span&gt;' + jQuery('ages', event) .text() + '&lt;/span&gt; &lt;span>' + jQuery('time', event) .text() + '&lt;/span&gt; &lt;/div&gt;' + '&lt;a href="' + jQuery('tickets', event) .text() + '" class="tickets"&gt;Tickets&lt;/a&gt;';
        };
        
        jQuery(document) .ready(function () {
        jQuery('#mycarousel') .jcarousel({
        // Uncomment the following option if you want items
        // which are outside the visible range to be removed
        // from the DOM.
        // Useful for carousels with MANY items.
        
        // itemVisibleOutCallback: {onAfterAnimation: function(carousel, item, i, state, evt) { carousel.remove(i); }},
        itemLoadCallback: mycarousel_itemLoadCallback,
        scroll: 1
        });
        });