function mycarousel_itemLoadCallback(carousel, state)
{
    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.
 <div style="margin-top: 20px;#margin-top: 15px;margin-left:8px; height: 100px;text-align:left;"><span style="font-family:Arial;font-size:10px;margin-left:0px;">' + item.title+'...</span></a><div style="width:15px;height:15px;"><a href="http://'+item.link+'/index.php?page=products_detail&prod='+item.id+'" class="linkCitesteMult">more>></a></div><div style="text-align:right;margin-right:10px;margin-bottom:5px;"><img border="0" src="'+item.linkPhpThumb+'" width="50" height="50"/></div></div> 
 */
function mycarousel_getItemHTML(item)
{
 return '<div style="text-align:center;margin-top:20px;width:103px;height:86px;"><a href="http://'+item.link+'/index.php?page=products_detail&prod='+item.id+'"><img class="pozaCarusel" src="'+item.linkPhpThumb+'" width="60" height="80"/></a></div><a href="http://'+item.link+'/index.php?page=products_detail&prod='+item.id+'" class="linkCitesteMult">' + item.title+'</a>';

};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        size: mycarousel_itemList.length,
        itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback}
    });
});
