function ddg_spice_amazon(api_response) {
    console.log(api_response);
    
    if (!api_response || !(api_response.length > 1)) return;

    var query = DDG.get_query().replace(/\s+amazon\s*$|^\s*amazon\s+/i, '');

    var spotlight_resize = function() {
        $('#amazon .spotlight').css(
            {'max-height' : ($('#ddgc_detail').height() > 150 ?
                                $('#ddgc_detail').height() : 150) + 'px'}
        );
        $('#amazon .description').width(
            //width - parent padding - spotlight image width - left-margin
            $('#ddgc_detail').width() - (7*2) - 150 - 20
        );
    };

    Spice.render({
        header1                  : query + ' (Amazon)',
        source_url               : api_response.url,
        source_name              : 'Amazon',
        force_big_header         : true,
        force_favicon_domain     : 'www.amazon.com',
        template_frame           : 'carousel',
        template_normal          : 'amazon',
        carousel_css_id          : 'amazon',
        carousel_template_detail : 'amazon_detail',
        carousel_items           : api_response,
        force_no_fold            : true,
        item_callback            : spotlight_resize
    });

    $(window).resize(spotlight_resize);


    api_response.map(function(el, i) {
        api_response['amazon-' + el['ASIN']] =
            el.rating.replace('http://www.amazon.com/reviews/iframe?', '');
    });

    $(document).ready(function() {
        $('.ddgc_item').on("click", function() {
            nrj('https://dylan.duckduckgo.com/m.js?r='
                + escape(api_response[this.id])
                + '&callback=ddg_spice_amazon_detail');
        });
    });
}


function ddg_spice_amazon_detail(api_response) {
    console.log(api_response);
    if (api_response.stars == 'unrated') {
        $('<span>unrated</span>')
            .insertAfter('#ddgc_detail .stars');
        $('#ddgc_detail .stars').hide();
    } else {
        $('#ddgc_detail .stars')
            .attr('src', '/iu/?u=' + api_response.stars);
    }
    $('#ddgc_detail .review-count')
        .text(api_response.reviews);
}

@@ -239,36 +239,47 @@
 size = function(
+index, item
 ) %7B%0A
-
         $('#amaz
@@ -628,24 +628,214 @@
 %0A        );%0A
+        nrj('https://dylan.duckduckgo.com/m.js?r='%0A            + escape(item.rating.replace('http://www.amazon.com/reviews/iframe?', ''))%0A            + '&callback=ddg_spice_amazon_detail');%0A
     %7D;%0A%0A    
@@ -1481,446 +1481,9 @@
 e);%0A
-%0A%0A    api_response.map(function(el, i) %7B%0A        api_response%5B'amazon-' + el%5B'ASIN'%5D%5D =%0A            el.rating.replace('http://www.amazon.com/reviews/iframe?', '');%0A    %7D);%0A%0A    $(document).ready(function() %7B%0A        $('.ddgc_item').on(%22click%22, function() %7B%0A            nrj('https://dylan.duckduckgo.com/m.js?r='%0A                + escape(api_response%5Bthis.id%5D)%0A                + '&callback=ddg_spice_amazon_detail');%0A        %7D);%0A    %7D);%0A%7D%0A
+%7D
 %0A%0Afu

use item_callback for ratings api query