﻿function UpdateCartAfterOrder() {
    jQuery.ajax({
        type: "POST",
        url: "/Order/ReloadCart",
        cache: false,
        success: function(html) {
            jQuery("#cartView").html(html);
        }
    });
    jQuery.ajax({
        type: "POST",
        url: "/Order/ReloadCartAmountText",
        cache: false,
        success: function(html) {
            jQuery("#cartAmountText").html(html);
        }
    });
}

function UpdateCartAmountText() {
    $("a[rel^='prettyPhoto']").prettyPhoto({
        animationSpeed: 'normal', /* fast/slow/normal */
        padding: 40, /* padding for each side of the picture */
        opacity: 0.75, /* Value betwee 0 and 1 */
        showTitle: true, /* true/false */
        allowresize: true, /* true/false */
        counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
        theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
        callback: function() { }
    });

    artId = $('#addedArticleId').html();
    $('#' + artId + '_success').fadeIn(1500);
    $('#' + artId + '_success').fadeOut(2500);
    $('#' + artId).find('.successMarker').attr('id', artId + '_addedArticleId');
    
    jQuery.ajax({
        type: "POST",
        url: "/Order/ReloadCartAmountText",
        cache: false,
        success: function(html) {
            jQuery("#cartAmountText").html(html);
        }
    });
}

function ReloadCartView() {
   jQuery.ajax({
        type: "POST",
        url: "/Order/ReloadCartAmountText",
        cache: false,
        success: function(html) {
            jQuery("#cartAmountText").html(html);
        }
    });
}

function setUpdatedProductId(productId) {
    jQuery('#updatedProductId').val(productId);
}
