$(document).ready(function () {

    // carousel
    $('#slider-home').jcarousel({
        auto: 6,
        wrap: 'circular',
        scroll: 1,
        animation: 2000,
        itemVisibleInCallback: {
            onBeforeAnimation: mycarousel_itemVisibleInCallbackBeforeAnimation,
            onAfterAnimation: mycarousel_itemVisibleInCallbackAfterAnimation
        }
    });

    // cycle
    $('#right .testimonials').cycle({
        fx: 'fade',
        speed: 1500,
        timeout: 6000,
        next: '#next',
        prev: '#prev',
        pager: '.testimonials-navigation',
        pagerAnchorBuilder: function (idx, slide) {
            return '<a href="#">View Image Number ' + (idx + 1) + '</a>';
        }
    });
});


/**
* This is the callback function which receives notification
* when an item becomes the first one in the visible range.
* Triggered before animation.
*/
function mycarousel_itemVisibleInCallbackBeforeAnimation(carousel, item, idx, state) {
    // No animation on first load of the carousel
    if (state == 'init')
        return;

    //jQuery('img', item).fadeIn('slow');
    //Cufon.set('fontFamily', 'Omnes').replace('h1')('h2')('h3');
};

/**
* This is the callback function which receives notification
* when an item becomes the first one in the visible range.
* Triggered after animation.
*/
function mycarousel_itemVisibleInCallbackAfterAnimation(carousel, item, idx, state) {
    //display('Item #' + idx + ' is now visible');
};

