﻿/// <reference path="JScript.js" />
$(function() {
    var itemFabricsAll = $.cookie('ItemFabrics');
    var itemFeaturesAll = $.cookie('ItemFeatures');
    var itemCommentsAll = $.cookie('ItemComments');
    var itemOrders = $.cookie('Orders');

    if (itemFabricsAll != null) {
        var fabricDetails = jiodar.deserialize(fabricList);
        var discounts = jiodar.deserialize(discountList);
        var categoriesAll = jiodar.deserialize(categoryList);
        var categoryDetails = jiodar.deserialize(categoryDetailList);
        var shippingMethodsAll = jiodar.deserialize(shippingMethodList);

        var htmls = '<div class="sbWrapper">' +
                        '<div class="sbInner">' +
                            '<div class="sbTilteBar">' +
                               '<table class="sbTabTitle" cellspacing="5" cellpadding="0">' +
                                    '<tr>' +
                                        '<td class="sbTabCol1">' +
                                            '&nbsp;' +
                                        '</td>' +
                                        '<td class="sbTabCol2" >' +
                                            'Details' +
                                        '</td>' +
                                        '<td class="sbTabCol3">' +
                                            'Qty.' +
                                        '</td>' +
                                        '<td class="sbTabCol4">' +
                                            'Cost' +
                                        '</td>' +
                                        '<td class="sbTabCol5">' +
                                            'Actions' +
                                        '</td>' +
                                    '</tr>' +
                                '</table>' +
                                '<div class="clear">' +
                                '</div>' +
                            '</div>';
        if (itemFabricsAll != null && itemFeaturesAll != null) {
            var itemfabricsAll = itemFabricsAll.split('&');
            $.each(itemfabricsAll, function(i, itemFabrics) {
                curKey = itemFabrics.split('=')[0];
                curCategory = curKey.split('_')[1];

                var lineageName = 'Category';
                $.each(categoriesAll, function(i, category) {
                    if (curCategory == category.ID) {
                        lineageName = category.LineageName;
                        lineageName = lineageName.substring(1, lineageName.length - 1).replace('/', '\'s ');

                    }
                });

                curComment = 'Please type your comments here.';
                if (itemCommentsAll != null) {
                    var comments = itemCommentsAll.split('&');
                    $.each(comments, function(i, comment) {
                        if (curKey == comment.split('=')[0]) {
                            curComment = comment.split('=')[1];
                        }
                    });
                }

                var itemFeatures = itemFeaturesAll.split('&');
                var found = false;
                $.each(itemFeatures, function(i, itemFeature) {
                    var curFeature = itemFeature.split('=');
                    if (curFeature[0] == curKey) {
                        found = true;
                    }
                });
                if (found) {
                    htmls += '<div class="sbItemWrapper">' +
                                '<div class="sbItemTitleWrapper">' +
                                    '<div class="sbItemTitleInner">' +
                                        '<table class="sbTabItemTitle" cellpadding="0" cellspacing="2">' +
                                            '<tr>' +
                                                '<td class="sbTabCol1">' +
                                                    '&nbsp;' +
                                                '</td>' +
                                                '<td>' +
                                                    '<b>Collection ' + curKey.split('_')[0] + ' :: ' + lineageName + '</b>' +
                                                '</td>' +
                                                '<td class="sbTabCol5">' +
                                                    '<a href="javascript:saveForLaterItem(\'' + curKey + '\');">Save&nbsp;for&nbsp;later</a>&nbsp;|&nbsp;<a href="javascript:deleteItem(\'' + curKey + '\');">Delete</a>' +
                                                '</td>' +
                                            '</tr>' +
                                        '</table>' +
                                    '</div>' +
                                    '<div class="clear">' +
                                    '</div>' +
                                '</div>' +
                                '<ul>' +
                                    '<li>' +
                                        '<div class="sbItemBodyWrapper">' +
                                            '<div class="sbItemStyles">' +
                                                '<table class="sbTabItemStyle" cellspacing="3" cellpadding="0">' +
                                                    '<tr>' +
                                                        '<td class="sbTabCol1">' +
                                                            '&nbsp;' +
                                                        '</td>' +
                                                        '<td class="sbTabCol2">';
                    var itemFeatures = itemFeaturesAll.split('&');
                    var features = '';
                    $.each(itemFeatures, function(i, itemFeature) {
                        var curFeature = itemFeature.split('=');
                        if (curFeature[0] == curKey) {
                            features = curFeature[1].substring(0, curFeature[1].length - 1);
                        }
                    });
                    $.each(features.split(','), function(i, feature) {
                        htmls += '<img src="http://www.jiodar.com/App_Themes/Jiodar/Images/Features/' + feature + '.jpg" alt="" class="sbImgStyle" />';
                    });
                    htmls += '</td>' +
                                                        '<td class="sbTabCol4">' +
                                                            '$0.00' +
                                                        '</td>' +
                                                        '<td class="sbTabCol5">' +
                                                            '<a href="Styles.aspx?key=' + curKey + '">Edit styles</a>' +
                                                        '</td>' +
                                                    '</tr>' +
                                                '</table>' +
                                            '</div>' +
                                            '<div class="sbItemFabrics">' +
                                                '<table class="sbTabItemFabrics" cellspacing="3" cellpadding="0">' +
                                                    '<tr>' +
                                                        '<td class="sbTabCol1">' +
                                                            '&nbsp;' +
                                                        '</td>' +
                                                        '<td colspan="2">' +
                                                            '<table class="sbTabItemFabric" cellspacing="0" cellpadding="1">';
                    curFabrics = itemFabrics.split('=')[1];
                    curFabrics = curFabrics.substring(0, curFabrics.length - 1);
                    $.each(curFabrics.split(','), function(i, fabric) {
                        var curFabric = fabric.split('/');
                        var curFabricDetail;
                        $.each(fabricDetails, function(i, fabricDetail) {
                            imageID = fabricDetail.Fabric.ID + '_' + fabricDetail.Pattern.ID + '_' + fabricDetail.Color.ID;
                            if (imageID == curFabric[0])
                                curFabricDetail = fabricDetail;
                        });

                        var curDiscount = 0;
                        $.each(discounts, function(j, discount) {
                            if (curFabricDetail.Fabric.DiscountID == discount.ID)
                                curDiscount = discount.Percentage;
                        });

                        showDiscount = curDiscount + '%';
                        if (curDiscount == 0)
                            showDiscount = 'N/A';

                        var trStyle = 'sbTabRow2';
                        if (i % 2 == 1)
                            trStyle = 'sbTabRow1';

                        var curFabricRequired;
                        var curLabor;
                        var curMargin;
                        $.each(categoryDetails, function(i, categoryDetail) {
                            if (curCategory == categoryDetail.ID) {
                                curFabricRequired = categoryDetail.FabricRequired;
                                curLabor = categoryDetail.Labor;
                                curMargin = categoryDetail.Margin;
                            }
                        });

                        var area = (curFabricDetail.Fabric.Width * 0.0254) * curFabricRequired;
                        var weight = area * curFabricDetail.Fabric.Weight / 1000;
                        var shippingCost = weight * 25;
                        var fabricCost = curMargin * curFabricDetail.Fabric.Price * curFabricRequired;
                        var price = (Math.ceil(shippingCost + curLabor + fabricCost)).toFixed(2);

                        htmls += '<tr class="' + trStyle + '">' +
                                                                    '<td class="sbTabCol21">' +
                                                                        '<div style="background-image: url(\'App_Themes/Jiodar/Images/Fabrics/' + curFabric[0] + '.jpg\'); width:50px; height:50px;"><img src="http://www.jiodar.com/App_Themes/Jiodar/Images/Fabrics/key120.gif" alt="" width="50" height="50" border="0" /></div>' +
                                                                    '</td>' +
                                                                    '<td class="sbTabCol22">' +
                                                                        '<div>' +
                                                                            'Fabric: ' + curFabricDetail.Fabric.Name + '</div>' +
                                                                        '<div>' +
                                                                            'Pattern: ' + curFabricDetail.Pattern.Name + '</div>' +
                                                                        '<div>' +
                                                                            'Color: ' + curFabricDetail.Color.Name + '</div>' +
                                                                    '</td>' +
                                                                    '<td class="sbTabCol23">' +
                                                                        '<div>' +
                                                                            'Unit price: $' + price + '</div>' +
                                                                        '<div>' +
                                                                            'Discount: ' + showDiscount + '</div>' +
                                                                    '</td>' +
                                                                    '<td class="sbTabCol24">' +
                                                                        '<input id="txtQuantity' + curKey + '-' + curFabric[0] + '" type="text" name="txtQuantity" value="' + curFabric[1] + '" onBlur="txtQuantity_OnBlur(this)" onKeyUp="txtQuantity_OnKeyUp(this)" style="width: 20px; text-align: right; padding: 0 2px; font-size: 11px;" maxlength="2" />' +
                                                                    '</td>' +
                                                                    '<td class="sbTabCol25">' +
                                                                        '$' + ((((100 - curDiscount) / 100) * price) * curFabric[1]).toFixed(2) +
                                                                    '</td>' +
                                                                '</tr>';
                    });
                    htmls += '</table>' +
                                                        '</td>' +
                                                        '<td class="sbTabCol5">' +
                                                            '<a href="Fabrics.aspx?key=' + curKey + '">Add/Edit fabrics</a><br />' +
                                                        '</td>' +
                                                    '</tr>' +
                                                '</table>' +
                                            '</div>' +
                                            '<div class="sbItemComment">' +
                                                '<table class="sbTabItemComment" cellspacing="3" cellpadding="0">' +
                                                    '<tr>' +
                                                        '<td class="sbTabCol1">' +
                                                            '&nbsp;' +
                                                        '</td>' +
                                                        '<td class="sbTabCol2" colspan="2">' +
                                                            '<textarea id="txtComment' + curKey + '" name="txtComment" rows="3" style="width: 99%; padding: 3px;" onclick="txtComment_OnClick(this);" onBlur="txtComment_OnBlur(this);" maxLength="200">' + curComment + '</textarea>' +
                                                        '</td>' +
                                                        '<td class="sbTabCol5">' +
                                                            '<a href="javascript:saveAllChanges(1);">Save all changes</a>' +
                                                        '</td>' +
                                                    '</tr>' +
                                                '</table>' +
                                            '</div>' +
                                        '</div>' +
                                    '</li>' +
                                '</ul>' +
                                '<div class="clear">' +
                                '</div>' +
                            '</div>';
                }
            });
        }
        htmls += '</div>' +
             '</div>';
        htmls += '<div class="sbBottomWrapper">' +
                        '<div class="sbBottomInner">' +
                           '<ul>' +
                                '<li class="sbBottomLeft" style="float: left;"></li>' +
                                '<li class="sbBottomRight" style="float: right;">' +
                                    '<table class="sbTabTotal">' +
                                        '<tr>' +
                                            '<td class="sbTabTotalCol1">' +
                                                'Subtotal' +
                                            '</td>' +
                                            '<td class="sbTabTotalCol2">' +
                                                '$' + subTotal.toFixed(2) +
                                            '</td>' +
                                            '<td class="sbTabTotalCol3">' +
                                                itemsCount + ' items' +
                                            '</td>' +
                                        '</tr>' +
                                        '<tr>' +
                                            '<td class="sbTabTotalCol1">' +
                                                'Shipping' +
                                            '</td>' +
                                            '<td colspan="2">' +
                                                '<select id="ddlShippingMethods" onchange="ddlShippingMethods_OnChange(this);" class="sbDdlShipping">';

        if (shippingMethodsAll != null) {
            curShipping = 1;
            if (itemOrders != null) {
                var orders = itemOrders.split('&');
                $.each(orders, function(i, order) {
                    if (order.split('=')[0] == 'Shipping') {
                        curShipping = order.split('=')[1];
                    }
                });
            }
            $.each(shippingMethodsAll, function(i, shippingMethod) {
                var selectString = '';
                if (shippingMethod.ID == curShipping)
                    selectString = ' selected="selected" ';
                htmls += '<option value="' + shippingMethod.ID + '" ' + selectString + '>' + shippingMethod.Name + '</option>';
            });
        }
        htmls += '</select>' +
                                            '</td>' +
                                        '</tr>' +
                                        '<tr>' +
                                            '<td class="sbTabTotalCol1">' +
                                                'Total' +
                                            '</td>' +
                                            '<td class="sbTabTotalCol2">' +
                                                '$' + (subTotal + shippingCost).toFixed(2) +
                                            '</td>' +
                                            '<td class="sbTabTotalCol3">' +
                                            '</td>' +
                                        '</tr>' +
                                    '</table>' +
                                '</li>' +
                            '</ul>' +
                        '</div>' +
                        '<div class="clear">' +
                        '</div>' +
                    '</div>';
        $('.bmShoppingBagItems').html(htmls);
    }
    else {
        var htmls = '<div class="sbWrapper">' +
                        '<div class="sbInner">' +
                            '<div class="sbItemWrapper">' +
                                '<div class="sbItemTitleWrapper">' +
                                    '<div class="sbItemTitleInner">' +
                                        '<table class="sbTabItemTitle" cellpadding="0" cellspacing="2">' +
                                            '<tr>' +
                                                '<td>' +
                                                    'No items in your shopping bag.' +
                                                '</td>' +
                                            '</tr>' +
                                        '</table>' +
                                    '</div>' +
                                    '<div class="clear">' +
                                    '</div>' +
                                '</div>' +
                                '<div class="clear">' +
                                '</div>' +
                            '</div>' +
                        '</div>' +
                    '</div>' +
                    '<div class="sbBottomWrapper">' +
                        '<div class="sbBottomInner">' +
                           '<ul>' +
                                '<li class="sbBottomLeft" style="float: left;"></li>' +
                                '<li class="sbBottomRight" style="float: right;">' +
                                    '<table class="sbTabTotal">' +
                                        '<tr>' +
                                            '<td class="sbTabTotalCol1">' +
                                                'Subtotal' +
                                            '</td>' +
                                            '<td class="sbTabTotalCol2">' +
                                                '$0.00' +
                                            '</td>' +
                                            '<td class="sbTabTotalCol3">' +
                                                '0 items' +
                                            '</td>' +
                                        '</tr>' +
                                        '<tr>' +
                                            '<td class="sbTabTotalCol1">' +
                                                'Shipping' +
                                            '</td>' +
                                            '<td colspan="2">' +
                                                '<select id="ddlShippingMethods" class="sbDdlShipping" disabled="disabled">' +
                                                '<option value="1">Standard | 1-3 weeks | Free</option>' +
                                                '</select>' +
                                            '</td>' +
                                        '</tr>' +
                                        '<tr>' +
                                            '<td class="sbTabTotalCol1">' +
                                                'Total' +
                                            '</td>' +
                                            '<td class="sbTabTotalCol2">' +
                                                '$0.00' +
                                            '</td>' +
                                            '<td class="sbTabTotalCol3">' +
                                            '</td>' +
                                        '</tr>' +
                                    '</table>' +
                                '</li>' +
                            '</ul>' +
                        '</div>' +
                        '<div class="clear">' +
                        '</div>' +
                    '</div>';
        $('.bmShoppingBagItems').html(htmls);
    }

    var itemFabricsRemovedAll = $.cookie('ItemFabricsRemoved');
    var itemFeaturesRemovedAll = $.cookie('ItemFeaturesRemoved');
    var itemCommentsRemovedAll = $.cookie('ItemCommentsRemoved');

    if (itemFabricsRemovedAll != null) {
        var fabricDetails = jiodar.deserialize(fabricList);
        var discounts = jiodar.deserialize(discountList);
        var categoriesAll = jiodar.deserialize(categoryList);
        var categoryDetails = jiodar.deserialize(categoryDetailList);

        var htmls = '<div class="bmShoppingBagTitle">' +
                        'Saved for later' +
                    '</div>' +
                    '<div class="sbWrapper">' +
                        '<div class="sbInner">' +
                            '<div class="sbTilteBar">' +
                               '<table class="sbTabTitle" cellspacing="5" cellpadding="0">' +
                                    '<tr>' +
                                        '<td class="sbTabCol1">' +
                                            '&nbsp;' +
                                        '</td>' +
                                        '<td class="sbTabCol2" >' +
                                            'Details' +
                                        '</td>' +
                                        '<td class="sbTabCol3">' +
                                            'Qty.' +
                                        '</td>' +
                                        '<td class="sbTabCol4">' +
                                            'Cost' +
                                        '</td>' +
                                        '<td class="sbTabCol5">' +
                                            'Actions' +
                                        '</td>' +
                                    '</tr>' +
                                '</table>' +
                                '<div class="clear">' +
                                '</div>' +
                            '</div>';
        if (itemFabricsRemovedAll != null && itemFeaturesRemovedAll != null) {
            var itemfabricsRemovedAll = itemFabricsRemovedAll.split('&');
            $.each(itemfabricsRemovedAll, function(i, itemFabrics) {
                curKey = itemFabrics.split('=')[0];
                curCategory = curKey.split('_')[1];

                var lineageName = 'Category';
                $.each(categoriesAll, function(i, category) {
                    if (curCategory == category.ID) {
                        lineageName = category.LineageName;
                        lineageName = lineageName.substring(1, lineageName.length - 1).replace('/', '\'s ');

                    }
                });

                curComment = 'Please type your comments here.';
                if (itemCommentsRemovedAll != null) {
                    var comments = itemCommentsRemovedAll.split('&');
                    $.each(comments, function(i, comment) {
                        if (curKey == comment.split('=')[0]) {
                            curComment = comment.split('=')[1];
                        }
                    });
                }
                htmls += '<div class="sbItemWrapper">' +
                                '<div class="sbItemTitleWrapper">' +
                                    '<div class="sbItemTitleInner">' +
                                        '<table class="sbTabItemTitle" cellpadding="0" cellspacing="2">' +
                                            '<tr>' +
                                                '<td class="sbTabCol1">' +
                                                    '&nbsp;' +
                                                '</td>' +
                                                '<td>' +
                                                    '<b>Collection ' + curKey.split('_')[0] + ' :: ' + lineageName + '</b>' +
                                                '</td>' +
                                                '<td class="sbTabCol5">' +
                                                    '<a href="javascript:moveToBagItem(\'' + curKey + '\', true);">Move&nbsp;to&nbsp;bag</a>&nbsp;|&nbsp;<a href="javascript:deleteItem(\'' + curKey + '\');">Delete</a>' +
                                                '</td>' +
                                            '</tr>' +
                                        '</table>' +
                                    '</div>' +
                                    '<div class="clear">' +
                                    '</div>' +
                                '</div>' +
                                '<ul>' +
                                    '<li>' +
                                        '<div class="sbItemBodyWrapper">' +
                                            '<div class="sbItemStyles">' +
                                                '<table class="sbTabItemStyle" cellspacing="3" cellpadding="0">' +
                                                    '<tr>' +
                                                        '<td class="sbTabCol1">' +
                                                            '&nbsp;' +
                                                        '</td>' +
                                                        '<td class="sbTabCol2">';
                var itemFeatures = itemFeaturesRemovedAll.split('&');
                var features = '';
                $.each(itemFeatures, function(i, itemFeature) {
                    var curFeature = itemFeature.split('=');
                    if (curFeature[0] == curKey) {
                        features = curFeature[1].substring(0, curFeature[1].length - 1);
                    }
                });
                $.each(features.split(','), function(i, feature) {
                    htmls += '<img src="http://www.jiodar.com/App_Themes/Jiodar/Images/Features/' + feature + '.jpg" alt="" class="sbImgStyle" />';
                });
                htmls += '</td>' +
                                                        '<td class="sbTabCol4">' +
                                                            '$0.00' +
                                                        '</td>' +
                                                        '<td class="sbTabCol5">' +
                                                            '<a href="javascript:moveToBagItem(\'' + curKey + '\', false);">Edit styles</a>' +
                                                        '</td>' +
                                                    '</tr>' +
                                                '</table>' +
                                            '</div>' +
                                            '<div class="sbItemFabrics">' +
                                                '<table class="sbTabItemFabrics" cellspacing="3" cellpadding="0">' +
                                                    '<tr>' +
                                                        '<td class="sbTabCol1">' +
                                                            '&nbsp;' +
                                                        '</td>' +
                                                        '<td colspan="2">' +
                                                            '<table class="sbTabItemFabric" cellspacing="0" cellpadding="1">';
                curFabrics = itemFabrics.split('=')[1];
                curFabrics = curFabrics.substring(0, curFabrics.length - 1);
                $.each(curFabrics.split(','), function(i, fabric) {
                    var curFabric = fabric.split('/');
                    var curFabricDetail;
                    $.each(fabricDetails, function(i, fabricDetail) {
                        imageID = fabricDetail.Fabric.ID + '_' + fabricDetail.Pattern.ID + '_' + fabricDetail.Color.ID;
                        if (imageID == curFabric[0])
                            curFabricDetail = fabricDetail;
                    });

                    var curDiscount = 0;
                    $.each(discounts, function(j, discount) {
                        if (curFabricDetail.Fabric.DiscountID == discount.ID)
                            curDiscount = discount.Percentage;
                    });

                    showDiscount = curDiscount + '%';
                    if (curDiscount == 0)
                        showDiscount = 'N/A';

                    var trStyle = 'sbTabRow2';
                    if (i % 2 == 1)
                        trStyle = 'sbTabRow1';

                    var curFabricRequired;
                    var curLabor;
                    var curMargin;
                    $.each(categoryDetails, function(i, categoryDetail) {
                        if (curCategory == categoryDetail.ID) {
                            curFabricRequired = categoryDetail.FabricRequired;
                            curLabor = categoryDetail.Labor;
                            curMargin = categoryDetail.Margin;
                        }
                    });

                    var area = (curFabricDetail.Fabric.Width * 0.0254) * curFabricRequired;
                    var weight = area * curFabricDetail.Fabric.Weight / 1000;
                    var shippingCost = weight * 25;
                    var fabricCost = curMargin * curFabricDetail.Fabric.Price * curFabricRequired;
                    var price = (Math.ceil(shippingCost + curLabor + fabricCost)).toFixed(2);

                    htmls += '<tr class="' + trStyle + '">' +
                                                                    '<td class="sbTabCol21">' +
                                                                        '<div style="background-image: url(\'App_Themes/Jiodar/Images/Fabrics/' + curFabric[0] + '.jpg\'); width:50px; height:50px;"><img src="http://www.jiodar.com/App_Themes/Jiodar/Images/Fabrics/key120.gif" alt="" width="50" height="50" border="0" /></div>' +
                                                                    '</td>' +
                                                                    '<td class="sbTabCol22">' +
                                                                        '<div>' +
                                                                            'Fabric: ' + curFabricDetail.Fabric.Name + '</div>' +
                                                                        '<div>' +
                                                                            'Pattern: ' + curFabricDetail.Pattern.Name + '</div>' +
                                                                        '<div>' +
                                                                            'Color: ' + curFabricDetail.Color.Name + '</div>' +
                                                                    '</td>' +
                                                                    '<td class="sbTabCol23">' +
                                                                        '<div>' +
                                                                            'Unit price: $' + price + '</div>' +
                                                                        '<div>' +
                                                                            'Discount: ' + showDiscount + '</div>' +
                                                                    '</td>' +
                                                                    '<td class="sbTabCol24">' +
                                                                        '<input id="txtQuantity' + curKey + '-' + curFabric[0] + '" type="text" name="txtQuantity" disabled="disabled" maxlength="2" value="' + curFabric[1] + '" onBlur="txtQuantity_OnBlur(this)" onKeyUp="txtQuantity_OnKeyUp(this)" style="width: 20px; text-align: right; padding: 0 2px; font-size: 11px;" />' +
                                                                    '</td>' +
                                                                    '<td class="sbTabCol25">' +
                                                                        '$' + ((((100 - curDiscount) / 100) * price) * curFabric[1]).toFixed(2) +
                                                                    '</td>' +
                                                                '</tr>';
                });
                htmls += '</table>' +
                                                        '</td>' +
                                                        '<td class="sbTabCol5">' +
                                                            '<a href="javascript:moveToBagItem(\'' + curKey + '\', false);">Add/Edit fabrics</a><br />' +
                                                            '<a href="javascript:moveToBagItem(\'' + curKey + '\', false);">Update quantity</a>' +
                                                        '</td>' +
                                                    '</tr>' +
                                                '</table>' +
                                            '</div>' +
                                            '<div class="sbItemComment">' +
                                                '<table class="sbTabItemComment" cellspacing="3" cellpadding="0">' +
                                                    '<tr>' +
                                                        '<td class="sbTabCol1">' +
                                                            '&nbsp;' +
                                                        '</td>' +
                                                        '<td class="sbTabCol2" colspan="2">' +
                                                            '<textarea id="txtComment' + curKey + '" name="txtComment" disabled="disabled" rows="3" maxLength="255" style="width: 99%; padding: 3px;" onclick="txtComment_OnClick(this);" onBlur="txtComment_OnBlur(this);">' + curComment + '</textarea>' +
                                                        '</td>' +
                                                        '<td class="sbTabCol5">' +
                                                            '<a href="javascript:moveToBagItem(\'' + curKey + '\', false);">Save Comment</a>' +
                                                        '</td>' +
                                                    '</tr>' +
                                                '</table>' +
                                            '</div>' +
                                        '</div>' +
                                    '</li>' +
                                '</ul>' +
                                '<div class="clear">' +
                                '</div>' +
                            '</div>';
            });
        }
        htmls += '</div>' +
             '</div>';
        $('.bmShoppingBagItemsRemoved').html(htmls);
    }
});