
function loadItemHandler(carousel, start, last, available)
{
    if (!available) {
        for (var i = start; i <= last; i++) {
            if (i > itemList.length) {
                break;
            }

            carousel.add(i, getItemHTML(itemList[i - 1]));
        }
    }

    // Trigger loaded
    carousel.loaded();
};

function getItemHTML(url)
{
    // return '<img src="' + url + '" width="' + 85 + '" height="' + 75 + '" />';
    return '<img src="' + url + '" />';
};

// Next-Button handling...
var nextOver = function() {
    jQuery(this).attr("src", "img/horizontal-ie7/next-over.gif");
};

var nextOut = function() {
    jQuery(this).attr("src", "img/horizontal-ie7/next.gif");
};

var nextDown = function() {
    jQuery(this).attr("src", "img/horizontal-ie7/next-down.gif");
};

function nextButtonStateHandler(carousel, button, enabling)
{
    if (enabling) {
        jQuery(button).attr("src", "img/horizontal-ie7/next.gif")
                      .mouseover(nextOver)
                      .mouseout(nextOut)
                      .mousedown(nextDown);
    } else {
        jQuery(button).attr("src", "img/horizontal-ie7/next-disabled.gif")
                      .unmouseover(nextOver)
                      .unmouseout(nextOut)
                      .unmousedown(nextDown);
    }
}

// Prev-Button handling
var prevOver = function() {
    jQuery(this).attr("src", "img/horizontal-ie7/prev-over.gif");
};

var prevOut = function() {
    jQuery(this).attr("src", "img/horizontal-ie7/prev.gif");
};

var prevDown = function() {
    jQuery(this).attr("src", "img/horizontal-ie7/prev-down.gif");
};

function prevButtonStateHandler(carousel, button, enabling)
{
    if (enabling) {
        jQuery(button).attr("src", "img/horizontal-ie7/prev.gif")
                      .mouseover(prevOver)
                      .mouseout(prevOut)
                      .mousedown(prevDown);
    } else {
        jQuery(button).attr("src", "img/horizontal-ie7/prev-disabled.gif")
                      .unmouseover(prevOver)
                      .unmouseout(prevOut)
                      .unmousedown(prevDown);
    }
}

// Ride the carousel...
jQuery(document).ready(function() {
    jQuery("#mycarousel").jcarousel({
        itemVisible: 7,
        itemScroll: 1,
        autoScroll: 4,
        wrap: true,
        scrollAnimation: "slow",
        loadItemHandler: loadItemHandler
    });
});
