<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<!--#include file="../Conn.asp"-->
<!--#include file="../HSK_Cls/HSK.CommonCls.asp"-->
<!--#include file="../HSK_Cls/HSK.AdministratorCls.asp"-->
<!--#include file="../HSK_Cls/HSK.Label.CommonCls.asp"-->
<!--#include file="Include/Session.asp"-->
<%

Dim KSCls
Set KSCls = New Admin_Shop
KSCls.HSK_Run()
Set KSCls = Nothing

Class Admin_Shop
        Private KS,KSCls
		'=====================================定义本页面全局变量=====================================
		Private ID, I, totalPut, Page, RS,ComeFrom
		Private FolderName, CreateDate, TempStr,UnionShopID
		Private IsChangedBuy,ChangeBuyNeedPrice,ChangeBuyPresentPrice
		Private IsLimitbuy,LimitBuyPrice,LimitBuyAmount,LimitBuyTaskID
		
		Private KeyWord, SearchType, StartDate, EndDate, VerificTF, SearchParam
		Private MaxPerPage,UserDefineFieldArr,UserDefineFieldValueStr
		Private T, TitleStr, VerificStr, ShortName, SpecialID,FileName
		Private TypeStr,AttributeStr,HitsByDay, HitsByWeek, HitsByMonth
		Private FolderID,TN, TI, TJ,Action,TemplateID,GroupPrice,ProductID
		Private ProID, Title, PhotoUrl,BigPhoto, ProIntro,Recommend,IsSpecial,IsTop
		Private Popular, Verific,Strip, Comment, Slide,Rolls, KeyWords,ProSpecificat, ProModel,ServiceTerm, ProducerName, TrademarkName, AddDate, Rank, Hits,Unit, TotalNum, AlarmNum,ProductType,Discount, Price_Market,Price_Original,Price_Member,Price,Point,BrandID
		Private CurrPath,UpPowerFlag
		Private Inputer,ComeUrl,AttributeCart,Weight
		Private SqlStr,Errmsg,Makehtml,FnameType,Tid,Fname,KSRObj
		Private ChannelID,F_B_Arr
		'=============================================================================================
		Private Sub Class_Initialize()
		  Set KS=New PublicCls
		  Set KSCls=New ManageCls
		End Sub
        Private Sub Class_Terminate()
		 Call CloseConn()
		 Set KS=Nothing
		 Set KSCls=Nothing
		End Sub
		Public Sub HSK_Run()
		ChannelID=KS.ChkClng(KS.G("ChannelID"))
		If ChannelID=0 Then ChannelID=5
		Session("ThumbnailsConfig")=KS.C_S(ChannelID,46)
		
		If KS.G("page") <> "" Then
			  Page = KS.ChkClng(KS.G("page"))
		Else
			  Page = 1
		End If
		If Instr(Request("action"),"LimitBuy")<>0 then
            If Not KS.ReturnPowerResult(5, "M520008") Then                  '权限检查
			 Call KS.ReturnErr(1, "")   
			 Response.End()
		    End If	
		ElseIf Instr(Request("action"),"Package")<>0 then
            If Not KS.ReturnPowerResult(5, "M520011") Then                  '权限检查
			 Call KS.ReturnErr(1, "")   
			 Response.End()
		    End If	
		end if
		
		Select Case Request("action")
		  case "StockAlarm" StockAlarm:Exit Sub
		  cASE "BatchSaveStock" BatchSaveStock
		  case "Package"    Package:Exit Sub
		  case "AddPackage"  AddPackage:Exit Sub
		  case "PackageSave" PackageSave:Exit Sub
		  case "DelPackage"  DelPackage:Exit Sub
		  case "AddPackPro" AddPackPro:Exit Sub
		  case "Packprolist" Packprolist:Exit Sub
		  case "DelPackagepro" DelPackagepro: Exit Sub
		  case "ChangedBuy" ChangedBuy:Exit Sub
		  case "DelChangeBuy" DelChangeBuy:Exit Sub
		  case "BatchSave" BatchSave
		  case "LimitBuy" LimitBuy:Exit Sub
		   case "DelLimitBuy" DelLimitBuy:Exit Sub
		   case "DelLimitBuyTask" DelLimitBuyTask:Exit Sub
		   case "BatchSaveLimitBuy" BatchSaveLimitBuy: Exit Sub
		   case "AddLimitBuyTask" AddLimitBuyTask:Exit Sub
		   case "LimitBuySave" LimitBuySave:Exit Sub
		   case "LimitBuyProduct" LimitBuyProduct:Exit Sub
		   case "SetKBXSPrice" SetKBXSPrice:Exit Sub
		   case "BundleSale" BundleSale:Exit Sub
		   case "DelBundleSale" DelBundleSale:Exit Sub
		End Select
		
		F_B_Arr=Split(KS.C_S(ChannelID,5),"|")

		'收集搜索参数
		KeyWord   = KS.G("KeyWord")
		SearchType= KS.G("SearchType")
		StartDate = KS.G("StartDate")
		EndDate   = KS.G("EndDate")
		Action     = KS.G("Action")
		ComeFrom   = KS.G("ComeFrom")
		SearchParam = "ChannelID=" & ChannelID
		If KeyWord<>"" Then SearchParam=SearchParam & "&KeyWord=" & KeyWord
		If SearchType<>"" Then  SearchParam=SearchParam & "&SearchType=" & SearchType
		If StartDate<>"" Then SearchParam=SearchParam & "&StartDate=" & StartDate 
		If EndDate<>"" Then SearchParam=SearchParam & "&EndDate=" & EndDate
		If KS.S("Status")<>"" Then SearchParam=SearchParam & "&Status=" & KS.S("Status")
		If ComeFrom<>"" Then SearchParam=SearchParam & "&ComeFrom=" & ComeFrom
		
		ComeUrl=Cstr(Request.ServerVariables("HTTP_REFERER"))
		
		IF KS.G("Method")="Save" Then
				 Call DoSave()
		Else 
				 Call ShopAdd()
		End If
	   End Sub
	   
	   
	   '超值礼包
	   Sub PackAge()
		 With Response
			  .Write "<html>"
			  .Write"<head>"
			  .Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
			  .Write"<link href=""Include/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
			  .Write "<script src=""../HSK_JS/common.js"" language=""JavaScript""></script>"
			  .Write "<script language='JavaScript' src='../HSK_JS/jquery.js'></script>" & vbCrLf
			  .Write"</head>"
			  .Write"<body leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"
			  .Write "<ul id='menu_top'><li class='parent'><strong>超值礼包管理</strong></li> <li class='parent' onclick=""window.$(parent.document).find('#BottomFrame')[0].src='Split.asp?OpStr='+escape('超值礼包管理 >> <font color=red>添加添加礼包</font>')+'&ButtonSymbol=GOSave';location.href='?action=AddPackage';""><span class=child onmouseover=""this.parentNode.className='parent_border'"" onMouseOut=""this.parentNode.className='parent'""><img src='images/ico/a.gif' border='0' align='absmiddle'>添加礼包</span></li></ul>"
			  .Write  "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>"
              .Write "   <tr height='25' align='center' class='sort'>"
	          .Write "   <td width='5%' nowrap>序号</td>"
	          .Write "   <td>小图</td>"
	          .Write "   <td>礼包名称</td>"
			  .Write "	 <td>礼包类型</td>"
			  .Write "	 <td>商品数</td>"
			  .Write "   <td>折扣率</td>"
			  .Write "   <td>可选商品</td>"
			  .Write "   <td>添加时间</td>"
			  .Write "   <td>状态</td>"
			  .Write "   <td>操作</td>"
			  .Write " </tr>"
			  .Write "<form name='myform' action='?' method='get'>"
			  .Write "<input type='hidden' name='action' value='BatchSave'>"
			  
			  Dim XML,Node,Param,TotalPages,PhotoUrl
			  MaxPerPage=100
			  Param=" 1=1"
			  SQLStr=KS.GetPageSQL("KS_ShopPackage","id",MaxPerPage,Page,1,Param,"*")
              Set RS = Server.CreateObject("AdoDb.RecordSet")
		      RS.Open SQLStr, conn, 1, 1
			  If RS.EOF Then
					 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
					 .Write "<td align='center' height='25' class='splittd' colspan=10>还没有添加任何礼包!</td>"
					 .Write "</tr>"
			  Else
					totalPut = Conn.Execute("Select count(id) from [KS_ShopPackage] where " & Param)(0)
					if (TotalPut mod MaxPerPage)=0 then
						TotalPages = TotalPut \ MaxPerPage
					else
						TotalPages = TotalPut \ MaxPerPage + 1
					end if
					if Page > TotalPages then Page=TotalPages
					Set XML=KS.ArrayToXml(RS.GetRows(MaxPerPage),RS,"row","")
					For Each Node In XML.DocumentElement.SelectNodes("row")
					 PhotoUrl=Node.SelectSingleNode("@photourl").text
					 If KS.IsNul(PhotoUrl) Then PhotoUrl="../images/nopic.gif"
					 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
					 .Write "<td align='center' class='splittd'>" & Node.SelectSingleNode("@id").text & "<input type='hidden' name='id' value='" & Node.SelectSingleNode("@id").text & "'></td>"
					 .Write "<td align='center' class='splittd'><Img src='" &PhotoUrl & "' width='40' height='40' /></td>"
					 .Write "<td class='splittd'>" & Node.SelectSingleNode("@packname").text & "</td>"
					 .Write "<td align='center' class='splittd'>"
					 if Node.SelectSingleNode("@packtype").text="0" then
					  .write "自选礼包"
					 else
					  .Write "<span style='color:red'>特惠礼包</span>"
					 end if
					 .Write "</td>"
					 .Write "<td align='center' class='splittd'>" & Node.SelectSingleNode("@num").text & "</td>"
					 .Write "<td align='center' class='splittd'>" & Node.SelectSingleNode("@discount").text & " 折</td>"
					 .Write "<td align='center' class='splittd'><a href='?Action=AddPackPro&id=" & Node.SelectSingleNode("@id").text & "' title='添加选购品'>" & Conn.Execute("Select Count(id) From KS_ShopPackagePro Where packid=" & Node.SelectSingleNode("@id").text)(0) &" 件</a></td>"
					 .Write "<td align='center' class='splittd'>" & FormatDateTime(Node.SelectSingleNode("@adddate").text,2) & "</td>"
					 .Write "<td align='center' class='splittd'>"
					 if Node.SelectSingleNode("@status").text="0" then
					  .write "<span style='color:red'>关闭</span>"
					 else
					  .Write "<span style='color:green'>正常</span>"
					 end if
					 .Write "</td>"
					 .Write "<td align='center' class='splittd'><a href='?Action=AddPackPro&id=" & Node.SelectSingleNode("@id").text & "'>添加选购品</a> | <a href='Shop.asp?channelid=5&id="& Node.SelectSingleNode("@id").text&"&Action=DelPackage' onclick=""return(confirm('删除后不可恢复,确定删除吗?'))"">删除</a> | <a href='?Page=" & Page & "&Action=AddPackage&ID=" &Node.SelectSingleNode("@id").text & "' onclick='parent.frames[""BottomFrame""].location.href=""Split.asp?ChannelID=" & ChannelID &"&ComeFrom="&ComeFrom&"&OpStr="&Server.URLEncode("超值礼包管理 >> <font color=red>编辑礼包</font>") & "&ButtonSymbol=GOSave"";'>修改</a> | <a href='../shop/pack.asp?id=" & Node.SelectSingleNode("@id").text& "' target='_blank'>查看</a></td>"
					 .Write "</tr>"
					Next
	         End If
			 .Write "</form>"
			 .Write "</table>"
			 Call KS.ShowPage(totalput, MaxPerPage, "", Page,true,true)
			 RS.Close
			 Set RS=Nothing

		End With	   
	   
	   End Sub
	   
	   '添加超值礼品
	   Sub AddPackage()
	        Dim PackName,PhotoURL,BigPhoto,Num,PackType,Discount,Status,Content,ID,TemplateID
	        Num=2 : Discount=8 : PackType=0 : Status=1 : Content=""
			ID=KS.ChkClng(Request("id"))
			If ID<>0 Then
			   Dim RS:Set RS=Server.CreateObject("ADODB.RECORDSET")
			   RS.Open "Select top 1 * From KS_ShopPackage Where ID=" & ID,conn,1,1
			   If Not RS.Eof Then
			     PackName=RS("PackName") : PhotoURL=RS("PhotoUrl") : BigPhoto=RS("BigPhoto") :Num=RS("Num") : PackType=RS("PackType") :Discount=RS("Discount") : Status=RS("Status") :Content=RS("Content"):TemplateID=RS("TemplateID")
			   End If
			   RS.Close:Set RS=Nothing
			End If
	   
	   		 With Response
              .Write"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"">"
		      .Write "<html xmlns=""http://www.w3.org/1999/xhtml"">"
			  .Write"<head>"
			  .Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
			  .Write"<link href=""Include/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
			  .Write "<script src=""../HSK_JS/common.js"" language=""JavaScript""></script>"
			  .Write "<script language='JavaScript' src='../HSK_JS/jquery.js'></script>" & vbCrLf
			  .Write"</head>"
			  .Write"<body leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"
			  .Write "<div class=""topdashed sort"">添加超值礼包</div>"
			  %>
			  <script type="text/javascript">
			  function CheckForm()
			  {
			  if ($('#PackName').val()=='')
				{
				 alert('请输入礼包名称!');
				 $('#PackName').focus();
				 return false;
				}
			  if ($('#Num').val()=='')
				{
				 alert('请输入限定商品数!');
				 $('#Num').focus();
				 return false;
				}
			  if ($('#Discount').val()=='')
				{
				 alert('请输入礼包折扣率!');
				 $('#Discount').focus();
				 return false;
				}
			  $("#myform").submit();
				
			  }
			  </script>

			  <br>
				<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="ctable">
				  <form name="myform" id="myform" action="?action=PackageSave" method="post">
					<input type="hidden" value="<%=ID%>" name="id" />
					<input type="hidden" value="<%=request.servervariables("http_referer")%>" name="comeurl" />
					<tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td  height='30' align='right' class='clefttitle'><strong>礼包名称：</strong></td>
					  <td height='30'>&nbsp;
						  <input type='text' name='PackName' id='PackName' value='<%=PackName%>' size="40" />
						  <font color=red>*</font></td>
					</tr>
					<tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td height='30' align='right' class='clefttitle'><strong>礼包图片：</strong></td>
					  <td height='30'>小图<input name='PhotoUrl' type='text' id='PhotoUrl' size='30' value='<%=PhotoUrl%>' class='textbox'>
			           <input class="button" type='button' name='Submit' value='选择礼包小图片...' onClick="OpenThenSetValue('Include/SelectPic.asp?ChannelID=5&CurrPath=<%=KS.GetUpFilesDir()%>',550,290,window,document.myform.PhotoUrl);"> <input class="button" type='button' name='Submit' value='远程抓取小图片...' onClick="OpenThenSetValue('Include/Frame.asp?FileName=SaveBeyondfile.asp&PageTitle='+escape('抓取远程图片')+'&ItemName=小图片&CurrPath=<%=KS.GetUpFilesDir()%>',300,100,window,document.myform.PhotoUrl);">
					 <input class="button"  type='button' name='Submit' value='裁剪...' onClick="if($('#PhotoUrl').val()==''){alert('请选择图片或是上传后再使用此功能');return false;}else{OpenImgCutWindow(1,'<%=KS.Setting(3)%>',$('#PhotoUrl').val())}"> 

					   <br/>
					   大图<input name='BigPhoto' type='text' id='BigPhoto' size='30' value='<%=BigPhoto%>' class='textbox'>
			           <input class="button" type='button' name='Submit' value='选择礼包大图片...' onClick="OpenThenSetValue('Include/SelectPic.asp?ChannelID=5&CurrPath=<%=KS.GetUpFilesDir()%>',550,290,window,document.myform.BigPhoto);"> <input class="button" type='button' name='Submit' value='远程抓取大图片...' onClick="OpenThenSetValue('Include/Frame.asp?FileName=SaveBeyondfile.asp&PageTitle='+escape('抓取远程图片')+'&ItemName=大图片&CurrPath=<%=KS.GetUpFilesDir()%>',300,100,window,document.myform.BigPhoto);">
					   <input class="button"  type='button' name='Submit' value='裁剪...' onClick="if($('#BigPhoto').val()==''){alert('请选择图片或是上传后再使用此功能');return false;}else{OpenImgCutWindows(1,'<%=KS.Setting(3)%>',$('#BigPhoto').val(),$('#BigPhoto')[0])}"> 

					  </td>
				    </tr>
					<tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td  height='30' align='right' class='clefttitle'><strong>上传图片：</strong></td>
					  <td nowrap>
					   <iframe id='UpPhotoFrame' name='UpPhotoFrame' src='UpFileForm.asp?ChannelID=5&UpType=Pic' frameborder=0 scrolling=no width='100%' height='30'></iframe>
					   
					  </td>
					</tr>
					<tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td  height='30' align='right' class='clefttitle'><strong>礼包类型：</strong></td>
					  <td nowrap>
					   <input type="radio" name="PackType" value="0"<%if PackType="0" then response.write " checked"%>>自选礼包
					   <input type="radio" name="PackType" value="1"<%if PackType="1" then response.write " checked"%>>特惠礼包
					  </td>
					</tr>
					<tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td  height='30' align='right' class='clefttitle'><strong>商 品 数：</strong></td>
					  <td nowrap>
					 <input type="text" name="Num" id="Num" style="text-align:center" size="4" value="<%=Num%>" /> 限定礼包内的商品数
					  </td>
					</tr>
					<tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td  height='30' align='right' class='clefttitle'><strong>礼包折扣：</strong></td>
					  <td nowrap>
					 <input type="text" name="Discount" id="Discount" style="text-align:center" size="4" value="<%=Discount%>" />折 礼包内的商品按此折扣率计算
					  </td>
					</tr>
					<tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td  height='30' align='right' class='clefttitle'><strong>礼包介绍：</strong></td>
					  <td nowrap>
					  <textarea ID='Content' name='Content' style='display:none'><%=Server.htmlencode(Content)%></textarea>
					  <script type="text/javascript" src="../editor/ckeditor.js" mce_src="../editor/ckeditor.js"></script>
					  <script type="text/javascript">
                       CKEDITOR.replace('Content', {width:"98%",height:"160px",toolbar:"Basic",filebrowserBrowseUrl :"Include/SelectPic.asp?from=ckeditor&Currpath=<%=KS.GetUpFilesDir()%>",filebrowserWindowWidth:650,filebrowserWindowHeight:290});
			        </script> 

					  </td>
					</tr>
					
					<tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td  height='30' align='right' class='clefttitle'><strong>礼包状态：</strong></td>
					  <td nowrap>
					   <input type="radio" name="Status" value="1"<%if Status="1" then response.write " checked"%>>正常
					   <input type="radio" name="Status" value="0"<%if Status="0" then response.write " checked"%>>关闭
					  </td>
					</tr>
					
					<tr class='tdbg'>
					 <td class='clefttitle' align='right'><strong>绑定模板:</strong></td><td>
			         <input id='TemplateID' name='TemplateID' readonly maxlength='255' size=30 class='textbox' value='<%=TemplateID%>'>&nbsp;<%=KSCls.Get_KS_T_C("$('#TemplateID')[0]")%>
				      </td>
			         </tr>
				</table>
			  <%
			 End With
	   End Sub
	   
	   '保存礼包
	   Sub PackageSave()
	     Dim PackName,PhotoURL,BigPhoto,Num,PackType,Discount,Status,Content,ID,TemplateID
		 PackName=KS.G("PackName")
		 PhotoUrl=KS.G("PhotoURL")
		 BigPhoto=KS.G("BigPhoto")
		 Num=KS.ChkClng(KS.G("Num"))
		 Discount=KS.G("Discount")
		 Status=KS.ChkClng(KS.G("Status"))
		 Content=Request.Form("Content")
		 ID=KS.ChkClng(KS.G("ID"))
		 PackType=KS.ChkClng(KS.G("PackType"))
		 TemplateID=KS.G("TemplateID")
		 If Not IsNumeric(Discount) Then
		  KS.Echo ("<script>alert('折扣率填写不正确!');history.back(-1);</script>")
		 End If
		 If KS.IsNul(PackName) Then
		  KS.Echo ("<script>alert('请输入礼包名称!');history.back(-1);</script>")
		 End If
		 
		 
		 Dim RS:Set RS=Server.CreateObject("ADODB.RECORDSET")
		 RS.Open "Select top 1 * From KS_ShopPackage Where ID=" & ID,conn,1,3
		 If RS.Eof Then
		   RS.AddNEW
		   RS("AddDate")=Now
		 End If
		   RS("PackName")=PackName
		   RS("PhotoURL")=PhotoUrl
		   RS("BigPhoto")=BigPhoto
		   RS("Num")     =Num
		   RS("PackType")=PackType
		   RS("Discount")=Discount
		   RS("Status")  =Status
		   RS("Content") =Content
		   RS("TemplateID")=TemplateID
		 RS.Update
		 RS.MoveLast
		 Dim NewID:NewID=RS("ID")
		 RS.Close
		 Set RS=Nothing
		
		 Response.Write "<script src='../HSK_JS/jquery.js'></script>" 
		 If ID=0 Then
		  '关联上传文件
		  Call KS.FileAssociation(1034,NewID,Content & PhotoUrl & BigPhoto,0)
		  Response.Write "<script>if (confirm('超值礼包添加成功,继续添加吗?')){location.href='Shop.asp?action=AddPackage';}else{$(parent.document).find('#BottomFrame')[0].src='Split.asp?ButtonSymbol=Disabled&OpStr=" & Server.URLEncode("商城系统 >> <font color=red>超值礼包管理</font>") & "';location.href='Shop.asp?action=Package';}</script>"
		 Else
		  '关联上传文件
		  Call KS.FileAssociation(1034,NewID,Content & PhotoUrl & BigPhoto,1)
		  Response.Write "<script>alert('超值礼包修改成功！');$(parent.document).find('#BottomFrame')[0].src='Split.asp?ButtonSymbol=Disabled&OpStr=" & Server.URLEncode("商城系统 >> <font color=red>超值礼包管理</font>") & "';location.href='"& KS.G("ComeUrl") & "';</script>"
		 End If
	   End Sub
	   Sub DelPackage()
	    Dim ID:ID=KS.G("ID")
		If ID="" Then KS.AlertHintScript "对不起,请先选择要删除的礼包"
		ID=KS.FilterIDs(ID)
		Conn.Execute("Delete From KS_ShopPackagePro Where PackID in(" & ID & ")")
		Conn.Execute("Delete From KS_ShopPackage Where ID in(" & ID & ")")
		KS.AlertHintScript "恭喜,已将选中的礼包删除!"
	   End Sub
	   
	   Sub DelLimitBuyTask()
	    Dim ID:ID=KS.G("ID")
		If ID="" Then KS.AlertHintScript "对不起,请先选择要删除的礼包"
		ID=KS.FilterIDs(ID)
		Conn.Execute("Update KS_Product Set LimitBuyTaskID=0,IsLimitbuy=0 Where LimitBuyTaskID in(" & ID & ")")
		Conn.Execute("Delete From KS_ShopLimitBuy Where ID in(" & ID & ")")
		KS.AlertHintScript "恭喜,限时/限量抢购任务删除成功!"
	   End Sub
	   
	   '将商品加入礼包
	   Sub AddPackPro()
	      Dim ID:id=KS.ChkCLng(Request("id"))
		  Dim RS,PackName,PackType,num
		  If ID=0 Then KS.AlertHintScript "对不起,参数出错啦!"
		  Set RS=Conn.Execute("Select top 1 PackName,PackType,num From KS_ShopPackage Where ID=" & ID)
		  If RS.Eof And RS.Bof Then
		    RS.Close :Set RS=Nothing
			KS.AlertHintScript "对不起,参数出错啦!"
		  End If
		  PackName=RS(0)
		  PackType=RS(1)
		  num=rs(2)
		  RS.Close:Set RS=Nothing
	  	  With Response
			  .Write "<html>"
			  .Write"<head>"
			  .Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
			  .Write"<link href=""Include/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
			  .Write "<script src=""../HSK_JS/common.js"" language=""JavaScript""></script>"
			  .Write "<script language='JavaScript' src='../HSK_JS/jquery.js'></script>" & vbCrLf
			  .Write"</head>"
			  .Write"<body leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"
			  .Write "<div class=""topdashed sort""><strong>礼包名称:</strong><font color=red>" & PackName & "</font> <strong>礼包类型:</strong><font color=blue>"
			  if PackType="0" then
			   .Write "自选礼包"
			  else
			   .Write "特惠礼包"
			  end if
			  .Write "</font></div>"
        %>
		<script type="text/javascript">
		  function getProduct()
		  {			 
		     $(parent.frames["FrameTop"].document).find("#ajaxmsg").toggle("fast");
			 var key=escape($('input[name=key]').val());
			 var tid=$('#tid>option:selected').val();
			 var priceType=$('#PriceType>option:selected').val();
			 var minPrice=$("#minPrice").val();
			 var maxPrice=$("#maxPrice").val();
			 var str='';
			 if (key!=''){
			   str='商品名称:'+key;
			 } 
			 if (tid!=''){
			   str+=' 栏目:'+$('#tid>option:selected').get(0).text
			 }
			 if (priceType!=0){
			   str+= minPrice +' 元';
			   switch (parseInt(priceType)){
			     case 1 :
				  str+='<=当前零售价<=';
				  break;
			     case 2 :
				   str+='<=会员价<=';
				   break;
			     case 3 :
				  str+='<=原始零售价<=';
				  break;
			   }
			   str+= maxPrice +' 元';
			   
			 }
			 if (str!='') str='<strong>条件:</strong><font color=red>'+str+'</font>';
			 $("#keyarea").html(str);
			 
			 $.get("../plus/ajaxs.asp", { action: "GetPackagePro", proid:$("#proids").val(),pricetype:priceType,key: key,tid:tid,minPrice:minPrice,maxPrice:maxPrice},
			 function(data){
					$(parent.frames["FrameTop"].document).find("#ajaxmsg").toggle("fast");
					$("#prolist").empty().append(data);
			  });
		  }
		</script>
		<div style="border:1px dashed #cccccc;margin:3px;padding:4px">
		<table width="100%" border="0">
		  <tr>
			<td style="text-align:left">
			  &nbsp;<strong>快速搜索=></strong>
			  <br/>
			   &nbsp;商品编号: <input type="text" class="textbox" name="proids" id="proids" size='15'> 可留空<br/>
			 &nbsp;商品名称: <input type="text" class='textbox' name="key">
			 <br/>&nbsp;所属栏目: <select size='1' name='tid' id='tid'><option value=''>--栏目不限--</option><%=KS.LoadClassOption(ChannelID,false)%></select>
			 <br/>&nbsp;价格范围:
			<input type='text' name='minPrice' size='5' style='text-align:center' id='minPrice' value='10'> 元
			<= <select name="PriceType" id="PriceType">
			  <option value=0>--不限制--</option>
			  <option value=1>当前零售价</option>
			  <option value=2>会员价</option>
			  <option value=3>原始零售价</option>
			 </select>
			 <= <input type='text' name='maxPrice' size='5' style='text-align:center' id='maxPrice' value='100'> 元
			  
			  <br/> <br/>
			  &nbsp;<input type="button" onclick="getProduct()" value="开始搜索" class="button" name="s1">
			
			</td>
			<form name="myform" id="myform" action="Shop.asp?action=Packprolist&flag=add" method="post" target="packframe">
			<input type="hidden" name="packid" value="<%=ID%>"/>
			<input type="hidden" name="PackType" value="<%=PackType%>"/>
			<input type="hidden" name="num" value="<%=num%>"/>
			<td>
			<div id='keyarea'></div>
			<strong>查询到的商品:</strong>			
			<br/>
			 <select name="prolist" size="5" style="width:260px;height:140px" multiple="multiple" id="prolist"></select>
			 <br/>
			 <input type="submit" value="将选中的商品加入选购品" class="button">
			</td>
			</form>
		  </tr>
		</table>
		 </div>
		 <iframe name="packframe" src="Shop.asp?action=Packprolist&packid=<%=ID%>" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe>
	   <%
	      End With
	   End Sub
	   
	   Sub Packprolist()
	      dim packid:packid=KS.ChkClng(KS.S("packid"))
		  dim rs,i
		  if request("flag")="add" then
		   dim proids:proids=ks.s("prolist")
		   dim PackType:PackType=ks.chkclng(ks.s("PackType"))
		   dim num:num=KS.Chkclng(ks.s("num"))
		   if proids<>"" then
		      proids=split(KS.FilterIds(proids),",")
			  if packtype=1 then
			   if ubound(proids)+1>num then
			     Response.Write "<script>alert('对不起,这个特惠礼包只能添加" & num & "件商品!');history.back();</script>"
				 response.end
			   end if
			   dim nownum:nownum=ks.chkclng(conn.execute("select count(id) from KS_ShopPackagePro where packid=" &packid)(0))
			   if ubound(proids)+1+nownum>num then
			     Response.Write "<script>alert('对不起,这个特惠礼包只能添加" & num & "件商品,请先删除再添加!');history.back();</script>"
				 response.end
			   end if
			  end if
			  for i=0 to ubound(proids)
			    set rs=server.createobject("adodb.recordset")
				rs.open "select top 1 * from KS_ShopPackagePro where packid=" & packid & " and proid=" & proids(i),conn,1,3
				if rs.eof then
				 rs.addnew
				 rs("packid")=packid
				 rs("proid")=proids(i)
				 rs.update
				end if 
				rs.close
				set rs=nothing
			  next
			   response.write "<script>alert('恭喜,加入成功!');location.href='Shop.asp?action=Packprolist&packid=" & packid & "';</script>"
		   else
		      response.write "<script>alert('您没有选择要加入该礼包的商品!');</script>"
		   end if
		  end if
		  
	  	  With Response
			  .Write "<html>"
			  .Write"<head>"
			  .Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
			  .Write"<link href=""Include/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
			  .Write "<script src=""../HSK_JS/common.js"" language=""JavaScript""></script>"
			  .Write "<script language='JavaScript' src='../HSK_JS/jquery.js'></script>" & vbCrLf
			  .Write"</head>"
			  .Write"<body leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"
			  Set RS=Server.CreateObject("ADODB.RECORDSET")
			  RS.Open "Select a.id,a.title,a.price,a.Price_Original,a.Price_Member,a.photourl,b.id as packproid from ks_product a inner join KS_ShopPackagePro b on a.id=b.proid where b.PackID=" &packid & " and a.verific=1 order by a.id desc",conn,1,1
			  
			  MaxPerPage=20
              dim TotalPages,xml,node,photourl
			  
			  .Write  "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>"
              .Write "   <tr height='25' align='center' class='sort'>"
	          .Write "   <td width='5%' nowrap>选择</td>"
	          .Write "   <td>小图</td>"
	          .Write "   <td>商品名称</td>"
			  .Write "	 <td>当前价格</td>"
			  .Write "	 <td>会员价</td>"
			  .Write "   <td>原始零售价</td>"
			  .Write "   <td>操作</td>"
			  .Write " </tr>"
			  .Write "<form name=""myform"" id=""myform"" action=""shop.asp"" method=""post"">"
			  .Write "<input type='hidden' name='action' id='action' value='DelPackagepro'/>"
			  If RS.EOF Then
					 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
					 .Write "<td align='center' height='25' class='splittd' colspan=10>该礼包下还没有添加选购的商品!</td>"
					 .Write "</tr>"
			  Else
					totalPut = RS.Recordcount
					if (TotalPut mod MaxPerPage)=0 then
						TotalPages = TotalPut \ MaxPerPage
					else
						TotalPages = TotalPut \ MaxPerPage + 1
					end if
					if Page > TotalPages then Page=TotalPages
					If TotalPages > 1 then Rs.Move (Page - 1) * maxperpage
					
					Set XML=KS.ArrayToXml(RS.GetRows(MaxPerPage),RS,"row","")
					For Each Node In XML.DocumentElement.SelectNodes("row")
					 PhotoUrl=Node.SelectSingleNode("@photourl").text
					 If KS.IsNul(PhotoUrl) Then PhotoUrl="../images/nopic.gif"
					 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
					 .Write "<td align='center' class='splittd'><input type='checkbox' name='id' value='" & Node.SelectSingleNode("@packproid").text & "'></td>"
					 .Write "<td align='center' class='splittd'><Img src='" &PhotoUrl & "' width='40' height='40' /></td>"
					 .Write "<td class='splittd'>" & Node.SelectSingleNode("@title").text & "</td>"
					 .Write "<td align='center' class='splittd'>" & Node.SelectSingleNode("@price").text & " 元</td>"
					 .Write "<td align='center' class='splittd'>" & Node.SelectSingleNode("@price_member").text & " 元</td>"
					 .Write "<td align='center' class='splittd'>" & Node.SelectSingleNode("@price_original").text & " 元</td>"
					 .Write "<td align='center' class='splittd'><a href='?Action=DelPackagepro&id=" & Node.SelectSingleNode("@packproid").text & "' onclick=""return(confirm('确定移除吗?'));"">移除</a> | <a href='javascript:void(0)' onclick='parent.parent.frames[""BottomFrame""].location.href=""Split.asp?ChannelID=" & ChannelID &"&ComeFrom="&ComeFrom&"&OpStr="&Server.URLEncode("编辑" & KS.C_S(ChannelID,3)) & "&ButtonSymbol=AddInfo&FolderID=" & ID & """;parent.location.href=""Shop.asp?Page=" & Page & "&Action=Edit&ID=" &Node.SelectSingleNode("@id").text & """;'>修改</a></td>"
					 .Write "</tr>"
					Next
	         End If
			 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
			 .Write "<td colspan=10>&nbsp;<label><input id=""chkAll"" onClick=""CheckAll(this.form)"" type=""checkbox"" value=""checkbox""  name=""chkAll"">全选</label> <input type='submit' value='批量移除选中的选购品' class='button'> "
			 .Write "</tr>"
			 .Write "</form>"
			 .Write "</table>"
			 
			  Call KS.ShowPage(totalput, MaxPerPage, "", Page,true,true)
			 RS.Close
			 Set RS=Nothing
			   
			   
			   
			   
	       End With
	   End Sub
	   
	   '将产品从移除
	   Sub DelPackagepro()
	    dim id:id=KS.G("ID")
		IF KS.IsNul(id) Then
		  KS.AlertHintScript "请选择要移除的商品!"
		End If
		id=KS.FilterIds(id)
		Conn.Execute("Delete From KS_ShopPackagePro Where ID in(" & id & ")")
		KS.AlertHintScript "恭喜,选购品移除成功!"
	   End Sub
	   
	   '捆绑销售商品管理
	   Sub BundleSale()
            If Not KS.ReturnPowerResult(5, "M520009") Then                  '权限检查
			 Call KS.ReturnErr(1, "")   
			 Response.End()
		    End If		   
	       With Response
			  .Write "<html>"
			  .Write"<head>"
			  .Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
			  .Write"<link href=""Include/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
			  .Write "<script src=""../HSK_JS/common.js"" language=""JavaScript""></script>"
			  .Write "<script language='JavaScript' src='../HSK_JS/jquery.js'></script>" & vbCrLf
			  .Write"</head>"
			  .Write"<body leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"
			  .Write "<div class=""topdashed sort"">捆绑销售的商品管理</div>"
			  .Write  "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>"
              .Write "   <tr height='25' align='center' class='sort'>"
	          .Write "   <td width='5%' nowrap>序号</td>"
	          .Write "   <td>小图</td>"
	          .Write "   <td>商品名称</td>"
			  .Write "	 <td>当前零售价</td>"
			  .Write "	 <td>会员价</td>"
			  .Write "   <td>添加时间</td>"
			  .Write "   <td>捆绑商品数</td>"
			  .Write "   <td>操作</td>"
			  .Write " </tr>"
			  .Write "<form name='myform' action='?' method='get'>"
			  .Write "<input type='hidden' name='action' value='BatchSave'>"
			  
			  Dim XML,Node,Param,TotalPages,PhotoUrl
			  MaxPerPage=100
			  Param=" ID in(select distinct(proid) from KS_ShopBundleSale) "
			  SQLStr=KS.GetPageSQL("KS_Product","id",MaxPerPage,Page,1,Param,"*")
		      Set RS = Server.CreateObject("AdoDb.RecordSet")
		      RS.Open SQLStr, conn, 1, 1
			  If RS.EOF Then
					 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
					 .Write "<td align='center' height='25' class='splittd' colspan=10>没有捆绑销售的商品!</td>"
					 .Write "</tr>"
			  Else
					totalPut = Conn.Execute("select count(1) from KS_Product where " & Param)(0)
					if (TotalPut mod MaxPerPage)=0 then
						TotalPages = TotalPut \ MaxPerPage
					else
						TotalPages = TotalPut \ MaxPerPage + 1
					end if
					if Page > TotalPages then Page=TotalPages
					Set XML=KS.ArrayToXml(RS.GetRows(MaxPerPage),RS,"row","")
					For Each Node In XML.DocumentElement.SelectNodes("row")
					 PhotoUrl=Node.SelectSingleNode("@photourl").text
					 If KS.IsNul(PhotoUrl) Then PhotoUrl="../images/nopic.gif"
					 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
					 .Write "<td align='center' class='splittd'>" & Node.SelectSingleNode("@id").text & "<input type='hidden' name='id' value='" & Node.SelectSingleNode("@id").text & "'></td>"
					 .Write "<td align='center' class='splittd'><Img src='" &PhotoUrl & "' width='40' height='40' /></td>"
					 .Write "<td class='splittd'>" & Node.SelectSingleNode("@title").text & "</td>"
					 .Write "<td align='center' class='splittd'>" & Node.SelectSingleNode("@price").text & " 元</td>"
					 .Write "<td align='center' class='splittd'>" & Node.SelectSingleNode("@price_member").text & " 元</td>"
					 .Write "<td align='center' class='splittd'>" & FormatDateTime(Node.SelectSingleNode("@adddate").text,2) & "</td>"
					 .Write "<td align='center' class='splittd'><font color=red>" &conn.execute("select count(1) from KS_ShopBundleSale where proid=" &Node.SelectSingleNode("@id").text &"")(0) & "</font> 件</td>"
					 .Write "<td align='center' class='splittd'><a href='?Action=DelBundleSale&id=" & Node.SelectSingleNode("@id").text & "' onclick=""return(confirm('确定移除所有捆绑定吗?'));"">移除</a> | <a href='ItemInfo.asp?channelid=5&id="& Node.SelectSingleNode("@id").text&"&Action=Delete' onclick=""return(confirm('删除后不可恢复,确定删除吗?'))"">永久删除</a> | <a href='?Page=" & Page & "&Action=Edit&ID=" &Node.SelectSingleNode("@id").text & "' onclick='parent.frames[""BottomFrame""].location.href=""Split.asp?ChannelID=" & ChannelID &"&ComeFrom="&ComeFrom&"&OpStr="&Server.URLEncode("编辑" & KS.C_S(ChannelID,3)) & "&ButtonSymbol=AddInfo&FolderID=" & ID & """;'>修改</a></td>"
					 .Write "</tr>"
					Next
	         End If
			 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
			' .Write "<td colspan=10>&nbsp;<input type='submit' value='批量设置换购价' class='button'> "
			 .Write "</tr>"
			 .Write "</form>"
			 .Write "</table>"
			 
			  Call KS.ShowPage(totalput, MaxPerPage, "", Page,true,true)
			 RS.Close
			 Set RS=Nothing

		End With
	   End Sub
	   
	   '移除捆绑销售的商品
	   Sub DelBundleSale()
	     Dim ID:ID=KS.ChkClng(Request("id"))
		 if id<>0 then
		   conn.execute("delete from KS_ShopBundleSale where proid=" & id)
		 end if
		 call KS.AlertHintScript("恭喜,移除成功!")
	   End Sub
	   
	   '限时抢购商品管理
	   Sub LimitBuy()
	     With Response
			  .Write "<html>"
			  .Write"<head>"
			  .Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
			  .Write"<link href=""Include/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
			  .Write "<script src=""../HSK_JS/common.js"" language=""JavaScript""></script>"
			  .Write "<script language='JavaScript' src='../HSK_JS/jquery.js'></script>" & vbCrLf
			  .Write"</head>"
			  .Write"<body leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"
			  .Write "<ul id='menu_top'><li class='parent'><strong>限时/限量抢购任管理</strong></li> <li class='parent' onclick=""window.$(parent.document).find('#BottomFrame')[0].src='Split.asp?OpStr='+escape('限时/限量抢购任管理 >> <font color=red>添加抢购任务</font>')+'&ButtonSymbol=GOSave';location.href='?action=AddLimitBuyTask';""><span class=child onmouseover=""this.parentNode.className='parent_border'"" onMouseOut=""this.parentNode.className='parent'""><img src='images/ico/a.gif' border='0' align='absmiddle'>添加抢购任务</span></li></ul>"
			  .Write  "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>"
              .Write "   <tr height='25' align='center' class='sort'>"
	          .Write "   <td width='5%' nowrap>序号</td>"
	          .Write "   <td>任务名称</td>"
			  .Write "	 <td>任务类型</td>"
			  .Write "   <td>活动时间</td>"
			  .Write "   <td>最后付款时间</td>"
			  .Write "   <td>状态</td>"
			  .Write "   <td>操作</td>"
			  .Write " </tr>"
			  .Write "<form name='myform' action='?' method='get'>"
			  .Write "<input type='hidden' name='action' value='BatchSave'>"
			  
			  Dim XML,Node,Param,TotalPages,PhotoUrl
			  MaxPerPage=100
			  Param=" 1=1"
			  SQLStr=KS.GetPageSQL("KS_ShopLimitBuy","id",MaxPerPage,Page,1,Param,"*")
              Set RS = Server.CreateObject("AdoDb.RecordSet")
		      RS.Open SQLStr, conn, 1, 1
			  If RS.EOF Then
					 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
					 .Write "<td align='center' height='25' class='splittd' colspan=10>还没有添加任何限时/限量任务!</td>"
					 .Write "</tr>"
			  Else
					totalPut = Conn.Execute("Select count(id) from [KS_ShopLimitBuy] where " & Param)(0)
					if (TotalPut mod MaxPerPage)=0 then
						TotalPages = TotalPut \ MaxPerPage
					else
						TotalPages = TotalPut \ MaxPerPage + 1
					end if
					if Page > TotalPages then Page=TotalPages
					Set XML=KS.ArrayToXml(RS.GetRows(MaxPerPage),RS,"row","")
					For Each Node In XML.DocumentElement.SelectNodes("row")
					 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
					 .Write "<td align='center' class='splittd'>" & Node.SelectSingleNode("@id").text & "<input type='hidden' name='id' value='" & Node.SelectSingleNode("@id").text & "'></td>"
					 .Write "<td class='splittd'>" & Node.SelectSingleNode("@taskname").text & "</td>"
					 .Write "<td align='center' class='splittd'>"
					 if Node.SelectSingleNode("@tasktype").text="1" then
					  .write "<span style='color:green'>限时抢购</span>"
					 else
					  .Write "<span style='color:blue'>限量抢购</span>"
					 end if
					 .Write "</td>"
					 .Write "<td align='center' class='splittd'>从" & Node.SelectSingleNode("@limitbuybegintime").text & "至<br/>" &Node.SelectSingleNode("@limitbuyendtime").text & "止</td>"
					 .Write "<td align='center' class='splittd'>下单后<font color=red>" &Node.SelectSingleNode("@limitbuypaytime").text & "</font>小时内</td>"
					 .Write "<td align='center' class='splittd'>"
					 if Node.SelectSingleNode("@status").text="0" then
					  .write "<span style='color:red'>关闭</span>"
					 else
					  .Write "<span style='color:green'>正常</span>"
					 end if
					 .Write "</td>"
					 .Write "<td align='center' class='splittd'><a href='?Action=LimitBuyProduct&id=" & Node.SelectSingleNode("@id").text & "'>活动商品(<font color=red>" & conn.execute("select count(id) from ks_product where limitbuytaskid=" & node.selectsinglenode("@id").text)(0) & "</font>)</a> | <a href='Shop.asp?channelid=5&id="& Node.SelectSingleNode("@id").text&"&Action=DelLimitBuyTask' onclick=""return(confirm('删除后不可恢复,确定删除吗?'))"">删除</a> | <a href='?Page=" & Page & "&Action=AddLimitBuyTask&ID=" &Node.SelectSingleNode("@id").text & "' onclick='parent.frames[""BottomFrame""].location.href=""Split.asp?ChannelID=" & ChannelID &"&ComeFrom="&ComeFrom&"&OpStr="&Server.URLEncode("超值礼包管理 >> <font color=red>编辑礼包</font>") & "&ButtonSymbol=GOSave"";'>修改</a> </td>"
					 .Write "</tr>"
					Next
	         End If
			 .Write "</form>"
			 .Write "</table>"
			 Call KS.ShowPage(totalput, MaxPerPage, "", Page,true,true)
			 RS.Close
			 Set RS=Nothing

		End With
	 End Sub
	 
	 '添加限时抢购
	 Sub AddLimitBuyTask()
	  Dim TaskName,LimitBuyBeginTime,LimitBuyEndTime,LimitBuyPayTime,TaskType,Intro,AddDate,ID,TemplateID,Status
	        Status=1 :Intro="":TaskType=1:LimitBuyBeginTime=Now:LimitBuyEndTime=Now+10:LimitBuyPayTime=48
			ID=KS.ChkClng(Request("id")):AddDate=Now
			If ID<>0 Then
			   Dim RS:Set RS=Server.CreateObject("ADODB.RECORDSET")
			   RS.Open "Select top 1 * From KS_ShopLimitBuy Where ID=" & ID,conn,1,1
			   If Not RS.Eof Then
			     TaskName=RS("TaskName") : Status=RS("Status") :Intro=RS("Intro"):TemplateID=RS("TemplateID") : TaskType=RS("TaskType")
				 LimitBuyBeginTime=RS("LimitBuyBeginTime") : LimitBuyEndTime=RS("LimitBuyEndTime") : LimitBuyPayTime=rs("LimitBuyPayTime") 
			   End If
			   RS.Close:Set RS=Nothing
			End If
	   
	   		 With Response
              .Write"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"">"
		      .Write "<html xmlns=""http://www.w3.org/1999/xhtml"">"
			  .Write"<head>"
			  .Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
			  .Write"<link href=""Include/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
			  .Write "<script src=""../HSK_JS/common.js"" language=""JavaScript""></script>"
			  .Write "<script language='JavaScript' src='../HSK_JS/jquery.js'></script>" & vbCrLf
			  .Write"</head>"
			  .Write"<body leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"
			  .Write "<div class=""topdashed sort"">添加超值礼包</div>"
			  %>
			  <script type="text/javascript">
			  function CheckForm()
			  {
			  if ($('#TaskName').val()=='')
				{
				 alert('请输入任务名称!');
				 $('#TaskName').focus();
				 return false;
				}
			  
			  $("#myform").submit();
				
			  }
			  </script>

			  <br>
				<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="ctable">
				  <form name="myform" id="myform" action="?action=LimitBuySave" method="post">
					<input type="hidden" value="<%=ID%>" name="id" />
					<input type="hidden" value="<%=request.servervariables("http_referer")%>" name="comeurl" />
					<tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td  height='30' width='160' align='right' class='clefttitle'><strong>限时/限量任务名称：</strong></td>
					  <td height='30'>
						  <input type='text' name='TaskName' id='TaskName' value='<%=TaskName%>' size="40" />
						  <font color=red>*</font> 如:7天限时抢购活动</td>
					</tr>
					<tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td height='30' align='right' class='clefttitle'><strong>任务类型：</strong></td>
					  <td height='30'>
					  <label><input type='radio' name='TaskType' onclick="$('#limitbuytime').show();" value='1'<%if tasktype="1" then response.write " checked"%>>限时抢购</label>
					  <label>
					  <input type='radio' name='TaskType' onclick="$('#limitbuytime').hide();" value='2'<%if tasktype="2" then response.write " checked"%>>限量抢购</label>
					  </td>
				    </tr>
					<tr class="tdbg" <%if tasktype="2" then response.write " style='display:none'" %> id='limitbuytime' onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td  height='30' align='right' class='clefttitle'><strong>抢购时间限制：</strong></td>
					  <td nowrap>
					  <input type='text' name='LimitBuyBeginTime' id='LimitBuyBeginTime' value='<%=LimitBuyBeginTime%>' size='20'>至<input type='text' name='LimitBuyEndTime' id='LimitBuyEndTime' value='<%=LimitBuyEndTime%>' size='20'>  <font color=red>在此时间内才能享受抢购价</font>
					  </td>
					</tr>
					<tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td  height='30' align='right' class='clefttitle'><strong>最迟付款时间：</strong></td>
					  <td nowrap>
					   下单后<input type='text' name='LimitBuyPayTime' id='LimitBuyPayTime' style='text-align:center' value='<%=LimitBuyPayTime%>' size='6'>小时内没有付款,视为抢购无效。如果不限制请录入"0"。</font>
					  </td>
					</tr>
				
					
					<tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td  height='30' align='right' class='clefttitle'><strong>任务介绍：</strong></td>
					  <td nowrap>
					  <textarea ID='Intro' name='Intro' style='display:none'><%=Server.htmlencode(Intro)%></textarea>
					  <script type="text/javascript" src="../editor/ckeditor.js" mce_src="../editor/ckeditor.js"></script>
					  <script type="text/javascript">
                       CKEDITOR.replace('Intro', {width:"98%",height:"160px",toolbar:"Basic",filebrowserBrowseUrl :"Include/SelectPic.asp?from=ckeditor&Currpath=<%=KS.GetUpFilesDir()%>",filebrowserWindowWidth:650,filebrowserWindowHeight:290});
			        </script> 
					
					  </td>
					</tr>
					<tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td  height='30' align='right' class='clefttitle'><strong>任务添加时间：</strong></td>
					  <td nowrap>
					   <input type='text' name='AddDate' id='AddDate' value='<%=AddDate%>' size='15'>
					  </td>
					</tr>
					<tr class="tdbg" onmouseover="this.className='tdbgmouseover'" onmouseout="this.className='tdbg'">
					  <td  height='30' align='right' class='clefttitle'><strong>任务状态：</strong></td>
					  <td nowrap>
					   <input type="radio" name="Status" value="1"<%if Status="1" then response.write " checked"%>>正常
					   <input type="radio" name="Status" value="0"<%if Status="0" then response.write " checked"%>>关闭
					  </td>
					</tr>
					
					<tr class='tdbg' style="display:none">
					 <td class='clefttitle'><div align='right'><strong>绑定模板:</strong></td><td>
			         <input id='TemplateID' name='TemplateID' readonly maxlength='255' size=30 class='textbox' value='<%=TemplateID%>'>&nbsp;<%=KSCls.Get_KS_T_C("$('#TemplateID')[0]")%>
				      </td>
			         </tr>
				</table>
			  <%
			 End With
	 End Sub
	 '保存限时抢购任务
	 Sub LimitBuySave()
	     Dim TaskName,LimitBuyBeginTime,LimitBuyEndTime,LimitBuyPayTime,TaskType,Intro,AddDate,ID,TemplateID,Status
		 TaskName=KS.G("TaskName")
		 LimitBuyBeginTime= KS.S("LimitBuyBeginTime")
		 LimitBuyEndTime = KS.S("LimitBuyEndTime")
		 LimitBuyPayTime=KS.ChkClng(KS.S("LimitBuyPayTime"))
		 If Not IsDate(LimitBuyBeginTime) Then LimitBuyBeginTime=now
		 If Not IsDate(LimitBuyEndTime) Then LimitBuyEndTime=Now+10


		 Status=KS.ChkClng(KS.G("Status"))
		 Intro=Request.Form("Intro")
		 ID=KS.ChkClng(KS.G("ID"))
		 TaskType=KS.ChkClng(KS.G("TaskType"))
		 TemplateID=KS.G("TemplateID")
		 AddDate=KS.G("AddDate")
		 If Not IsDate(AddDate) Then AddDate=Now
		 
		 If KS.IsNul(TaskName) Then
		  KS.Echo ("<script>alert('请输入任务名称!');history.back(-1);</script>")
		 End If
	     
		 Dim RS:Set RS=Server.CreateObject("ADODB.RECORDSET")
		 RS.Open "Select top 1 * From KS_ShopLimitBuy Where ID=" & ID,conn,1,3
		 If RS.Eof Then
		   RS.AddNEW
		 End If
		   RS("TaskName")=TaskName
		   RS("LimitBuyBeginTime")=LimitBuyBeginTime
		   RS("LimitBuyEndTime")=LimitBuyEndTime
		   RS("LimitBuyPayTime") =LimitBuyPayTime
		   RS("TaskType")=TaskType
		   RS("Intro")=Intro
		   RS("Status")  =Status
		   RS("AddDate") =AddDate
		   RS("TemplateID")=TemplateID
		 RS.Update
		 RS.MoveLast
		 Dim NewID:NewID=RS("ID")
		 RS.Close
		 Set RS=Nothing
		
		 Response.Write "<script src='../HSK_JS/jquery.js'></script>" 
		 If ID=0 Then
		  Response.Write "<script>if (confirm('限时/限量抢购任务添加成功,继续添加吗?')){location.href='Shop.asp?action=AddLimitBuyTask';}else{$(parent.document).find('#BottomFrame')[0].src='Split.asp?ButtonSymbol=Disabled&OpStr=" & Server.URLEncode("商城系统 >> <font color=red>抢购任务管理</font>") & "';location.href='Shop.asp?action=LimitBuy';}</script>"
		 Else
		  Response.Write "<script>alert('限时/限量抢购任务修改成功！');$(parent.document).find('#BottomFrame')[0].src='Split.asp?ButtonSymbol=Disabled&OpStr=" & Server.URLEncode("商城系统 >> <font color=red>抢购任务管理</font>") & "';location.href='"& KS.G("ComeUrl") & "';</script>"
		 End If
	End Sub
	 
	 
	 Sub LimitBuyProduct()
		 With Response
			  .Write "<html>"
			  .Write"<head>"
			  .Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
			  .Write"<link href=""Include/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
			  .Write "<script src=""../HSK_JS/common.js"" language=""JavaScript""></script>"
			  %>
			  <script type="text/javascript">
			  function regInput(obj, reg, inputStr)
				{
					var docSel = document.selection.createRange()
					if (docSel.parentElement().tagName != "INPUT")    return false
					oSel = docSel.duplicate()
					oSel.text = ""
					var srcRange = obj.createTextRange()
					oSel.setEndPoint("StartToStart", srcRange)
					var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
					return reg.test(str)
				}
			  </script>
			  <%
			  dim id:id=ks.chkclng(request("id"))
			  dim rs:set rs=server.createobject("adodb.recordset")
			  rs.open "select * from ks_shoplimitbuy where id="& id,conn,1,1
			  if rs.eof and rs.bof then 
			    rs.close : set rs=nothing
				ks.alerthintscript "出错了!"
			  end if
			  dim taskname:taskname=rs("taskname")
			  dim tasktype:tasktype=rs("tasktype")
			  rs.close: set rs=nothing
			  
			  .Write "<script language='JavaScript' src='../HSK_JS/jquery.js'></script>" & vbCrLf
			  .Write"</head>"
			  .Write"<body leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"
			  .Write "<div class=""topdashed sort"" style='text-align:left'>&nbsp;&nbsp;<a href='Shop.asp?action=LimitBuy&channelid=5'>返 回</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;管理抢购任务[<font color=red>" & taskname & "</font>]下的商品</div>"

			  .Write  "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>"
              .Write "   <tr height='25' align='center' class='sort'>"
	          .Write "   <td width='5%' nowrap>序号</td>"
	          .Write "   <td>小图</td>"
	          .Write "   <td>商品名称</td>"
			  .Write "	 <td>抢购价</td>"
			  .Write "	 <td>抢购数量</td>"
			  .Write "   <td>已被抢购</td>"
			  .Write "   <td>操作</td>"
			  .Write " </tr>"
			  .Write "<form name='myform' action='?' method='get'>"
			  .Write "<input type='hidden' name='action' value='BatchSaveLimitBuy'>"
			  .Write "<input type='hidden' name='f' value='" & KS.G("F") & "'>"
			  
			  Dim XML,Node,Param,TotalPages
			  MaxPerPage=100
			  Param=" LimitBuyTaskID=" & ID
			  SQLStr=KS.GetPageSQL("KS_Product","id",MaxPerPage,Page,1,Param,"*")
		      Set RS = Server.CreateObject("AdoDb.RecordSet")
		      RS.Open SQLStr, conn, 1, 1
			  If RS.EOF Then
					 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
					 .Write "<td align='center' height='25' class='splittd' colspan=10>没有允许换购的商品!</td>"
					 .Write "</tr>"
			  Else
					totalPut = Conn.Execute("Select count(id) from [KS_Product] where " & Param)(0)
					if (TotalPut mod MaxPerPage)=0 then
						TotalPages = TotalPut \ MaxPerPage
					else
						TotalPages = TotalPut \ MaxPerPage + 1
					end if
					if Page > TotalPages then Page=TotalPages
					Set XML=KS.ArrayToXml(RS.GetRows(MaxPerPage),RS,"row","")
					For Each Node In XML.DocumentElement.SelectNodes("row")
					 PhotoUrl=Node.SelectSingleNode("@photourl").text
					 If KS.IsNul(PhotoUrl) Then PhotoUrl="../images/nopic.gif"
					 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
					 .Write "<td align='center' class='splittd'>" & Node.SelectSingleNode("@id").text & "<input type='hidden' name='id' value='" & Node.SelectSingleNode("@id").text & "'></td>"
					 .Write "<td align='center' class='splittd'><Img src='" &PhotoUrl & "' width='40' height='40' /></td>"
					 .Write "<td class='splittd'>" & Node.SelectSingleNode("@title").text & "<br/>会员价:" & Node.SelectSingleNode("@price_member").text & "元</td>"
					 .Write "<td align='center' class='splittd'><input onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" class='textbox' type='text' name='limitbuyprice" & Node.SelectSingleNode("@id").text & "' value='" & Node.SelectSingleNode("@limitbuyprice").text & "' size='5' style='text-align:center'> 元</td>"
					 .Write "<td align='center' class='splittd'><input onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" class='textbox' type='text' name='limitbuyamount" & Node.SelectSingleNode("@id").text & "' value='" & Node.SelectSingleNode("@limitbuyamount").text & "' size='5' style='text-align:center'></td>"
					 
					
					 
					 .Write "<td align='center' class='splittd'><font color=red>" &conn.execute("select count(1) from ks_orderitem where proid=" &Node.SelectSingleNode("@id").text &" and islimitbuy<>0 and limitbuytaskid=" & id & "")(0) & "</font> 件</td>"
					 .Write "<td align='center' class='splittd'><a href='?Action=DelLimitBuy&id=" & Node.SelectSingleNode("@id").text & "' onclick=""return(confirm('确定移除吗?'));"">移除</a> | <a href='ItemInfo.asp?channelid=5&id="& Node.SelectSingleNode("@id").text&"&Action=Delete' onclick=""return(confirm('删除后不可恢复,确定删除吗?'))"">永久删除</a> | <a href='?Page=" & Page & "&Action=Edit&ID=" &Node.SelectSingleNode("@id").text & "' onclick='parent.frames[""BottomFrame""].location.href=""Split.asp?ChannelID=" & ChannelID &"&ComeFrom="&ComeFrom&"&OpStr="&Server.URLEncode("编辑" & KS.C_S(ChannelID,3)) & "&ButtonSymbol=AddInfo&FolderID=" & ID & """;'>修改</a></td>"
					 .Write "</tr>"
					Next
	         End If
			 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
			 .Write "<td colspan=10><br/>&nbsp;<input type='submit' value='批量设置抢购商品信息' class='button'> "
			 .Write "</tr>"
			 .Write "</form>"
			 .Write "</table>"
			 
			  Call KS.ShowPage(totalput, MaxPerPage, "", Page,true,true)
			 RS.Close
			 Set RS=Nothing

		End With
	   End Sub
	   '移出抢购品
	   Sub DelLimitBuy()
	    Dim ID:ID=KS.G("ID")
		If ID="" Then KS.AlertHintScript "对不起,请先选择要移除的商品"
		ID=KS.FilterIDs(ID)
		Conn.Execute("Update KS_Product Set IsLimitBuy=0 Where ID in(" & ID & ")")
		KS.AlertHintScript "恭喜,已将选中的商品移出!"
	   End Sub
	   
	   '批量设置换购价格
	   Sub BatchSaveLimitBuy()
	    Dim ID:ID=KS.G("ID")
		If ID="" Then KS.AlertHintScript "对不起,请先选择要设置的商品"
		Dim i,IDArr,LimitBuyBeginTime,LimitBuyEndTime,LimitBuyPayTime
		IDArr=Split(KS.FilterIDs(ID),",")
		For i=0 to ubound(idArr)
		  Conn.Execute("Update KS_Product Set LimitBuyPrice=" & KS.G("LimitBuyPrice"&idArr(i)) & ",LimitBuyAmount=" & KS.ChkClng(KS.G("LimitBuyAmount"&idArr(i))) & " Where ID=" & Idarr(i))
		Next
		KS.AlertHintScript "恭喜,批量设置抢购商品成功!"
	   End Sub
	   
	   '批量设置库存
	   Sub BatchSaveStock()
	    Dim ID:ID=KS.G("ID")
		If ID="" Then KS.AlertHintScript "对不起,请先选择要补货的商品"
		Dim i,IDArr
		IDArr=Split(KS.FilterIDs(ID),",")
		For i=0 to ubound(idArr)
		  Conn.Execute("Update KS_Product Set alarmnum=" & KS.ChkClng(KS.G("alarmnum"&idArr(i))) & ",totalNum=" & KS.ChkClng(KS.G("totalnum"&idArr(i))) &" Where ID=" & Idarr(i))
		Next
		KS.AlertHintScript "恭喜,批量补货成功!"
	   End Sub

	   
	   '库存报警管理
	   Sub StockAlarm()
	        If Not KS.ReturnPowerResult(5, "M520012") Then                  '权限检查
			 Call KS.ReturnErr(1, "")   
			 Response.End()
		    End If		   

		 With Response
			  .Write "<html>"
			  .Write"<head>"
			  .Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
			  .Write"<link href=""Include/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
			  .Write "<script src=""../HSK_JS/common.js"" language=""JavaScript""></script>"
			  %>
			  <script type="text/javascript">
			  function regInput(obj, reg, inputStr)
				{
					var docSel = document.selection.createRange()
					if (docSel.parentElement().tagName != "INPUT")    return false
					oSel = docSel.duplicate()
					oSel.text = ""
					var srcRange = obj.createTextRange()
					oSel.setEndPoint("StartToStart", srcRange)
					var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
					return reg.test(str)
				}
			  </script>
			  <%
			  .Write "<script language='JavaScript' src='../HSK_JS/jquery.js'></script>" & vbCrLf
			  .Write"</head>"
			  .Write"<body leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"
			  .Write "<div class=""topdashed sort"">以下商品库存量已不足，请及时补货</div>"
			  .Write  "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>"
              .Write "   <tr height='25' align='center' class='sort'>"
	          .Write "   <td width='5%' nowrap>序号</td>"
	          .Write "   <td>小图</td>"
	          .Write "   <td>商品名称</td>"
			  .Write "	 <td>当前库存量</td>"
			  .Write "   <td>报警库存量</td>"
			  .Write " </tr>"
			  .Write "<form name='myform' action='?' method='get'>"
			  .Write "<input type='hidden' name='action' value='BatchSaveStock'>"
			  
			  Dim XML,Node,Param,TotalPages,PhotoUrl
			  MaxPerPage=100
			  Param=" totalnum<=AlarmNum"
			  SQLStr=KS.GetPageSQL("KS_Product","id",MaxPerPage,Page,1,Param,"*")
		      Set RS = Server.CreateObject("AdoDb.RecordSet")
		      RS.Open SQLStr, conn, 1, 1
			  If RS.EOF Then
					 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
					 .Write "<td align='center' height='25' class='splittd' colspan=10>还没有发现库存量不足的商品!</td>"
					 .Write "</tr>"
			  Else
					totalPut = Conn.Execute("Select count(id) from [KS_Product] where " & Param)(0)
					if (TotalPut mod MaxPerPage)=0 then
						TotalPages = TotalPut \ MaxPerPage
					else
						TotalPages = TotalPut \ MaxPerPage + 1
					end if
					if Page > TotalPages then Page=TotalPages
					Set XML=KS.ArrayToXml(RS.GetRows(MaxPerPage),RS,"row","")
					For Each Node In XML.DocumentElement.SelectNodes("row")
					 PhotoUrl=Node.SelectSingleNode("@photourl").text
					 If KS.IsNul(PhotoUrl) Then PhotoUrl="../images/nopic.gif"
					 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
					 .Write "<td align='center' class='splittd'>" & Node.SelectSingleNode("@id").text & "<input type='hidden' name='id' value='" & Node.SelectSingleNode("@id").text & "'></td>"
					 .Write "<td align='center' class='splittd'><Img src='" &PhotoUrl & "' width='40' height='40' /></td>"
					 .Write "<td class='splittd'>" & KS.Gottopic(Node.SelectSingleNode("@title").text,40) & "</td>"
					 .Write "<td align='center' class='splittd'><input onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" class='textbox' type='text' name='totalnum" & Node.SelectSingleNode("@id").text & "' value='" & Node.SelectSingleNode("@totalnum").text & "' size='5' style='text-align:center'> " & Node.SelectSingleNode("@unit").text & "</td>"
					 .Write "<td align='center' class='splittd'><input onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" class='textbox' type='text' name='alarmnum" & Node.SelectSingleNode("@id").text & "' value='" & Node.SelectSingleNode("@alarmnum").text & "' size='5' style='text-align:center'> " & Node.SelectSingleNode("@unit").text &"</td>"
					 .Write "</tr>"
					Next
	         End If
			 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
			 .Write "<td colspan=10>&nbsp;<input type='submit' value='保存批量补货' class='button'> "
			 .Write "</tr>"
			 .Write "</form>"
			 .Write "</table>"
			 
			  Call KS.ShowPage(totalput, MaxPerPage, "", Page,true,true)
			 RS.Close
			 Set RS=Nothing

		End With
		%>
		<br/><br/><br/>
		<div class="attention" style="clear:both">
		<font color=red>说明：这里只显示库存量少于等于库存量报警的商品，为保证客户顺利购买商品，请对库存量不多的商品及时补货。</font>
		</div><br/>
		<%
	   End Sub
	   
	   
	   '换购品管理
	   Sub ChangedBuy()
	        If Not KS.ReturnPowerResult(5, "M520010") Then                  '权限检查
			 Call KS.ReturnErr(1, "")   
			 Response.End()
		    End If		   

		 With Response
			  .Write "<html>"
			  .Write"<head>"
			  .Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
			  .Write"<link href=""Include/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
			  .Write "<script src=""../HSK_JS/common.js"" language=""JavaScript""></script>"
			  %>
			  <script type="text/javascript">
			  function regInput(obj, reg, inputStr)
				{
					var docSel = document.selection.createRange()
					if (docSel.parentElement().tagName != "INPUT")    return false
					oSel = docSel.duplicate()
					oSel.text = ""
					var srcRange = obj.createTextRange()
					oSel.setEndPoint("StartToStart", srcRange)
					var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
					return reg.test(str)
				}
			  </script>
			  <%
			  .Write "<script language='JavaScript' src='../HSK_JS/jquery.js'></script>" & vbCrLf
			  .Write"</head>"
			  .Write"<body leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"
			  .Write "<div class=""topdashed sort"">允许换购的商品管理</div>"
			  .Write  "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>"
              .Write "   <tr height='25' align='center' class='sort'>"
	          .Write "   <td width='5%' nowrap>序号</td>"
	          .Write "   <td>小图</td>"
	          .Write "   <td>商品名称</td>"
			  .Write "	 <td>订单满足金额</td>"
			  .Write "	 <td>换购价格</td>"
			  .Write "   <td>添加时间</td>"
			  .Write "   <td>已被兑换</td>"
			  .Write "   <td>操作</td>"
			  .Write " </tr>"
			  .Write "<form name='myform' action='?' method='get'>"
			  .Write "<input type='hidden' name='action' value='BatchSave'>"
			  
			  Dim XML,Node,Param,TotalPages,PhotoUrl
			  MaxPerPage=100
			  Param=" IsChangedBuy=1"
			  SQLStr=KS.GetPageSQL("KS_Product","id",MaxPerPage,Page,1,Param,"*")
		      Set RS = Server.CreateObject("AdoDb.RecordSet")
		      RS.Open SQLStr, conn, 1, 1
			  If RS.EOF Then
					 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
					 .Write "<td align='center' height='25' class='splittd' colspan=10>没有允许换购的商品!</td>"
					 .Write "</tr>"
			  Else
					totalPut = Conn.Execute("Select count(id) from [KS_Product] where " & Param)(0)
					if (TotalPut mod MaxPerPage)=0 then
						TotalPages = TotalPut \ MaxPerPage
					else
						TotalPages = TotalPut \ MaxPerPage + 1
					end if
					if Page > TotalPages then Page=TotalPages
					Set XML=KS.ArrayToXml(RS.GetRows(MaxPerPage),RS,"row","")
					For Each Node In XML.DocumentElement.SelectNodes("row")
					 PhotoUrl=Node.SelectSingleNode("@photourl").text
					 If KS.IsNul(PhotoUrl) Then PhotoUrl="../images/nopic.gif"
					 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
					 .Write "<td align='center' class='splittd'>" & Node.SelectSingleNode("@id").text & "<input type='hidden' name='id' value='" & Node.SelectSingleNode("@id").text & "'></td>"
					 .Write "<td align='center' class='splittd'><Img src='" &PhotoUrl & "' width='40' height='40' /></td>"
					 .Write "<td class='splittd'>" & KS.Gottopic(Node.SelectSingleNode("@title").text,40) & "</td>"
					 .Write "<td align='center' class='splittd'><input onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" class='textbox' type='text' name='changebuyneedprice" & Node.SelectSingleNode("@id").text & "' value='" & Node.SelectSingleNode("@changebuyneedprice").text & "' size='5' style='text-align:center'> 元</td>"
					 .Write "<td align='center' class='splittd'><input onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" class='textbox' type='text' name='changebuypresentprice" & Node.SelectSingleNode("@id").text & "' value='" & Node.SelectSingleNode("@changebuypresentprice").text & "' size='5' style='text-align:center'> 元</td>"
					 .Write "<td align='center' class='splittd'>" & FormatDateTime(Node.SelectSingleNode("@adddate").text,2) & "</td>"
					 .Write "<td align='center' class='splittd'><font color=red>" &conn.execute("select count(1) from ks_orderitem where proid=" &Node.SelectSingleNode("@id").text &" and IsChangedBuy=1")(0) & "</font> 次</td>"
					 .Write "<td align='center' class='splittd'><a href='?Action=DelChangeBuy&id=" & Node.SelectSingleNode("@id").text & "' onclick=""return(confirm('确定移除吗?'));"">移除</a> | <a href='ItemInfo.asp?channelid=5&id="& Node.SelectSingleNode("@id").text&"&Action=Delete' onclick=""return(confirm('删除后不可恢复,确定删除吗?'))"">永久删除</a> | <a href='?Page=" & Page & "&Action=Edit&ID=" &Node.SelectSingleNode("@id").text & "' onclick='parent.frames[""BottomFrame""].location.href=""Split.asp?ChannelID=" & ChannelID &"&ComeFrom="&ComeFrom&"&OpStr="&Server.URLEncode("编辑" & KS.C_S(ChannelID,3)) & "&ButtonSymbol=AddInfo&FolderID=" & ID & """;'>修改</a></td>"
					 .Write "</tr>"
					Next
	         End If
			 .Write "<tr onmouseout=""this.className='list'"" onmouseover=""this.className='listmouseover'"">"
			 .Write "<td colspan=10>&nbsp;<input type='submit' value='批量设置换购价' class='button'> "
			 .Write "</tr>"
			 .Write "</form>"
			 .Write "</table>"
			 
			  Call KS.ShowPage(totalput, MaxPerPage, "", Page,true,true)
			 RS.Close
			 Set RS=Nothing

		End With
	   End Sub
	   
	   '移出兑换品
	   Sub DelChangeBuy()
	    Dim ID:ID=KS.G("ID")
		If ID="" Then KS.AlertHintScript "对不起,请先选择要移除的商品"
		ID=KS.FilterIDs(ID)
		Conn.Execute("Update KS_Product Set IsChangedBuy=0 Where ID in(" & ID & ")")
		KS.AlertHintScript "恭喜,已将选中的商品移出!"
	   End Sub
	   
	   '批量设置换购价格
	   Sub BatchSave()
	    Dim ID:ID=KS.G("ID")
		If ID="" Then KS.AlertHintScript "对不起,请先选择要移除的商品"
		Dim i,IDArr
		IDArr=Split(KS.FilterIDs(ID),",")
		For i=0 to ubound(idArr)
		  Conn.Execute("Update KS_Product Set changebuyneedprice=" & KS.G("changebuyneedprice"&idArr(i)) & ",changebuypresentprice=" & KS.G("changebuypresentprice"&idArr(i)) &" Where ID=" & Idarr(i))
		Next
		KS.AlertHintScript "恭喜,批量设置换购价格成功!"
	   End Sub
	   
	   
	   
	   
	   
	   
	   

       Sub ShopAdd() 
			With Response
			.Write"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"">"
			.Write "<html xmlns=""http://www.w3.org/1999/xhtml"">"
			.Write "<head>" & vbCrlf
			.Write "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbCrlf
			.Write "<title>添加商品</title>" & vbCrlf
			.Write "<link href='Include/Admin_Style.CSS' rel='stylesheet' type='text/css'>" & vbCrlf
			.Write "<script language='JavaScript' src='../HSK_JS/common.js'></script>" & vbCrlf
			.Write "<script language='JavaScript' src='../HSK_JS/JQuery.js'></script>" & vbCrlf
			.Write "<script language=""javascript"" src=""../HSK_JS/popcalendar.js""></script>" & vbCrlf
			.Write "<script src=""images/pannel/tabpane.js"" language=""JavaScript""></script>"
			.Write "<link href=""images/pannel/tabpane.CSS"" rel=""stylesheet"" type=""text/css"">"
		    .Write "<script type=""text/javascript"" src=""../editor/ckeditor.js"" mce_src=""../editor/ckeditor.js""></script>"
			.Write "<script language='javascript' src='../HSK_JS/HSK.box.js'></script>"
			CurrPath = KS.GetUpFilesDir()
			Session("UploadFileIDs")=""   '上传附件的ID
						
			Set RS = Server.CreateObject("ADODB.RecordSet")
			If Action = "Add" Then
			  FolderID = Trim(KS.G("FolderID"))
			  If Not KS.ReturnPowerResult(ChannelID, "M" & ChannelID & "10002") Then          '检查是否有添加商品的权限
			   .Write ("<script>$(parent.document).find('#BottomFrame')[0].src='Split.asp?ButtonSymbol=ViewFolder&FolderID=" & FolderID & "';</script>")
			   Call KS.ReturnErr(2, "ItemInfo.asp?ChannelID=" & ChannelID & "&Page=" & Page & "&ID=" & FolderID)
			   Exit Sub
			  End If
			  ProductID=0: ProductType=1:Discount=9:Hits = 0:HitsByDay = 0: HitsByWeek = 0:HitsByMonth = 0:TotalNum = 1000: AlarmNum = 10:Comment = 1:GroupPrice=0:BrandID=0:Strip=0:IsChangedBuy=0:Weight=0
			  
				IsLimitbuy = 0
				LimitBuyPrice = 100
				LimitBuyAmount = 100

			  
			  
			  ProID = KS.GetInfoID(ChannelID)
			  KeyWords = Session("keywords")
			  ProducerName = Session("ProducerName")
			  TrademarkName = Session("TrademarkName")
			ElseIf Action = "Edit" Or Action="Verify" Then
			   Set RS = Server.CreateObject("ADODB.RECORDSET")
			   RS.Open "Select top 1 * From KS_Product Where ID=" & KS.G("ID"), conn, 1, 1
			   If RS.EOF And RS.BOF Then Call KS.Alert("参数传递出错!", ComeUrl):Exit Sub
				ID = Trim(RS("ID"))
				FolderID = Trim(RS("Tid"))
				If Not KS.ReturnPowerResult(ChannelID, "M" & ChannelID & "10003") Then     '检查是否有编辑商品的权限
				RS.Close:Set RS = Nothing
				 If KeyWord = "" Then
				  .Write ("<script>$(parent.document).find('#BottomFrame')[0].src='Split.asp?ButtonSymbol=ViewFolder&FolderID=" & FolderID & "';</script>")
				  Call KS.ReturnErr(1, "Shop.asp?Page=" & Page & "&ID=" & FolderID)
				 Else
				  .Write ("<script>$(parent.document).find('#BottomFrame')[0].src='Split.asp?OpStr=" & server.URLEncode("商品管理 >> <font color=red>搜索商品结果</font>") & "&ButtonSymbol=ShopSearch';</script>")
				  Call KS.ReturnErr(1, "Shop.asp?Page=" & Page & "&KeyWord=" & KeyWord & "&SearchType=" & SearchType & "&StartDate=" & StartDate & "&EndDate=" & EndDate)
				 End If
				 Exit Sub
			   End If
			    ProductID=RS("ID")
				ProID=RS("ProID")
				Title = Trim(RS("title"))
				PhotoUrl = Trim(RS("PhotoUrl"))
				BigPhoto=Trim(RS("BigPhoto"))
				BigPhoto = Trim(RS("BigPhoto"))
				ProIntro = Trim(RS("ProIntro"))
				Rolls = CInt(RS("Rolls"))
				Recommend = CInt(RS("Recommend"))
				Popular = CInt(RS("Popular"))
				Verific = CInt(RS("Verific"))
				Comment = CInt(RS("Comment"))
				Slide = CInt(RS("Slide"))
				IsSpecial =RS("IsSpecial")
				IsTop = RS("IsTop")
				Strip = RS("Strip")
				AddDate = CDate(RS("AddDate"))
				Rank = Trim(RS("Rank"))
                FileName= RS("Fname")
				TemplateID = RS("TemplateID")
				Hits = Trim(RS("Hits"))
				HitsByDay = Trim(RS("HitsByDay"))
				HitsByWeek = Trim(RS("HitsByWeek"))
				HitsByMonth = Trim(RS("HitsByMonth"))
				IsChangedBuy=RS("IsChangedBuy")
				ChangeBuyNeedPrice=RS("ChangeBuyNeedPrice")
				ChangeBuyPresentPrice=RS("ChangeBuyPresentPrice")
				Weight=RS("Weight")
				IsLimitbuy = KS.ChkClng(RS("IsLimitBuy"))
				LimitBuyPrice = RS("LimitBuyPrice")
				LimitBuyTaskID= RS("LimitBuyTaskID")
				LimitBuyAmount = KS.ChkCLng(RS("LimitBuyAmount"))
				
				
				Unit= Trim(RS("Unit"))
				TotalNum = Trim(RS("TotalNum"))
				AlarmNum = Trim(RS("AlarmNum"))
				ProductType=RS("ProductType")
				Price= RS("Price")
				Discount=RS("Discount")
				Price_Original=RS("Price_Original")
				GroupPrice = RS("GroupPrice")
				Price_Member=RS("Price_Member")
				Price_Market = Trim(RS("Price_Market"))
				KeyWords = Trim(RS("KeyWords"))
				ProducerName = Trim(RS("ProducerName"))
				TrademarkName = Trim(RS("TrademarkName"))
				ProModel= RS("ProModel")
				ProSpecificat=RS("ProSpecificat")
				ServiceTerm=RS("ServiceTerm")
				FolderID = RS("Tid")
				Point=RS("Point")
				BrandID=RS("BrandID")
				AttributeCart=RS("AttributeCart")
				'自定义字段
				UserDefineFieldArr=KSCls.Get_KS_D_F_Arr(ChannelID)
				If IsArray(UserDefineFieldArr) Then
				For I=0 To Ubound(UserDefineFieldArr,2)
				  Dim UnitOption
				  If UserDefineFieldArr(12,I)="1" Then
				   UnitOption="@" & RS(UserDefineFieldArr(0,I)&"_Unit")
				  Else
				   UnitOption=""
				  End If
				  If I=0 Then
				    UserDefineFieldValueStr=RS(UserDefineFieldArr(0,I))& UnitOption & "||||"
				  Else
				    UserDefineFieldValueStr=UserDefineFieldValueStr  & RS(UserDefineFieldArr(0,I))& UnitOption & "||||"
				  End If
				Next
			  End If
				RS.Close:Set RS = Nothing
			End If
			If KS.IsNul(AttributeCart) Then AttributeCart=""
			'取得上传权限
			UpPowerFlag = KS.ReturnPowerResult(ChannelID, "M" & ChannelID & "10009")
			.Write "<script>var BigPhoto='" & BigPhoto & "';</script>" & vbCrlf
			%>
			<script>
		    $(document).ready(function(){
				$(parent.frames["BottomFrame"].document).find("#Button1").attr("disabled",false);
				$(parent.frames["BottomFrame"].document).find("#Button2").attr("disabled",false);
				$('#KeyLinkByTitle').click(function(){
			     GetKeyTags();
			    });
				$('#checkProIdButton').click(function(){
				  CheckProIdRepeat();
				});
				
		    })
            function GetKeyTags()
			{
			  var text=escape($('input[name=Title]').val());
			  if (text!=''){
				  $('#KeyWords').val('请稍等,系统正在自动获取tags...').attr("disabled",true);
				  $.get("../plus/ajaxs.asp", { action: "GetTags", text: text,maxlen: 20 },
				  function(data){
					$('#KeyWords').val(unescape(data)).attr("disabled",false);
				  });
			  }else{
			   alert('对不起,请先输入商品名称!');
			  }
			}
			function CheckProIdRepeat(){
			 var text=$('input[name=proid]').val();
			 if(text!=''){
			    if (text.length<8){
				 alert('编号长度不能小于8位!');
				}else{
				 $(parent.frames["FrameTop"].document).find("#ajaxmsg").toggle(true);
				 $.get("../plus/ajaxs.asp",{action:"Shop_CheckProID",proid:escape(text),id:<%=ProductID%>},function(d){
				 $(parent.frames["FrameTop"].document).find("#ajaxmsg").toggle(false);
				 alert(unescape(d));
				 });
				}
			 }else{
			  alert('请输入商品编号!');
			  $("input[name=proid]").focus();
			 }
			}
			function UnSelectAll(){
			  $("#SpecialID>option").each(function(){
				$(this).attr("selected",false);
				});
			}
			function displaydiscount(){
			 if (document.myform.ProductType[2].checked==true)
			   $('#discountarea').show();
			 else
			   $('#discountarea').hide();
			}
			function getprice(Price_Original){
			  if(Price_Original==''|| isNaN(Price_Original)){Price_Original=0;}
			  if(document.myform.ProductType[2].checked==true){
			  document.myform.Price.value=Math.round(Price_Original*Math.abs(document.myform.Discount.value/10)*100)/100;
			  }
			  else{document.myform.Price.value=Price_Original;}
			  document.myform.Price_Market.value=document.myform.Price.value;
			}
			function regInput(obj, reg, inputStr)
			{
				var docSel = document.selection.createRange()
				if (docSel.parentElement().tagName != "INPUT")    return false
				oSel = docSel.duplicate()
				oSel.text = ""
				var srcRange = obj.createTextRange()
				oSel.setEndPoint("StartToStart", srcRange)
				var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
				return reg.test(str)
			}
			function GetFileNameArea(f)
			{
			  $('#filearea').toggle(f);
			}
			function GetTemplateArea(f)
			{
			   $('#templatearea').toggle(f);
			}
			function insertHTMLToEditor(codeStr) 
			{ 
			 CKEDITOR.instances.Content.insertHtml(codeStr);
			} 
            function SelectAllUnion(){
			  $("select[name=UnionShopID]>option").each(function(){
				$(this).attr({"selected":true});
				});
			}
			function UnSelectAllUnion(){
			  $("select[name=UnionShopID]>option").each(function(){
				$(this).attr({"selected":false});
				});
			}
			function SubmitFun()
			{   if ($('input[name=title]').val()==""){
					alert("请输入商品名称！");
					$('input[name=title]').focus();
					return;
				}
				if ($('input[name=proid]').val()==""){
				    alert("请输入商品编号!");
					$('input[name=proid]').focus();
					return;
				}
				 if ($('#tid').val()=='0' || $('#tid').val()==''){
				    alert('请选择商品栏目!');
					return ;
				 }
				  if ($('#Unit').val()==""){
				    alert("商品单位不能为空!");
					$('#Unit').focus();
					return;
				  }
				  if ($('input[name=Price_Original]').val()==""){
				   alert("商品的原始零售价不能为空!");
				   $('input[name=Price_Original]').focus();
				   return;
				  }
				if ($("#BeyondSavePic").attr("checked")==true) {
				   $("#LayerPrompt").show();
				  window.setInterval('ShowPromptMessage()',150)
				 }
				  $('#myform').submit();
				  $(parent.frames["BottomFrame"].document).find("#Button1").attr("disabled",true);
				  $(parent.frames["BottomFrame"].document).find("#Button2").attr("disabled",true);
			}

			function getBrandList(v)
			{
			  if (v==0)
			  $("#brandarea").html("");
			  else
			  {
			   $(parent.frames["FrameTop"].document).find("#ajaxmsg").toggle(true);
			   var url='../plus/ajaxs.asp';
			   $.get(url,{action:"Shop_BrandOption",classid:$("#tid").val()},function(d){
			   $(parent.frames["FrameTop"].document).find("#ajaxmsg").toggle(false);
			   $("#brandarea").html(unescape(d));
			   });
 
			  }
			}
			var ForwardShow=true;
			function ShowPromptMessage()
			{
				var TempStr=ShowArticleArea.innerText;
				if (ForwardShow==true)
				{
					if (TempStr.length>4) ForwardShow=false;
					ShowArticleArea.innerText=TempStr+'.';
					
				}
				else
				{
					if (TempStr.length==1) ForwardShow=true;
					ShowArticleArea.innerText=TempStr.substr(0,TempStr.length-1);
				}
			}
			
			
			var SaveBeyondInfo=''
					   +'<div id="LayerPrompt" style="position:absolute; z-index:1; left: 200px; top: 150px; background-color: #f1efd9; layer-background-color: #f1efd9; border: 1px none #000000; width: 360px; height: 63px; display: none;"> '
					   +'<table width="100%" height="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#FF0000">'
					   +'<tr> '
					   +'<td align="center">'
					   +'<table width="80%" border="0" cellspacing="0" cellpadding="0">'
					   +'<tr>'
					   +' <td width="75%" nowrap>'
					   +'<div align="right">请稍候，系统正在保存远程图片到本地</div></td>'
					   +'   <td width="25%"><font id="ShowArticleArea">&nbsp;</font></td>'
					   +' </tr>'
					   +'</table>'
					   +'</td>'
					   +'</tr>'
					   +'</table>'
					   +'</div>'
			document.write (SaveBeyondInfo)
			</script>
			<%
			.Write "</head>"
			.Write "<body leftmargin='0' topmargin='0' marginwidth='0' onkeydown='if (event.keyCode==83 && event.ctrlKey) SubmitFun();' marginheight='0'>"
			.Write "<div align='center'>"
			.Write "<ul id='menu_top'>"
			.Write "<li onclick=""return(SubmitFun())"" class='parent'><span class=child onmouseover=""this.parentNode.className='parent_border'"" onMouseOut=""this.parentNode.className='parent'""><img src='images/ico/save.gif' border='0' align='absmiddle'>确定保存</span></li>"
			.Write "<li onclick=""history.back();"" class='parent'><span class=child onmouseover=""this.parentNode.className='parent_border'"" onMouseOut=""this.parentNode.className='parent'""><img src='images/ico/back.gif' border='0' align='absmiddle'>取消返回</span></li>"
		    .Write "</ul>"			
			
           .Write "<div class=tab-page id=ShopPane>"
			.Write " <SCRIPT type=text/javascript>"
			.Write "   var tabPane1 = new WebFXTabPane( document.getElementById( ""ShopPane"" ), 1 )"
			.Write " </SCRIPT>"
					 
			.Write " <div class=tab-page id=basic-page>"
			.Write "  <H2 class=tab>基本信息</H2>"
			.Write "	<SCRIPT type=text/javascript>"
			.Write "				 tabPane1.addTabPage( document.getElementById( ""basic-page"" ) );"
			.Write "	</SCRIPT>"
			.Write " <TABLE width='100%' BORDER='0' cellpadding='1'  cellspacing='1' class='ctable'>"
			.Write "    <form action='?ChannelID=" & ChannelID & "&Method=Save' method='post' id='myform' name='myform' onsubmit='return(SubmitFun())'>"
			.Write "      <input type='hidden' value='" & ProductID & "' name='ProductID'>"
			.Write "      <input type='hidden' value='" & Action & "' name='Action'>"
			.Write "      <input type='hidden' name='Page' value='" & Page & "'>"
			.Write "      <input type='hidden' name='KeyWord' value='" & KeyWord & "'>"
			.Write "      <input type='hidden' name='SearchType' value='" & SearchType & "'>"
			.Write "      <Input type='hidden' name='StartDate' value='" & StartDate & "'>"
			.Write "      <input type='hidden' name='EndDate' value='" & EndDate & "'>"
			.Write "            <tr class='tdbg'>"
			.Write "                <td width='85' class='clefttitle'><div align='right'><font color='#FF0000'><strong>商品名称:</strong></font></div></td>"
			.Write "                <td> "
			.Write "                  <input name='title' type='text'  class='textbox' value='" & Title & "' size=40><font color='#FF0000'>*</font>  <input type='checkbox' name='MakeHtml' value='1' checked>立即发布 </td>"
			.Write "              </tr>"
			.Write "            <tr class='tdbg'>"
			.Write "                <td class='clefttitle' align='right'><strong>商品编号:</strong></td>"
			.Write "                <td>"
			.Write "                 <input name='proid' type='text' id='proid' class='textbox' value='" & proid & "' size=20> <input type='button' value='检测重复' id='checkProIdButton' class='button'><font color=green>所指定的商品号必须唯一</font><span id='cmsg'></span>"
			.Write "              </tr>"
			.Write "              <tr class='tdbg'>"
			.Write "                <td class='clefttitle' align='right'><strong>归属栏目:</strong></td>"
			.Write "                <td>"
			
			.Write " <select size='1' name='tid' id='tid' onchange='getBrandList(1)'><option value='0'>--请选择栏目--</option>"
			.Write Replace(KS.LoadClassOption(ChannelID,true),"value='" & FolderID & "'","value='" & FolderID &"' selected") & " </select>"

			.Write "属性:"
			.Write "                                 <input name='Recommend' type='checkbox' id='Recommend' value='1'"
			If Recommend = "1" Then .Write (" Checked")
			.Write ">"

			.Write "                                推荐"
			.Write "                                <input name='IsSpecial' type='checkbox' id='IsSpecial' value='1'"
			If IsSpecial = "1" Then .Write (" Checked")
			.Write ">"
			.Write "                                特价"
			.Write "                                <input name='Popular' type='checkbox' id='Popular' value='1'"
			If Popular = "1" Then .Write (" Checked")
			.Write ">"
			.Write "                                热卖"
			.Write "                                <input name='Verific' type='checkbox' id='Verific' value='1'"
			If Action <> "Edit" Then
			 .Write (" checked")
			ElseIf Verific = "1" Then
			.Write (" Checked")
			End If
			.Write ">"
			.Write "                                正常销售"
			.Write "                                <input name='Comment' type='checkbox' id='Comment' value='1'"
			If Comment = "1" Then .Write (" Checked")
			.Write ">"
			.Write "                                允许评论"
			.Write "                                <input name='IsTop' type='checkbox' id='IsTop' value='1'"
			If IsTop = "1" Then .Write (" Checked")
			.Write ">"
			.Write "                                置顶"
			.Write "                                <input name='Rolls' type='checkbox' id='Rolls' value='1'"
			If Rolls = "1" Then .Write (" Checked")
			.Write ">"
			.Write "                                滚动"
			.Write "                                <input name='Slide' type='checkbox' id='Slide' value='1'"
			If Slide = "1" Then .Write (" Checked")
			.Write ">幻灯"
			.Write "                                <input name='Strip' type='checkbox' id='Strip' value='1'"
			If Strip = "1" Then .Write (" Checked")
			.Write ">头条"
		    .Write "             </td>"
			.Write "             </tr>"
			.Write "              <tr class='tdbg'>"
			.Write "                <td class='clefttitle' align='right'><strong>归属品牌:</strong></td>"
			.Write "                <td>"

		    .Write "<span id='brandarea'>"
			If Action="Edit" or (FolderID<>"" and FolderID<>"0") Then
			.Write GetBrandByClassID(FolderID,BrandID)
			Else
			 .Write "<select name='BrandID'><option value='0'>--选择品牌--</option></select>"
			End If
			.Write "</span>&nbsp;<font color=blue>说明：品牌由分类决定自动关联</font>"

			
			
			.Write "                                </td>"
			.Write "              </tr>"
			.Write "              <tr class='tdbg' style='height:25px'>"
			.Write "                <td  class='clefttitle' align='right'><strong>商品小图:</strong></td>"
			.Write "                <td height='25' width='92%'  nowrap> <input name='PhotoUrl' type='text' id='PhotoUrl' size='30' value='" & PhotoUrl & "' class='textbox'>"
			.Write "   &nbsp;<input class=""button"" type='button' name='Submit' value='选择商品小图片...' onClick=""OpenThenSetValue('Include/SelectPic.asp?ChannelID=5&CurrPath=" & CurrPath & "',550,290,window,document.myform.PhotoUrl);""> <input class=""button"" type='button' name='Submit' value='远程抓取小图片...' onClick=""OpenThenSetValue('Include/Frame.asp?FileName=SaveBeyondfile.asp&PageTitle='+escape('抓取远程图片')+'&ItemName=小图片&CurrPath=" & CurrPath & "',300,100,window,document.myform.PhotoUrl);"">"
		.Write "        <input class=""button""  type='button' name='Submit' value='裁剪...' onClick=""if($('#PhotoUrl').val()==''){alert('请选择图片或是上传后再使用此功能');return false;}else{OpenImgCutWindow(1,'" & KS.Setting(3) & "',$('#PhotoUrl').val())}"">  "
			.Write "            </td>"
			.Write "              </tr>"
			
			.Write "              <tr class='tdbg' style='height:25px'>"
			.Write "                <td  class='clefttitle' align='right'><strong>商品大图:</strong></td>"
			.Write "                <td> <input name='BigPhoto' type='text' id='BigPhoto' size='30' value='" & BigPhoto & "' class='textbox'>"
			.Write "   &nbsp;<input class=""button"" type='button' name='Submit' value='选择商品大图片...' onClick=""OpenThenSetValue('Include/SelectPic.asp?ChannelID=5&CurrPath=" & CurrPath & "',550,290,window,document.myform.BigPhoto);""> <input class=""button"" type='button' name='Submit' value='远程抓取大图片...' onClick=""OpenThenSetValue('Include/Frame.asp?FileName=SaveBeyondfile.asp&PageTitle='+escape('抓取远程图片')+'&ItemName=大图片&CurrPath=" & CurrPath & "',300,100,window,document.myform.BigPhoto);"">"
		.Write "        <input class=""button""  type='button' name='Submit' value='裁剪...' onClick=""if($('#BigPhoto').val()==''){alert('请选择图片或是上传后再使用此功能');return false;}else{OpenImgCutWindows(1,'" & KS.Setting(3) & "',$('#BigPhoto').val(),$('#BigPhoto')[0])}"">  "
			.Write "            </td>"
			.Write "              </tr>"
			
		If CBool(UpPowerFlag) = True Then
		.Write "              <tr class='tdbg' style='height:25px'>"
		.Write "                <td height='25'  class='clefttitle' align='right'><strong><font color=blue>上传图片:</font></strong></td>"
		.Write "                <td height='25' width='92%'  align='left'><iframe id='UpPhotoFrame' name='UpPhotoFrame' src='UpFileForm.asp?ChannelID=5&UpType=Pic' frameborder=0 scrolling=no width='100%' height='100%'></iframe>"
		.Write "            </td>"
		.Write "              </tr>"
		End If
        .Write               KSCls.Get_KS_D_F(ChannelID,UserDefineFieldValueStr)
		
		.Write " <tr class='tdbg'>"
		.Write "  <td class='clefttitle' align='right'><strong><font color=#ff6600>是否换购商品:</font></strong></td>"
		.Write "  <td><label onclick=""$('#ChangedBuy').hide();""><input name='IsChangedBuy' type='radio'  value='0'"
		If IsChangedBuy="0" Then .Write " checked"
		.Write "> 否</label> &nbsp;&nbsp;<label onclick=""$('#ChangedBuy').show();""><input name='IsChangedBuy' type='radio'  value='1'"
		If IsChangedBuy="1" Then .Write " checked"
		.Write "> 是</label>"
		If IsChangedBuy="0" Then
		.Write "<div id='ChangedBuy' style='display:none'>"
		Else
		.Write "<div id='ChangedBuy'>"
		End If
		.Write "订单满足金额：<input type='text' style='text-align:center' name='ChangeBuyNeedPrice' value='" & ChangeBuyNeedPrice &"' size='6' onkeyup='getprice($(""input[name=Price_Original]"").val())' value='" & Discount &"' size='4' maxlength='4' class='textbox' onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" class='textbox'>元 换购价格：<input type='text' style='text-align:center' name='ChangeBuyPresentPrice' value='" & ChangeBuyPresentPrice &"' onkeyup='getprice($(""input[name=Price_Original]"").val())' value='" & Discount &"' size='4' maxlength='4' class='textbox' onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" size='6' class='textbox'>元 "
		.Write "<span class='help' onclick=""new KesionPopup().mousepop('说明','当购买商品总金额>=订单满足金额时,可以根据换购价格得到此商品。',300)"">帮助</span>"
		.Write "</div>"
		.Write " </td>"
		.Write "</tr>"
		
		
		.Write " <tr class='tdbg'>"
		.Write "  <td class='clefttitle' align='right'><strong><font color=green>是否限时限量:</font></strong></td>"
		.Write "  <td style='padding:10px;margin-top:3px;border:1px solid #f9c943;background:#FFFFF6'>"
		.Write "<label onclick=""$('#LimitBuy').hide();""><input name='IsLimitbuy' type='radio'  value='0'"
		If IsLimitbuy="0" Then .Write " checked"
		.Write "> 正常销售</label> &nbsp;&nbsp;<label onclick=""$('#LimitBuy').show();$('#LimitBuyTaskID1').show();$('#LimitBuyTaskID2').hide();""><input name='IsLimitbuy' type='radio'  value='1'"
		If IsLimitbuy="1" Then .Write " checked"
		.Write "> 限时抢购</label>&nbsp;&nbsp;<label onclick=""$('#LimitBuy').show();$('#LimitBuyTaskID1').hide();$('#LimitBuyTaskID2').show();""><input name='IsLimitbuy' type='radio'  value='2'"
		If IsLimitbuy="2" Then .Write " checked"
		.Write "> 限量抢购</label>"
		If IsLimitbuy="0" Then
		.Write "<div id='LimitBuy' style='margin-tio:10px;padding:10px;display:none;border:0px solid #ff6600'>"
		Else
		.Write "<div id='LimitBuy' style='margin-tio:10px;padding:10px;border:0px solid #ff6600'>"
		End If
		
		.Write "抢购任务:"
		if IsLimitbuy="1" Then
		.Write "<select name='LimitBuyTaskID1' id='LimitBuyTaskID1'>"
		Else
		.Write "<select name='LimitBuyTaskID1' id='LimitBuyTaskID1' style='display:none'>"
		End If
		.Write "<option value=''>---请选择---</option>"
		
		 Dim RST:Set RST=Conn.Execute("Select ID,taskname from KS_ShopLimitBuy Where TaskType=1 and Status=1 Order by id desc")
		 Do While NOt RST.Eof
		    If LimitBuyTaskID=RST(0) Then
		    .Write "<option value='" & RST(0) & "' selected>" & RST(1) & "</option>"
			Else
		    .Write "<option value='" & RST(0) & "'>" & RST(1) & "</option>"
			End If
		 RST.MoveNext
		 Loop
		 RST.CLose 
		 .Write "</select>"
		 if IsLimitbuy="2" Then
		 .Write "<select name='LimitBuyTaskID2' id='LimitBuyTaskID2'>"
		 Else
		 .Write "<select name='LimitBuyTaskID2' id='LimitBuyTaskID2' style='display:none'>"
		 End If
		.Write "<option value=''>---请选择---</option>"

		 
		 Set RST=Conn.Execute("Select ID,taskname from KS_ShopLimitBuy Where TaskType=2 and Status=1 Order by id desc")
		 Do While NOt RST.Eof
		    If LimitBuyTaskID=RST(0) Then
		    .Write "<option value='" & RST(0) & "' selected>" & RST(1) & "</option>"
			Else
		    .Write "<option value='" & RST(0) & "'>" & RST(1) & "</option>"
			End If
		 RST.MoveNext
		 Loop
		  RST.Close: Set RST=Nothing
		  .Write "</select>"
		 
		.Write " <a href='Shop.asp?action=LimitBuy&channelid=5'>抢购任务管理</a><br/>"
		.Write "抢 购 价:<input type='text' style='text-align:center' name='LimitBuyPrice' id='LimitBuyPrice' size='6'  value='" & LimitBuyPrice &"' size='4' maxlength='4' class='textbox' onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" class='textbox'>元<br/>"
		.Write "抢购数量:<input type='text' name='LimitBuyAmount' id='LimitBuyAmount' value='" & LimitBuyAmount & "' size='10'/>件   设置允许让抢购的商品数<br/>"
		.Write "</div>"
		.Write "</td>"
		.Write "</tr>"



	
		.Write " <tr class='tdbg'>"
		.Write "  <td class='clefttitle' align='right'><strong>商品单位:</strong></td>"
		.Write "  <td><input name='Unit' type='text' id='Unit' value='" & Unit & "' size='10' class='textbox'> "
		.Write " << <select name='sUnit' onchange=""$('#Unit').val(this.value);"">"
		.Write " <option value=''>请选择</option>"
		.Write  KSCls.Get_O_F_D(KS.C_S(ChannelID,2),"Distinct Top 10 Unit","1=1 Group by unit")
		.Write "</select>"
		.Write " 单件重量：<input name='Weight' type='text' id='Weight' value='" & Weight & "' size='6' class='textbox'>KG <span style='color:green'>用于计算运费，如果不设置请输入0，表示按首重计算运费。</span>"
		.Write "              </td>"
		.Write "             </tr>"
		.Write "             <tr class='tdbg'><td height='70' class='clefttitle' align='right'><strong>商品价格:</strong></td><td><input name='ProductType' type='radio' value='1'"
		If ProductType=1 Then .Write " Checked"
		.Write " onclick='document.myform.Price.value=document.myform.Price_Original.value;document.myform.Price.disabled=true;displaydiscount();'>正常销售&nbsp;<input name='ProductType' type='radio' value='2'"
		If ProductType=2 Then .Write " Checked"
		.Write " onclick='document.myform.Price.disabled=false;displaydiscount();'><font color='green'> 涨价销售&nbsp;&nbsp;&nbsp;&nbsp;</font><input name='ProductType' type='radio' value='3'"
		If ProductType=3 Then .Write " Checked"
		.Write " onclick='getprice(document.myform.Price_Original.value);document.myform.Price.disabled=false;displaydiscount();'><font color='red'> 降价销售&nbsp;&nbsp;&nbsp;&nbsp;<span id='discountarea'"
		If ProductType<>3 Then .Write " style='display:none'"
		.Write ">折扣率：<input name='Discount' type='text' onkeyup='getprice($(""input[name=Price_Original]"").val())' value='" & Discount &"' size='4' maxlength='4' class='textbox' onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" style='text-align: center;'> 折&nbsp;&nbsp;如书籍等商品9折促销</font></span><hr size=1 color=blue><font color=red>原始零售价<input name='Price_Original' type='text' id='Price_Original' value='" & Price_Original & "' size='6' onchange='getprice(this.value)' onkeyup='getprice(this.value)' style='text-align: right;' onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" class='textbox'> *元</font>&nbsp;<font color=blue>当前零售价<input name='Price' type='text' id='Price' value='" & Price & "' size='6' class='textbox'"
		If ProductType=1 Then .Write " disabled"
		.Write" onKeyPress=""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"">元</font>&nbsp;&nbsp;市场价<input name='Price_Market' type='text' id='Price_Market' value='" & Price_Market & "' size='6' class='textbox' onKeyPress=""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"">元"
		
		.Write "&nbsp;&nbsp;&nbsp;获得积分:<input type=text class='textbox' value='" & point & "' name='point' size='5' style='text-align:center'>分(<font color=#ff0000>以客户付款成功为准</font>)"
		
		.Write "<table border='0' width='80%'>"
		.Write "<tr>"
		.Write " <td width='200'><input type='radio' onclick=""$('#GroupPriceArea').hide();""  name='GroupPrice' value='0'"
		 If GroupPrice=0 Then .Write " Checked"
		.Write ">会员统一指定价</td>"
		.Write " <td align='left'>会员价<input name='Price_Member' type='text' id='Price_Member' value='" & Price_Member & "' size='6' class='textbox' onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"">元&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;所有会员都以此为准，不区分组别。"
		.Write "</tr>"
		.Write "<tr>"
		.Write "  <td><input type='radio' onclick=""$('#GroupPriceArea').show();"" name='GroupPrice' value='1'"
		If GroupPrice=1 Then .Write " Checked"
		.Write ">详细设置会员价</td>"
		.Write "  <td>详细设置每个会员组的价格。</td>"
		.Write "</tr>"
		If GroupPrice=0 Then
		.Write "<tr id='GroupPriceArea' style='display:none'>"
		Else
		.Write "<tr id='GroupPriceArea'>" 
		End If
		.Write "<td colspan=2>"
		
		  .Write "<table border='0' width='80%'>"
		  .Write "<tr class='clefttitle'><td>会员组</td><td>价格</td></tr>"
		  Dim Node
		  Call KS.LoadUserGroup()
		  For Each Node In Application(KS.SiteSN&"_UserGroup").DocumentElement.SelectNodes("row")
		  .Write "<tr><td>" &Node.SelectSingleNode("@groupname").text & "</td><td><input onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" class='textbox' type='text' size='6' name='price" & Node.SelectSingleNode("@id").text & "' value='" & LFCls.GetSingleFieldValue("Select Price From KS_ProPrice Where GroupID=" & Node.SelectSingleNode("@id").text & " and ProID=" & ProductID) & "'> 元</td></tr>"
		 Next
		  .Write "</table>"
		.Write "</td>"
		.Write "</tr></table>"
		
		.Write "              </td>"
		.Write "             </tr>"
    	.Write "             <tr class='tdbg'><td class='clefttitle' align='right'><strong>库存设置:</strong></td><td>库存数量<input name='TotalNum' type='text' id='TotalNum' value='" & TotalNum & "' size='10' class='textbox' onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"">&nbsp;&nbsp;&nbsp;库存报警下限数&nbsp;<input name='AlarmNum' type='text' id='AlarmNum' value='" & AlarmNum & "' size='10' class='textbox' onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"">"
       .Write "</td></tr>"
	   
       .Write "<tr  class='tdbg'><td class='clefttitle' align='right'><strong>购物车属性: </strong><br><font color=red>可留空</font></td><td align='left'><table border='0'><tr><td> <textarea name=""AttributeCart"" style='width:400px;height:100px;line-height:26px;padding-left:20px;background:url(Images/rule1.gif) no-repeat 0 0px;border:1px solid #999999;' ID=""AttributeCart"">" & Replace(AttributeCart,"§",vbcrlf) & "</textarea></td><td align='left'>  <span class='help' onclick=""new KesionPopup().mousepop('购物车属性作用','当一件商品有多种属性可供选择时,可以在这里设置。如衣服的颜色,尺码等。',300)"">帮助</span><br/><font color=green>一行表示一个属性，属性名称与属性值之间用“|”线隔开，属性值与属性值之间用英文逗号(,)隔开。<br/></font><font color=blue><b>录入格式如下：</b></font><br/>颜色|红色,白色,蓝色<br/>尺码|29码,30码,32码</td></tr>"
			.Write "</table>"
			
			.Write "</TD>"
			.Write "      </TR>"

        .Write "</table>"
		.Write "</div>"
		
		.Write " <div class=tab-page id=intro-page>"
		.Write "  <H2 class=tab>商品介绍</H2>"
		.Write "	<SCRIPT type=text/javascript>"
		.Write "				 tabPane1.addTabPage( document.getElementById( ""intro-page"" ) );"
		.Write "	</SCRIPT>"

        .Write "<TABLE style='margin:1px' width='100%' BORDER='0' cellpadding='1'  cellspacing='1' class='ctable'>"

		.Write "      <tr class='tdbg'>"
		.Write "       <td class='clefttitle' width='100' align='right'><strong>" & KS.C_S(ChannelID,3) & "简介:</strong><br><input name='BeyondSavePic' type='checkbox' value='1' id='BeyondSavePic'><font color=green>自动下载简介里的图片</font></td>"
		.Write "       <td valign='top'>"
		.Write "<table border='0' width='100%' cellspacing='0' cellpadding='0'>"
		.Write "<tr><td height='30' width=70>&nbsp;<strong>附件上传:</strong></td><td width='120'><input onclick='PopInsertAnnex()' class='button' type='button' name='annexbtn' value='插入已存在的附件...'/>&nbsp;</td><td><iframe id='UpFileFrame' name='UpFileFrame' src='UpFileForm.asp?UPType=File&ChannelID=" & ChannelID &"' frameborder=0 scrolling=no width='100%' height='24'></iframe></td></tr>"
		.Write "</table>"
			.Write " <textarea ID='Content' name='Content' style='display:none'>" & Server.HTMLEncode(ProIntro) & "</textarea>"
					.Write "<script type=""text/javascript"">"
            .Write "CKEDITOR.replace('Content', {width:""98%"",height:""300px"",toolbar:""Basic"",filebrowserBrowseUrl :""Include/SelectPic.asp?from=ckeditor&Currpath="& KS.GetUpFilesDir() &""",filebrowserWindowWidth:650,filebrowserWindowHeight:290});"
			.Write "</script>"
			

		
		.Write "      </TD></tr>"
        .Write "</table>"
		.Write "</div>"
		
		
		.Write " <div class=tab-page id=option-page>"
		.Write "  <H2 class=tab>属性设置</H2>"
		.Write "	<SCRIPT type=text/javascript>"
		.Write "				 tabPane1.addTabPage( document.getElementById( ""option-page"" ) );"
		.Write "	</SCRIPT>"

        .Write "<TABLE style='margin:1px' width='100%' BORDER='0' cellpadding='1'  cellspacing='1' class='ctable'>"
			.Write "           <tr class='tdbg'>"
			.Write "              <td class='clefttitle' width='80' align='right'><strong>所属专题:</strong></td>"
			.Write "              <td>"
			Call KSCls.Get_KS_Admin_Special(ChannelID,KS.ChkClng(KS.G("ID")))
			.write "              </td>"
			.Write "           </tr>"
		.Write "      <tr class='tdbg'>"
		.Write "         <td  class='clefttitle' align='right'><strong>关 键 字:</strong></td>"
		.Write "         <td> <input name='KeyWords' type='text' id='KeyWords' class='textbox' value='" & KeyWords & "' size=50> <<"
		.Write "                  <select name='SelKeyWords' style='width:100px' onChange='InsertKeyWords($(""#KeyWords"").get(0),this.options[this.selectedIndex].value)'>"
		.Write "<option value="""" selected> </option><option value=""Clean"" style=""color:red"">清空</option>"
		.Write KSCls.Get_O_F_D("KS_KeyWords","KeyText","IsSearch=0 Order BY AddDate Desc")
		.Write "                  </select>"
		.Write " <br />【<a href=""#"" id=""KeyLinkByTitle"" style=""color:green"">根据商品名称自动获取Tags</a>】<input type='checkbox' name='tagstf' value='1' checked>写入Tags表"
		.Write "                </td>"
		.Write "              </tr>"
		.Write "              <tr class='tdbg'>"
		.Write "                <td class='clefttitle' align='right'><strong>" & KS.C_S(ChannelID,3) & "型号:</strong></td>"
		.Write "                <td> <input name='ProModel' type='text' id='ProModel' value='" & ProModel & "' size=50 class='textbox'> << "
		.Write ("<select name='sProModel' style='width:100px' onChange=""$('#ProModel').val(this.options[this.selectedIndex].value)"">")
		.Write  KSCls.Get_O_F_D(KS.C_S(ChannelID,2),"Distinct Top 10 ProModel","1=1 Group by ProModel")
        .Write "</select>"
		.Write "</td>"
		.Write "              </tr>"
		.Write "              <tr class='tdbg'>"
		.Write "                <td class='clefttitle' align='right'><strong>" & KS.C_S(ChannelID,3) & "规格:</strong></td>"
		.Write "                <td height='22' nowrap> <input name='ProSpecificat' type='text' id='ProSpecificat' value='" &ProSpecificat & "' size=50 class='textbox'> << "
		.Write ("<select name='selProSpecificat' style='width:100px' onChange=""$('#ProSpecificat').val(this.options[this.selectedIndex].value)"">")
		.Write  KSCls.Get_O_F_D(KS.C_S(ChannelID,2),"Distinct Top 10 ProSpecificat","1=1 Group by ProSpecificat")
        .Write "</select>"
		.Write "</td>"
		.Write "              </tr>"
		.Write "              <tr class='tdbg'>"
		.Write "                <td class='clefttitle' align='right'><strong>生 产 商:</strong></td>"
		.Write "                <td> <input name='ProducerName' type='text' id='ProducerName' value='" & ProducerName & "' size=50 class='textbox'>               << "
			.Write ("<select name='SelProducerName' style='width:100px' onChange=""$('#ProducerName').val(this.options[this.selectedIndex].value)"">")
		    .Write "<option value="""" selected> </option><option value="""" style=""color:red"">清空</option>"
			.Write KSCls.Get_O_F_D("KS_Origin","OriginName","ChannelID=" & ChannelID &" And OriginType=1 Order BY AddDate Desc")
			.Write "       </select></td>"
			.Write "              </tr>"
			.Write "              <tr class='tdbg'>"
			.Write "                <td class='clefttitle' align='right' nowrap><strong>商品商标:</strong></td>"
			.Write "                <td><input name='TrademarkName' type='text' id='TrademarkName' value='" & TrademarkName & "' size=50 class='textbox'>                << "
			.Write ("<select name='selTrademarkName' style='width:100px' onChange=""$('#TrademarkName').val(this.options[this.selectedIndex].value)"">")
		    .Write  KSCls.Get_O_F_D(KS.C_S(ChannelID,2),"Distinct Top 10 TrademarkName","1=1 Group by TrademarkName")
			.Write "                </select> </td>"
			.Write "              </tr>"
			.Write "              <tr class='tdbg'>"
			.Write "                <td class='clefttitle' align='right'><strong>上市时间:</strong></td>"
			.Write "                <td height='22' nowrap>"
		If Action <> "Edit" Then
		.Write ("<input name='AddDate' type='text' id='AddDate' value='" & Now() & "' size='60'  onclick=""popUpCalendar(this, this, dateFormat,-1,-1)"" class='textbox'>")
		Else
		.Write ("<input name='AddDate' type='text' id='AddDate' value='" & AddDate & "' size='60'  onclick=""popUpCalendar(this, this, dateFormat,-1,-1)"" class='textbox'>")
		End If
		.Write "                 <a href='#' onClick=""popUpCalendar(this, $('input[name=AddDate]').get(0), dateFormat,-1,-1)""><img src='Images/date.gif' border='0' align='absmiddle' title='选择日期'></a>"
			.Write "             </td>"
			.Write "            </tr>"
			.Write "            <tr class='tdbg'>"
			.Write "                <td class='clefttitle' align='right'><strong>服务期限:</strong></td>"
			.Write "                <td><input name='ServiceTerm' onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" type='text' id='ServiceTerm' value='" & ServiceTerm & "' size=8 class='textbox'>年</td>"
			.Write "              </tr>"
			.Write "              <tr class='tdbg'>"
			.Write "                <td class='clefttitle' align='right'><strong>商品等级:</strong></td>"
			.Write "                <td height='22' nowrap><select name='rank'>"
			If Rank = "★" Then
			.Write "                    <option  selected>★</option>"
			Else
			.Write "                    <option>★</option>"
			End If
			If Rank = "★★" Then
			.Write "                    <option  selected>★★</option>"
			Else
			.Write "                    <option>★★</option>"
			End If
			If Rank = "★★★" Or Action = "Add" Then
			.Write "                    <option  selected>★★★</option>"
			Else
			.Write "                    <option>★★★</option>"
			End If
			If Rank = "★★★★" Then
			.Write "                    <option  selected>★★★★</option>"
			Else
			.Write "                    <option>★★★★</option>"
			End If
			If Rank = "★★★★★" Then
			.Write "                    <option  selected>★★★★★</option>"
			Else
			.Write "                    <option>★★★★★</option>"
			End If
			.Write "                  </select>"
			.Write "                  请为商品评定推荐等级"
			.Write "               </td>"
			.Write "               <tr class='tdbg'>"
			.Write "               <td class='clefttitle' align='right'><strong>点 击 数:</strong></td>"
			.Write "               <td>本日：<input name='HitsByDay' type='text' id='HitsByDay' value='" & HitsByDay & "' size='10' class='textbox'> 本周：<input name='HitsByWeek' type='text' id='HitsByWeek' value='" & HitsByWeek & "' size='10' class='textbox'> 本月：<input name='HitsByMonth' type='text' id='HitsByMonth' value='" & HitsByMonth & "' size='10' class='textbox'> 总计：<input name='Hits' onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" type='text' id='Hits' value='" & Hits & "' size='10' class='textbox'>次"
			.Write "</td></tr>"
			 .Write "             <tr class='tdbg'>"
			 .Write "               <td class='clefttitle'><div align='right'><strong>" & KS.C_S(ChannelID,3) & "模板:</strong></div></td>"
			.Write "                <td> "
			IF Action <> "Edit" and  Action<>"Verify" Then
			.Write " <input type='radio' name='templateflag' onclick='GetTemplateArea(false);' value='2' checked>继承栏目设定<input type='radio' onclick='GetTemplateArea(true);' name='templateflag' value='1'>自定义"
			.Write "<div id='templatearea' style='display:none'><input id='TemplateID' name='TemplateID' readonly size=30 class='textbox' value='" & TemplateID & "'>&nbsp;" & KSCls.Get_KS_T_C("$('#TemplateID')[0]") & "</div>"
			Else
			
			.Write "<div id='templatearea'><input name='TemplateID' id='TemplateID' readonly size=30 class='textbox' value='" & TemplateID & "'>&nbsp;" & KSCls.Get_KS_T_C("$('#TemplateID')[0]") & "</div>"
			End If
			.Write "                </td>"
			.Write "             </tr>"
			.Write "             <tr class='tdbg'>"
			.Write "               <td class='clefttitle'><div align='right'><strong>文 件 名:</strong></td><td>"
			IF Action = "Edit" or Action="Verify" Then
			.Write "<input name='FileName' type='text' id='FileName' readonly  value='" & FileName & "' size='25' class='textbox'> <font color=red>不能改</font>"
			Else
			.Write "<input type='radio' value='0' name='filetype' onclick='GetFileNameArea(false);' checked>自动生成 <input type='radio' value='1' name='filetype' onclick='GetFileNameArea(true);' >自定义"
			.Write "<div id='filearea' style='display:none'><input name='FileName' type='text' id='FileName'   value='" & FileName  & "' size='25' class='textbox'> <font color=red>可带路径,如 help.html,news/news_1.shtml等</font></div>"
			End IF
			 .Write "                  </td>"
			 .Write "             </tr>"
			 .Write "    </table>"
			 .Write "    </div>"		
		
		
		.Write " <div class=tab-page id=kbxs-page>"
		.Write "  <H2 class=tab>捆绑销售</H2>"
		.Write "	<SCRIPT type=text/javascript>"
		.Write "				 tabPane1.addTabPage( document.getElementById( ""kbxs-page"" ) );"
		.Write "	</SCRIPT>"

        .Write "<table style='margin:1px' width='100%' BORDER='0' cellpadding='1'  cellspacing='1' class='ctable'>"
		%>
		  <tr class="tdbg">
			<td  style="text-align:left">
			 <script type="text/javascript">
		  function getProduct()
		  {			 
		     $(parent.frames["FrameTop"].document).find("#ajaxmsg").toggle("fast");
			 var key=escape($('input[name=key]').val());
			 var kbtid=$('#kbtid>option:selected').val();
			 var priceType=$('#PriceType>option:selected').val();
			 var minPrice=$("#minPrice").val();
			 var maxPrice=$("#maxPrice").val();
			 var str='';
			 if (key!=''){
			   str='商品名称:'+key;
			 } 
			 if (kbtid!='' && kbtid !='0'){
			   str+=' 栏目:'+$('#kbtid>option:selected').get(0).text
			 }
			 if (priceType!=0){
			   str+= minPrice +' 元';
			   switch (parseInt(priceType)){
			     case 1 :
				  str+='<=当前零售价<=';
				  break;
			     case 2 :
				   str+='<=会员价<=';
				   break;
			     case 3 :
				  str+='<=原始零售价<=';
				  break;
			   }
			   str+= maxPrice +' 元';
			   
			 }
			 if (str!='') str='<strong>条件:</strong><font color=red>'+str+'</font>';
			 $("#keyarea").html(str);
			 
			 $.get("../plus/ajaxs.asp", { action: "GetPackagePro", proid:$("#proids").val(),id:<%=ks.chkclng(request("id"))%>,pricetype:priceType,key: key,tid:kbtid,minPrice:minPrice,maxPrice:maxPrice},
			 function(data){
					$(parent.frames["FrameTop"].document).find("#ajaxmsg").toggle("fast");
					$("#prolist").empty().append(data);
			  });
		  }
		  function addProductIn(){
		   var proid=$('#prolist>option:selected').val();
		   if (proid!=undefined){
		      new KesionPopup().PopupCenterIframe('设置捆绑销售价格','Shop.asp?action=SetKBXSPrice&proid='+proid,350,200,'no')
		    }else{
			 alert('请选择要加入捆绑销售的商品!');
			}
		  }
		  function updateKBXS(arrstr)
		  {
			  if (arrstr!=''){
				 var finder=false;
				  var arr=arrstr.split('@@@');
				 $('#kbprolist>option').each(function(){
				 if (arr[0]==this.value.split('|')[0]){
				   this.text=arr[2]+"(捆绑销售价:￥"+arr[1]+"元)";
				   this.value=arr[0]+"|"+arr[1];
				   finder=true;}
			     });
				  if (finder==false){
					$('#kbprolist').append("<option value='"+arr[0]+"|"+arr[1]+"' selected>"+arr[2]+"(捆绑销售价:￥"+arr[1]+"元)</option>");
				 }
				 
			}
		  
		  }
		  function modifyKBXS(){
		   var l=$('#kbprolist>option:selected').length;
		   if (l==1){
		    var kb=$('#kbprolist>option:selected').val().split('|');
			 new KesionPopup().PopupCenterIframe('设置捆绑销售价格','Shop.asp?action=SetKBXSPrice&proid='+kb[0]+'&kbprice='+kb[1],350,200,'no')
		   }else if(l==0){
		    alert('请选择一个商品!');
		   }else{
		    alert('一次只能选择一个商品!');
		   }
		  }
		  function delAllKBXS(){
		    $("#kbprolist").empty();
		  }
		  function delSelectKBXS(){
		      var dest = document.getElementById('kbprolist');
			  for (var i = dest.options.length - 1; i >= 0 ; i--)
					  {
						  if (dest.options[i].selected)
						  {
							  dest.options[i] = null;
						  }
					  }
		  }
		  function selectAllKBXS(){
		   $("#kbprolist option").each(function(){
		      $(this).attr("selected",true);
		   });
		  }
		</script>
			  &nbsp;<strong>快速搜索=></strong>
			  <br/>
			  &nbsp;商品编号: <input type="text" class="textbox" name="proids" id="proids" size='15'> 可留空<br/>
			 &nbsp;商品名称: <input type="text" class='textbox' name="key">
			 <br/>&nbsp;所属栏目: <select size='1' name='kbtid' id='kbtid'><option value=''>--栏目不限--</option><%=KS.LoadClassOption(ChannelID,false)%></select>
			 <br/>&nbsp;价格范围:
			<input type='text' name='minPrice' size='5' style='text-align:center' id='minPrice' value='10'> 元
			<= <select name="PriceType" id="PriceType">
			  <option value=0>--不限制--</option>
			  <option value=1>当前零售价</option>
			  <option value=2>会员价</option>
			  <option value=3>原始零售价</option>
			 </select>
			 <= <input type='text' name='maxPrice' size='5' style='text-align:center' id='maxPrice' value='100'> 元
			  
			  <br/> <br/>
			  &nbsp;<input type="button" onclick="getProduct()" value="开始搜索" class="button" name="s1">
			
			</td>
			<td  style="text-align:left">
			<div id='keyarea'></div>
			<strong>查询到的商品:</strong>			
			<br/>
			 <select name="prolist" size="5" style="width:260px;height:140px" id="prolist"></select>
			 <br/>
			 <input type="button" onclick="addProductIn()" value="将选中的商品加入捆绑销售" class="button">
			</td>
		  </tr>
		  <tr class="tdbg">
		    <td>
			  <strong>捆绑销售商品:</strong><br/>
			  <select name="kbprolist" id="kbprolist" multiple size="6" style="width:360px;height:160px">
			  <%
			   if id<>0 then
			     Dim RSK:Set RSK=Conn.Execute("Select I.Title,i.id,K.KBPrice From KS_ShopBundleSale k Inner Join KS_Product I on i.id=k.kbproid where k.proid=" & id)
				 do while not rsk.eof
				   response.write "<option value='" & rsk(1) & "|" & rsk(2) & "' selected>" & rsk(0) & "(捆绑销售价:￥" & rsk(2) & "元)</option>"
				 rsk.movenext
				 loop
				 rsk.close : set rsk=nothing
			   end if
			  %>
			  </select>
			</td>
			<td>
			<input type="button" class="button" value="修改选中商品价格" onclick="modifyKBXS()"/><br/><br/>
			<input type="button" class="button" value="移除选中商品" onclick="delSelectKBXS()"/><br/><br/>
			<input type="button" class="button" value="全部移除" onclick="delAllKBXS()" /><br/><br/>
			<input type="button" class="button" value="全部全中" onclick="selectAllKBXS()" />
			</td>
		  </tr>
		<%
		.Write "</table>"
		.Write "</div>"
		
		

			 
			.Write " <div class=tab-page id=ghdd-page>"
		    .Write "  <H2 class=tab>看货地点</H2>"
		    .Write "	<SCRIPT type=text/javascript>"
		    .Write "				 tabPane1.addTabPage( document.getElementById( ""ghdd-page"" ) );"
		    .Write "	</SCRIPT>"

            .Write "<TABLE style='margin:1px' width='100%' BORDER='0' cellpadding='1'  cellspacing='1' class='ctable'>"

			
			.Write "      <tr class='tdbg'>"
		    .Write "       <td class='clefttitle' align='right'><strong>看货地点:</strong></td>"
		    .Write "       <td valign='top'>"
		
			.Write "          <table border=0 cellspacing='0' cellspadding='0'>"
			.Write "           <tr>"
			.Write "              <td><select name='UnionShopID' id='UnionShopID' multiple style='width:280px;height:220px'>"
							
							Dim GRS:Set GRS=Conn.Execute("Select ID,Title From KS_ShopUnion Order By ID")
							If Not GRS.Eof Then
							 Do While Not GRS.Eof
							  If Not Conn.Execute("Select id From KS_ShopUnionR Where UnionID=" & GRS(0) & " And Proid=" & ProductID).Eof Then
							   .Write "<option value='" & GRS(0) & "' selected>" & GRS(1) & "</option>"
							  Else
							  .Write "<option value='" & GRS(0) & "'>" & GRS(1) & "</option>"
							  End If
							  GRS.MoveNext
							 Loop
							End If
							GRS.Close
							Set GRS=Nothing
			.Write "              </select><br /><font color=red>为方便用户就近上门看货,这里可以指定多家联盟店</font></td>"
			.Write "              <td><input type='button' class='button' name='Submit' value='  选定所有联盟店  ' onclick='SelectAllUnion()'>              <br><br><input type='button' class='button' name='Submit' value='取消选定所有联盟店' onclick='UnSelectAllUnion()'><br><br><font color=blue>提示：按住""CTRL""或""Shift""键可以进行多选</font></td>"
			.Write "           </tr>"
			.Write "           </table>"

		     .Write "      </td>"
	         .Write "     </tr>"
			 .Write "    </table>"
			 .Write "    </div>"
			 
			 KSCls.LoadRelativeOption ChannelID,KS.ChkClng(KS.G("ID"))
			
			
			 .Write "      </form>"
			 .Write " </div>"
			 .Write "</body>"
			 .Write "</html>"
			 End With
		End Sub
		
		'保存
		Sub DoSave()
		  Dim SelectInfoList,HasInRelativeID
		  With Response
		    ProductID = KS.ChkClng(Request("ProductID"))
		    ProID       = KS.G("ProID")
			If ProID="" Then ProID = KS.GetInfoID(ChannelID)
			Title       = KS.G("Title")
			PhotoUrl    = KS.G("PhotoUrl")
			BigPhoto    = KS.G("BigPhoto")
			ProIntro    = Request.Form("Content")
			Hits        = KS.ChkClng(KS.G("Hits"))
			HitsByDay   = KS.ChkClng(KS.G("HitsByDay"))
			HitsByWeek  = KS.ChkClng(KS.G("HitsByWeek"))
			HitsByMonth = KS.ChkClng(KS.G("HitsByMonth"))
			TotalNum    = KS.ChkClng(KS.G("TotalNum"))
			AlarmNum    = KS.ChkClng(KS.G("AlarmNum"))
			Unit        = KS.G("Unit")
			Weight      = KS.G("Weight")
			If Not IsNumeric(Weight) Then KS.AlertHintScript "商品重量只能输入数字!"
			ProductType = KS.ChkClng(KS.G("ProductType"))
			AttributeCart  = Replace(Request.Form("AttributeCart"),vbcrlf,"§")
			If ProductType<>3 Then
			 Discount=10
			Else 
			 Discount=KS.G("Discount")
			End If
			Price_Original = KS.G("Price_Original")
			If ProductType=1 Then
			 Price=Price_Original
			ElseIf (ProductType=2 Or ProductType=3) And KS.G("Price")="" Then
			 Price=Price_Original
			Else
			 Price = KS.G("Price")
			End If
			Price_Market = KS.G("Price_Market"):If Price_Market="" Then Price_Market=0
			Price_Member = KS.G("Price_Member"):If Price_Member="" Then Price_Member=0
			If Discount>10 Then ErrMsg = ErrMsg & "商品的折扣率必须小于10! \n"
			If ProductType=2 And KS.ChkClng(Price)<KS.ChkClng(Price_Original) Then ErrMsg = ErrMsg & "涨价销售,商品的“当前零售价”必须大于等于“原始零售价”! \n"
			If ProductType=3 And KS.ChkClng(Price_Member)>KS.ChkClng(Price) Then ErrMsg = ErrMsg & "降价销售,商品的“会员价”必须小于等于“当前零售价”! \n"
			GroupPrice  = KS.ChkClng(KS.G("GroupPrice"))  
			Recommend   = KS.ChkClng(KS.G("Recommend"))
			Rolls       = KS.ChkClng(KS.G("Rolls"))
			Popular     = KS.ChkClng(KS.G("Popular"))
			Verific     = KS.ChkClng(KS.G("Verific"))
			Comment     = KS.ChkClng(KS.G("Comment"))
			Strip       = KS.ChkClng(KS.G("Strip"))
			Slide       = KS.ChkClng(KS.G("Slide"))
			Point       = KS.ChkClng(KS.G("Point"))
			BrandID     = KS.ChkClng(KS.G("Brandid"))
			IsSpecial   = KS.ChkCLng(KS.G("IsSpecial"))
			IsTop       = KS.ChkClng(KS.G("IsTop"))
			SpecialID = Replace(KS.G("SpecialID")," ",""):SpecialID = Split(SpecialID,",")
			UnionShopID=Replace(KS.G("UnionShopID")," ",""):UnionShopID=Split(UnionShopID,",")
			SelectInfoList = Replace(KS.G("SelectInfoList")," ","")
			Makehtml    = KS.ChkClng(KS.G("Makehtml"))
			FnameType = Trim(KS.G("Fnametype"))
			Tid = Trim(KS.G("Tid"))
			
				TemplateID = KS.G("TemplateID")
				Dim filetype:filetype=KS.ChkClng(KS.G("filetype"))
				Dim FnameType
				Dim RS_C:Set RS_C=Server.CreateObject("Adodb.RecordSet")
					RS_C.Open "Select top 1 * From KS_Class Where ID='" & Tid & "'",conn,1,1
					If Not RS_C.Eof Then
					    FnameType=RS_C("FnameType")
						If KS.ChkClng(KS.G("TemplateFlag"))=2 Or TemplateID="" Then TemplateID=RS_C("TemplateID")
						If FileType=0 Then
						  If Action = "Add" OR Action="Verify" Then
						   Fname=KS.GetFileName(RS_C("FsoType"), Now, "") & FnameType
						   End If
						End If
					End If
				RS_C.Close:Set RS_C=Nothing
				If filetype=1 Then Fname=KS.G("FileName")
                Call KSCls.CheckDiyField(ChannelID,UserDefineFieldArr,ErrMsg)  '检查自定义字段
					
			KeyWords = KS.G("KeyWords")
			ProducerName = KS.G("ProducerName")
			TrademarkName = KS.G("TrademarkName")
			ProModel = KS.G("ProModel")
			ProSpecificat =KS.G("ProSpecificat")
			ServiceTerm = KS.ChkClng(KS.G("ServiceTerm"))
			AddDate = KS.G("AddDate")
			Rank = Trim(KS.G("Rank"))	
			IsChangedBuy=KS.ChkClng(KS.G("IsChangedBuy"))
			ChangeBuyNeedPrice=KS.G("ChangeBuyNeedPrice"): If Not IsNumeric(ChangeBuyNeedPrice) Then ChangeBuyNeedPrice=0
			ChangeBuyPresentPrice=KS.G("ChangeBuyPresentPrice"): If Not IsNumeric(ChangeBuyPresentPrice) Then ChangeBuyPresentPrice=0
			
			IsLimitbuy = KS.ChkClng(KS.S("IsLimitBuy"))
			LimitBuyPrice = KS.S("LimitBuyPrice")
			LimitBuyAmount = KS.ChkCLng(KS.S("LimitBuyAmount"))
			LimitBuyTaskID=KS.ChkCLng(KS.S("LimitBuyTaskID" & IsLimitbuy))
			If IsLimitBuy<>0 And LimitBuyTaskID=0 Then ErrMsg = ErrMsg & "请选请择抢购任务! \n"
			iF IsLimitbuy<>0 and LimitBuyAmount>=TotalNum Then ErrMsg=ErrMsg & "抢购数量必须小于等于商品数量!\n"
			If Not IsNumeric(LimitBuyPrice) Then LimitBuyPrice=0
			
			
					 
			If Title = "" Then .Write ("<script>alert('商品名称不能为空!');history.back(-1);</script>")
			
			Set RS = Server.CreateObject("ADODB.RecordSet")
			If Tid = "" Then ErrMsg = ErrMsg & "[商品类别]必选! \n"
			If Title = "" Then ErrMsg = ErrMsg & "[商品标题]不能为空! \n"
			If Title <> "" And Tid <> "" And Action = "Add" Then
			  SqlStr = "select top 1 * from KS_Product where Title='" & Title & "' And Tid='" & Tid & "'"
			   RS.Open SqlStr, conn, 1, 1
				If Not RS.EOF Then
				 ErrMsg = ErrMsg & "该类别已存在此商品! \n"
			   End If
			   RS.Close
			End If
			If ProductID=0 Then
			  If Not Conn.Execute("Select top 1 ProID From KS_Product Where ProID='" & ProID & "'").eof Then
			    ErrMsg = ErrMsg & "该商品编号已存在! \n"
			  End If
			Else
			  If Not Conn.Execute("Select top 1 ProID From KS_Product Where ID<>" & ProductID & " and ProID='" & ProID & "'").eof Then
			    ErrMsg = ErrMsg & "该商品编号已存在! \n"
			  End If
			End If
			
			If ErrMsg <> "" Then
			   .Write ("<script>alert('" & ErrMsg & "');history.back(-1);</script>")
			   .End
			Else
			
			    If KS.ChkClng(KS.G("BeyondSavePic")) = 1 Then
				    Dim SaveFilePath
					SaveFilePath = KS.GetUpFilesDir & "/"
					KS.CreateListFolder (SaveFilePath)
				    ProIntro= KS.ReplaceBeyondUrl(ProIntro, SaveFilePath)
				End If
						
				If KS.ChkClng(KS.G("TagsTF"))=1 Then Call KSCls.AddKeyTags(KeyWords)	
				  If Action = "Add" Then
					SqlStr = "select top 1 * from KS_Product where 1=0"
					RS.Open SqlStr, conn, 1, 3
					RS.AddNew
					RS("ProID") = ProID
					RS("Title") = Title
					RS("PhotoUrl") = PhotoUrl
					RS("BigPhoto")=BigPhoto
					RS("ProIntro") = ProIntro
					RS("Recommend") = Recommend
					RS("Rolls") = Rolls
					RS("Popular") = Popular
					RS("Verific") = Verific
					RS("Strip")   = Strip
					RS("Comment") = Comment
					RS("Tid") = Tid
					RS("TotalNum") = TotalNum
					RS("AlarmNum") = AlarmNum
					RS("ProductType") = ProductType
					RS("Discount") = Discount
					RS("Unit") = Unit
					RS("Weight")=Weight
					RS("Price_Original") = Price_Original
					RS("Price") = Price
					RS("GroupPrice") = GroupPrice
					RS("Price_Member")=Price_Member
					RS("Price_Market") = Price_Market
					RS("KeyWords") = KeyWords
					RS("ProSpecificat")=ProSpecificat
					RS("ProModel") = ProModel
					RS("ServiceTerm") = ServiceTerm
					RS("ProducerName") = ProducerName
					RS("TrademarkName") = TrademarkName
					RS("AddDate") = AddDate
					RS("Rank") = Rank
					RS("Slide") = Slide
					RS("IsTop") = IsTop
					RS("IsSpecial") = IsSpecial
					RS("TemplateID") = TemplateID
					RS("Hits") = Hits
					RS("HitsByDay") = HitsByDay
					RS("HitsByWeek") = HitsByWeek
					RS("HitsByMonth") = HitsByMonth
					RS("Fname") = Fname
					RS("Point") = Point
					RS("BrandID")=BrandID
					RS("AttributeCart")=AttributeCart
					RS("IsChangedBuy")=IsChangedBuy
					RS("ChangeBuyNeedPrice")=ChangeBuyNeedPrice
					RS("ChangeBuyPresentPrice")=ChangeBuyPresentPrice
					
					RS("IsLimitbuy") = IsLimitBuy
					RS("LimitBuyPrice") = LimitBuyPrice
					RS("LimitBuyTaskID")=LimitBuyTaskID
					RS("LimitBuyAmount")= LimitBuyAmount

					
					if Action="Verify" Then
						   RS("Inputer") = Trim(KS.G("Inputer"))
					Else
					       RS("Inputer") = KS.C("AdminName")
					End IF
					RS("RefreshTF") = Makehtml
					RS("DelTF") = 0
					Call KSCls.AddDiyFieldValue(RS,UserDefineFieldArr)
					RS.Update
					
				   Session("KeyWords") = KeyWords
				   Session("ProducerName") = ProducerName
				   Session("TrademarkName") = TrademarkName
				    RS.MoveLast
					  If Left(Ucase(Fname),2)="ID" Then
					   RS("Fname") = RS("ID") & FnameType
					   RS.Update
					  End If
					  
					   Call addBundleSale(rs("id"))
					  
					  
					   Call AddGroupPrice(RS("ID"))
					   For I=0 To Ubound(UnionShopID)
						Conn.Execute("Insert Into KS_ShopUnionR(UnionID,ProID) values(" & UnionShopID(I) & "," & RS("ID") &")")
						Next
						For I=0 To Ubound(SpecialID)
						Conn.Execute("Insert Into KS_SpecialR(SpecialID,InfoID,ChannelID) values(" & SpecialID(I) & "," & RS("ID") & "," & ChannelID & ")")
					  Next
					    Call KSCls.UpdateRelative(ChannelID,RS("ID"),SelectInfoList,0)
						Call LFCls.AddItemInfo(ChannelID,RS("ID"),Title,Tid,ProIntro,KeyWords,PhotoUrl,AddDate,KS.C("AdminName"),Hits,HitsByDay,HitsByWeek,HitsByMonth,Recommend,Rolls,IsSpecial,Popular,Slide,IsTop,Comment,Verific,RS("Fname"))
					   '关联上传文件
				       Call KS.FileAssociation(ChannelID,RS("ID"),PhotoUrl & BigPhoto & ProIntro ,0)
                       If Not KS.IsNul(Session("UploadFileIDs")) Then 
					    Conn.Execute("Update [KS_UpLoadFiles] Set InfoID=" & RS("ID") &",classID=" & KS.C_C(Tid,9) & " Where ID In (" & KS.FilterIds(Session("UploadFileIDs")) & ")")
					   End If
			        Call RefreshHtml(1)
					RS.Close:Set RS = Nothing
					
				ElseIf Action = "Edit"  Or Action="Verify" Then
				
				SqlStr = "SELECT Top 1 * FROM KS_Product Where ID=" & ProductID
					RS.Open SqlStr, conn, 1, 3
					If RS.EOF And RS.BOF Then
					 .Write ("<script>alert('参数传递出错!');history.back(-1);</script>")
					 .End
					End If
					RS("ProID") = ProID
					RS("Title") = Title
					RS("PhotoUrl") = PhotoUrl
					RS("BigPhoto")=BigPhoto
					RS("ProIntro") = ProIntro
					RS("Recommend") = Recommend
					RS("Rolls") = Rolls
					RS("Strip")   = Strip
					RS("Popular") = Popular
					RS("Verific") = Verific
					RS("Comment") = Comment
					RS("Tid") = Tid
					RS("KeyWords") = KeyWords
					RS("TotalNum") = TotalNum
					RS("AlarmNum") = AlarmNum
					RS("Unit") = Unit
					RS("Weight")=Weight
					RS("ProductType") = ProductType
					RS("Discount") = Discount
					RS("Price_Original") = Price_Original
					RS("Price") = Price
					RS("GroupPrice") = GroupPrice
					RS("Price_Member")=Price_Member
					RS("Price_Market") = Price_Market
					RS("ProSpecificat")=ProSpecificat
					RS("ProModel") = ProModel
					RS("ServiceTerm") = ServiceTerm
					RS("ProducerName") = ProducerName
					RS("TrademarkName") = TrademarkName
					RS("AddDate") = AddDate
					RS("Rank") = Rank
					RS("Slide") = Slide
					RS("IsTop") = IsTop
					RS("IsSpecial") = IsSpecial
					RS("TemplateID") = TemplateID
					RS("Fname") = Replace(RS("Fname"), Trim(Mid(Trim(RS("Fname")), InStrRev(Trim(RS("Fname")), "."))), FnameType)
					If Makehtml = 1 Then RS("RefreshTF") = 1
					RS("Hits") = Hits
					RS("HitsByDay") = HitsByDay
					RS("HitsByWeek") = HitsByWeek
					RS("HitsByMonth") = HitsByMonth
					RS("Point") = Point
					RS("BrandID")=BrandID
					RS("AttributeCart")=AttributeCart
					RS("IsChangedBuy")=IsChangedBuy
					RS("ChangeBuyNeedPrice")=ChangeBuyNeedPrice
					RS("ChangeBuyPresentPrice")=ChangeBuyPresentPrice
					RS("IsLimitbuy") = IsLimitBuy
					RS("LimitBuyPrice") = LimitBuyPrice
					RS("LimitBuyTaskID")=LimitBuyTaskID
					RS("LimitBuyAmount")= LimitBuyAmount
                    Call KSCls.AddDiyFieldValue(RS,UserDefineFieldArr)
					RS.Update
				   RS.MoveLast
					
				   Call addBundleSale(rs("id"))

				   Call AddGroupPrice(RS("ID"))
					Conn.Execute("Delete From KS_ShopUnionR Where Proid=" & ProductID)
					For I=0 To Ubound(UnionShopID)
						Conn.Execute("Insert Into KS_ShopUnionR(UnionID,ProID) values(" & UnionShopID(I) & "," & ProductID &")")
					Next
					Conn.Execute("Delete From KS_SpecialR Where InfoID=" &ProductID & " and channelid=" & ChannelID)
					For I=0 To Ubound(SpecialID)
					Conn.Execute("Insert Into KS_SpecialR(SpecialID,InfoID,ChannelID) values(" & SpecialID(I) & "," & ProductID & "," & ChannelID & ")")
					Next
					Call KSCls.UpdateRelative(ChannelID,ProductID,SelectInfoList,1)
					Call LFCls.UpdateItemInfo(ChannelID,ProductID,Title,Tid,ProIntro,KeyWords,PhotoUrl,AddDate,Hits,HitsByDay,HitsByWeek,HitsByMonth,Recommend,Rolls,IsSpecial,Popular,Slide,IsTop,Comment,Verific)
					'关联上传文件
				    Call KS.FileAssociation(ChannelID,ProductID,PhotoUrl & BigPhoto & ProIntro ,1)
					If Not KS.IsNul(Session("UploadFileIDs")) Then 
					    Conn.Execute("Update [KS_UpLoadFiles] Set InfoID=" & ProductID &",classID=" & KS.C_C(Tid,9) & " Where ID In (" & KS.FilterIds(Session("UploadFileIDs")) & ")")
					End If
				    Call RefreshHtml(2)
		          
				  RS.Close:Set RS = Nothing
					
					If KeyWord <>"" Then
						 .Write ("<script> parent.frames['MainFrame'].focus();alert('商品修改成功!');location.href='Shop.asp?Page=" & Page & "&KeyWord=" & KeyWord & "&SearchType=" & SearchType & "&StartDate=" & StartDate & "&EndDate=" & EndDate & "';$(parent.document).find('#BottomFrame')[0].src='Split.asp?ButtonSymbol=ShopSearch&OpStr=" & server.URLEncode("商品管理 >> <font color=red>搜索结果</font>") & "';</script>")
					End If
				End If
			End If
		 End With		
		End Sub
		
		Sub AddGroupPrice(ByVal ID)
		    If GroupPrice=1 Then
			  Dim Node
			  Call KS.LoadUserGroup()
			  For Each Node In Application(KS.SiteSN&"_UserGroup").DocumentElement.SelectNodes("row")
				  Dim PRS:Set PRS=Server.CreateOBject("ADODB.RECORDSET")
				  PRS.Open "Select * From KS_ProPrice Where GroupiD=" & Node.SelectSingleNode("@id").text & " And ProID=" & ID,conn,1,3
				  If PRS.Eof Then
				   PRS.AddNew
				  End If
				   PRS("GroupID")=Node.SelectSingleNode("@id").text
				   PRS("ProID")=ID
				   If KS.G("Price" & Node.SelectSingleNode("@id").text)="" Then
				    PRS("Price")=0
				   Else
				   PRS("Price")=KS.G("Price" & Node.SelectSingleNode("@id").text)
				   End If
				  PRS.Update
				  PRS.Close:Set PRS=Nothing
				Next
			End If
		End Sub
		
		Sub RefreshHtml(Flag)
			     Dim TempStr,EditStr,AddStr
			    If Flag=1 Then
				  TempStr="添加":EditStr="修改商品":AddStr="继续添加商品"
				Else
				  TempStr="修改":EditStr="继续修改商品":AddStr="添加商品"
				End If
			    With Response
				     .Write "<link href='Include/Admin_Style.CSS' rel='stylesheet' type='text/css'>"
					  .Write "<script language='JavaScript' src='../HSK_JS/Jquery.js'></script>"
					 .Write " <Br><br><br><table align='center' width=""95%"" height='200' class='ctable' cellpadding=""1"" cellspacing=""1"">"
					  .Write "	  <tr class=""sort""> "
					  .Write "		<td  height=""28"" colspan=2>系统操作提示信息</td>" & vbcrlf
					  .Write "	  </tr>"
                      .Write "    <tr class='tdbg'>"
					  .Write "          <td align='center'><img src='images/succeed.gif'></td>"
					  .Write "<td><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;恭喜，" & TempStr &"" & KS.C_S(ChannelID,3) & "成功！</b><br>"
					   If Makehtml = 1 Then
					      .Write "<div style=""margin-top:15px;border: #E7E7E7;height:220; overflow: auto; width:100%"">" 
					    If KS.C_S(ChannelID,7)=1 Or KS.C_S(ChannelID,7)=2 Then
						  	 .Write "<div><iframe src=""Include/RefreshHtmlSave.Asp?ChannelID=" & ChannelID &"&Types=Content&RefreshFlag=ID&ID=" & RS("ID") &""" width=""100%"" height=""80"" frameborder=""0"" allowtransparency='true'></iframe></div>"
						  Else
						  .Write "<div style=""height:25px""><li>由于" & KS.C_S(ChannelID,1) & "没有启用生成HTML的功能，所以ID号为 <font color=red>" & RS("ID") & "</font>  的" & KS.C_S(ChannelID,3) & "没有生成!</li></div> "
						  End If
						  
							If KS.C_S(ChannelID,7)<>1 Then
							  .Write "<div style=""height:25px""><li>由于" & KS.C_S(ChannelID,1) & "的栏目页没有启用生成HTML的功能，所以ID号为 <font color=red>" & TID & "</font>  的栏目没有生成!</li></div> "
							Else
							 If KS.C_S(ChannelID,9)<>1 Then
								  Dim FolderIDArr:FolderIDArr=Split(left(KS.C_C(Tid,8),Len(KS.C_C(Tid,8))-1),",")
								  For I=0 To Ubound(FolderIDArr)
								  .Write "<div align=center><iframe src=""Include/RefreshHtmlSave.Asp?ChannelID=" & ChannelID &"&Types=Folder&RefreshFlag=ID&FolderID=" & FolderIDArr(i) &""" width=""100%"" height=""90"" frameborder=""0"" allowtransparency='true'></iframe></div>"
								   Next
							 End If
						   End If
					   If Split(KS.Setting(5),".")(1)="asp" or KS.C_S(ChannelID,9)<>3 Then
					   Else
					     .Write "<div align=center><iframe src=""Include/RefreshIndex.asp?RefreshFlag=Info"" width=""100%"" height=""80"" frameborder=""0"" allowtransparency='true'></iframe></div>"
					   End If
					   .Write "</div>"
					   End If
					   .Write   "</td></tr>"
					  .Write "	  <tr class='tdbg'>"
					  .Write "		<td></td><td height=""25"" style='text-align:right'>【<a href=""#"" onclick=""location.href='Shop.asp?Page=" & Page & "&Action=Edit&KeyWord=" & KeyWord &"&SearchType=" & SearchType &"&StartDate=" & StartDate & "&EndDate=" & EndDate &"&ID=" & RS("ID") & "';""><strong>" & EditStr &"</strong></a>】&nbsp;【<a href=""#"" onclick=""location.href='Shop.asp?Action=Add&FolderID=" & Tid & "';$(parent.document).find('#BottomFrame')[0].src='Split.asp?OpStr=" & server.URLEncode("添加商品")& "&ButtonSymbol=AddInfo&FolderID=" & Tid & "';""><strong>" & AddStr & "</strong></a>】&nbsp;【<a href=""#"" onclick=""location.href='ItemInfo.asp?ChannelID=" & ChannelID &"&ID=" & Tid & "&Page=" & Page &"';$(parent.document).find('#BottomFrame')[0].src='Split.asp?ButtonSymbol=ViewFolder&FolderID=" & Tid & "';""><strong>商品管理</strong></a>】&nbsp;【<a href=""#"" onclick=""location.href='ProImages.asp?ProID=" & RS("ID") & "&ChannelID=5&Page=" & Page &"';$(parent.document).find('#BottomFrame')[0].src='Split.asp?OpStr=" & server.URLEncode("商品图片管理")& "&ButtonSymbol=disabled';""><strong>商品图片管理</strong></a>】&nbsp;【<a href=""" & KS.GetDomain & "Item/Show.asp?m=" & ChannelID & "&d=" & RS("ID") & """ target=""_blank""><strong>预览商品内容</strong></a>】</td>"
					  .Write "	  </tr>"
					  .Write "	</table>"				
			End With
		End Sub
		
		Function GetBrandByClassID(ClassID,BrandID)
		  Dim SQL,K
		  Dim RS:Set RS=Server.CreateOBject("ADODB.RECORDSET")
		  RS.Open "Select B.ID,B.BrandName From KS_ClassBrand B inner join KS_ClassBrandR R On B.id=R.BrandID where R.classid='" & classid & "' order by B.orderid",conn,1,1
		  If Not RS.Eof  Then SQL=RS.GetRows(-1):RS.Close:Set RS=Nothing
		  If Not IsArray(SQL) Then
		   GetBrandByClassID="Null" 
		  Else
		     GetBrandByClassID = "<select name='brandid'>"
			 GetBrandByClassID = GetBrandByClassID & "<option value='0'>-请选择品牌-</option>"
		     For K=0 To Ubound(SQL,2)
			  If BrandID=SQL(0,K) Then
			  GetBrandByClassID=GetBrandByClassID & "<option value='" & sql(0,k) & "' selected>" & sql(1,k) & "</option>"
			  Else
			  GetBrandByClassID=GetBrandByClassID & "<option value='" & sql(0,k) & "'>" & sql(1,k) & "</option>"
			  End If
			 Next
			 GetBrandByClassID = GetBrandByClassID &  "</select>"
			 Erase Sql
		  End If
       End Function

	   Sub SetKBXSPrice()
	   	  with response
		      .Write "<html>"
			  .Write"<head>"
			  .Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
			  .Write"<link href=""Include/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
			  .Write "<script src=""../HSK_JS/common.js"" language=""JavaScript""></script>"
			  .Write "<script language='JavaScript' src='../HSK_JS/jquery.js'></script>" & vbCrLf
			  .Write"</head>"
			  .Write"<body leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"

	    dim proid:proid=ks.chkclng(request("proid"))
		if proid=0 then ks.die "error!"
		dim kbprice:kbprice=request("kbprice")
	    dim rs:set rs=server.createobject("adodb.recordset")
		rs.open "select top 1 * from ks_product where id=" & proid,conn,1,1
		if not rs.eof then
		%>
		 <script type="text/javascript">
		  function regInput(obj, reg, inputStr)
				{
					var docSel = document.selection.createRange()
					if (docSel.parentElement().tagName != "INPUT")    return false
					oSel = docSel.duplicate()
					oSel.text = ""
					var srcRange = obj.createTextRange()
					oSel.setEndPoint("StartToStart", srcRange)
					var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
					return reg.test(str)
				}
			function addIn(){
		   var title=$("#title").val();
		   var proid=$("#proid").val();
		   var kbprice=$("#kbprice").val();
		   top.frames["MainFrame"].updateKBXS(proid+"@@@"+kbprice+"@@@"+title);
		   top.frames["MainFrame"].closeWindow();
		  }
		 </script>
		<%if kbprice="" then kbprice=rs("price_member")
	     .write "<table border='0' width='100%' class='ctable' cellspacing='1' cellpadding='1'>"
		 .write "<tr class='tdbg'><td height='30' class='clefttitle' align='right' width='130'><strong>商品名称:</strong></td><td>" & rs("title") & "<input type='hidden' name='title' id='title' value='" & rs("title") & "'><input type='hidden' name='proid' id='proid' value='" & proid & "'></td></tr>"
		 .write "<tr class='tdbg'><td height='30' class='clefttitle' align='right'><strong>当前零售价:</strong></td><td>￥" & formatnumber(rs("price"),2,-1) & "元</td></tr>"
		 .write "<tr class='tdbg'><td height='30' class='clefttitle' align='right'><strong>会 员 价:</strong></td><td><font color=red>￥" & formatnumber(rs("price_member"),2,-1) & "元</font></td></tr>"
		 .write "<tr class='tdbg'><td height='30' class='clefttitle' align='right'><strong>捆绑销售价:</strong></td><td><input type='text' name='kbprice' id='kbprice' value='" & kbprice & "' size='5' onKeyPress= ""return regInput(this,/^\d*\.?\d{0,2}$/,String.fromCharCode(event.keyCode))"" onpaste=""return regInput(this,/^\d*\.?\d{0,2}$/,window.clipboardData.getData('Text'))"" ondrop=""return regInput(this,    /^\d*\.?\d{0,2}$/,event.dataTransfer.getData('Text'))"" style='text-align:center'> 元</td></tr>"
		 .write "<tr class='tdbg'><td height='30' align='center' colspan='2'>"
		 if request("kbprice")="" Then
		 .Write "<input onclick='addIn()' type='button' value='确定加入' class='button'>"
		 else
		 .Write "<input onclick='addIn()' type='button' value='确定修改' class='button'>"
		 end if
		 .Write "</td></tr>"
         .write "</table>"		
		end if
		rs.close
		set rs=nothing
		end with
	   End Sub
	   
	   Sub addBundleSale(ID)
	   		Dim KBProList:KBProList=KS.S("KBProList")
			Dim KBArr,I
			 Conn.Execute("Delete From KS_ShopBundleSale Where ProID=" & ID)
			 
			If Not KS.IsNul(KBProList) Then
			  KBProList=Replace(KBProList," ","")
			  KBArr=Split(KBProList,",")
			   For i=0 to ubound(KBArr)
			        Dim KBSArr:KBSArr=Split(KBArr(i),"|")
					Dim PRS:Set PRS=Server.CreateOBject("ADODB.RECORDSET")
					PRS.Open "Select * From KS_ShopBundleSale Where KBProID=" & KBSArr(0) & " And ProID=" & ID,conn,1,3
				  If PRS.Eof Then
				   PRS.AddNew
				  End If
				   PRS("ProID")=ID
				   PRS("KBProID")=KBSArr(0)
				   PRS("KBPrice")=KBSArr(1)
				  PRS.Update
				  PRS.Close:Set PRS=Nothing
				Next
		  End If
		   
	   End Sub
End Class
%> 
