var mycarousel_itemList = [
    {url: 'http://www.organicguide.com/wp-content/themes/OG4/images/featured/juice2.jpg', title: 'Juice Beauty', site: 'http://www.juicebeauty.com'},
    {url: 'http://www.organicguide.com/wp-content/themes/OG4/images/featured/Revolution-Tea-280by280.jpg', title: 'Revolution Tea', site: 'http://www.revolutiontea.com'},
    {url: 'http://www.organicguide.com/wp-content/themes/OG4/images/featured/frey-wines-selection-280by280.jpg', title: 'Frey Wine', site: 'http://www.freywine.com'},
    {url: 'http://www.organicguide.com/wp-content/themes/OG4/images/featured/Fresh-Life-Sprouter-280by280.jpg', title: 'Fresh Life Sprouter', site: 'http://www.freshlifesprouter.com'},
    {url: 'http://www.organicguide.com/wp-content/themes/OG4/images/featured/organic-lip-balm.jpg', title: 'Absolutely Gorgeous', site: 'http://www.absolutelygorgeous.com.au'},
    {url: 'http://www.organicguide.com/wp-content/themes/OG4/images/featured/Pete-Gerry-Eggs-280by280.jpg', title: "Pete &amp; Gerry's Organic Eggs", site: 'http://www.peteandgerrys.com/'}
];





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 '<h1>' + item.title + '</h1><a href="' + item.site + '" rel="nofollow"><img src="' + item.url + '" width="280px" height="280px" alt="' + item.title + '" /></a>';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        wrap: 'circular',
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });
});
