<!--#include file="conn.asp"-->
<!--#include file="buy2buysys.asp"-->
<!-- IFRAME自动高度代码 -->
<script language="Javascript">
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=getFFVersion>=0.1? 16 : 0 

function dyniframesize(iframename) {
  var pTar = null;
  if (document.getElementById){
    pTar = document.getElementById(iframename);
  }
  else{
    eval('pTar = ' + iframename + ';');
  }
  if (pTar && !window.opera){
    //begin resizing iframe
    pTar.style.display="block"
    
    if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
      //ns6 syntax
      pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight; 
    }
    else if (pTar.Document && pTar.Document.body.scrollHeight){
      //ie5+ syntax
      pTar.height = pTar.Document.body.scrollHeight;
    }
  }
}
</script>
<!-- IFRAME自动高度代码 END-->
<%
Dim bigpic,bigurl,top,topurl,ll0326,ll0326url,bottom,bottomurl,left1,left2,left3,left1url,left2url,left3url
Dim zuo1,zuo2,zuo3,zuo4,zuo1url,zuo2url,zuo3url,zuo4url,bigpic2,bigpic3,bigpic2url,bigpic3url
Dim best1,best2,best3,best4,best5,best1url,best2url,best3url,best4url,best5url,zf1,zf2,zf3,zf1url,zf2url,zf3url
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from ad",conn,1,1
best1url=trim(rs("best1url"))
best1=trim(rs("best1"))
best2url=trim(rs("best2url"))
best2=trim(rs("best2"))
best3url=trim(rs("best3url"))
best3=trim(rs("best3"))
best4url=trim(rs("best4url"))
best4=trim(rs("best4"))
best5url=trim(rs("best5url"))
best5=trim(rs("best5"))
zf1url=trim(rs("zf1url"))
zf1=trim(rs("zf1"))
zf2url=trim(rs("zf2url"))
zf2=trim(rs("zf2"))
zf3url=trim(rs("zf3url"))
zf3=trim(rs("zf3"))
bigurl=trim(rs("bigurl"))
bigpic=trim(rs("bigpic"))
bigpic2url=trim(rs("bigpic2url"))
bigpic2=trim(rs("bigpic2"))
bigpic3url=trim(rs("bigpic3url"))
bigpic3=trim(rs("bigpic3"))
top=trim(rs("top"))
topurl=trim(rs("topurl"))
ll0326=trim(rs("ll0326"))
ll0326url=trim(rs("ll0326url"))
bottom=trim(rs("bottom"))
bottomurl=trim(rs("bottomurl"))
left1=trim(rs("left1"))
left1url=trim(rs("left1url"))
left2=trim(rs("left2"))
left2url=trim(rs("left2url"))
left3=trim(rs("left3"))
left3url=trim(rs("left3url"))
zuo1=trim(rs("zuo1"))
zuo1url=trim(rs("zuo1url"))
zuo2=trim(rs("zuo2"))
zuo2url=trim(rs("zuo2url"))
zuo3=trim(rs("zuo3"))
zuo3url=trim(rs("zuo3url"))
zuo4=trim(rs("zuo4"))
zuo4url=trim(rs("zuo4url"))
verad=trim(rs("verad"))
veradurl=trim(rs("veradurl"))
ddad=trim(rs("ddad"))
ddadurl=trim(rs("ddadurl"))
rs.close
%>


