﻿// JScript 文件
var curChar = "";
function orderadd(id,num,post,color)
{
    var reqUrl = "Ajax/my_cart.aspx?id=" + id + "&num=" + num + "&jifen=" + post + "&price=0&color=" + color + "&t=" + new Date();
	Ajax.doGet(reqUrl,null,SetBuild,true,false);
}

function SetBuild(responseStr)
{   
	var objDiv=document.getElementById("div_section");
	if (responseStr!="")
	{
	    //alert(responseStr);
//	    top.location.reload();
	    objDiv.innerHTML = responseStr;
	    var myCartCount = document.getElementById("mayCartCount").innerHTML;
	    document.getElementById("Top1_ltShoppingCartCount").innerHTML = "<a href='/my_cart.html' rel='nofollow' style='display:inline;'>(" + myCartCount + ")</a>";		
	}
	else
	{
	    objDiv.style.display="none";
	}
}
function SetOrder(responseStr)
{   
	if (responseStr!="")
	{
	    top.location.href="/my_cart.html";
	}
}

function updateordernum(num,orderid,price,jifen)
{
	var reqUrl = "Ajax/my_cart.aspx?action=edit&num="+num+"&orderid="+orderid+"&price="+price+"&jifen="+jifen+"&t="+new Date();
	Ajax.doGet(reqUrl,null,SetOrder,true,false);
}
function buyNow(productId, productCount, postId, num) {
    try {
        var color = document.getElementById("ddlProductColor").value;
        if (num > 0) {
            window.location = "orderyunshu_" + productId + "_" + productCount + "_" + postId + "_" + color + ".html";
        }
        else {
            alert("OUT OF STOCK");
        }
    }
    catch (e) {
        if (num > 0) {
            window.location = "orderyunshu_" + productId + "_" + productCount + "_" + postId + ".html";
        }
        else {
            alert("OUT OF STOCK");
        }
    }
}


