﻿function setShoppingUrl()
{
    if(checkurl(location.href)) setCookie("ShoppingBackUrl",location.href,30);//设置返回页面
}

function backShoppingUrl(urls)
{
    setTimeout("GoCompeltes();",10);
} 
function GoCompeltes()
{
    if (changeSuccess) {
        var Url = getCookie("ShoppingBackUrl");
        if (Url == "" || Url == undefined) Url = "/";
        setTimeout("GoCompeltes();", 10);
    }
} 
function GoCompeltes()
{ 
	if(changeSuccess)
	{
	    var Url = getCookie("ShoppingBackUrl");
		if(Url=="" || Url==undefined)Url="/";	
		location.href = Url;
	}
	else
	{
		setTimeout("GoCompeltes();",10);
	}

}
function checkurl(url)
{
    if(url.indexOf("Edit_InRow")>-1)
    {
        return false;
    }
    return true;
}

//检查购物车限时抢购的规则是否正常
function SelectProductIsLimit()
{
	 b = true;
	 var Url = "initcart.aspx?action=CheckShoppingCart";
		$.ajax({ 
			url: Url, 
			cache: false, 
			async:false,
			datatype: "xml",
			contentType: "text/xml",
			success: function(data) {
					if(typeof(data)=='object')
					{
						var Limit = $(data).find("Limit").text();
						if(Limit != '0') b = false;
					}
			}
	   });
	 return b;
}
//检查插入、修改购物车，限时抢购的规则是否正常
function InsertProductIsLimit(ProductCode,num)
{
	 var b = "";
	 var Url = "initcart.aspx?action=CheckShoppingCart&ProductCode=" + ProductCode + "&num=" + num;
		$.ajax({ 
			url: Url, 
			cache: false, 
			async:false,
			datatype: "xml",
			contentType: "text/xml",
			success: function(data) {
					if(typeof(data)=='object')
					{
						var Limit = $(data).find("Limit").text();
                        b=Limit;
					}
			}
	   });
	 return b;
}

