
var mycarousel_itemList = [
    {url: 'includes/images/gallery_images/Flames-Cake-small.jpg', urlxl: 'includes/images/gallery_images/Flames-Cake.jpg', title: 'Flames Birthday Cake'},
    {url: 'includes/images/gallery_images/Steak-Potato-Wrap-small.jpg', urlxl: 'includes/images/gallery_images/Steak-Potato-Wrap.jpg', title: 'Steak and Potato Wrap'},
    {url: 'includes/images/gallery_images/Strawberry-Sundae-small.jpg', urlxl: 'includes/images/gallery_images/Strawberry-Sundae.jpg', title: 'Strawberry Sundae'},
    {url: 'includes/images/gallery_images/California-Burger-small.jpg', urlxl: 'includes/images/gallery_images/California-Burger.jpg', title: 'California Burger'},
    {url: 'includes/images/gallery_images/Seafood-Skillet-small.jpg', urlxl: 'includes/images/gallery_images/Seafood-Skillet.jpg', title: 'Seafood Skillet'}
];

function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a
    // given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
    return '<a href="' + item.urlxl + '" class="highslide" onclick="return hs.expand(this)"><img src="' + item.url + '" width="247" height="162" border="0" alt="' + item.title + '" /></a>';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        wrap: 'circular',
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });
});
