function mycarousel_itemLoadCallback(carousel, state)
{
    // Check if the requested items already exist
    if (carousel.has(carousel.first, carousel.last)) {
        return;
    }

    $.get(
        '/scrollFooterFeature/',
        {
            first: carousel.first,
            last: carousel.last
        },
        function(xml) {
            mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, xml);
			setTimeout( function() {
				$( window ).trigger( 'resize' );
			}, 1000 );
        },
        'xml'
    );
};

function mycarousel_itemAddCallback(carousel, first, last, xml)
{
    // Set the size of the carousel
    carousel.size(parseInt($('total', xml).text()));

    $('image', xml).each(function(i) {
        carousel.add(first + i, mycarousel_getItemHTML($(this).text()));
    });
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(url)
{
	myurl = url.split("|");	
    return '<a title="'+myurl[2]+'" href="'+myurl[1]+'"><img src="' + myurl[0]+ '" width="100" height="75" alt="" /></a>';
};

$(document).ready(function() {
    $('#mycarousel').jcarousel({
        itemLoadCallback: mycarousel_itemLoadCallback
    });	
	
	$("#mycarousel ul img").live('hover', function() {
		$('#scrollDivContent').html($(this).parent().attr('title'));
	});
	
	$('#mycarousel2').jcarousel({scroll: 2});
	$('#mycarousel3').jcarousel({scroll: 1});
	
});
