function shopping(product_id,p_num,id)
judge=0
product_all=request.cookies("shopping")
if product_all<>"" then
newchars=split(product_all,"|")
i=0
do while not newchars(i)=""
product(i)= newchars(i)
product_l=product(i)
product_n=split(product_l,",")
'productid=product_n(0)
' product_num=product_n(1)
'删除商品
if id=0 then
if product_n(0) <> product_id then
shopping=shopping&product(i)&"|"
'response.cookies("shopping")=shopping
end if
end if
if id=1 then
if product_n(0) = product_id then
if product_n(1)="" then'产品数量
product_n(1)=1
end if
p_num1 =0 + formatnumber(product_n(1)) + formatnumber(p_num)
judge=1
shopping=shopping&product_id&","&p_num1&"|"
'response.cookies("shopping")=shopping'将购物加入购物车
else
shopping=shopping&product(i)&"|"
end if
end if
i=i+1
loop
response.cookies("shopping")=shopping
if judge<>1 and id=1 then
response.cookies("shopping")=request.cookies("shopping")&product_id&","&p_num&"|"
end if
else
response.cookies("shopping")=product_id&","&p_num&"|"
end if
end function
%>