function mycarousel_itemLoadCallback_all_products(carousel, state){
     
    if (carousel.has(carousel.first, carousel.last)) {
        return;
    }
    
    jQuery.get(    
        "index.php?page=ajax_functions_slider",
        {
            first: carousel.first,
            last: carousel.last,
            slider: "products",
            current_category_id: current_category_id
        },
        function(xml) {
            mycarousel_itemAddCallback_all_products(carousel, carousel.first, carousel.last, xml);
        },
        'xml'
    );
};

function mycarousel_itemAddCallback_all_products(carousel, first, last, xml){
    carousel.size(parseInt(jQuery('total', xml).text()));
    
    var count = 0;
    
    jQuery('item', xml).each(function(i) {
        count = count + 1;
        carousel.add(first + i, mycarousel_getItemHTML_all_products(jQuery(this), count));
    });
};

function mycarousel_getItemHTML_all_products(url, count){
    return  '<div style="height: 205px; width: 112px; float: left; border: 0px solid #DBDBDB; padding: 1px 1px 1px 1px;">' +
                '<div style="width: 112px; height: 92px;"><a href="' + jQuery('url_text', url).text() + '" title="' + jQuery('products_name', url).text() + '"><img align="middle" style="float: none; margin-left: auto; margin-right: auto;" src="' + jQuery('products_image_thumb', url).text() + '" alt="Image" /></a></div>' +
                '<div style="height:100px; margin-left: 5px; margin-right: 5px;"><h3>' + jQuery('products_name', url).text() + '</h3>' +
                '<div>' + jQuery('products_short_description', url).text() + '</div></div>' + 
                '</div>' +
                '<div style="float: left; height: 15px; margin-top: 5px; margin-left: 5px;"><a class="button_' + text_more + '" href="' + jQuery('url_text', url).text() + '">' + text_more + '</a></div> ' +
            '';    
};

jQuery(document).ready(function() {
    jQuery('#mycarousel_horizontal_all_products ul').empty();
    $("#mycarousel_horizontal_all_products_ul").attr("style", "display: block;");
    jQuery('#mycarousel_horizontal_all_products').jcarousel({
        scroll: 4,
        itemLoadCallback: mycarousel_itemLoadCallback_all_products
    });
});

