 function mycarousel_itemLoadCallback(carousel, state)
    {
        // Check if the requested items already exist
        if (carousel.has(carousel.first, carousel.last)) {
            return;
        }
        //alert(carousel.first + "=>" + carousel.last +'=>'+item+"=>"+lang);

        jQuery.get(
            '/ajax_bottom_section.php',
            {
                first: carousel.first,
                last: carousel.last,
                id: item,
                lang: lng
            },
            function(xml) {
                mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, xml);
            },
            'xml'
        );
    }

    function mycarousel_itemAddCallback(carousel, first, last, xml)
    {
        // Set the size of the carousel
        carousel.size(parseInt(jQuery('total', xml).text()));

        jQuery('image', xml).each(function(i) {
//            carousel.add(first + i, mycarousel_getItemHTML(jQuery(this).text()));
          var item = jQuery(mycarousel_getItemHTML(jQuery(this).text()));

          // Apply thickbox
          //tb_init(item);
          carousel.add(first + i, item);
        });
    }


    function mycarousel_getItemHTML(url)
    {
        var url_ = url.split('|');

        var img_src = url_[0];
        var img_width = url_[1];
        var img_height = url_[2];
        var item_id = url_[3];
        var name = url_[4];
        var old_price = url_[5];
        var price = url_[6];
        var currency = url_[7];
        var in_cart = url_[8];
        var lang = url_[9];
        var urname = url_[10];
        var lang_id = url_[11];
        var text = '';

        if(img_height > 65)
        {
           img_height = 65;
           img_width = img_width*(65/img_height);
        }

        text += '<div class="product" style="margin-top:5px;margin-left:5px;border:none 1px">';
        text += '<div style="height:75px">';
        if(img_src!='')
        {
           text += '<a title="'+name+'" href="'+lang+'/item/'+item_id+'/name/'+urname+'/"><img src="/images/it/'+img_src+'" border="0" alt="'+name+'" width="'+img_width+'" height="'+img_height+'"/></a>';

        }
        text += '</div>';
        text += '<div><a class="name" title="'+name+'" href="'+lang+'/item/'+item_id+'/name/'+urname+'/" style="text-decoration: none; color: #333300">'+name+'</a>';
        text += '<span class="price">';
        if(old_price > 0)
        {
          text += '<strike>'+old_price+'</strike>&#160;';
        }
        text += price+'</span><span class="currency">&#160;'+currency+'</span>';

        text += '<span id="itm_'+item_id+'" style="width:33px;height:34px">';
        if(in_cart == 1) text += '<a id="cart_'+item_id+'" class="by" style="background:url(/i/trash-active.gif) no-repeat;" title="" href="javascript://" onClick="delFromCart(\''+item_id+'\',\'/i/trash.gif\',\'\',\''+lang_id+'\',\'/i/trash_over.gif\')" onmouseover="changeBgCart(\'cart_'+item_id+'\',\'/i/trash.gif\')" onmouseout="changeBgCart(\'cart_'+item_id+'\',\'/i/trash-active.gif\')"></a>';
        else text += '<a id="cart_'+item_id+'" class="by" style="background:url(/i/trash.gif) no-repeat;" title="" href="javascript://" onClick="add2Cart(\''+item_id+'\',\'/i/trash-active.gif\',\'/i/trash.gif\',\''+lang_id+'\',\'/i/trash_over.gif\')" onmouseover="changeBgCart(\'cart_'+item_id+'\',\'/i/trash_over.gif\')" onmouseout="changeBgCart(\'cart_'+item_id+'\',\'/i/trash.gif\')"></a>';
        text += '</span>';
        text += '</div>';

        text += '</div>';
        //alert(text);
        return text;


    }

    jQuery(document).ready(function() {
        jQuery('#mycarousel').jcarousel({
            //itemVisibleOutCallback: {onAfterAnimation: function(carousel, item, i, state, evt) { carousel.remove(i); }},
            itemLoadCallback: mycarousel_itemLoadCallback,
            size: 3,
            scroll: 3,
            visible: 3


        });
    });