// JavaScript Document
function AddToCartSuccess(jsonCart) {
    art.dialog({
        skin: 'chrome',
        title: ' ',
        width: 452,
        height: 235,
        time: 5,
        content: '<div class=\"add_to_cardTips"\>' +
						'<p class=\"f18 c00 lh35\"><em>' + jsonCart.SuccessAddedQuantity + '</em> item added to your cart</p>' +
						'<p class=\"c00 lh25 pt20\"><em>' + jsonCart.Quantity + '</em> item(s) in your cart</p>' +
						'<p class=\"c00 lh25\">Subtotal: <em>' + jsonCart.ProductAmount + '</em></p>' +
						'<a style=\"margin-top:20px;\" href=\"' + jsonCart.CartUrl + '\" class=\"viewCart\"></a>' +
						'<p class=\"pt20\"><a href=\"/\">Continue Shopping</a><p>' +
						'<p class=\"pt20 f11 alignR\">This window will close in 5 seconds</p>' +
					'</div>'
    });
}
function AddToDropSuccess(jsonCart) {//代理
    art.dialog({
        skin: 'chrome',
        title: ' ',
        width: 452,
        height: 235,
        time: 30,
        content: '<div class=\"add_to_cardTips"\>' +
						'<p class=\"f18 c00 lh35\"><em>' + jsonCart.SuccessAddedQuantity + '</em> item added to your drop-ship order</p>' +
						'<p class=\"c00 lh25 pt20\"><em>' + jsonCart.Quantity + '</em> item(s) in your drop-ship order</p>' +
						'<p class=\"c00 lh25\">Subtotal: <em>' + jsonCart.ProductAmount + '</em></p>' +
						'<a style=\"margin-top:20px;\" href=\"' + jsonCart.CartUrl + '\" class=\"viewCart_dropshipping\"></a>' +
						'<p class=\"pt20\"><a href=\"/\">Continue Shopping</a><p>' +
						'<p class=\"pt20 f11 alignR\">This window will close in 30 seconds</p>' +
					'</div>'
    });
}
function AddToCart(url, callback,addQuantity) { //添加到购物车
    $.post(url, { "isAjax": true }, function (json) {
        if (typeof (callback) == "function") {
            callback(json, addQuantity);
        }
    });
}
function AddToDrop(url, callback) { //添加到代理
    $.post(url, function (json) {
        if (typeof (callback) == "function") {
            callback(json);
        }
    });
}
function InitHeaderCart(jsonCart) {
    if (jsonCart.Quantity > 0) {
        $("#headerCartItemCount").text(jsonCart.Quantity);
    }
}
function AddProductAndInitHeader(url) {
    AddToCart(url, function (json) { AddToCartSuccess(json); InitHeaderCart(json); });
}
function GetCurrentCartInfo(url, callback) {
    $.post(url, function (json) {
        if (typeof (callback) == "function") {
            callback(json);
        }
    });
}
GetCurrentCartInfo('/cart/query', function (json) { InitHeaderCart(json); });
function Addtowish(url) {
    $.post(url, function () {
        art.dialog({
            skin: 'default',
            title: ' ',
            width: 452,
            height: 235,
            time: 5,
            content: '<div class=\"add_to_cardTips h100"\>\
				<p class=\"f18 c00 lh35\">' + '1 Successfully added this itemto your wish list!' + '</p>\
				<p class=\"pt20\" style=\"padding-left:15px;\"><a href=\"/Wishlist\">View my Wish List >></a><p>\
				<p class=\"pt20 f11 alignR\">This window will close in 5 seconds</p>\
			</div>'
        });
    });
}
