var mycarousel_itemList = [
    {html: '<a href="genius_card.php"><div class="fundraising_item"><p style="margin-top: 10px; line-height: 100%;">Genius<br>Card</p></div></a>'},
    {html: '<a href="donate.php"><div class="fundraising_item"><p style="margin-top: 30px;">donate!</p><p style="font-size: 33%">(tax free)</p></div></a>'},
    {html: '<a href="bid_for_the_building.php"><div class="fundraising_item"><p>Bid</p><p style="font-size: 72%;">for the</p><p style="margin-left: -1px;">Building</p></div></a>'},
];    

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 item.html;
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        vertical: true,
        auto: 3,
        visible: 1,
        scroll: 1,
        wrap: 'circular',
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });
});

