// Initialise JB Video Player

//Shadowbox.loadSkin('classic', '/js/sb/skin'); // use the "classic" skin
//Shadowbox.loadLanguage('en', '/js/sb/lang');
//Shadowbox.loadPlayer('flv', '/js/sb/player'); // flv players

//window.onload = Shadowbox.init;

/*****************************************************************************************************************/

// Home Page Adds

function mycarousel_initCallback(carousel)
{
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

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);
};

function mycarousel_getItemHTML(item)
{
    return '<a rel="' + item.rel + '" href="' + item.href + '"><img src="' + item.url + '" width="375" height="215" alt="' + item.title + '"></a>';
};

$(function() { 
	$('#carousel').jcarousel({
        wrap: 'circular',
		auto: 4,
		scroll: 1,
		animation: 1000,
		initCallback: mycarousel_initCallback,
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });
});



