var mycarousel_itemList = [
 {url: "promos/hitachi_cp_a100.gif", href: "product_info.php?products_id=616"},
 {url: "promos/sony_vpl_cw125.gif", href: "product_info.php?products_id=330"},
 {url: "promos/grandview_fix_frame.gif", href: "product_info.php?products_id=545"},
 {url: "promos/panasonic_LB51NTEA.gif", href: "product_info.php?products_id=257"},
 {url: "promos/sony_vpl_fx41.gif", href: "product_info.php?products_id=604"},
 {url: "promos/sony_vpl_es5.gif", href: "product_info.php?products_id=168"},
/*  {url: "promos/ELITE-ezFrame.gif", href: "product_info.php?products_id="},
 {url: "promos/NEC_NP901W.gif", href: "product_info.php?products_id="},
 {url: "promos/ASKProxima_C445.gif", href: "product_info.php?products_id="}, */
 {url: "promos/grandview_pullup.gif", href: "product_info.php?products_id=562"}
];

function mycarousel_itemLoadCallback(carousel, state)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });

    for (var i = carousel.first; i <= carousel.last; i++) {
        if (carousel.has(i)) {
            continue;
        }

        if (i > mycarousel_itemList.length) {
            break;
        }

        carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[i-1]));
    }
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
    return '<a href="' + item.href + '"><img src="' + item.url + '" width="171" height="224" alt="' + item.url + '" /></a>';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
		auto: 3,
		scroll: 1,
        wrap: 'both',
        size: mycarousel_itemList.length,
        itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback}
    });
});