<html>
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
.style3 {color: #000000}
body {
	background-image: url(admin/images/bg.gif);
}
.STYLE4 {
	color: #FF0000;
	font-weight: bold;
}
-->
</style>
<head>
<title><%=webname%>--您的购物车</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Robots" content="index,follow">
</head>
<body text="#000000" leftmargin="0" topmargin="0">
<%
Sub PutToShopBag( Prodid, ProductList )
   If Len(ProductList) = 0 Then
      ProductList =Prodid
   ElseIf InStr( ProductList, Prodid ) <= 0 Then
      ProductList = ProductList&", "&Prodid &""
   End If
End Sub

ProductList = Session("ProductList")
Products = Split(Request("Prodid"), ",")
For I=0 To UBound(Products)
   PutToShopBag Products(I), ProductList
Next
Session("ProductList") = ProductList
'************************************************************************************
Sub PutToShopBagProperty1( selectProperty1, selectProperty1List )
   tmpStr = Split( selectProperty1,"|")
   tmpStrID = tmpStr(0)
   tmpStrName = tmpStr(1)
   'Response.write "Session:"&Session("selectProperty1List")&"<br>"
   'Response.write "tmpStrID:"&tmpStrID&"<br>"
   'Response.write "tmpStrName:"&tmpStrName&"<br>"
   If Len(selectProperty1List) = 0 Then
      selectProperty1List =selectProperty1
   Else 
   				'Response.write "selectProperty1List:"&selectProperty1List&"<br>"
   				tmpList = Split( selectProperty1List,",")
				'Response.write "UBound(tmpList):"&UBound(tmpList)&"<br>"
				For i=0 To UBound(tmpList)
					tmp = Split(tmpList(i),"|")
					'response.write tmp(0)&"<br>"
					if Trim(tmp(0)) <> "" then
						if Trim(tmp(0)) = Trim(tmpStrID) then
							'表示找到了，则改变为最新的选择情况
							Flag = "True"
							'Response.write tmp(0)&"|"&tmp(1) &"<br>"
							'Response.write selectProperty1 & "<br>"
							selectProperty1List = replace(selectProperty1List,tmp(0)&"|"&tmp(1),selectProperty1)
							'Response.Write selectProperty1List & "<br>"
							Exit For
						end if
					end if
				Next
				'没有的话，则直接加一个到Session里面
				if Flag <> "True" then selectProperty1List = selectProperty1List&", "&selectProperty1 &""
   End If
End Sub

selectProperty1List = Session("selectProperty1List")
Products = Split(Request("selectProperty1"), ",")
For I=0 To UBound(Products)
   PutToShopBagProperty1 Products(I), selectProperty1List
Next
Session("selectProperty1List") = selectProperty1List



Sub PutToShopBagProperty2( selectProperty2, selectProperty2List )
   tmpStr = Split( selectProperty2,"|")
   tmpStrID = tmpStr(0)
   tmpStrName = tmpStr(1)
   'Response.write "Session:"&Session("selectProperty2List")&"<br>"
   'Response.write "tmpStrID:"&tmpStrID&"<br>"
   'Response.write "tmpStrName:"&tmpStrName&"<br>"
   If Len(selectProperty2List) = 0 Then
      selectProperty2List =selectProperty2
   Else 
   				'Response.write "selectProperty2List:"&selectProperty2List&"<br>"
   				tmpList = Split( selectProperty2List,",")
				'Response.write "UBound(tmpList):"&UBound(tmpList)&"<br>"
				For i=0 To UBound(tmpList)
					tmp = Split(tmpList(i),"|")
					'response.write tmp(0)&"<br>"
					if Trim(tmp(0)) <> "" then
						if Trim(tmp(0)) = Trim(tmpStrID) then
							'表示找到了，则改变为最新的选择情况
							Flag = "True"
							'Response.write tmp(0)&"|"&tmp(2) &"<br>"
							'Response.write selectProperty2 & "<br>"
							selectProperty2List = replace(selectProperty2List,tmp(0)&"|"&tmp(1),selectProperty2)
							'Response.Write selectProperty2List & "<br>"
							Exit For
						end if
					end if
				Next
				'没有的话，则直接加一个到Session里面
				if Flag <> "True" then selectProperty2List = selectProperty2List&", "&selectProperty2 &""
   End If
End Sub

selectProperty2List = Session("selectProperty2List")
Products = Split(Request("selectProperty2"), ",")
For I=0 To UBound(Products)
   PutToShopBagProperty2 Products(I), selectProperty2List
Next
Session("selectProperty2List") = selectProperty2List

Sub PutToShopBagProperty3( selectProperty3, selectProperty3List )
   tmpStr = Split( selectProperty3,"|")
   tmpStrID = tmpStr(0)
   tmpStrName = tmpStr(1)
   'Response.write "Session:"&Session("selectProperty3List")&"<br>"
   'Response.write "tmpStrID:"&tmpStrID&"<br>"
   'Response.write "tmpStrName:"&tmpStrName&"<br>"
   If Len(selectProperty3List) = 0 Then
      selectProperty3List =selectProperty3
   Else 
   				'Response.write "selectProperty3List:"&selectProperty3List&"<br>"
   				tmpList = Split( selectProperty3List,",")
				'Response.write "UBound(tmpList):"&UBound(tmpList)&"<br>"
				For i=0 To UBound(tmpList)
					tmp = Split(tmpList(i),"|")
					'response.write tmp(0)&"<br>"
					if Trim(tmp(0)) <> "" then
						if Trim(tmp(0)) = Trim(tmpStrID) then
							'表示找到了，则改变为最新的选择情况
							Flag = "True"
							'Response.write tmp(0)&"|"&tmp(3) &"<br>"
							'Response.write selectProperty3 & "<br>"
							selectProperty3List = replace(selectProperty3List,tmp(0)&"|"&tmp(1),selectProperty3)
							'Response.Write selectProperty3List & "<br>"
							Exit For
						end if
					end if
				Next
				'没有的话，则直接加一个到Session里面
				if Flag <> "True" then selectProperty3List = selectProperty3List&", "&selectProperty3 &""
   End If
End Sub

selectProperty3List = Session("selectProperty3List")
Products = Split(Request("selectProperty3"), ",")
For I=0 To UBound(Products)
   PutToShopBagProperty3 Products(I), selectProperty3List
Next
Session("selectProperty3List") = selectProperty3List

Sub PutToShopBagProperty4( selectProperty4, selectProperty4List )
   tmpStr = Split( selectProperty4,"|")
   tmpStrID = tmpStr(0)
   tmpStrName = tmpStr(1)
   'Response.write "Session:"&Session("selectProperty4List")&"<br>"
   'Response.write "tmpStrID:"&tmpStrID&"<br>"
   'Response.write "tmpStrName:"&tmpStrName&"<br>"
   If Len(selectProperty4List) = 0 Then
      selectProperty4List =selectProperty4
   Else 
   				'Response.write "selectProperty4List:"&selectProperty4List&"<br>"
   				tmpList = Split( selectProperty4List,",")
				'Response.write "UBound(tmpList):"&UBound(tmpList)&"<br>"
				For i=0 To UBound(tmpList)
					tmp = Split(tmpList(i),"|")
					'response.write tmp(0)&"<br>"
					if Trim(tmp(0)) <> "" then
						if Trim(tmp(0)) = Trim(tmpStrID) then
							'表示找到了，则改变为最新的选择情况
							Flag = "True"
							'Response.write tmp(0)&"|"&tmp(4) &"<br>"
							'Response.write selectProperty4 & "<br>"
							selectProperty4List = replace(selectProperty4List,tmp(0)&"|"&tmp(1),selectProperty4)
							'Response.Write selectProperty4List & "<br>"
							Exit For
						end if
					end if
				Next
				'没有的话，则直接加一个到Session里面
				if Flag <> "True" then selectProperty4List = selectProperty4List&", "&selectProperty4 &""
   End If
End Sub

selectProperty4List = Session("selectProperty4List")
Products = Split(Request("selectProperty4"), ",")
For I=0 To UBound(Products)
   PutToShopBagProperty4 Products(I), selectProperty4List
Next
Session("selectProperty4List") = selectProperty4List

Sub PutToShopBagProperty5( selectProperty5, selectProperty5List )
   tmpStr = Split( selectProperty5,"|")
   tmpStrID = tmpStr(0)
   tmpStrName = tmpStr(1)
   'Response.write "Session:"&Session("selectProperty5List")&"<br>"
   'Response.write "tmpStrID:"&tmpStrID&"<br>"
   'Response.write "tmpStrName:"&tmpStrName&"<br>"
   If Len(selectProperty5List) = 0 Then
      selectProperty5List =selectProperty5
   Else 
   				'Response.write "selectProperty5List:"&selectProperty5List&"<br>"
   				tmpList = Split( selectProperty5List,",")
				'Response.write "UBound(tmpList):"&UBound(tmpList)&"<br>"
				For i=0 To UBound(tmpList)
					tmp = Split(tmpList(i),"|")
					'response.write tmp(0)&"<br>"
					if Trim(tmp(0)) <> "" then
						if Trim(tmp(0)) = Trim(tmpStrID) then
							'表示找到了，则改变为最新的选择情况
							Flag = "True"
							'Response.write tmp(0)&"|"&tmp(5) &"<br>"
							'Response.write selectProperty5 & "<br>"
							selectProperty5List = replace(selectProperty5List,tmp(0)&"|"&tmp(1),selectProperty5)
							'Response.Write selectProperty5List & "<br>"
							Exit For
						end if
					end if
				Next
				'没有的话，则直接加一个到Session里面
				if Flag <> "True" then selectProperty5List = selectProperty5List&", "&selectProperty5 &""
   End If
End Sub

selectProperty5List = Session("selectProperty5List")
Products = Split(Request("selectProperty5"), ",")
For I=0 To UBound(Products)
   PutToShopBagProperty5 Products(I), selectProperty5List
Next
Session("selectProperty5List") = selectProperty5List
'************************************************************************************

if request("payment")="去收银台" then
response.redirect "b2b_ddlcsys.asp?action=1"
end if

If Request("cmdShow") = "Yes" Then
   ProductList = ""
   Products = Split(Request("ProdId"), ", ")
   For I=0 To UBound(Products)
      PutToShopBag Products(I), ProductList
   Next
   Session("ProductList") = ProductList
End If
If Len(Session("ProductList")) = 0 Then
Response.write "<table  height=100% width=100%  ><tr><td align=center>您的购物车为空，<a href=index.asp><b>继续购物</b></a>&nbsp;<a href=""JavaScript:onClick=window.close();""><B>关闭窗口</B></a></td></tr></table>"
Response.end
end if
%>
<form action="check.asp" method="POST" name="check">
<table width="700" border="0" cellspacing="0" cellpadding="0" align="center">
<tr> 
    <td><A HREF=<%=ddadurl%> TARGET="_blank"></A></td>
 </tr>
<tr><td>
<table border="0" cellspacing="1" cellpadding="4" align="center" width="100%" bgcolor="#CCCCCC">
 <%
Set rsCheck=Server.CreateObject("ADODB.RecordSet") 
strsql="select ID,Name,Score,Price1,Price2," & LstPrice & ",amount,VipPrice,Stock,Pic,Code from Product where ID in ("&Session("ProductList")&") order by ID"
rsCheck.open strsql,conn,1,1
Sum = 0
SumS = 0
Quatity = 1
Do While Not rsCheck.EOF
     Quatity = CInt( Request.Form( "Q_" & rsCheck("ID")) )
     If Quatity <= 0 Then 
        Quatity = CInt( Session(rsCheck("ID")) )
        If Quatity <= 0 Then Quatity = 1
     End If
Session(rsCheck("ID")) = Quatity

IF rsCheck("Stock") < Quatity Then
Quatity = 1
Session(rsCheck("ID")) = 1
response.write "<script language=javascript>alert('对不起，"&rsCheck("Name")&"暂时库存不足，请过段时间再来购买该商品！');window.close();</script>" 
Response.End()
Conn.Close
Set Conn = Nothing
End IF

'Dim YourPrice,strprice2,strvipprice,ProScore
strprice1 = Round(rsCheck("Price1"),2)
strprice2 = Round(rsCheck("Price2"),2)
strvipprice = Round(rsCheck("VipPrice"),2)
ProScore = rsCheck("Score")
YourPrice =  Round(rsCheck("" & LstPrice & ""),2)
Sum = Sum + (YourPrice + strvipprice)*Quatity
Sum=Round(Sum,2) 
SumS = SumS + ProScore*Quatity
%> 
   <tr bgcolor="#f7f7f7" height="25" align="center">
     <td width="40" bgcolor="#f7f7f7">       <input type="CheckBox" name="ProdId" value="<%=rsCheck("ID")%>" Checked></td>
     <td width="141" bgcolor="#FFFFFF"><a href="#### target="_blank"><img src="image\<%=rsCheck("Pic")%>" width="100" height="100" border="0"></a></td>  
	 <td width="491" bgcolor="#FFFFFF"><table width="98%"  border="0" cellpadding="7" cellspacing="1" bgcolor="#f2f2f2">
   <tr>
         <td width="17%" align="right" bgcolor="#f7f7f7"><strong>商品名称：</strong></td>
         <td colspan="5" bgcolor="#FFFFFF"><a href="b2b_cpinfo.asp?ID=<%=rsCheck("ID")%>" target="_blank"><strong><%=rsCheck("Name")%>（编号：<%=rsCheck("Code")%>）</strong></a>（<%
		 			  	Flag=""
			  	selectProperty1List= Split( Session("selectProperty1List"),",")
				For I=0 To UBound(selectProperty1List)
					tmp = Split(selectProperty1List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next
				
				
			  	selectProperty2List= Split( Session("selectProperty2List"),",")
				For I=0 To UBound(selectProperty2List)
					tmp = Split(selectProperty2List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next
				
			  	selectProperty3List= Split( Session("selectProperty3List"),",")
				For I=0 To UBound(selectProperty3List)
					tmp = Split(selectProperty3List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next
				Response.Write(Flag)
			  	selectProperty4List= Split( Session("selectProperty4List"),",")
				For I=0 To UBound(selectProperty4List)
					tmp = Split(selectProperty4List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next	
				
			  	selectProperty5List= Split( Session("selectProperty5List"),",")
				For I=0 To UBound(selectProperty5List)
					tmp = Split(selectProperty5List(I),"|")
					if Trim(tmp(0)) <> "" then
						if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
							Flag = Flag & Trim(tmp(1))&","
							Exit For
						end if
					end if
				Next	
				
		 %>）</td>
  </tr>
       <tr>
         <td align="right" bgcolor="#f7f7f7"><strong>数量：</strong></td>
         <td width="20%" bgcolor="#FFFFFF"><input type="Text" name="<%="Q_" & rsCheck("ID")%>" value="<%=Quatity%>" size="1" class="input_sr">
           <input name="imageField" type="image" src="image/gx.gif" align="middle"></td>
         <td width="20%" align="right" bgcolor="#f7f7f7"><strong>所赠积分：</strong></td>
         <td width="15%" bgcolor="#FFFFFF"><%=ProScore %>&nbsp;分</td>
         <td width="15%" align="right" bgcolor="#f7f7f7"><strong>市场价：</strong></td>
         <td width="13%" bgcolor="#FFFFFF"><%=strprice1 %>&nbsp;元</td>
       </tr>
       <tr>
         <td align="right" bgcolor="#f7f7f7"><strong>会员价：</strong></td>
         <td bgcolor="#FFFFFF"><%=strprice2 %>&nbsp;元</td>
         <td align="right" bgcolor="#f7f7f7"><strong>成交价：</strong></td>
         <td bgcolor="#FFFFFF"><%=YourPrice %>&nbsp;元</td>
         <td align="right" bgcolor="#f7f7f7"><strong>总计：</strong></td>
         <td bgcolor="#FFFFFF"><span class="STYLE4"><%=Round((YourPrice + strvipprice)*Quatity,2) %>&nbsp;元</span></td>
       </tr>
     </table></td>
     </tr>
          <%
     rsCheck.MoveNext
     Loop
rsCheck.close
set rsCheck=nothing
%> 
 </table>
 
 
 <table width="100%"  border="0" cellpadding="4" cellspacing="1" bgcolor="#FFFFFF">
   <tr>
     <td width="75%" align="right"><INPUT type=hidden value=Yes name=cmdShow>
您的用户等级为：<%= strTitle %> | <span class="STYLE4"><strong>价格总计：<%=Round(Sum,2) %>元</strong></span> | 获得积分：<%=SumS %>分</td>
     <td width="25%" align="center" bgcolor="#FF6f0f">
	   <input name="payment" type="submit" class="input_bot" value="去收银台">
	 <input name="button" type="button" class="input_bot" onClick="javascript:window.close()" value="继续购物" language=javascript></td>
   </tr>
 </table></td>
</tr>
  </table>
</form>
</body>
</html>