<!--#include file="Admin_Common.asp"-->
<!--#include file="Admin_CommonCode_Content.asp"-->
<!--#include file="../Include/PowerEasy.CreateThumb.asp"-->
<!--#include file="../Include/PowerEasy.Common.Content.asp"-->
<!--#include file="../Include/PowerEasy.FSO.asp"-->
<!--#include file="../Include/PowerEasy.XmlHttp.asp"-->
<%
'**************************************************************
' Software name: PowerEasy SiteWeaver
' Web: http://www.powereasy.net
' Copyright (C) 2005－2009 佛山市动易网络科技有限公司 版权所有
'**************************************************************

Const NeedCheckComeUrl = True   '是否需要检查外部访问

Const PurviewLevel = 2      '0--不检查，1--超级管理员，2--普通管理员
Const PurviewLevel_Channel = 0   '0--不检查，1--频道管理员，2--栏目总编，3--栏目管理员
Const PurviewLevel_Others = ""   '其他权限

Dim HtmlDir, PurviewChecked
Dim ManageType, ProductKind, arrProductKind, Status, MyStatus, arrStatus
Dim ClassID, SpecialID, ProductID, EnableSale
Dim IncludePic, UploadFiles, DefaultPicUrl, IsThumb

Dim tClass, ClassName, RootID, ParentID, Depth, ParentPath, Child, arrChildID, ChildID, ParentDir, ClassDir
Dim VoteID

ChannelID = 1000
Call GetChannel(ChannelID)
'检查管理员操作权限
If AdminPurview > 1 Then
    AdminPurview_Channel = PE_CLng(rsGetAdmin("AdminPurview_" & ChannelDir))
    If AdminPurview_Channel = 0 Then AdminPurview_Channel = 5
    
    If AdminPurview_Channel <= PurviewLevel_Channel Then
        PurviewPassed = True
    End If
    If PurviewPassed = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        Response.End
    End If
End If

ModuleType = 5

HtmlDir = InstallDir & ChannelDir

ManageType = Trim(Request("ManageType"))
ProductKind = Trim(Request("ProductKind"))
ClassID = PE_CLng(Trim(Request("ClassID")))
SpecialID = PE_CLng(Trim(Request("SpecialID")))
ProductID = Trim(Request("ProductID"))
SearchType = PE_CLng(Trim(Request("SearchType")))

If Action = "" Then
    Action = "Manage"
End If

If ProductKind = "" Then
    ProductKind = 1
Else
    ProductKind = PE_CLng(ProductKind)
End If
If IsValidID(ProductID) = False Then
    ProductID = ""
End If

FileName = "Admin_Product.asp?Action=" & Action & "&ManageType=" & ManageType & "&ChannelID=1000"
strFileName = FileName & "&SearchType=" & SearchType & "&ClassID=" & ClassID & "&SpecialID=" & SpecialID & "&Field=" & strField & "&keyword=" & Keyword
arrProductKind = Array("", "实物", "软件", "点卡", "服务")

Response.Write "<html><head><title>" & ChannelShortName & "管理</title>" & vbCrLf
Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbCrLf
Response.Write "<link href='Admin_Style.css' rel='stylesheet' type='text/css'>" & vbCrLf
If Action = "Add" Or Action = "Modify" Then
    Response.Write "<script src=""../JS/prototype.js""></script>" & vbCrLf
    Response.Write "<script src=""../JS/checklogin.js""></script>" & vbCrLf
End If
Response.Write "</head>" & vbCrLf
Response.Write "<body leftmargin='2' topmargin='0' marginwidth='0' marginheight='0'>" & vbCrLf
Response.Write "<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
Dim strTitle
strTitle = ChannelName & "管理----"
Select Case Action
Case "Add"
    strTitle = strTitle & "添加" & ChannelShortName
Case "Modify"
    strTitle = strTitle & "修改" & ChannelShortName
Case "SaveAdd", "SaveModify"
    strTitle = strTitle & "保存" & ChannelShortName
Case "Move"
    strTitle = strTitle & "移动" & ChannelShortName
Case "Show"
    strTitle = strTitle & "查看" & ChannelShortName
Case "Batch", "DoBatch"
    strTitle = strTitle & "批量修改" & ChannelShortName & "属性"
Case "Manage"
    If ManageType = "HTML" Then
        strTitle = strTitle & ChannelShortName & "生成"
    ElseIf ManageType = "Recyclebin" Then
        strTitle = strTitle & ChannelShortName & "回收站管理"
    ElseIf ManageType = "Special" Then
        strTitle = strTitle & "专题" & ChannelShortName & "管理"
    Else
        strTitle = strTitle & ChannelShortName & "管理首页"
    End If
End Select
Call ShowPageTitle(strTitle, 10151)
Response.Write "  <tr class='tdbg'>"
Response.Write "    <td width='70' height='30' ><strong>管理导航：</strong></td><td colspan='9'>"
Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&EnableSale=All'>" & ChannelShortName & "管理首页</a>&nbsp;|&nbsp;"
Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Add&ProductKind=1&ClassID=" & ClassID & "&SpecialID=" & SpecialID & "'>添加" & ChannelShortName & "（实物）</a>&nbsp;|&nbsp;"
Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Add&ProductKind=2&ClassID=" & ClassID & "&SpecialID=" & SpecialID & "'>添加" & ChannelShortName & "（软件）</a>&nbsp;|&nbsp;"
Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Add&ProductKind=3&ClassID=" & ClassID & "&SpecialID=" & SpecialID & "'>添加" & ChannelShortName & "（点卡）</a>&nbsp;|&nbsp;"
If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&ManageType=Special'>专题" & ChannelShortName & "管理</a>&nbsp;|&nbsp;"
End If
If AdminPurview = 1 Or AdminPurview_Channel = 1 Then
Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&ManageType=Recyclebin&EnableSale=All'>" & ChannelShortName & "回收站管理</a>"
End If
If UseCreateHTML > 0 And ObjInstalled_FSO = True Then
    Response.Write "&nbsp;|&nbsp;<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&ManageType=HTML&EnableSale=True'><b>生成HTML管理</b></a>"
End If
Response.Write "</td></tr>" & vbCrLf
If Action = "Manage" Then
    Response.Write "  <tr class='tdbg'>"
    Response.Write "<form name='form3' method='Post' action='" & FileName & "'>"
    Response.Write "<td width='70' height='30' ><strong>快速查找：</strong></td><td>"
    Response.Write "      <select size=1 name='SearchType' onChange='javascript:submit()'>"
    Response.Write "          <option value='0'"
    If SearchType = 0 Then Response.Write " selected"
    Response.Write ">所有" & ChannelShortName & "</option>"
    Response.Write "          <option value='1'"
    If SearchType = 1 Then Response.Write " selected"
    Response.Write ">正在销售的" & ChannelShortName & "</option>"
    Response.Write "          <option value='2'"
    If SearchType = 2 Then Response.Write " selected"
    Response.Write ">未销售的" & ChannelShortName & "</option>"
    Response.Write "          <option value='3'"
    If SearchType = 3 Then Response.Write " selected"
    Response.Write ">正常销售的" & ChannelShortName & "</option>"
    Response.Write "          <option value='4'"
    If SearchType = 4 Then Response.Write " selected"
    Response.Write ">涨价" & ChannelShortName & " </option>"
    Response.Write "          <option value='5'"
    If SearchType = 5 Then Response.Write " selected"
    Response.Write ">特价处理" & ChannelShortName & "</option>"
    Response.Write "          <option value='6'"
    If SearchType = 6 Then Response.Write " selected"
    Response.Write ">降价促销" & ChannelShortName & "</option>"
    Response.Write "          <option value='7'"
    If SearchType = 7 Then Response.Write " selected"
    Response.Write ">促销礼品</option>"
    Response.Write "          <option value='8'"
    If SearchType = 8 Then Response.Write " selected"
    Response.Write ">有促销活动的" & ChannelShortName & "</option>"
    Response.Write "          <option value='9'"
    If SearchType = 9 Then Response.Write " selected"
    Response.Write ">实际库存报警的" & ChannelShortName & "</option>"
    Response.Write "          <option value='10'"
    If SearchType = 10 Then Response.Write " selected"
    Response.Write ">预订库存报警的" & ChannelShortName & "</option>"
    Response.Write "          <option value='11'"
    If SearchType = 11 Then Response.Write " selected"
    Response.Write ">已售完的" & ChannelShortName & "</option>"
    Response.Write "          <option value='12'"
    If SearchType = 12 Then Response.Write " selected"
    Response.Write ">所有固顶" & ChannelShortName & "</option>"
    Response.Write "          <option value='13'"
    If SearchType = 13 Then Response.Write " selected"
    Response.Write ">所有热卖" & ChannelShortName & "</option>"
    Response.Write "          <option value='14'"
    If SearchType = 14 Then Response.Write " selected"
    Response.Write ">所有推荐" & ChannelShortName & "</option>"
    Response.Write "          <option value='15'"
    If SearchType = 15 Then Response.Write " selected"
    Response.Write ">所有批发" & ChannelShortName & "</option>"
    Response.Write "        </select>"
    Response.Write "</td>"
    Response.Write "</form>" & vbCrLf
    Response.Write "<form method='Get' name='SearchForm' action='" & FileName & "'>"
    Response.Write "<td><b>高级查询：</b>"
    Response.Write "<select name='Field' size='1'>"
    Response.Write "<option value='ProductName' selected>" & ChannelShortName & "名称</option>"
    Response.Write "<option value='ProductIntro'>" & ChannelShortName & "简介</option>"
    Response.Write "<option value='ProductExplain'>" & ChannelShortName & "介绍</option>"
    Response.Write "<option value='ProductNum'>商品编号</option>"
    Response.Write "<option value='ProducerName'>厂商</option>"
    Response.Write "<option value='TrademarkName'>品牌/商标</option>"
    Response.Write "<option value='ID'>" & ChannelShortName & "ID</option>"
    Response.Write "</select>"
    Response.Write "<select name='ClassID'><option value=''>所有栏目</option>" & GetClass_Option(1, 0) & "</select>"
    Response.Write "<input type='text' name='keyword'  size='15' value='关键字' maxlength='50' onFocus='this.select();'>"
    Response.Write "<input type='submit' name='Submit'  value='搜索'>"
    Response.Write "<input name='SearchType' type='hidden' id='SearchType' value='-1'>"
    Response.Write "<input name='ManageType' type='hidden' id='ManageType' value='" & ManageType & "'>"
    Response.Write "<input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "</td></form>"
    Response.Write "</tr>"
End If
Response.Write "</table>" & vbCrLf

Select Case Action
Case "Add"
    Call Add
Case "Modify"
    Call Modify
Case "SaveAdd", "SaveModify"
    Call SaveProduct
Case "SetOnTop", "CancelOnTop", "SetElite", "CancelElite", "SetHot", "CancelHot", "StartSale", "StopSale"
    Call SetProperty
Case "Show"
    Call Show
Case "Del"
    Call Del
Case "ConfirmDel"
    Call ConfirmDel
Case "ClearRecyclebin"
    Call ClearRecyclebin
Case "Restore"
    Call Restore
Case "RestoreAll"
    Call RestoreAll
Case "DelFile"
    Call DelFile
Case "Batch"
    Call Batch
Case "DoBatch"
    Call DoBatch
Case "MoveToClass"
    Call ShowForm_MoveToClass
Case "MoveToSpecial"
    Call ShowForm_MoveToSpecial
Case "AddToSpecial"
    Call ShowForm_AddToSpecial
Case "DoMoveToClass"
    Call DoMoveToClass
Case "DoMoveToSpecial"
    Call DoMoveToSpecial
Case "DoAddToSpecial"
    Call DoAddToSpecial
Case "DelFromSpecial"
    Call DelFromSpecial
Case "BatchPrice"
    Call BatchPrice
Case "DoBatchPrice"
    Call DoBatchPrice
Case "Manage", "Price"
    Call main
Case "SavePrice"
    Call SavePrice
Case Else
    Call main
End Select
If FoundErr = True Then
    Call WriteErrMsg(ErrMsg, ComeUrl)
End If
Response.Write "</body></html>"
Call CloseConn


Sub main()
    If ManageType = "HTML" And UseCreateHTML = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>本频道设置了不生成HTML，所以不用进行生成管理！</li>"
        Exit Sub
    End If
    Dim rsProductList, sql, Querysql
    
    If ClassID = 0 Then
        If strField = "" And AdminPurview = 2 And AdminPurview_Channel = 3 And ManageType <> "My" Then
            If arrClass_Manage = "" Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>对不起，您没有在此频道管理" & ChannelShortName & "的权限！</li>"
                Exit Sub
            End If
            Set tClass = Conn.Execute("select top 1 ClassID,ClassName,RootID,ParentID,Depth,ParentPath,Child,arrChildID,ParentDir,ClassDir from PE_Class where ChannelID=" & ChannelID & " and ClassID In (" & DelRightComma(arrClass_Manage) & ")")
            If tClass.BOF And tClass.EOF Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>对不起，您没有在此频道的管理权限！</li>"
            Else
                ClassID = tClass(0)
                ClassName = tClass(1)
                RootID = tClass(2)
                ParentID = tClass(3)
                Depth = tClass(4)
                ParentPath = tClass(5)
                Child = tClass(6)
                arrChildID = tClass(7)
                PurviewChecked = True
                ParentDir = tClass(8)
                ClassDir = tClass(9)
            End If
        End If
    ElseIf ClassID = -1 Then
        If AdminPurview = 1 Or (AdminPurview = 2 And AdminPurview_Channel < 3) Then PurviewChecked = True
    ElseIf ClassID > 0 Then
        Set tClass = Conn.Execute("select ClassName,RootID,ParentID,Depth,ParentPath,Child,arrChildID,ParentDir,ClassDir from PE_Class where ClassID=" & ClassID)
        If tClass.BOF And tClass.EOF Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>找不到指定的栏目</li>"
        Else
            ClassName = tClass(0)
            RootID = tClass(1)
            ParentID = tClass(2)
            Depth = tClass(3)
            ParentPath = tClass(4)
            Child = tClass(5)
            arrChildID = tClass(6)
            ParentDir = tClass(7)
            ClassDir = tClass(8)
        End If
        Set tClass = Nothing
    End If
    If FoundErr = True Then Exit Sub
    If PurviewChecked = False Then
        If ParentID > 0 Then
            PurviewChecked = CheckPurview_Class(arrClass_Manage, ParentPath & "," & ClassID)
        Else
            PurviewChecked = CheckPurview_Class(arrClass_Manage, ClassID)
        End If
    End If

    Call ShowJS_Manage(ChannelShortName)
    Response.Write "<br><table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    If ManageType = "Special" Then
        Response.Write "<tr class='title'>"
        Response.Write "  <td height='22'>" & GetSpecialList() & "</td></tr>" & vbCrLf
    Else
        Response.Write "  <tr class='title'>"
        Response.Write "    <td height='22'>" & GetRootClass() & "</td>"
        Response.Write "  </tr>" & GetChild_Root() & ""
    End If
    Response.Write "</table><br>"

    Select Case ManageType
    Case "HTML"
        Call ShowManagePath(ChannelShortName & "生成")
    Case "Recyclebin"
        Call ShowManagePath(ChannelShortName & "回收站管理")
    Case "Special"
        Call ShowManagePath("专题" & ChannelShortName & "管理")
    Case "Price"
        Call ShowManagePath("价格设置")
    Case Else
        Call ShowManagePath(ChannelShortName & "管理")
    End Select

    
    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr>"
    Response.Write "    <form name='myform' method='Post' action='Admin_Product.asp' onsubmit='return ConfirmDel();'>"
    Response.Write "     <td><table class='border' border='0' cellspacing='1' width='100%' cellpadding='0'>"
    Response.Write "          <tr class='title' height='22'> "
    If ManageType <> "Price" Then
        Response.Write "            <td height='22' width='30' align='center'><strong>选中</strong></td>"
    End If
    Response.Write "            <td width='25' align='center'><strong>ID</strong></td>"
    If ManageType = "Special" Then
        Response.Write "        <td width='120' align='center'><strong>所属专题</strong></td>"
    End If
    Response.Write "            <td align='center' ><strong>" & ChannelShortName & "名称</strong></td>"
    Response.Write "            <td width='40' align='center' ><strong>类型</strong></td>"
    Response.Write "            <td width='40' align='center' ><strong>单位</strong></td>"
    Response.Write "            <td width='40' align='center' ><strong>库存量</strong></td>"
    If ManageType = "Price" Then
        Response.Write "            <td width='60' align='center' ><strong>市场价</strong></td>"
        Response.Write "            <td width='60' align='center' ><strong>原始价</strong></td>"
        Response.Write "            <td width='60' align='center' ><strong>当前价</strong></td>"
        Response.Write "            <td width='60' align='center' ><strong>会员价</strong></td>"
        Response.Write "            <td width='60' align='center' ><strong>代理价</strong></td>"
    Else
        Response.Write "            <td width='110' align='center' ><strong>价格</strong></td>"
        Response.Write "            <td width='60' align='center' ><strong>人气值</strong></td>"
        Response.Write "            <td width='80' align='center' ><strong>" & ChannelShortName & "属性</strong></td>"
        Response.Write "            <td width='40' align='center' ><strong>销售中</strong></td>"
        If UseCreateHTML > 0 And ObjInstalled_FSO = True And ManageType <> "Special" Then
            Response.Write "            <td width='40' align='center' ><strong>已生成</strong></td>"
        End If
        Select Case ManageType
        Case "HTML"
            Response.Write "            <td width='180' align='center' ><strong>生成HTML操作</strong></td>"
        Case "Recyclebin"
            Response.Write "            <td width='100' align='center' ><strong>回收站操作</strong></td>"
        Case "Special"
            Response.Write "            <td width='100' align='center' ><strong>专题管理操作</strong></td>"
        Case Else
            Response.Write "            <td width='60' align='center' ><strong>操作</strong></td>"
        End Select
    End If
    Response.Write "          </tr>"
    If ManageType = "Special" Then
        sql = "select top " & MaxPerPage & " I.InfoID,I.SpecialID,P.ProductID,S.SpecialName,P.ProductKind,P.ProductNum,P.ProductName,P.ProductModel,P.ProductStandard,P.ProductThumb,P.Keyword,"
        sql = sql & "P.ProductType,P.Price,P.Price_Original,P.Price_Market,P.Price_Member,P.Price_Agent,P.EnableWholesale,P.Unit,P.OnTop,P.IsHot,P.IsElite,P.Stars,P.EnableSale,P.Stocks,P.Discount,P.BeginDate,P.EndDate,P.UpdateTime,P.Hits,P.BuyTimes,P.VoteID"
        sql = sql & " from PE_Product P right join (PE_InfoS I left join PE_Special S on I.SpecialID=S.SpecialID) on P.ProductID=I.ItemID "
    Else
        If ClassID = -1 Or (ClassID > 0 And Child = 0) Then
            sql = sql & "select top " & MaxPerPage & " P.ClassID,P.ProductID,P.ProductKind,P.ProductNum,P.ProductName,P.ProductModel,P.ProductStandard,P.ProductThumb,P.Keyword,"
            sql = sql & "P.ProductType,P.Price,P.Price_Original,P.Price_Market,P.Price_Member,P.Price_Agent,P.EnableWholesale,P.Unit,P.OnTop,P.IsHot,P.IsElite,P.Stars,P.EnableSale,P.Stocks,P.Discount,P.BeginDate,P.EndDate,P.UpdateTime,P.Hits,P.BuyTimes,P.VoteID"
            sql = sql & " from PE_Product P "
        Else
            sql = sql & "select top " & MaxPerPage & " P.ClassID,P.ProductID,C.ClassName,C.ParentDir,C.ClassDir,P.ProductKind,P.ProductNum,P.ProductName,P.ProductModel,P.ProductStandard,P.ProductThumb,P.Keyword,"
            sql = sql & "P.ProductType,P.Price,P.Price_Original,P.Price_Market,P.Price_Member,P.Price_Agent,P.EnableWholesale,P.Unit,P.OnTop,P.IsHot,P.IsElite,P.Stars,P.EnableSale,P.Stocks,P.Discount,P.BeginDate,P.EndDate,P.UpdateTime,P.Hits,P.BuyTimes,P.VoteID"
            sql = sql & " from PE_Product P left join PE_Class C on P.ClassID=C.ClassID "
        End If
    End If
    
    Querysql = " where P.ChannelID=" & ChannelID
    If ManageType = "Special" Then
        Querysql = Querysql & " and I.ModuleType=" & ModuleType
    End If
    If ManageType = "Recyclebin" Then
        Querysql = Querysql & " and P.Deleted=" & PE_True & ""
    Else
        Querysql = Querysql & " and P.Deleted=" & PE_False & ""
    End If
    
    Select Case SearchType
    Case 1
        Querysql = Querysql & " and P.EnableSale=" & PE_True
    Case 2
        Querysql = Querysql & " and P.EnableSale=" & PE_False
    Case 3
        Querysql = Querysql & " and P.ProductType=1"
    Case 4
        Querysql = Querysql & " and P.ProductType=2"
    Case 5
        Querysql = Querysql & " and P.ProductType=3"
    Case 6
        Querysql = Querysql & " and P.ProductType=5"
    Case 7
        Querysql = Querysql & " and P.ProductType=4"
    Case 8
        Querysql = Querysql & " and P.SalePromotionType>0"
    Case 9
        Querysql = Querysql & " and P.Stocks<=AlarmNum"
    Case 10
        Querysql = Querysql & " and P.Stocks<=AlarmNum+OrderNum"
    Case 11
        Querysql = Querysql & " and P.Stocks<=0"
    Case 12
        Querysql = Querysql & " and P.OnTop=" & PE_True
    Case 13
        Querysql = Querysql & " and P.IsHot=" & PE_True
    Case 14
        Querysql = Querysql & " and P.IsElite=" & PE_True
    Case 15
        Querysql = Querysql & " and P.EnableWholesale=" & PE_True
    End Select
    If ClassID <> 0 Then
        If Child > 0 Then
            Querysql = Querysql & " and P.ClassID in (" & arrChildID & ")"
        Else
            Querysql = Querysql & " and P.ClassID=" & ClassID
        End If
    End If
    If SpecialID > 0 Then
        Querysql = Querysql & " and I.SpecialID=" & SpecialID
    End If

    If ManageType = "My" Then
        Querysql = Querysql & " and P.Inputer='" & username & "' "
    End If
    If Keyword <> "" Then
        Select Case strField
        Case "ProductName"
            Querysql = Querysql & " and P.ProductName like '%" & Keyword & "%' "
        Case "ProductIntro"
            Querysql = Querysql & " and P.ProductIntro like '%" & Keyword & "%' "
        Case "ProductExplain"
            Querysql = Querysql & " and P.ProductExplain like '%" & Keyword & "%' "
        Case "ProducerName"
            Querysql = Querysql & " and P.ProducerName like '%" & Keyword & "%' "
        Case "TrademarkName"
            Querysql = Querysql & " and P.TrademarkName like '%" & Keyword & "%' "
        Case "ProductNum"
            Querysql = Querysql & " and P.ProductNum like '%" & Keyword & "%' "
        Case Else
            Querysql = Querysql & " and P.ProductName like '%" & Keyword & "%' "
        End Select
    End If
    
    If ManageType = "Special" Then
        totalPut = PE_CLng(Conn.Execute("select Count(*) from PE_InfoS I inner join PE_Product P on I.ItemID=P.ProductID " & Querysql)(0))
    Else
        totalPut = PE_CLng(Conn.Execute("select Count(*) from PE_Product P " & Querysql)(0))
    End If
    If CurrentPage < 1 Then
        CurrentPage = 1
    End If
    If (CurrentPage - 1) * MaxPerPage > totalPut Then
        If (totalPut Mod MaxPerPage) = 0 Then
            CurrentPage = totalPut \ MaxPerPage
        Else
            CurrentPage = totalPut \ MaxPerPage + 1
        End If
    End If
    If CurrentPage > 1 Then
        If ManageType = "Special" Then
            Querysql = Querysql & " and I.InfoID < (select min(InfoID) from (select top " & ((CurrentPage - 1) * MaxPerPage) & " I.InfoID from PE_InfoS I inner join PE_Product P on I.ItemID=P.ProductID " & Querysql & " order by I.InfoID desc) as QueryProduct)"
        Else
            Querysql = Querysql & " and P.ProductID < (select min(ProductID) from (select top " & ((CurrentPage - 1) * MaxPerPage) & " P.ProductID from PE_Product P " & Querysql & " order by P.ProductID desc) as QueryProduct)"
        End If
    End If
    If ManageType = "Special" Then
        sql = sql & Querysql & " order by I.InfoID desc"
    Else
        sql = sql & Querysql & " order by P.ProductID desc"
    End If

    Set rsProductList = Server.CreateObject("ADODB.Recordset")
    rsProductList.Open sql, Conn, 1, 1
    
    If rsProductList.BOF And rsProductList.EOF Then
        totalPut = 0
        Response.Write "<tr class='tdbg'><td colspan='20' align='center'><br>"

        If ClassID > 0 Then
            Response.Write "此栏目及其子栏目中没有任何"
        Else
            Response.Write "没有任何"
        End If
        If EnableSale = "True" Then
            Response.Write "<font color=green>销售中</font>的" & ChannelShortName & "！"
        ElseIf EnableSale = "False" Then
            Response.Write "<font color=blue>待销售</font>的" & ChannelShortName & "！"
        Else
            Response.Write ChannelShortName & "！"
        End If
        Response.Write "<br><br></td></tr>"
    Else
        Dim ProductNum, ProductPath
        ProductNum = 0
        Do While Not rsProductList.EOF
            Response.Write "      <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
            If ManageType = "Special" Then
                Response.Write "        <td width='30' align='center'><input name='InfoID' type='checkbox' onclick='CheckItem(this)' id='InfoID' value='" & rsProductList("InfoID") & "'></td>"
                Response.Write "        <td width='25' align='center'>" & rsProductList("InfoID") & "</td>"
                Response.Write "        <td width='120' align='center'>"
                If rsProductList("SpecialID") > 0 Then
                    Response.Write "<a href='" & FileName & "&SpecialID=" & rsProductList("SpecialID") & "'>" & rsProductList("SpecialName") & "</a>"
                Else
                    Response.Write "&nbsp;"
                End If
                Response.Write "</td>"
            ElseIf ManageType = "Price" Then
                Response.Write "        <td width='25' align='center'><input name='ProductID' type='hidden' value='" & rsProductList("ProductID") & "'>" & rsProductList("ProductID") & "</td>"
            Else
                Response.Write "        <td width='30' align='center'><input name='ProductID' type='checkbox' onclick='CheckItem(this)' id='ProductID' value='" & rsProductList("ProductID") & "'></td>"
                Response.Write "        <td width='25' align='center'>" & rsProductList("ProductID") & "</td>"
            End If
            Response.Write "        <td>"
            If ManageType <> "Special" Then
                If rsProductList("ClassID") <> ClassID And ClassID <> -1 Then
                    Response.Write "<a href='" & FileName & "&ClassID=" & rsProductList("ClassID") & "'>["
                    If rsProductList("ClassName") <> "" Then
                        Response.Write rsProductList("ClassName")
                    Else
                        Response.Write "<font color='gray'>不属于任何栏目</font>"
                    End If
                    Response.Write "]</a>&nbsp;"
                End If
            End If
            Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Show&ProductID=" & rsProductList("ProductID") & "'"
            Response.Write " title='" & ChannelShortName & "名称：" & rsProductList("ProductName") & vbCrLf
            Response.Write ChannelShortName & "类别：" & arrProductKind(rsProductList("ProductKind")) & ChannelShortName & vbCrLf
            Response.Write ChannelShortName & "型号：" & rsProductList("ProductModel") & vbCrLf
            Response.Write ChannelShortName & "规格：" & rsProductList("ProductStandard") & vbCrLf
            Response.Write "关 键 字：" & Mid(rsProductList("Keyword"), 2, Len(rsProductList("Keyword")) - 2) & vbCrLf
            Response.Write "上市时间：" & rsProductList("UpdateTime") & vbCrLf
            Response.Write "推荐等级："
            If rsProductList("Stars") = 0 Then
                Response.Write "无"
            Else
                Response.Write String(rsProductList("Stars"), "★")
            End If
            Response.Write "'>"
            Select Case rsProductList("ProductKind")
            Case 1
                Response.Write "<font color='#000000'>"
            Case 2
                Response.Write "<font color='green'>"
            Case 3
                Response.Write "<font color='blue'>"
            End Select
            Response.Write rsProductList("ProductName") & "</font></a>"
            Response.Write "</td>"
            Response.Write "            <td width='40' align='center'>"
            Select Case rsProductList("ProductType")
            Case 1
                Response.Write "<font color='#000000'>正常</font>"
            Case 2
                Response.Write "<font color='green'>涨价</font> "
            Case 5
                Response.Write "<font color='red'>降价</font> "
            Case 3
                Response.Write "<font color='#FFCC00'>特价</font>"
                If rsProductList("Begindate") > Date Then Response.Write "<br><font color='red'>未开始</font>"
                If rsProductList("EndDate") < Date Then Response.Write "<br><font color='red'>已过期</font>"
            Case 4
                Response.Write "<font color='blue'>礼品</font> "
            End Select
            Response.Write "    </td>"
            If ManageType = "Price" Then
                Response.Write "            <td width='40' align='center' ><input type='text' name='Unit" & rsProductList("ProductID") & "' size='6' value='" & rsProductList("Unit") & "' style='text-align:center'></td>"
                Response.Write "            <td width='40' align='center' ><input type='text' name='Stocks" & rsProductList("ProductID") & "' size='6' value='" & rsProductList("Stocks") & "' style='text-align:center'></td>"
                Response.Write "            <td width='60' align='center' ><input type='text' name='Price_Market" & rsProductList("ProductID") & "' size='8' value='" & FormatNumber(rsProductList("Price_Market"), 2, vbTrue, vbFalse, vbFalse) & "' style='text-align:right'></td>"
                Response.Write "            <td width='60' align='center' ><input type='text' name='Price_Original" & rsProductList("ProductID") & "' size='8' value='" & FormatNumber(rsProductList("Price_Original"), 2, vbTrue, vbFalse, vbFalse) & "' style='text-align:right'></td>"
                Response.Write "            <td width='60' align='center' ><input type='text' name='Price" & rsProductList("ProductID") & "' size='8' value='" & FormatNumber(rsProductList("Price"), 2, vbTrue, vbFalse, vbFalse) & "' style='text-align:right'></td>"
                Response.Write "            <td width='60' align='center' ><input type='text' name='Price_Member" & rsProductList("ProductID") & "' size='8' value='" & FormatNumber(rsProductList("Price_Member"), 2, vbTrue, vbFalse, vbFalse) & "' style='text-align:right'></td>"
                Response.Write "            <td width='60' align='center' ><input type='text' name='Price_Agent" & rsProductList("ProductID") & "' size='8' value='" & FormatNumber(rsProductList("Price_Agent"), 2, vbTrue, vbFalse, vbFalse) & "' style='text-align:right'></td>"
            Else
                Response.Write "            <td width='40' align='center'>" & rsProductList("Unit") & "</td>"
                Response.Write "            <td width='40' align='center'>" & rsProductList("Stocks") & "</td>"
                Response.Write "            <td width='110' align='left'><a href='#' title='当前零售价：" & Price2Str(rsProductList("Price")) & vbCrLf
                Response.Write "原始零售价：" & Price2Str(rsProductList("Price_Original")) & vbCrLf
                Response.Write "市场参考价：" & Price2Str(rsProductList("Price_Market")) & vbCrLf
                Response.Write "会员价：" & Price2Str(rsProductList("Price_Member")) & vbCrLf
                Response.Write "代理价：" & Price2Str(rsProductList("Price_Agent"))
                Response.Write "'>原价："
                If rsProductList("Price") = rsProductList("Price_Original") Then
                    Response.Write Price2Str(rsProductList("Price_Original"))
                Else
                    Response.Write "<font color='red'><STRIKE>" & Price2Str(rsProductList("Price_Original")) & "</STRIKE></font>"
                End If
                Response.Write "<br>现价：" & Price2Str(rsProductList("Price"))
                Response.Write "</a></td>"
                Response.Write "            <td width='60' align='center'>" & rsProductList("Hits") & "/" & rsProductList("BuyTimes") & "</td>"
                Response.Write "    <td width='80' align='center'>"
                If rsProductList("OnTop") = True Then
                    Response.Write "<font color=blue>顶</font> "
                Else
                    Response.Write "&nbsp;&nbsp;&nbsp;"
                End If
                If rsProductList("IsHot") = True Then
                    Response.Write "<font color=red>热</font> "
                Else
                    Response.Write "&nbsp;&nbsp;&nbsp;"
                End If
                If rsProductList("IsElite") = True Then
                    Response.Write "<font color=green>荐</font> "
                Else
                    Response.Write "&nbsp;&nbsp;&nbsp;"
                End If
                If Trim(rsProductList("ProductThumb")) <> "" Then
                    Response.Write "<font color=blue>图</font>"
                Else
                    Response.Write "&nbsp;&nbsp;"
                End If
                If rsProductList("VoteID") > 0 Then
                    Response.Write "<a href='" & InstallDir & "Vote.asp?ID=" & rsProductList("VoteID") & "&Action=Show' target='_blank'>调</a>"
                Else
                    Response.Write "&nbsp;&nbsp;"
                End If
                Response.Write "    </td>"
                Response.Write "    <td width='40' align='center'>"
                If rsProductList("EnableSale") = True Then
                    Response.Write "<b>√</b>"
                Else
                    Response.Write "<font color=red><b>×</b></font>"
                End If
                Response.Write "    </td>"
                If UseCreateHTML > 0 And ObjInstalled_FSO = True And ManageType <> "Special" Then
                    Response.Write "    <td width='40' align='center'>"
                    If ClassID = -1 Or (ClassID > 0 And Child = 0) Then
                        ProductPath = HtmlDir & GetItemPath(StructureType, ParentDir, ClassDir, rsProductList("UpdateTime")) & GetItemFileName(FileNameType, ChannelDir, rsProductList("UpdateTime"), rsProductList("ProductID")) & FileExt_Item
                    Else
                        ProductPath = HtmlDir & GetItemPath(StructureType, rsProductList("ParentDir"), rsProductList("ClassDir"), rsProductList("UpdateTime")) & GetItemFileName(FileNameType, ChannelDir, rsProductList("UpdateTime"), rsProductList("ProductID")) & FileExt_Item
                    End If
                    Response.Write "<a href='#' title='文件位置：" & ProductPath & "'>"
                    If fso.FileExists(Server.MapPath(ProductPath)) Then
                        Response.Write "<b>√</b>"
                    Else
                        Response.Write "<font color=red><b>×</b></font>"
                    End If
                    Response.Write "</a></td>"
                End If
                Select Case ManageType
                Case "HTML"
                    Response.Write "    <td width='180' align='left'>&nbsp;"
                    Response.Write "<a href='Admin_CreateProduct.asp?ChannelID=" & ChannelID & "&Action=CreateProduct&ProductID=" & rsProductList("ProductID") & "' title='生成本" & ChannelShortName & "的HTML页面'>生成文件</a>&nbsp;"
                    If fso.FileExists(Server.MapPath(ProductPath)) Then
                        Response.Write "<a href='" & ProductPath & "' target='_blank' title='查看本" & ChannelShortName & "的HTML页面'>查看文件</a>&nbsp;"
                        Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=DelFile&ProductID=" & rsProductList("ProductID") & "' title='删除本" & ChannelShortName & "的HTML页面' onclick=""return confirm('确定要删除此" & ChannelShortName & "的HTML页面吗？');"">删除文件</a>&nbsp;"
                    End If
                    Response.Write "</td>"
                Case "Recyclebin"
                    Response.Write "<td width='100' align='center'>"
                    Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=ConfirmDel&ProductID=" & rsProductList("ProductID") & "' onclick=""return confirm('确定要彻底删除此" & ChannelShortName & "吗？彻底删除后将无法还原！');"">彻底删除</a> "
                    Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Restore&ProductID=" & rsProductList("ProductID") & "'>还原</a>"
                    Response.Write "</td>"
                Case "Special"
                    Response.Write "<td width='100' align='center'>"
                    If rsProductList("SpecialID") > 0 Then
                        Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=DelFromSpecial&InfoID=" & rsProductList("InfoID") & "' onclick=""return confirm('确定要将此" & ChannelShortName & "从其所属专题中删除吗？操作成功后此" & ChannelShortName & "将不属于任何专题。');"">从所属专题中删除</a> "
                    End If
                    Response.Write "</td>"
                Case Else
                    Response.Write "    <td width='60' align='center'>"
                    Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Modify&ProductID=" & rsProductList("ProductID") & "'>修改</a>&nbsp;"
                    Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Del&ProductID=" & rsProductList("ProductID") & "' onclick=""return confirm('确定要删除此" & ChannelShortName & "吗（有订单的商品无法删除）？删除后你还可以从回收站中还原。');"">删除</a>&nbsp;"
                    Response.Write "</td>"
                End Select
            End If
            Response.Write "</tr>"

            ProductNum = ProductNum + 1
            If ProductNum >= MaxPerPage Then Exit Do
            rsProductList.MoveNext
        Loop
    End If
    rsProductList.Close
    Set rsProductList = Nothing
    Response.Write "</table>"
    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0'>"
    Response.Write "  <tr height='30'>"
    If ManageType <> "Price" Then
        Response.Write "    <td width='200'><input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form)' value='checkbox'>选中本页显示的所有" & ChannelShortName & "</td>"
    End If
    Response.Write "    <td align='left'>"
    Select Case ManageType
    Case "HTML"
        If AdminPurview = 1 Or AdminPurview_Channel <= 2 Or PurviewChecked = True Then
            Response.Write "<input name='CreateType' type='hidden' id='CreateType' value='1'>"
            Response.Write "<input name='ClassID' type='hidden' id='ClassID' value='" & ClassID & "'>"
            If ClassID > 0 Then
                If UseCreateHTML = 1 Or UseCreateHTML = 3 Then
                    Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateClass';document.myform.CreateType.value='1';document.myform.action='Admin_CreateProduct.asp';"" value='生成当前栏目列表页'>&nbsp;&nbsp;"
                End If
                Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateProduct';document.myform.CreateType.value='2';document.myform.action='Admin_CreateProduct.asp';"" value='生成当前栏目的" & ChannelShortName & "'>&nbsp;&nbsp;"
            Else
                Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateIndex';document.myform.CreateType.value='1';document.myform.action='Admin_CreateProduct.asp';"" value='生成首页'>&nbsp;&nbsp;"
                If UseCreateHTML = 1 Or UseCreateHTML = 3 Then
                    Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateClass';document.myform.CreateType.value='2';document.myform.action='Admin_CreateProduct.asp';"" value='生成所有栏目列表页'>&nbsp;&nbsp;"
                End If
                Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='CreateProduct';document.myform.CreateType.value='3';document.myform.action='Admin_CreateProduct.asp';"" value='生成所有" & ChannelShortName & "'>&nbsp;&nbsp;"
            End If
            Response.Write "<input name='submit2' type='submit' id='submit2' onClick=""document.myform.Action.value='CreateProduct';document.myform.action='Admin_CreateProduct.asp';"" value='生成选定的" & ChannelShortName & "'>&nbsp;&nbsp;&nbsp;&nbsp;"
            Response.Write "<input name='Submit3' type='submit' id='submit3' onClick=""document.myform.Action.value='DelFile';document.myform.action='Admin_Product.asp'"" value='删除选定" & ChannelShortName & "的HTML文件'>"
        End If
    Case "Recyclebin"
        If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
            Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='ConfirmDel'"" value=' 彻底删除 '>&nbsp;"
            Response.Write "<input name='Submit2' type='submit' id='Submit2' onClick=""document.myform.Action.value='ClearRecyclebin'"" value='清空回收站'>&nbsp;&nbsp;&nbsp;&nbsp;"
            Response.Write "<input name='Submit3' type='submit' id='Submit3' onClick=""document.myform.Action.value='Restore'"" value='还原选定的" & ChannelShortName & "'>&nbsp;"
            Response.Write "<input name='Submit4' type='submit' id='Submit4' onClick=""document.myform.Action.value='RestoreAll'"" value='还原所有" & ChannelShortName & "'>"
        End If
    Case "Special"
        If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
            Response.Write "<input name='submit1' type='submit' id='submit1' onClick=""document.myform.Action.value='DelFromSpecial'"" value='从所属专题中移除'> "
            Response.Write "<input name='Submit2' type='submit' id='Submit2' onClick=""document.myform.Action.value='AddToSpecial'"" value='添加到其他专题中'> "
            Response.Write "<input name='Submit2' type='submit' id='Submit2' onClick=""document.myform.Action.value='MoveToSpecial'"" value='移动到另一专题中'>"
        End If
    Case "Price"
        If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
            Response.Write "<input type='submit' name='Submit8' value='保存价格修改结果' onClick=""document.myform.Action.value='SavePrice'"">"
        End If
    Case Else
        If AdminPurview = 1 Or AdminPurview_Channel <= 2 Or PurviewChecked = True Then
            Response.Write "<input type='submit' name='submit1' value='开始销售' onClick=""document.myform.Action.value='StartSale'"">&nbsp;"
            Response.Write "<input type='submit' name='submit2' value='停止销售' onClick=""document.myform.Action.value='StopSale'"">&nbsp;"
            Response.Write "<input type='submit' name='submit3' value='设为热卖' onClick=""document.myform.Action.value='SetHot'"">&nbsp;"
            Response.Write "<input type='submit' name='submit4' value='取消热卖' onClick=""document.myform.Action.value='CancelHot'"">&nbsp;"
            Response.Write "<input type='submit' name='submit3' value='设为推荐' onClick=""document.myform.Action.value='SetElite'"">&nbsp;"
            Response.Write "<input type='submit' name='submit4' value='取消推荐' onClick=""document.myform.Action.value='CancelElite'""><br>"
            Response.Write "<input type='submit' name='submit5' value='批量删除' onClick=""document.myform.Action.value='Del'"">&nbsp;"
            If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
                Response.Write "<input type='submit' name='Submit6' value='批量设置' onClick=""document.myform.Action.value='Batch'"">&nbsp;"
                Response.Write "<input type='submit' name='Submit7' value='批量移动' onClick=""document.myform.Action.value='MoveToClass'"">&nbsp;"
                Response.Write "<input type='submit' name='Submit8' value='价格变动' onClick=""document.myform.Action.value='BatchPrice'"">&nbsp;"
            End If
        End If
    End Select
    Response.Write "<input name='Action' type='hidden' id='Action' value=''>"
    Response.Write "<input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "  </td></tr>"
    Response.Write "</table>"
    Response.Write "</td>"
    Response.Write "</form></tr></table>"
    If totalPut > 0 Then
        Response.Write ShowPage(strFileName, totalPut, MaxPerPage, CurrentPage, True, True, ChannelItemUnit & ChannelShortName & "", True)
    End If

    Response.Write "<br><b>" & ChannelShortName & "属性中的各项含义：</b><br>"
    Response.Write "<font color=blue>顶</font>----固顶" & ChannelShortName & "，<font color=red>热</font>----热门" & ChannelShortName & "，<font color=green>荐</font>----推荐" & ChannelShortName & "，<font color=blue>图</font>----有" & ChannelShortName & "缩略图，<font color=black>调</font>----有调查<br><br>"

End Sub

Sub ShowJS_Product()
    Response.Write "<script language = 'JavaScript'>" & vbCrLf
    Response.Write "function SelectProduct(){" & vbCrLf
    Response.Write "  var arr=showModalDialog('Admin_SelectFile.asp?ChannelID=" & ChannelID & "&dialogtype=productthumb', '', 'dialogWidth:820px; dialogHeight:600px; help: no; scroll: yes; status: no');" & vbCrLf
    Response.Write "  if(arr!=null){" & vbCrLf
    Response.Write "    var ss=arr.split('|');" & vbCrLf
    Response.Write "    document.myform.ProductThumb.value=ss[0];" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function AddItem(strFileName){" & vbCrLf
    Response.Write "  var arrName=strFileName.split('.');" & vbCrLf
    Response.Write "  var FileExt=arrName[1];" & vbCrLf
    Response.Write "  if (FileExt=='gif'||FileExt=='jpg'||FileExt=='jpeg'||FileExt=='jpe'||FileExt=='bmp'||FileExt=='png'){" & vbCrLf
    Response.Write "  frmPreview.img.src='" & InstallDir & ChannelDir & "/" & UploadDir & "/" & "'+strFileName;" & vbCrLf
    Response.Write "  document.myform.ProductThumb.value=strFileName;}" & vbCrLf
    Response.Write "  document.myform.ProductThumbList.options[document.myform.ProductThumbList.length]=new Option(strFileName,strFileName);" & vbCrLf
    Response.Write "  document.myform.ProductThumbList.selectedIndex+=1;" & vbCrLf
    Response.Write "  if(document.myform.UploadFiles.value==''){" & vbCrLf
    Response.Write "    document.myform.UploadFiles.value=strFileName;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  else{" & vbCrLf
    Response.Write "    document.myform.UploadFiles.value=document.myform.UploadFiles.value+'|'+strFileName;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function selectPaginationType(){" & vbCrLf
    Response.Write "  return false;" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function CheckForm()" & vbCrLf
    Response.Write "{" & vbCrLf
    Response.Write "  var CurrentMode=editor.CurrentMode;" & vbCrLf
    Response.Write "  if (CurrentMode==0){" & vbCrLf
    Response.Write "    document.myform.ProductExplain.value=editor.HtmlEdit.document.body.innerHTML; " & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  else if(CurrentMode==1){" & vbCrLf
    Response.Write "   document.myform.ProductExplain.value=editor.HtmlEdit.document.body.innerText;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  else{" & vbCrLf
    Response.Write "    alert('预览状态不能保存！请先回到编辑状态后再保存');" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  var obj=document.myform.ClassID;" & vbCrLf
    Response.Write "  var iCount=0;" & vbCrLf
    Response.Write "  for(var i=0;i<obj.length;i++){" & vbCrLf
    Response.Write "    if(obj.options[i].selected==true){" & vbCrLf
    Response.Write "      iCount=iCount+1;" & vbCrLf
    Response.Write "      if(obj.options[i].value==''){" & vbCrLf
    Response.Write "        ShowTabs(0);" & vbCrLf
    Response.Write "        alert('" & ChannelShortName & "所属栏目不能指定为外部栏目！');" & vbCrLf
    Response.Write "        document.myform.ClassID.focus();" & vbCrLf
    Response.Write "        return false;" & vbCrLf
    Response.Write "      }" & vbCrLf
    Response.Write "      if(obj.options[i].selected==true&&obj.options[i].value=='0'){" & vbCrLf
    Response.Write "        ShowTabs(0);" & vbCrLf
    Response.Write "        alert('指定的栏目不允许添加" & ChannelShortName & "！只允许在其子栏目中添加" & ChannelShortName & "。');" & vbCrLf
    Response.Write "        document.myform.ClassID.focus();" & vbCrLf
    Response.Write "        return false;" & vbCrLf
    Response.Write "      }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.ProductName.value==''){" & vbCrLf
    Response.Write "    ShowTabs(0);" & vbCrLf
    Response.Write "    alert('" & ChannelShortName & "名称不能为空！');" & vbCrLf
    Response.Write "    document.myform.ProductName.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.Keyword.value==''){" & vbCrLf
    Response.Write "    ShowTabs(0);" & vbCrLf
    Response.Write "    alert('关键字不能为空！');" & vbCrLf
    Response.Write "    document.myform.Keyword.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.Unit.value==''){" & vbCrLf
    Response.Write "    ShowTabs(0);" & vbCrLf
    Response.Write "    alert('" & ChannelShortName & "单位不能为空！');" & vbCrLf
    Response.Write "    document.myform.Unit.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (iCount==0){" & vbCrLf
    Response.Write "    ShowTabs(0);" & vbCrLf
    Response.Write "    alert('请选择所属栏目！');" & vbCrLf
    Response.Write "    document.myform.ClassID.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.Price_Original.value==''){" & vbCrLf
    Response.Write "    ShowTabs(2);" & vbCrLf
    Response.Write "    alert('" & ChannelShortName & "原始零售价不能为空！');" & vbCrLf
    Response.Write "    document.myform.Price_Original.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.ProductExplain.value==''){" & vbCrLf
    Response.Write "    ShowTabs(0);" & vbCrLf
    Response.Write "    alert('" & ChannelShortName & "详细说明不能为空！');" & vbCrLf
    Response.Write "    editor.HtmlEdit.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  for(var i=0;i<document.myform.DependentProductsList.length;i++){" & vbCrLf
    Response.Write "      if (document.myform.DependentProducts.value=='') document.myform.DependentProducts.value=document.myform.DependentProductsList.options[i].value;" & vbCrLf
    Response.Write "      else document.myform.DependentProducts.value+=','+document.myform.DependentProductsList.options[i].value;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    
    Response.Write "function SelectPresent(id){" & vbCrLf
    Response.Write "    var arr = showModalDialog('Admin_SelectProduct.asp?ProductType=4', '', 'dialogWidth:820px; dialogHeight:600px; help: no; scroll: auto; status: no');  " & vbCrLf
    Response.Write "    if (arr != null&arr!=''){" & vbCrLf
    Response.Write "        var ss=arr.split(',');" & vbCrLf
    Response.Write "        if(id == 2)" & vbCrLf
    Response.Write "        {" & vbCrLf
    Response.Write "            document.myform.PresentID2.value=ss[2];" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "        else" & vbCrLf
    Response.Write "        {" & vbCrLf
    Response.Write "            document.myform.PresentID.value=ss[2];" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf
    
    Response.Write "function regInput(obj, reg, inputStr)" & vbCrLf
    Response.Write "{" & vbCrLf
    Response.Write "    var docSel = document.selection.createRange()" & vbCrLf
    Response.Write "    if (docSel.parentElement().tagName != ""INPUT"")    return false" & vbCrLf
    Response.Write "    oSel = docSel.duplicate()" & vbCrLf
    Response.Write "    oSel.text = """"" & vbCrLf
    Response.Write "    var srcRange = obj.createTextRange()" & vbCrLf
    Response.Write "    oSel.setEndPoint(""StartToStart"", srcRange)" & vbCrLf
    Response.Write "    var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)" & vbCrLf
    Response.Write "    return reg.test(str)" & vbCrLf
    Response.Write "}" & vbCrLf
    
    Response.Write "function IsDigit(){" & vbCrLf
    Response.Write "  return ((event.keyCode >= 48) && (event.keyCode <= 57));" & vbCrLf
    Response.Write "}" & vbCrLf

    Response.Write "function IsDigit2(){" & vbCrLf
    Response.Write "  return ((event.keyCode >= 48) && (event.keyCode <= 57) || (event.keyCode = 46));" & vbCrLf
    Response.Write "}" & vbCrLf
    
    Response.Write "function getprice(Price_Original){" & vbCrLf
    Response.Write "  if(Price_Original==''|| isNaN(Price_Original)){Price_Original=0;}" & vbCrLf
    Response.Write "  if(document.myform.ProductType[2].checked==true){document.myform.Price.value=Math.round(Price_Original*Math.abs(document.myform.Discount2.value/10)*100)/100;}" & vbCrLf
    Response.Write "  else if(document.myform.ProductType[3].checked==true){document.myform.Price.value=Math.round(Price_Original*Math.abs(document.myform.Discount.value/10)*100)/100;}" & vbCrLf
    Response.Write "  else{document.myform.Price.value=Price_Original;}" & vbCrLf

    Response.Write "}" & vbCrLf

    Response.Write "var tID=0;" & vbCrLf
    Response.Write "function ShowTabs(ID){" & vbCrLf
    Response.Write "  if(ID!=tID){" & vbCrLf
    Response.Write "    TabTitle[tID].className='title5';" & vbCrLf
    Response.Write "    TabBottom[tID].className='title3';" & vbCrLf
    Response.Write "    TabTitle[ID].className='title6';" & vbCrLf
    Response.Write "    TabBottom[ID].className='title4';" & vbCrLf
    Response.Write "    Tabs[tID].style.display='none';" & vbCrLf
    Response.Write "    Tabs[ID].style.display='';" & vbCrLf
    Response.Write "    tID=ID;" & vbCrLf
    Response.Write "    if(ID==0){" & vbCrLf
    Response.Write "      editor.yToolbarsCss();" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function CopyTitle(){" & vbCrLf
    Response.Write "  if (document.myform.VoteTitle.value==''){" & vbCrLf
    Response.Write "     document.myform.VoteTitle.value = document.myform.ProductName.value;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function moreitem(inputname,listnum,ichannelid,inputype){" & vbCrLf
    Response.Write "    var chedkurl = '../inc/checklist.asp';" & vbCrLf
    Response.Write "    var CheckDOM = new ActiveXObject(""Microsoft.XMLDOM"");" & vbCrLf
    Response.Write "    CheckDOM.async=false;" & vbCrLf
    Response.Write "    var p = CheckDOM.createProcessingInstruction('xml','version=\""1.0\"" encoding=\""gb2312\""'); " & vbCrLf
    Response.Write "    CheckDOM.appendChild(p); " & vbCrLf
    Response.Write "    var CheckRoot = CheckDOM.createElement('root');" & vbCrLf
    Response.Write "    var CField = CheckDOM.createNode(1,'text',''); " & vbCrLf
    Response.Write "    CField.text = $F(inputname);" & vbCrLf
    Response.Write "    CheckRoot.appendChild(CField);" & vbCrLf
    Response.Write "    CField = CheckDOM.createNode(1,'lnum',''); " & vbCrLf
    Response.Write "    CField.text = listnum;" & vbCrLf
    Response.Write "    CheckRoot.appendChild(CField);" & vbCrLf
    Response.Write "    CField = CheckDOM.createNode(1,'channelid',''); " & vbCrLf
    Response.Write "    CField.text = ichannelid;" & vbCrLf
    Response.Write "    CheckRoot.appendChild(CField);" & vbCrLf
    Response.Write "    CField = CheckDOM.createNode(1,'type',''); " & vbCrLf
    Response.Write "    CField.text = inputype;" & vbCrLf
    Response.Write "    CheckRoot.appendChild(CField);" & vbCrLf
    Response.Write "    CField = CheckDOM.createNode(1,'inputname',''); " & vbCrLf
    Response.Write "    CField.text = inputname;" & vbCrLf
    Response.Write "    CheckRoot.appendChild(CField);" & vbCrLf
    Response.Write "    CheckDOM.appendChild(CheckRoot);" & vbCrLf
    Response.Write "    var CHttp = getHTTPObject();" & vbCrLf
    Response.Write "    CHttp.open('POST',chedkurl,true);" & vbCrLf
    Response.Write "    CHttp.onreadystatechange = function () " & vbCrLf
    Response.Write "    {" & vbCrLf
    Response.Write "        if(CHttp.readyState == 4 && CHttp.status==200){" & vbCrLf
    Response.Write "            if(CHttp.responseText == ''){" & vbCrLf
    Response.Write "                Element.hide(inputype);" & vbCrLf
    Response.Write "            }else{" & vbCrLf
    Response.Write "                Element.show(inputype);" & vbCrLf
    Response.Write "                $(inputype).innerHTML=CHttp.responseText;" & vbCrLf
    Response.Write "            }" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    CHttp.send(CheckDOM);" & vbCrLf
    Response.Write "}" & vbCrLf

    Response.Write "function addinput(iname,ivalue){" & vbCrLf
    Response.Write "  if(iname!='' && ivalue!=''){" & vbCrLf
    Response.Write "     $(iname).value=ivalue;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf

    'Response.Write "function getKey() {" & vbCrLf
    'Response.Write " if(window.event.keyCode==49) {" & vbCrLf
    'Response.Write "   ShowTabs(0);" & vbCrLf
    'Response.Write " }" & vbCrLf
    'Response.Write " if(window.event.keyCode==50) {" & vbCrLf
    'Response.Write "   ShowTabs(1);" & vbCrLf
    'Response.Write " }" & vbCrLf
    'Response.Write " if(window.event.keyCode==51) {" & vbCrLf
    'Response.Write "   ShowTabs(2);" & vbCrLf
    'Response.Write " }" & vbCrLf
    'Response.Write " if(window.event.keyCode==52) {" & vbCrLf
    'Response.Write "   ShowTabs(3);" & vbCrLf
    'Response.Write " }" & vbCrLf
    'Response.Write " if(window.event.keyCode==53) {" & vbCrLf
    'Response.Write "   ShowTabs(4);" & vbCrLf
    'Response.Write " }" & vbCrLf
    'Response.Write " if(window.event.keyCode==54) {" & vbCrLf
    'Response.Write "   ShowTabs(5);" & vbCrLf
    'Response.Write " }" & vbCrLf
    'Response.Write "}" & vbCrLf
    'Response.Write "document.onkeypress = getKey;" & vbCrLf
    Response.Write "function DelDependentProduct(){" & vbCrLf
    Response.Write "  if(document.myform.DependentProductsList.length==0) return false;" & vbCrLf
    Response.Write "  var thisurl=document.myform.DependentProductsList.value; " & vbCrLf
    Response.Write "  if (thisurl=='') {alert('请先选择一个换购礼品，再点删除按钮！');return false;}" & vbCrLf
    Response.Write "  document.myform.DependentProductsList.options[document.myform.DependentProductsList.selectedIndex]=null;" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function AddDependentProduct(){" & vbCrLf
    Response.Write "    var arr = showModalDialog('Admin_SelectProduct.asp', '', 'dialogWidth:820px; dialogHeight:600px; help: no; scroll: yes; status: no');  " & vbCrLf
    Response.Write "    if (arr != null&arr!=''){" & vbCrLf
    Response.Write "        var ss=arr.split(',');" & vbCrLf
    Response.Write "        document.myform.DependentProductsList.options[document.myform.DependentProductsList.length]=new Option(ss[1],ss[0]);" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf

    
    Response.Write "</script>" & vbCrLf
End Sub

Sub ShowTabs_Title()
    Response.Write "<table width='100%'  border='0' align='center' cellpadding='0' cellspacing='0'>" & vbCrLf
    Response.Write "  <tr align='center'>" & vbCrLf
    Response.Write "    <td id='TabTitle' class='title6' onclick='ShowTabs(0)'>基本信息</td>" & vbCrLf
    Response.Write "    <td id='TabTitle' class='title5' onclick='ShowTabs(1)'>所属专题</td>" & vbCrLf
    Response.Write "    <td id='TabTitle' class='title5' onclick='ShowTabs(2)'>价格设置</td>" & vbCrLf
    Response.Write "    <td id='TabTitle' class='title5' onclick='ShowTabs(3)'>促销设置</td>" & vbCrLf
    Response.Write "    <td id='TabTitle' class='title5' onclick='ShowTabs(4)'>" & ChannelShortName & "信息</td>" & vbCrLf
    Response.Write "    <td id='TabTitle' class='title5' onclick='ShowTabs(5);CopyTitle()'"
    If FoundInArr(arrEnabledTabs, "Vote", ",") = False Then Response.Write " style='display:none'"
    Response.Write ">调查设置</td>" & vbCrLf
    Response.Write "    <td>&nbsp;</td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
End Sub

Sub ShowTabs_Bottom()
    Response.Write "<table width='100%'  border='0' align='center' cellpadding='0' cellspacing='0'>" & vbCrLf
    Response.Write "  <tr align='center' height='24'>" & vbCrLf
    Response.Write "    <td id='TabBottom' class='title4' onclick='ShowTabs(0)'>基本信息</td>" & vbCrLf
    Response.Write "    <td id='TabBottom' class='title3' onclick='ShowTabs(1)'>所属专题</td>" & vbCrLf
    Response.Write "    <td id='TabBottom' class='title3' onclick='ShowTabs(2)'>价格设置</td>" & vbCrLf
    Response.Write "    <td id='TabBottom' class='title3' onclick='ShowTabs(3)'>促销设置</td>" & vbCrLf
    Response.Write "    <td id='TabBottom' class='title3' onclick='ShowTabs(4)'>" & ChannelShortName & "信息</td>" & vbCrLf
    Response.Write "    <td id='TabBottom' class='title3' onclick='ShowTabs(5);CopyTitle()'"
    If FoundInArr(arrEnabledTabs, "Vote", ",") = False Then Response.Write " style='display:none'"
    Response.Write ">调查设置</td>" & vbCrLf
    Response.Write "    <td>&nbsp;</td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
End Sub

Sub Add()
    Call ShowJS_Product
    
    Call PopCalendarInit
    
    Response.Write "<br><table width='100%'><tr><td align='left'>您现在的位置：<a href='Admin_Product.asp?ChannelID=" & ChannelID & "'>" & ChannelName & "管理</a>&nbsp;&gt;&gt;&nbsp;添加" & ChannelShortName & "（" & arrProductKind(ProductKind) & "）</td></tr></table>"
    Response.Write "<form method='POST' name='myform' onSubmit='return CheckForm();' action='Admin_Product.asp' target='_self'>"

    Call ShowTabs_Title

    Response.Write "<table width='100%' border='0' align='center' cellpadding='5' cellspacing='0' class='border'>"
    Response.Write "  <tr align='center'>"
    Response.Write "    <td class='tdbg'>"
    Response.Write "      <table width='98%' border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>"
    Response.Write "        <tbody id='Tabs' style='display:'>" & vbCrLf

    Call ShowTr_Class

    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "编号：</td>"
    Response.Write "            <td><input name='ProductNum' type='text' value='" & GetNumString() & "' size='20' maxlength='20' disabled> <input type='checkbox' name='AutoGetNum' value='Yes' checked onclick='document.myform.ProductNum.disabled=this.checked'>自动编号<input type='button' name='checksame' value='检查是否存在相同的" & ChannelShortName & "编号' onclick=""showModalDialog('Admin_CheckSameTitle.asp?CheckType=CheckNum&ModuleType=" & ModuleType & "&Title='+document.myform.ProductNum.value,'checksame','dialogWidth:350px; dialogHeight:250px; help: no; scroll: no; status: no');""></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>条形码：</td>"
    Response.Write "            <td><input name='BarCode' type='text' value='' size='20' maxlength='20' ONKEYPRESS=""event.returnValue=IsDigit();""></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "名称：</td>"
    Response.Write "            <td><div style=""clear: both;""><input name='ProductName' type='text' value='' autocomplete='off' size='50' maxlength='255' onPropertyChange=""moreitem('ProductName',10," & ChannelID & ",'satitle4');"" onBlur=""setTimeout('Element.hide(satitle4)',500);"" "
    If IsExists("MY_Namepy","PE_Product") = True then Response.Write "onChange=""MY_Namepy.value=GetSpellingChar(ProductName.value,2)"""
    Response.Write "><font color='#FF0000'>*</font><input type='button' name='checksame' value='检查是否存在相同的" & ChannelShortName & "名' onclick=""showModalDialog('Admin_CheckSameTitle.asp?ModuleType=" & ModuleType & "&Title='+document.myform.ProductName.value,'checksame','dialogWidth:350px; dialogHeight:250px; help: no; scroll: no; status: no');"">"
    Response.Write "                </div><div id=""satitle4"" style='display:none'></div></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>关键字：</td>"
    Response.Write "            <td><div style=""clear: both;""><input name='Keyword' type='text' id='Keyword' autocomplete='off' size='50' maxlength='255' onPropertyChange=""moreitem('Keyword',10," & ChannelID & ",'skey');"" onBlur=""setTimeout('Element.hide(skey)',500);""> <font color='#FF0000'>*</font> " & GetKeywordList("Admin", ChannelID)
    Response.Write "              </div><div id=""skey"" style='display:none'></div>"
    Response.Write "              <font color='#0000FF'>用来查找相关" & ChannelShortName & "，可输入多个关键字，"
    Response.Write "              中间用<font color='#FF0000'>“|”</font>隔开。不能出现&quot;'&?;:()等字符。</font></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "单位：</td>"
    Response.Write "            <td><input name='Unit' type='text' value='" & Session("Unit") & "' size='10' maxlength='20' style='text-align: center;'> &lt;&lt; <select name='UnitList' onchange='document.myform.Unit.value=this.value;'>" & GetAllUnit() & "</select></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>库存数量：</td>"
    Response.Write "            <td><input name='Stocks' type='text' value='1000' size='10' maxlength='10' style='text-align: right;' ONKEYPRESS=""event.returnValue=IsDigit();""></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>库存报警下限：</td>"
    Response.Write "            <td><input name='AlarmNum' type='text' value='10' size='10' maxlength='10' style='text-align: right;' ONKEYPRESS=""event.returnValue=IsDigit();""></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "重量：</td>"
    Response.Write "            <td><input name='Weight' type='text' value='' size='10' maxlength='10' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit2();""> 千克（Kg）</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' valign='middle' class='tdbg5'>" & ChannelShortName & "简介：</td>"
    Response.Write "            <td>用于首页及栏目页显示，不要超过255个字符<br><textarea name='ProductIntro' cols='67' rows='3' id='ProductIntro'></textarea></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' valign='bottom' class='tdbg5'>详细介绍：<br><br>"
    If EnableSaveRemote = True And IsObjInstalled("Microsoft.XMLHTTP") = True Then
        Response.Write "<table><tr><td><input type='checkbox' name='SaveRemotePic' value='Yes' ></td><td>自动下载" & ChannelShortName & "介绍里的图片</td>"
        If PhotoObject = 1 Then
            Response.Write "<tr><td><input type='checkbox' name='AddWatermark' value='Yes' ></td><td>是否给" & ChannelShortName & "介绍里远程获得的图片加水印</td></tr>"
            Response.Write "<tr><td><input type='checkbox' name='AddThumb' value='Yes' ></td><td>是否给" & ChannelShortName & "介绍里远程获得的第一张图片加缩略图</td></tr>"
        End If
        Response.Write "</tr></table>"
    End IF	
    Response.Write "<iframe id='frmPreview' width='120' height='150' frameborder='1' src='Admin_imgPreview.asp'></iframe></td>"
    Response.Write "            <td><textarea name='ProductExplain' cols='67' rows='8' id='ProductExplain' style='display:none'></textarea><iframe ID='editor' src='../editor.asp?ChannelID=" & ChannelID & "&ShowType=4&tContentid=ProductExplain' frameborder='1' scrolling='no' width='660' height='350' ></iframe></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "缩略图：</td>"
    Response.Write "            <td><input name='ProductThumb' type='text' id='ProductThumb' size='40' maxlength='200'> <input type='button' name='Button2' value='从已上传图片中选择' onclick='SelectProduct()'>"
    Response.Write "              <br>从本产品图片中选择：<select name='ProductThumbList' id='ProductThumbList' onChange=""ProductThumb.value=this.value;frmPreview.img.src=((this.value == '') ? '../images/nopic.gif' : '" & InstallDir & ChannelDir & "/" & UploadDir & "/'+this.value);""><option selected>不指定缩略图</option></select><input name='UploadFiles' type='hidden' id='UploadFiles'>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "        </tbody>" & vbCrLf
    
    Call ShowTabs_Special(SpecialID, "")
    
    Response.Write "        <tbody id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "类型：</td>"
    Response.Write "            <td> <input name='ProductType' type='radio' value='1' checked onclick='document.myform.Price.value=document.myform.Price_Original.value;document.myform.Price.disabled=true;'> 正常销售&nbsp;&nbsp;&nbsp;&nbsp;正常销售，没有打折的" & ChannelShortName & "。<br>"
    Response.Write "<input name='ProductType' type='radio' value='2' onclick='document.myform.Price.disabled=false'><font color='green'> 涨价" & ChannelShortName & "&nbsp;&nbsp;&nbsp;&nbsp;如内存条等一些可能涨价的" & ChannelShortName & "</font><br>"
    Response.Write "<input name='ProductType' type='radio' value='5' onclick='getprice(document.myform.Price_Original.value);document.myform.Price.disabled=false'><font color='red'> 降价" & ChannelShortName & "&nbsp;&nbsp;&nbsp;&nbsp;折扣率：<input name='Discount2' type='text' value='9' size='4' maxlength='4' style='text-align: center;'> 折&nbsp;&nbsp;如书籍等" & ChannelShortName & "9折促销</font><br>"
    Response.Write "<input name='ProductType' type='radio' value='3' onclick='getprice(document.myform.Price_Original.value);document.myform.Price.disabled=false;'><font color='#c7a728'> 特价处理&nbsp;&nbsp;&nbsp;&nbsp;折扣率：<input name='Discount' type='text' value='8' size='4' maxlength='4' style='text-align: center;'> 折"
    Response.Write "&nbsp;&nbsp;优惠期限：<input name='BeginDate' type='text' value='" & FormatDateTime(Date, 2) & "' size='10' maxlength='10'><a style='cursor:hand;' onClick='PopCalendar.show(document.myform.BeginDate, ""yyyy-m-d"", null, null, null, ""11"");'><img src='Images/Calendar.gif' border='0' Style='Padding-Top:10px' align='absmiddle'></a> 至 <input name='EndDate' type='text' value='" & FormatDateTime(DateAdd("m", 1, Date), 2) & "' size='10' maxlength='10'><a style='cursor:hand;' onClick='PopCalendar.show(document.myform.EndDate, ""yyyy-m-d"", null, null, null, ""11"");'><img src='Images/Calendar.gif' border='0' Style='Padding-Top:10px' align='absmiddle'></a>"
    Response.Write "&nbsp;&nbsp;限购数量：<input name='LimitNum' type='text' value='0' size='4' maxlength='4' style='text-align: center;'>（0为不限制）</font><br>"
    Response.Write "<input name='ProductType' type='radio' value='4' onclick='document.myform.Price.disabled=false'><font color='blue'> 促销礼品&nbsp;&nbsp;&nbsp;&nbsp;购物满一定金额后换购（现价>0）或赠送（现价＝0）的礼品。</font><br>"
    Response.Write "          </td></tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "价格：<br><br><a href='Admin_Help_Price.asp' target='_blank'><font color='red'>查看价格计算公式</font></a></td>"
    Response.Write "            <td><table width='100%' border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'><tr valign='top' class='tdbg'><td align='right' width='80'><font color='red'>原始零售价：</font></td><td width='130'><input name='Price_Original' type='text' value='' size='10' maxlength='10' onchange='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'))""><font color='red'>元 *</font></td><td>正常销售时的价格。以及降价及促销时的参考价。</td></tr>"
    Response.Write "<tr valign='top' class='tdbg'><td align='right' width='80'><font color='blue'>当前零售价：</font></td><td><input name='Price' type='text' value='' size='10' maxlength='10' disabled 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'))""><font color='blue'>元 </font><input type='button' name='calculate' value='计算' onclick='getprice(document.myform.Price_Original.value);'></td><td>系统会自动根据" & ChannelShortName & "类型、原始零售价及折扣率计算当前零售价。也可以手动输入当前零售价，若降价" & ChannelShortName & "的原始价格×折扣率≠输入的当前零售价，以输入的为准</td></tr>"
    Response.Write "<tr valign='top' class='tdbg'><td align='right' width='80'>市场参考价：</td><td><input name='Price_Market' type='text' value='' size='10' maxlength='10' 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'))"">元</td><td>市场参考零售价，一般可以设高一些。如果不填或为0，前台不显示。</td></tr>"
    Response.Write "<tr valign='top' class='tdbg'><td align='right' width='80'>会员零售价：</td><td><input name='Price_Member' type='text' value='' size='10' maxlength='10' 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'))"">元</td><td>若大于0，则会员组中设定的折扣比率无效，所有会员都以此为准，不区分组别，并且会员的折上折优惠失效。若想使用折扣比率，请保持为空或输入0。</td></tr>"
    Response.Write "<tr valign='top' class='tdbg'><td align='right' width='80'>代理零售价：</td><td><input name='Price_Agent' type='text' value='' size='10' maxlength='10' 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'))"">元</td><td>若大于0，则代理商组中设定的折扣比率无效，所有代理商都以此为准，不区分组别。若想使用折扣比率，请保持为空或输入0。</td></tr>"
    
    Response.Write "<tr valign='top' class='tdbg'><td colspan='6'><input name='EnableWholesale' type='checkbox' value='Yes' onclick=""if (this.checked==true) {Wholesale.style.display='';} else {Wholesale.style.display='none';}""> 允许批发"
    Response.Write "<table width='100%' border='0' cellpadding='2' cellspacing='1' id='Wholesale' style='display:none'>"
    Response.Write "<tr><td align='left'>① 一次性购买此" & ChannelShortName & "数量满 <input name='Number_Wholesale1' type='text' value='10' size='6' maxlength='6' style='text-align: right;'> 时，批发价为 <input name='Price_Wholesale1' type='text' value='' size='8' maxlength='10' 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'))""> 元</td></tr>"
    Response.Write "<tr><td align='left'>② 一次性购买此" & ChannelShortName & "数量满 <input name='Number_Wholesale2' type='text' value='50' size='6' maxlength='6' style='text-align: right;'> 时，批发价为 <input name='Price_Wholesale2' type='text' value='' size='8' maxlength='10' 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'))""> 元</td></tr>"
    Response.Write "<tr><td align='left'>③ 一次性购买此" & ChannelShortName & "数量满 <input name='Number_Wholesale3' type='text' value='100' size='6' maxlength='6' style='text-align: right;'> 时，批发价为 <input name='Price_Wholesale3' type='text' value='' size='8' maxlength='10' 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'))""> 元</td></tr>"
    Response.Write "</table></td></tr>"
    Response.Write "          </table></td></tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>允许单独销售：</td>"
    Response.Write "            <td><input name='EnableSingleSell' type='radio' value='Yes' checked onclick=""trDependentProducts.style.display='none'""> 是&nbsp;&nbsp;&nbsp;&nbsp;<input name='EnableSingleSell' type='radio' value='No' onclick=""trDependentProducts.style.display=''""> 否&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>如果不允许单独销售，请指定从属的商品。</font></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg' id='trDependentProducts' style='display:none'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>从属商品：</td>"
    Response.Write "            <td><table width='100%'  border='0' cellspacing='5' cellpadding='0'><tr>" & vbCrLf
    Response.Write "                  <td width='200'><select name='DependentProductsList' size='2' multiple id='DependentProductsList' style='height:80;width:200 '></select></td>" & vbCrLf
    Response.Write "                  <td><input type='button' name='Submit' value='添加商品' onClick='AddDependentProduct()'><br><input name='DependentProducts' type='hidden' id='DependentProducts'>" & vbCrLf
    Response.Write "                  <br><input type='button' name='Submit' value=' 删  除 ' onClick='DelDependentProduct()'></td></tr></table>如果不指定从属商品，则可以与任何非促销礼品捆绑销售。" & vbCrLf
    Response.Write "            </td>" & vbCrLf
    Response.Write "          </tr>"
    Response.Write "        </tbody>" & vbCrLf

    
    Response.Write "        <tbody id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>促销方案：</td>"
    Response.Write "            <td> <input name='SalePromotionType' type='radio' value='0' checked onclick=''> 不促销<br>"
    Response.Write "<input name='SalePromotionType' type='radio' value='1' onclick=''><font color='red'> 买 <input name='MinNumber1' type='text' value='2' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 送 <input name='PresentNumber1' type='text' value='1' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 同样的" & ChannelShortName & "</font><br>"
    Response.Write "<input name='SalePromotionType' type='radio' value='2' onclick=''><font color='blue'> 买 <input name='MinNumber2' type='text' value='2' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 送 <input name='PresentNumber2' type='text' value='1' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 其他" & ChannelShortName & "&nbsp;&nbsp;&nbsp;赠品编号：<input name='PresentID' type='text' value='' size='20' maxlength='30'><input type='button' name='button21' value='...' onclick='SelectPresent(1)'></font><br>"

    Response.Write "<input name='SalePromotionType' type='radio' value='3' onclick=''><font color='red'> 买&nbsp;&nbsp; 就&nbsp;&nbsp; 送 <input name='PresentNumber3' type='text' value='1' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 同样的" & ChannelShortName & "</font><br>"
    Response.Write "<input name='SalePromotionType' type='radio' value='4' onclick=''><font color='blue'> 买&nbsp;&nbsp;  就&nbsp;&nbsp;  送 <input name='PresentNumber4' type='text' value='1' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 其他" & ChannelShortName & "&nbsp;&nbsp;&nbsp;赠品编号：<input name='PresentID2' type='text' value='' size='20' maxlength='30'><input type='button' name='button41' value='...' onclick='SelectPresent(2)'></font>"
    Response.Write "<br>买满××元返还××元现金（券），买满××元在促销" & ChannelShortName & "中任选等更多促销方案请到“促销方案管理”中设置。"

    Response.Write "          </td></tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>赠送" & PointName & "：</td>"
    Response.Write "            <td>购买一件此" & ChannelShortName & "可以得到<input name='PresentPoint' type='text' value='0' size='6' maxlength='9' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();"">" & PointName & "<br>买满××元可以得××" & PointName & "等更多促销方案，请到“促销方案管理”中设置。</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>购物积分：</td>"
    Response.Write "            <td>购买一件此" & ChannelShortName & "可以得到<input name='PresentExp' type='text' value='0' size='6' maxlength='9' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();"">积分<br>买满××元可以得××积分等更多促销方案，请到“促销方案管理”中设置。</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>赠送现金券：</td>"
    Response.Write "            <td>购买一件此" & ChannelShortName & "可以得到<input name='PresentMoney' type='text' value='0' size='6' maxlength='9' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();"">元现金券<br>买满××元可以得××元现金券等更多促销方案，请到“促销方案管理”中设置。</td>"
    Response.Write "          </tr>"
    Response.Write "        </tbody>" & vbCrLf
    
        
    Response.Write "        <tbody id='Tabs' style='display:none'>" & vbCrLf
    If ProductKind = 1 Then
        Response.Write "          <tr class='tdbg'>"
        Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "型号：</td>"
        Response.Write "            <td><input name='ProductModel' type='text' value='' size='50' maxlength='50'> &lt;&lt; <select name='ModelList' onchange='document.myform.ProductModel.value=this.value;'>" & GetAllModel() & "</select></td>"
        Response.Write "          </tr>"
        Response.Write "          <tr class='tdbg'>"
        Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "规格：</td>"
        Response.Write "            <td><input name='ProductStandard' type='text' value='' size='50' maxlength='50'> &lt;&lt; <select name='StandardList' onchange='document.myform.ProductStandard.value=this.value;'>" & GetAllStandard() & "</select></td>"
        Response.Write "          </tr>"
    End If
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>生 产 商：</td>"
    Response.Write "            <td><input name='ProducerName' type='text' value='" & Trim(Session("ProducerName")) & "' size='50' maxlength='50'> <font color='blue'><=【<font color='green' onclick=""window.open('Admin_SourceList.asp?TypeSelect=ProducerList&ChannelID=" & ChannelID & "', 'ProducerList', 'width=600,height=450,resizable=0,scrollbars=yes');"" style=""cursor:hand;"">列表</font>】</font></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>品牌/商标：</td>"
    Response.Write "            <td><input name='TrademarkName' type='text' value='" & Trim(Session("TrademarkName")) & "' size='50' maxlength='50'> <font color='blue'><=【<font color='green' onclick=""window.open('Admin_SourceList.asp?TypeSelect=TrademarkList&ChannelID=" & ChannelID & "', 'TrademarkList', 'width=600,height=450,resizable=0,scrollbars=yes');"" style=""cursor:hand;"">列表</font>】</font></td>"
    Response.Write "          </tr>"
    
    '自定义字段
    Dim rsField
    Set rsField = Conn.Execute("select * from PE_Field where ChannelID=-5 or ChannelID=" & ChannelID & " Order by FieldID")
    Do While Not rsField.EOF
        Call WriteFieldHTML(rsField("FieldName"), rsField("Title"), rsField("Tips"), rsField("FieldType"), rsField("DefaultValue"), rsField("Options"), rsField("EnableNull"))
        rsField.MoveNext
    Loop
    Set rsField = Nothing

    If ProductKind = 2 Then
        Response.Write "          <tr class='tdbg'>"
        Response.Write "            <td width='120' align='right' class='tdbg5'>软件下载地址：</td>"
        Response.Write "            <td><input name='DownloadUrl' type='text' value='' size='60' maxlength='200'></td>"
        Response.Write "          </tr>"
        Response.Write "          <tr class='tdbg'>"
        Response.Write "            <td width='120' align='right' class='tdbg5'>软件下载说明：</td>"
        Response.Write "            <td><input name='Remark' type='text' value='' size='60' maxlength='250'></td>"
        Response.Write "          </tr>"
    ElseIf ProductKind = 3 Then
        Response.Write "          <tr class='tdbg'>"
        Response.Write "            <td width='120' align='right' class='tdbg5'>点卡类" & ChannelShortName & "说明：</td>"
        Response.Write "            <td><font color='blue'>请在添加好" & ChannelShortName & "后，去“充值卡管理”处添加相应的充值卡。可以批量自动生成充值卡，也可以逐个添加其他公司的卡号及密码（用于代销）。</font></td>"
        Response.Write "          </tr>"
    End If
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>服务期限：</td>"
    Response.Write "            <td><input name='ServiceTerm' type='text' value='" & Session("ServiceTerm") & "' size='8' maxlength='8' ONKEYPRESS=""event.returnValue=IsDigit();"">年</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "属性：</td>"
    Response.Write "            <td> <input name='OnTop' type='checkbox' id='OnTop' value='Yes'> 固顶" & ChannelShortName & "&nbsp;&nbsp;&nbsp;&nbsp; "
    Response.Write "<input name='IsHot' type='checkbox' id='IsHot' value='Yes'> 热门" & ChannelShortName & "&nbsp;&nbsp;&nbsp; "
    Response.Write "<input name='IsElite' type=checkbox id='IsElite' value='Yes'> 推荐" & ChannelShortName & "&nbsp;&nbsp;&nbsp;&nbsp;  "
    Response.Write ChannelShortName & "推荐等级：<select name='Stars' id='Stars'>" & GetStars(3) & "</select>"
    Response.Write "          </td></tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>点击数初始值：</td>"
    Response.Write "            <td>"
    Response.Write "              <input name='Hits' type='text' id='Hits' value='0' size='10' maxlength='10' style='text-align:center'>&nbsp;&nbsp; <font color='#0000FF'>这功能是提供给管理员作弊用的。不过尽量不要用呀！^_^</font>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
            
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>上市时间：</td>"
    Response.Write "            <td><input name='UpdateTime' type='text' id='UpdateTime' value='" & Now() & "' maxlength='50'>"
    Response.Write "              时间格式为“年-月-日 时:分:秒”，如：<font color='#0000FF'>2003-5-12 12:32:47</font></td>"
    Response.Write "          </tr>"
    
    Response.Write "          <tr class='tdbg'> "
    Response.Write "            <td width='120' align='right' class='tdbg5'>配色风格：</td>"
    Response.Write "            <td  colspan='3'><select Name='SkinID'>" & GetSkin_Option(Session("SkinID")) & "</select>&nbsp;相关模板中包含CSS、颜色、图片等信息</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'> "
    Response.Write "            <td width='120' align='right' class='tdbg5'>版面设计模板：</td>"
    Response.Write "            <td  colspan='3'><select Name='TemplateID'>" & GetTemplate_Option(ChannelID, 3, Session("TemplateID")) & "</select>&nbsp;相关模板中包含了版面设计的版式等信息</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>销售操作：</td>"
    Response.Write "            <td><input name='EnableSale' type='checkbox' id='EnableSale' value='Yes' checked>立即销售"
    If UseCreateHTML > 0 And AutoCreateType > 0 Then
        Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name='CreateImmediate' type='checkbox' value='Yes' checked>立即生成HTML"
    End If
    Response.Write "        </td></tr>"
    Response.Write "        </tbody>" & vbCrLf

    Call ShowTabs_Vote_Add
    
    Response.Write "        </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "  </table>"

    Call ShowTabs_Bottom

    Response.Write "  <p align='center'>"
    Response.Write "   <input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "   <input name='ProductKind' type='hidden' id='ProductKind' value='" & ProductKind & "'>"
    Response.Write "   <input name='Action' type='hidden' id='Action' value='SaveAdd'>"
    Response.Write "   <input name='add' type='submit'  id='Add' value=' 添 加 ' style='cursor:hand;'>&nbsp;&nbsp;"
    Response.Write "   <input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick=""window.location.href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Manage';"" style='cursor:hand;'>"
    Response.Write "  </p><br>"
    Response.Write "</form>"
End Sub

Sub Modify()
    Dim rsProduct
    If ProductID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定要修改的" & ChannelShortName & "ID</li>"
        Exit Sub
    Else
        ProductID = PE_CLng(ProductID)
    End If
    Set rsProduct = Conn.Execute("select * from PE_Product where ProductID=" & ProductID & "")
    If rsProduct.BOF And rsProduct.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到" & ChannelShortName & "</li>"
        rsProduct.Close
        Set rsProduct = Nothing
        Exit Sub
    End If

    ClassID = rsProduct("ClassID")
    Dim arrSpecialID
    arrSpecialID = GetSpecialIDArr(ModuleType, ProductID)

    If rsProduct("Inputer") <> UserName Then
        Call CheckClassPurview(Action, ClassID)
    End If
    If FoundErr = True Then
        rsProduct.Close
        Set rsProduct = Nothing
        Exit Sub
    End If

    Call ShowJS_Product
    ProductKind = rsProduct("ProductKind")

    Call PopCalendarInit

    Response.Write "<br><table width='100%'><tr><td align='left'>您现在的位置：<a href='Admin_Product.asp?ChannelID=" & ChannelID & "'>" & ChannelName & "管理</a>&nbsp;&gt;&gt;&nbsp;修改" & ChannelShortName & "（" & arrProductKind(ProductKind) & "）</td></tr></table>"
    Response.Write "<form method='POST' name='myform' onSubmit='return CheckForm();' action='Admin_Product.asp' target='_self'>"

    Call ShowTabs_Title

    Response.Write "<table width='100%' border='0' align='center' cellpadding='5' cellspacing='0' class='border'>"
    Response.Write "  <tr align='center'>"
    Response.Write "    <td class='tdbg'>"
    Response.Write "      <table width='98%' border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>"
    Response.Write "        <tbody id='Tabs' style='display:'>" & vbCrLf

    Call ShowTr_Class

    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "编号：</td>"
    Response.Write "            <td><input name='ProductNum' type='text' value='" & PE_HTMLEncode(rsProduct("ProductNum")) & "' size='20' maxlength='20'></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>条形码：</td>"
    Response.Write "            <td><input name='BarCode' type='text' value='" & PE_HTMLEncode(rsProduct("BarCode")) & "' size='20' maxlength='20'></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "名称：</td>"
    Response.Write "            <td><div style=""clear: both;""><input name='ProductName' "
    If IsExists("MY_Namepy","PE_Product") Then Response.Write "onChange=""MY_Namepy.value=GetSpellingChar(ProductName.value,2)"""
    Response.Write"type='text' value='" & PE_HTMLEncode(rsProduct("ProductName")) & "' autocomplete='off' size='50' maxlength='255' onPropertyChange=""moreitem('ProductName',10," & ChannelID & ",'satitle4');"" onBlur=""setTimeout('Element.hide(satitle4)',500);""> <font color='#FF0000'>*</font>"
    Response.Write "                </div><div id=""satitle4"" style='display:none'></div></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>关键字：</td>"
    Response.Write "            <td><div style=""clear: both;""><input name='Keyword' type='text' id='Keyword' value='" & Mid(rsProduct("Keyword"), 2, Len(rsProduct("Keyword")) - 2) & "' autocomplete='off' size='50' maxlength='255' onPropertyChange=""moreitem('Keyword',10," & ChannelID & ",'skey');"" onBlur=""setTimeout('Element.hide(skey)',500);""> <font color='#FF0000'>*</font> " & GetKeywordList("Admin", ChannelID)
    Response.Write "              </div><div id=""skey"" style='display:none'></div>"
    Response.Write "              <font color='#0000FF'>用来查找相关" & ChannelShortName & "，可输入多个关键字，"
    Response.Write "              中间用<font color='#FF0000'>“|”</font>隔开。不能出现&quot;'&?;:()等字符。</font></td>"
    Response.Write "          </tr>"
    
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "单位：</td>"
    Response.Write "            <td><input name='Unit' type='text' value='" & PE_HTMLEncode(rsProduct("Unit")) & "' size='10' maxlength='20' style='text-align: center;'> &lt;&lt; <select name='UnitList' onchange='document.myform.Unit.value=this.value;'>" & GetAllUnit() & "</select></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>库存数量：</td>"
    Response.Write "            <td><input name='Stocks' type='text' value='" & rsProduct("Stocks") & "' size='10' maxlength='10' style='text-align: right;' ONKEYPRESS=""event.returnValue=IsDigit();""></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>库存报警下限：</td>"
    Response.Write "            <td><input name='AlarmNum' type='text' value='" & rsProduct("AlarmNum") & "' size='10' maxlength='10' style='text-align: right;' ONKEYPRESS=""event.returnValue=IsDigit();""></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "重量：</td>"
    Response.Write "            <td><input name='Weight' type='text' value='" & rsProduct("Weight") & "' size='10' maxlength='10' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit2();""> 千克（Kg）</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' valign='middle' class='tdbg5'>" & ChannelShortName & "简介：</td>"
    Response.Write "            <td>用于首页及栏目页显示，不要超过255个字符<br><textarea name='ProductIntro' cols='67' rows='3' id='ProductIntro'>" & rsProduct("ProductIntro") & "</textarea></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' valign='bottom' class='tdbg5'>详细介绍：<br>"
    If EnableSaveRemote = True And IsObjInstalled("Microsoft.XMLHTTP") = True Then
        Response.Write "<table><tr><td><input type='checkbox' name='SaveRemotePic' value='Yes' ></td><td>自动下载" & ChannelShortName & "介绍里的图片</td>"
        If PhotoObject = 1 Then
            Response.Write "<tr><td><input type='checkbox' name='AddWatermark' value='Yes' ></td><td>是否给" & ChannelShortName & "介绍里远程获得的图片加水印</td></tr>"
            Response.Write "<tr><td><input type='checkbox' name='AddThumb' value='Yes' ></td><td>是否给" & ChannelShortName & "介绍里远程获得的第一张图片加缩略图</td></tr>"
        End If
        Response.Write "</tr></table>"
    End If		
	Response.Write "<br><iframe id='frmPreview' width='120' height='150' frameborder='1' src='Admin_imgPreview.asp'></iframe></td>"
    Response.Write "            <td><textarea name='ProductExplain' cols='67' rows='8' id='ProductExplain' style='display:none'>" & Replace(Replace(Server.HTMLEncode(rsProduct("ProductExplain")), "[InstallDir_ChannelDir]", InstallDir & ChannelDir & "/"), "{$UploadDir}", UploadDir) & "</textarea>"
    Response.Write "                <iframe ID='editor' src='../editor.asp?ChannelID=" & ChannelID & "&ShowType=4&tContentid=ProductExplain' frameborder='1' scrolling='no' width='660' height='350' ></iframe>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "缩略图：</td>"
    Response.Write "            <td><input name='ProductThumb' type='text' id='ProductThumb' size='60' maxlength='200' value='" & rsProduct("ProductThumb") & "'>"
    Response.Write "              <input type='button' name='Button2' value='从已上传图片中选择' onclick='SelectProduct()'>"
    Response.Write "              <br>直接从上传图片中选择："
    Response.Write "              <select name='ProductThumbList' id='ProductThumbList' onChange=""ProductThumb.value=this.value;frmPreview.img.src=((this.value == '') ? '../images/nopic.gif' : '" & InstallDir & ChannelDir & "/" & UploadDir & "/'+this.value);"">"
    Response.Write "                <option value=''"
    If rsProduct("ProductThumb") = "" Then Response.Write "selected"
    Response.Write ">不指定缩略图</option>"
    If rsProduct("UploadFiles") <> "" Then
        Dim IsOtherUrl
        IsOtherUrl = True
        If InStr(rsProduct("UploadFiles"), "|") > 1 Then
            Dim arrUploadFiles, intTemp
            arrUploadFiles = Split(rsProduct("UploadFiles"), "|")
            For intTemp = 0 To UBound(arrUploadFiles)
                If rsProduct("ProductThumb") = arrUploadFiles(intTemp) Then
                    Response.Write "<option value='" & arrUploadFiles(intTemp) & "' selected>" & arrUploadFiles(intTemp) & "</option>"
                    IsOtherUrl = False
                Else
                    Response.Write "<option value='" & arrUploadFiles(intTemp) & "'>" & arrUploadFiles(intTemp) & "</option>"
                End If
            Next
        Else
            If rsProduct("UploadFiles") = rsProduct("ProductThumb") Then
                Response.Write "<option value='" & rsProduct("UploadFiles") & "' selected>" & rsProduct("UploadFiles") & "</option>"
                IsOtherUrl = False
            Else
                Response.Write "<option value='" & rsProduct("UploadFiles") & "'>" & rsProduct("UploadFiles") & "</option>"
            End If
        End If
        If IsOtherUrl = True And rsProduct("ProductThumb") <> "" Then
            Response.Write "<option value='" & rsProduct("ProductThumb") & "' selected>" & rsProduct("ProductThumb") & "</option>"
        End If
    End If
    Response.Write "              </select>"
    Response.Write "              <input name='UploadFiles' type='hidden' id='UploadFiles' value='" & rsProduct("UploadFiles") & "'> "
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "        </tbody>" & vbCrLf


    Call ShowTabs_Special(arrSpecialID, "")
    
    Response.Write "        <tbody id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "类型：</td>"
    Response.Write "            <td> <input name='ProductType' type='radio' value='1'"
    If rsProduct("ProductType") = 1 Then Response.Write " checked"
    Response.Write " onclick='document.myform.Price.value=document.myform.Price_Original.value;document.myform.Price.disabled=true;'> 正常销售&nbsp;&nbsp;&nbsp;&nbsp;正常销售，没有打折的" & ChannelShortName & "。<br>"
    Response.Write "<input name='ProductType' type='radio' value='2'"
    If rsProduct("ProductType") = 2 Then Response.Write " checked"
    Response.Write " onclick='document.myform.Price.disabled=false'><font color='green'> 涨价" & ChannelShortName & "&nbsp;&nbsp;&nbsp;&nbsp;如内存条等一些可能涨价的" & ChannelShortName & "</font><br>"
    Response.Write "<input name='ProductType' type='radio' value='5'"
    If rsProduct("ProductType") = 5 Then Response.Write " checked"
    Response.Write " onclick='getprice(document.myform.Price_Original.value);document.myform.Price.disabled=false;'><font color='red'> 降价" & ChannelShortName & "&nbsp;&nbsp;&nbsp;&nbsp;折扣率：<input name='Discount2' type='text' value='" & rsProduct("Discount") & "' size='4' maxlength='4'> 折&nbsp;&nbsp;如书籍等" & ChannelShortName & "9折促销</font><br>"
    Response.Write "<input name='ProductType' type='radio' value='3'"
    If rsProduct("ProductType") = 3 Then Response.Write " checked"
    Response.Write " onclick='getprice(document.myform.Price_Original.value);document.myform.Price.disabled=false;'><font color='#c7a728'> 特价处理&nbsp;&nbsp;&nbsp;&nbsp;折扣率：<input name='Discount' type='text' value='" & rsProduct("Discount") & "' size='4' maxlength='4'> 折"
    Response.Write "&nbsp;&nbsp;优惠期限：<input name='BeginDate' type='text' value='" & FormatDateTime(rsProduct("BeginDate"), 2) & "' size='10' maxlength='10'><a style='cursor:hand;' onClick='PopCalendar.show(document.myform.BeginDate, ""yyyy-m-d"", null, null, null, ""11"");'><img src='Images/Calendar.gif' border='0' Style='Padding-Top:10px' align='absmiddle'></a> 至 <input name='EndDate' type='text' value='" & FormatDateTime(rsProduct("EndDate"), 2) & "' size='10' maxlength='10'><a style='cursor:hand;' onClick='PopCalendar.show(document.myform.EndDate, ""yyyy-m-d"", null, null, null, ""11"");'><img src='Images/Calendar.gif' border='0' Style='Padding-Top:10px' align='absmiddle'></a>"
    Response.Write "&nbsp;&nbsp;限购数量：<input name='LimitNum' type='text' value='" & rsProduct("LimitNum") & "' size='4' maxlength='4' style='text-align: center;'>（0为不限制）</font><br>"
    Response.Write "<input name='ProductType' type='radio' value='4'"
    If rsProduct("ProductType") = 4 Then Response.Write " checked"
    Response.Write " onclick='document.myform.Price.disabled=false'><font color='blue'> 促销礼品&nbsp;&nbsp;&nbsp;&nbsp;购物满一定金额后换购或赠送的礼品。</font><br>"
    Response.Write "          </td></tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "价格：<br><br><a href='Admin_Help_Price.asp' target='_blank'><font color='red'>查看价格计算公式</font></a></td>"
    Response.Write "            <td><table width='100%' border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'><tr valign='top' class='tdbg'><td align='right' width='80'><font color='red'>原始零售价：</font></td><td width='130'><input name='Price_Original' type='text' value='" & rsProduct("Price_Original") & "' size='10' maxlength='10' onchange='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'))""><font color='red'>元 *</font></td><td>正常销售时的价格。以及降价及促销时的参考价。</td></tr>"
    Response.Write "<tr valign='top' class='tdbg'><td align='right' width='80'><font color='blue'>当前零售价：</font></td><td><input name='Price' type='text' value='" & rsProduct("Price") & "' size='10' maxlength='10' 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'))""><font color='blue'>元 </font><input type='button' name='calculate' value='计算' onclick='getprice(document.myform.Price_Original.value);' ></td><td>系统会自动根据" & ChannelShortName & "类型、原始零售价及折扣率计算当前零售价。也可以手动输入当前零售价，若降价" & ChannelShortName & "的原始价格×折扣率≠输入的当前零售价，以输入的为准。</td></tr>"
    Response.Write "<tr valign='top' class='tdbg'><td align='right' width='80'>市场参考价：</td><td><input name='Price_Market' type='text' value='" & rsProduct("Price_Market") & "' size='10' maxlength='10' 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'))"">元</td><td>市场参考零售价，一般可以设高一些。如果不填或为0，前台不显示。</td></tr>"
    Response.Write "<tr valign='top' class='tdbg'><td align='right' width='80'>会员零售价：</td><td><input name='Price_Member' type='text' value='" & rsProduct("Price_Member") & "' size='10' maxlength='10' 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'))"">元</td><td>若大于0，则会员组中设定的折扣比率无效，所有会员都以此为准，不区分组别，并且会员的折上折优惠失效。若想使用折扣比率，请保持为空或输入0。</td></tr>"
    Response.Write "<tr valign='top' class='tdbg'><td align='right' width='80'>代理零售价：</td><td><input name='Price_Agent' type='text' value='" & rsProduct("Price_Agent") & "' size='10' maxlength='10' 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'))"">元</td><td>若大于0，则代理商组中设定的折扣比率无效，所有代理商都以此为准，不区分组别。若想使用折扣比率，请保持为空或输入0。</td></tr>"
    
    Response.Write "<tr valign='top' class='tdbg'><td colspan='6'><input name='EnableWholesale' type='checkbox' value='Yes' onclick=""if (this.checked==true) {Wholesale.style.display='';} else {Wholesale.style.display='none';}"""
    If rsProduct("EnableWholesale") = True Then Response.Write " checked"
    Response.Write "> 允许批发"
    Response.Write "<table width='100%' border='0' cellpadding='2' cellspacing='1' id='Wholesale' style='display:"
    If rsProduct("EnableWholesale") <> True Then Response.Write "none"
    Response.Write "'>"
    Response.Write "<tr><td align='left'>① 一次性购买此" & ChannelShortName & "数量满 <input name='Number_Wholesale1' type='text' value='" & rsProduct("Number_Wholesale1") & "' size='6' maxlength='6' style='text-align: right;'> 时，批发价为 <input name='Price_Wholesale1' type='text' value='" & Price2Str(rsProduct("Price_Wholesale1")) & "' size='8' maxlength='10' 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'))""> 元</td></tr>"
    Response.Write "<tr><td align='left'>② 一次性购买此" & ChannelShortName & "数量满 <input name='Number_Wholesale2' type='text' value='" & rsProduct("Number_Wholesale2") & "' size='6' maxlength='6' style='text-align: right;'> 时，批发价为 <input name='Price_Wholesale2' type='text' value='" & Price2Str(rsProduct("Price_Wholesale2")) & "' size='8' maxlength='10' 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'))""> 元</td></tr>"
    Response.Write "<tr><td align='left'>③ 一次性购买此" & ChannelShortName & "数量满 <input name='Number_Wholesale3' type='text' value='" & rsProduct("Number_Wholesale3") & "' size='6' maxlength='6' style='text-align: right;'> 时，批发价为 <input name='Price_Wholesale3' type='text' value='" & Price2Str(rsProduct("Price_Wholesale3")) & "' size='8' maxlength='10' 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'))""> 元</td></tr>"
    Response.Write "</table></td></tr>"
    Response.Write "          </table></td></tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>允许单独销售：</td>"
    Response.Write "            <td><input name='EnableSingleSell' type='radio' value='Yes' " & RadioValue(rsProduct("EnableSingleSell"), True) & " onclick=""trDependentProducts.style.display='none'""> 是&nbsp;&nbsp;&nbsp;&nbsp;<input name='EnableSingleSell' type='radio' value='No' " & RadioValue(rsProduct("EnableSingleSell"), False) & " onclick=""trDependentProducts.style.display=''""> 否&nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>如果不允许单独销售，请指定从属的商品。</font></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg' id='trDependentProducts'"
    If rsProduct("EnableSingleSell") = True Then
        Response.Write " style='display:none'"
    End If
    Response.Write ">"
    Response.Write "            <td width='120' align='right' class='tdbg5'>从属商品：</td>"
    Response.Write "            <td><table width='100%'  border='0' cellspacing='5' cellpadding='0'><tr>" & vbCrLf
    Response.Write "                  <td width='200'><select name='DependentProductsList' size='2' multiple id='DependentProductsList' style='height:80;width:200 '>"
    
    If rsProduct("DependentProducts") & "" <> "" Then
        Dim rsPresent
        Set rsPresent = Conn.Execute("select ProductID,ProductName from PE_Product where ProductID in (" & rsProduct("DependentProducts") & ")")
        Do While Not rsPresent.EOF
            Response.Write "<option value='" & rsPresent(0) & "'>" & rsPresent(1) & "</option>"
            rsPresent.MoveNext
        Loop
        Set rsPresent = Nothing
    End If
    Response.Write "                  </select></td>" & vbCrLf
    Response.Write "                  <td><input type='button' name='Submit' value='添加商品' onClick='AddDependentProduct()'><br><input name='DependentProducts' type='hidden' id='DependentProducts' value='" & rsProduct("DependentProducts") & "'>" & vbCrLf
    Response.Write "                  <br><input type='button' name='Submit' value=' 删  除 ' onClick='DelDependentProduct()'></td></tr></table>如果不指定从属商品，则可以与任何非促销礼品捆绑销售。" & vbCrLf
    Response.Write "            </td>" & vbCrLf
    Response.Write "          </tr>"
    Response.Write "        </tbody>" & vbCrLf

    
    Response.Write "        <tbody id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>促销设置：</td>"
    Response.Write "            <td> <input name='SalePromotionType' type='radio' value='0'"
    If rsProduct("SalePromotionType") = 0 Then Response.Write " checked"
    Response.Write " onclick='' > 不促销<br>"
    Response.Write "<input name='SalePromotionType' type='radio' value='1'"
    If rsProduct("SalePromotionType") = 1 Then Response.Write " checked"
    Response.Write " onclick=''><font color='red'> 买 <input name='MinNumber1' type='text' value='" & rsProduct("MinNumber") & "' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 送 <input name='PresentNumber1' type='text' value='"
    If rsProduct("SalePromotionType") = 1 Then
        Response.Write rsProduct("PresentNumber")
    Else
        Response.Write "1"
    End If
    Response.Write "' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 同样的" & ChannelShortName & "</font><br>"
    Response.Write "<input name='SalePromotionType' type='radio' value='2'"
    If rsProduct("SalePromotionType") = 2 Then Response.Write " checked"
    Response.Write " onclick=''><font color='blue'> 买 <input name='MinNumber2' type='text' value='" & rsProduct("MinNumber") & "' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 送 <input name='PresentNumber2' type='text' size='4' value='"
    If rsProduct("SalePromotionType") = 2 Then
        Response.Write rsProduct("PresentNumber")
    Else
        Response.Write "1"
    End If
    Response.Write "' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 其他" & ChannelShortName & "&nbsp;&nbsp;&nbsp;赠品编号：<input name='PresentID' type='text' value='"
    If rsProduct("SalePromotionType") = 2 Then
        Response.Write rsProduct("PresentID")
    End If
    Response.Write "' size='20' maxlength='30'><input type='button' name='button21' value='...' onclick='SelectPresent(1)'></font><br>"

    Response.Write "<input name='SalePromotionType' type='radio' value='3'"
    If rsProduct("SalePromotionType") = 3 Then Response.Write " checked"
    Response.Write " onclick=''><font color='red'> 买&nbsp;&nbsp; 就&nbsp;&nbsp; 送 <input name='PresentNumber3' type='text' value='"
    If rsProduct("SalePromotionType") = 3 Then
        Response.Write rsProduct("PresentNumber")
    Else
        Response.Write "1"
    End If
    Response.Write "' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 同样的" & ChannelShortName & "</font><br>"
    Response.Write "<input name='SalePromotionType' type='radio' value='4'"
    If rsProduct("SalePromotionType") = 4 Then Response.Write " checked"
    Response.Write " onclick=''><font color='blue'> 买&nbsp;&nbsp; 就&nbsp;&nbsp; 送 <input name='PresentNumber4' type='text' size='4' value='"
    If rsProduct("SalePromotionType") = 4 Then
        Response.Write rsProduct("PresentNumber")
    Else
        Response.Write "1"
    End If
    Response.Write "' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 其他" & ChannelShortName & "&nbsp;&nbsp;&nbsp;赠品编号：<input name='PresentID2' type='text' value='"
        If rsProduct("SalePromotionType") = 4 Then
        Response.Write rsProduct("PresentID")
    End If
    Response.Write "' size='20' maxlength='30'><input type='button' name='button41' value='...' onclick='SelectPresent(2)'></font>"
    Response.Write "<br>买满××元返还××元现金（券），买满××元在促销" & ChannelShortName & "中任选等更多促销方案请到“促销方案管理”中设置。"
    Response.Write "          </td></tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>赠送" & PointName & "：</td>"
    Response.Write "            <td>购买一件此" & ChannelShortName & "可以得到<input name='PresentPoint' type='text' value='" & rsProduct("PresentPoint") & "' size='6' maxlength='9' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();"">" & PointName & "<br>买满××元可以得××" & PointName & "等更多促销方案，请到“促销方案管理”中设置。</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>购物积分：</td>"
    Response.Write "            <td>购买一件此" & ChannelShortName & "可以得到<input name='PresentExp' type='text' value='" & rsProduct("PresentExp") & "' size='6' maxlength='9' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();"">积分<br>买满××元可以得××积分等更多促销方案，请到“促销方案管理”中设置。</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>赠送现金券：</td>"
    Response.Write "            <td>购买一件此" & ChannelShortName & "可以得到<input name='PresentMoney' type='text' value='" & rsProduct("PresentMoney") & "' size='6' maxlength='9' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();"">元现金券<br>买满××元可以得××元现金券等更多促销方案，请到“促销方案管理”中设置。</td>"
    Response.Write "          </tr>"
    Response.Write "        </tbody>" & vbCrLf

        
    Response.Write "        <tbody id='Tabs' style='display:none'>" & vbCrLf
    If ProductKind = 1 Then
        Response.Write "          <tr class='tdbg'>"
        Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "型号：</td>"
        Response.Write "            <td><input name='ProductModel' type='text' value='" & PE_HTMLEncode(rsProduct("ProductModel")) & "' size='50' maxlength='50'> &lt;&lt; <select name='ModelList' onchange='document.myform.ProductModel.value=this.value;'>" & GetAllModel() & "</select></td>"
        Response.Write "          </tr>"
        Response.Write "          <tr class='tdbg'>"
        Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "规格：</td>"
        Response.Write "            <td><input name='ProductStandard' type='text' value='" & PE_HTMLEncode(rsProduct("ProductStandard")) & "' size='50' maxlength='50'> &lt;&lt; <select name='StandardList' onchange='document.myform.ProductStandard.value=this.value;'>" & GetAllStandard() & "</select></td>"
        Response.Write "          </tr>"
    End If
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>生 产 商：</td>"
    Response.Write "            <td><input name='ProducerName' type='text' value='" & PE_HTMLEncode(rsProduct("ProducerName")) & "' size='50' maxlength='50'> <font color='blue'><=【<font color='green' onclick=""window.open('Admin_SourceList.asp?TypeSelect=ProducerList&ChannelID=" & ChannelID & "', 'ProducerList', 'width=600,height=450,resizable=0,scrollbars=yes');"" style=""cursor:hand;"">列表</font>】</font></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>品牌/商标：</td>"
    Response.Write "            <td><input name='TrademarkName' type='text' value='" & PE_HTMLEncode(rsProduct("TrademarkName")) & "' size='50' maxlength='50'> <font color='blue'><=【<font color='green' onclick=""window.open('Admin_SourceList.asp?TypeSelect=TrademarkList&ChannelID=" & ChannelID & "', 'TrademarkList', 'width=600,height=450,resizable=0,scrollbars=yes');"" style=""cursor:hand;"">列表</font>】</font></td>"
    Response.Write "          </tr>"
    
    '自定义字段
    Dim rsField
    Set rsField = Conn.Execute("select * from PE_Field where ChannelID=-5 or ChannelID=" & ChannelID & "")
    Do While Not rsField.EOF
        Call WriteFieldHTML(rsField("FieldName"), rsField("Title"), rsField("Tips"), rsField("FieldType"), rsProduct(Trim(rsField("FieldName"))), rsField("Options"), rsField("EnableNull"))
        rsField.MoveNext
    Loop
    Set rsField = Nothing

    If ProductKind = 2 Then
        Response.Write "          <tr class='tdbg'>"
        Response.Write "            <td width='120' align='right' class='tdbg5'>下载地址：</td>"
        Response.Write "            <td><input name='DownloadUrl' type='text' value='" & PE_HTMLEncode(rsProduct("DownloadUrl")) & "' size='60' maxlength='200'> &nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>用于软件类产品</td>"
        Response.Write "          </tr>"
        Response.Write "          <tr class='tdbg'>"
        Response.Write "            <td width='120' align='right' class='tdbg5'>下载说明：</td>"
        Response.Write "            <td><input name='Remark' type='text' value='" & PE_HTMLEncode(rsProduct("Remark")) & "' size='60' maxlength='250'> &nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>用于软件类产品</td>"
        Response.Write "          </tr>"
    ElseIf ProductKind = 3 Then
        Response.Write "          <tr class='tdbg'>"
        Response.Write "            <td width='120' align='right' class='tdbg5'>点卡类商品说明：</td>"
        Response.Write "            <td><font color='blue'>请在“充值卡管理”处添加相应的充值卡。可以批量自动生成充值卡，也可以逐个添加其他公司的卡号及密码（用于代销）。</font></td>"
        Response.Write "          </tr>"
    End If
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>服务期限：</td>"
    Response.Write "            <td><input name='ServiceTerm' type='text' value='" & rsProduct("ServiceTerm") & "' size='8' maxlength='8'>年 &nbsp;&nbsp;&nbsp;&nbsp;<font color='blue'>用于软件类产品</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>" & ChannelShortName & "属性：</td>"
    Response.Write "            <td> <input name='OnTop' type='checkbox' id='OnTop' value='Yes'"
    If rsProduct("OnTop") = True Then
        Response.Write " checked"
    End If
    Response.Write ">"
    Response.Write "              固顶" & ChannelShortName & "&nbsp;&nbsp;&nbsp;&nbsp; <input name='IsHot' type='checkbox' id='IsHot' value='Yes'"
    If rsProduct("IsHot") = True Then
        Response.Write " checked"
    End If
    Response.Write ">"
    Response.Write "              热门" & ChannelShortName & "&nbsp;&nbsp;&nbsp; <input name='IsElite' type=checkbox id='IsElite' value='Yes'"
    If rsProduct("IsElite") = True Then
        Response.Write " checked"
    End If
    Response.Write ">"
    Response.Write "              推荐" & ChannelShortName & "&nbsp;&nbsp;&nbsp;" & ChannelShortName & "推荐等级："
    Response.Write "              <select name='Stars' id='Stars'>" & GetStars(rsProduct("Stars")) & "</select><font color='#FF0000'>*</font></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>点击数：</td>"
    Response.Write "            <td>"
    Response.Write "              <input name='Hits' type='text' id='Hits' value='" & rsProduct("Hits") & "' size='10' maxlength='10'>&nbsp;&nbsp;<font color='#0000FF'>这功能是提供给管理员作弊用的。不过尽量不要用呀！^_^</font>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>上市时间：</td>"
    Response.Write "            <td><input name='UpdateTime' type='text' id='UpdateTime' value='" & rsProduct("UpdateTime") & "' maxlength='50'>"
    Response.Write "              时间格式为“年-月-日 时:分:秒”，如：<font color='#0000FF'>2003-5-12 12:32:47</font></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'> "
    Response.Write "            <td width='120' align='right' class='tdbg5'>配色风格：</td>"
    Response.Write "            <td><select Name='SkinID'>" & GetSkin_Option(rsProduct("SkinID")) & "</select>&nbsp;相关模板中包含CSS、颜色、图片等信息</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>版面设计模板：</td>"
    Response.Write "            <td><select Name='TemplateID'>" & GetTemplate_Option(ChannelID, 3, rsProduct("TemplateID")) & "</select>&nbsp;相关模板中包含了版面设计的版式等信息</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>销售操作：</td>"
    Response.Write "            <td><input name='EnableSale' type='checkbox' id='EnableSale' value='Yes'"
    If rsProduct("EnableSale") = True Then
        Response.Write " checked"
    End If
    Response.Write "> <font color='#0000FF'>立即销售</font>"
    If UseCreateHTML > 0 And AutoCreateType > 0 Then
        Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name='CreateImmediate' type='checkbox' value='Yes' checked>立即生成"
    End If
    Response.Write "        </td></tr>"
    Response.Write "        </tbody>" & vbCrLf

    Call ShowTabs_Vote_Modify(rsProduct)

    Response.Write "        </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "  </table>"

    Call ShowTabs_Bottom

    Response.Write "  <p align='center'>"
    Response.Write "   <input name='Action' type='hidden' id='Action' value='SaveModify'>"
    Response.Write "   <input name='ProductKind' type='hidden' id='ProductKind' value='" & ProductKind & "'>"
    Response.Write "   <input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "   <input name='ProductID' type='hidden' id='ProductID' value='" & rsProduct("ProductID") & "'>"
    Response.Write "   <input name='Save' type='submit' onClick=""document.myform.Action.value='SaveModify';"" value='保存修改结果' style='cursor:hand;'>&nbsp;"
    Response.Write "   <input name='Save' type='submit' value='添加为新" & ChannelShortName & "' onClick=""document.myform.Action.value='SaveAdd';document.myform.target='_self';"" style='cursor:hand;'>&nbsp;"
    Response.Write "   <input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick=""window.location.href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Manage';"" style='cursor:hand;'>"
    Response.Write "  </p><br>"
    Response.Write "</form>"
    Response.Write "<script language='javascript'>setTimeout('setpic()',1000);" & vbCrLf
    Response.Write "function setpic(){" & vbCrLf
    If Trim(rsProduct("ProductThumb")) = "" Then
    
    ElseIf Left(rsProduct("ProductThumb"), 1) <> "/" And InStr(rsProduct("ProductThumb"), "://") <= 0 Then
        Response.Write "frmPreview.img.src='" & InstallDir & ChannelDir & "/" & UploadDir & "/" & rsProduct("ProductThumb") & "';"
    Else
        Response.Write "frmPreview.img.src='" & rsProduct("ProductThumb") & "';"
    End If
    Response.Write "}" & vbCrLf
    Response.Write "</script>"
    rsProduct.Close
    Set rsProduct = Nothing
End Sub


Sub SaveProduct()
    Dim rsProduct, sql, trs, i
    Dim ProductID, ClassID, SpecialID
    Dim ProductNum, AutoGetNum, BarCode
    Dim ProductName, ProductModel, ProductStandard, Keyword
    Dim ProducerName, TrademarkName
    Dim ProductIntro, ProductExplain, ProductThumb, arrUploadFiles
    Dim ProductType, Discount, Discount2, BeginDate, EndDate, LimitNum
    Dim Price, Price_Original, Price_Market, Price_Member, Price_Agent, Unit
    Dim EnableWholesale, Price_Wholesale1, Number_Wholesale1, Price_Wholesale2, Number_Wholesale2, Price_Wholesale3, Number_Wholesale3
    Dim SalePromotionType, MinNumber, PresentNumber, PresentID, PresentPoint, PresentExp, PresentMoney, Weight
    Dim EnableSale, Stocks, AlarmNum, UpdateTime
    Dim arrSpecialID

    ProductID = PE_CLng(Trim(Request.Form("ProductID")))
    ClassID = Trim(Request.Form("ClassID"))
    SpecialID = Trim(Request.Form("SpecialID"))
    
    ProductNum = ReplaceBadChar(Trim(Request.Form("ProductNum")))
    AutoGetNum = Trim(Request.Form("AutoGetNum"))
    BarCode = ReplaceBadChar(Trim(Request.Form("BarCode")))
    
    
    ProductName = Trim(Request.Form("ProductName"))
    ProductModel = Trim(Request.Form("ProductModel"))
    ProductStandard = Trim(Request.Form("ProductStandard"))
    ProducerName = Trim(Request.Form("ProducerName"))
    TrademarkName = Trim(Request.Form("TrademarkName"))
    
    Keyword = ReplaceBadChar(Trim(Request.Form("Keyword")))
    
    
    ProductIntro = Trim(Request.Form("ProductIntro"))
    If Trim(Request.Form("SaveRemotePic")) = "Yes" And EnableSaveRemote = True Then
        ProductExplain = ReplaceRemoteUrl(ReplaceBadUrl(Trim(Request.Form("ProductExplain"))))
        ProductThumb = DefaultPicUrl		
    Else
        ProductExplain = ReplaceBadUrl(Trim(Request.Form("ProductExplain")))
        ProductThumb = Trim(Request.Form("ProductThumb"))
        UploadFiles = Trim(Request.Form("UploadFiles"))		
    End If
    ProductType = PE_CLng(Trim(Request("ProductType")))
    Discount = Trim(Request.Form("Discount"))
    Discount2 = Trim(Request.Form("Discount2"))
    BeginDate = Trim(Request.Form("BeginDate"))
    EndDate = Trim(Request.Form("EndDate"))
    LimitNum = PE_CLng(Trim(Request.Form("LimitNum")))
    
    Price = PE_CDbl(Trim(Request.Form("Price")))
    Price_Original = PE_CDbl(Trim(Request.Form("Price_Original")))
    Price_Market = PE_CDbl(Trim(Request.Form("Price_Market")))
    Price_Member = PE_CDbl(Trim(Request.Form("Price_Member")))
    Price_Agent = PE_CDbl(Trim(Request.Form("Price_Agent")))
    Unit = Trim(Request.Form("Unit"))
    Stocks = PE_CDbl(Trim(Request.Form("Stocks")))
    AlarmNum = PE_CDbl(Trim(Request.Form("AlarmNum")))
    Weight = PE_CDbl(Trim(Request("Weight")))
    
    EnableWholesale = Trim(Request.Form("EnableWholesale"))
    Price_Wholesale1 = PE_CDbl(Trim(Request.Form("Price_Wholesale1")))
    Number_Wholesale1 = PE_CDbl(Trim(Request.Form("Number_Wholesale1")))
    Price_Wholesale2 = PE_CDbl(Trim(Request.Form("Price_Wholesale2")))
    Number_Wholesale2 = PE_CDbl(Trim(Request.Form("Number_Wholesale2")))
    Price_Wholesale3 = PE_CDbl(Trim(Request.Form("Price_Wholesale3")))
    Number_Wholesale3 = PE_CDbl(Trim(Request.Form("Number_Wholesale3")))
    
    SalePromotionType = PE_CLng(Trim(Request.Form("SalePromotionType")))
    If SalePromotionType <= 2 Then
        MinNumber = PE_CLng(Trim(Request("MinNumber" & SalePromotionType)))
        PresentID = Trim(Request.Form("PresentID"))
    Else
        PresentID = Trim(Request.Form("PresentID2"))
    End If
    PresentNumber = PE_CLng(Trim(Request("PresentNumber" & SalePromotionType)))
    PresentPoint = PE_CLng(Trim(Request.Form("PresentPoint")))
    PresentExp = PE_CLng(Trim(Request.Form("PresentExp")))
    PresentMoney = PE_CLng(Trim(Request.Form("PresentMoney")))
        
    EnableSale = Trim(Request.Form("EnableSale"))
    UpdateTime = PE_CDate(Trim(Request.Form("UpdateTime")))
    
    Call CheckClassPurview(Action, ClassID)
    If FoundErr = True Then Exit Sub

    If Action = "SaveAdd" Then
        If AutoGetNum = "Yes" Then
            ProductNum = GetNumString()
        Else
            If ProductNum = "" Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>请输入" & ChannelShortName & "编号！"
            Else
                Set trs = Conn.Execute("select top 1 ProductID from PE_Product where ProductNum='" & ProductNum & "'")
                If Not (trs.BOF And trs.EOF) Then
                    FoundErr = True
                    ErrMsg = ErrMsg & "<li>输入的" & ChannelShortName & "编号已经存在！</li>"
                End If
                Set trs = Nothing
            End If
        End If
        If BarCode <> "" Then
            Set trs = Conn.Execute("select top 1 ProductID from PE_Product where BarCode='" & BarCode & "'")
            If Not (trs.BOF And trs.EOF) Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>输入的" & ChannelShortName & "条形码已经存在！</li>"
            End If
            Set trs = Nothing
        End If
    Else
        If ProductNum = "" Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请输入" & ChannelShortName & "编号！"
        Else
            Set trs = Conn.Execute("select top 1 ProductID from PE_Product where ProductID<>" & ProductID & " and ProductNum='" & ProductNum & "'")
            If Not (trs.BOF And trs.EOF) Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>输入的" & ChannelShortName & "编号已经存在！</li>"
            End If
            Set trs = Nothing
        End If
        If BarCode <> "" Then
            Set trs = Conn.Execute("select top 1 ProductID from PE_Product where ProductID<>" & ProductID & " and  BarCode='" & BarCode & "'")
            If Not (trs.BOF And trs.EOF) Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>输入的" & ChannelShortName & "条形码已经存在！</li>"
            End If
            Set trs = Nothing
        End If

    End If
    If ProductName = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>" & ChannelShortName & "名称不能为空！</li>"
    End If
    If Keyword = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>关键字不能为空！</li>"
    Else
        Call SaveKeyword(Keyword)
    End If
    If ProductIntro <> "" Then
        If Len(ProductIntro) > 255 Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>" & ChannelShortName & "简介不能超过255字符！</li>"
        End If
    End If
    If ProductExplain = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>" & ChannelShortName & "详细说明不能为空！</li>"
    End If
    
    If Price_Original = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请输入原始价格！</li>"
    Else
        Price_Original = PE_CDbl(Price_Original)
    End If
    If Stocks < 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请输入库存！</li>"
    End If
    If AlarmNum < 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请输入库存报警下限！</li>"
    End If
    
    If ProductType = 1 Then
        Price = Price_Original
        Discount = 10
        BeginDate = Date
        EndDate = Date
    Else
        If Price = "" Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>" & ChannelShortName & "零售价不能为空！</li>"
        Else
            Price = PE_CDbl(Price)
        End If
        Select Case ProductType
        Case 2
            If Price < Price_Original Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>涨价" & ChannelShortName & "的当前零售价不能低于原始零售价！</li>"
            End If
            Discount = 10
            BeginDate = Date
            EndDate = Date
        Case 3
            If Price > Price_Original Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>特价处理" & ChannelShortName & "的当前零售价不能高于原始零售价</li>"
            End If
            
            If Discount = "" Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>请指定特价处理的折扣率！</li>"
            Else
                Discount = Abs(PE_CDbl(Discount))
                If Discount <= 0 Or Discount >= 10 Then
                    FoundErr = True
                    ErrMsg = ErrMsg & "<li>请指定正确的特价处理折扣率</li>"
                End If
            End If
            If IsDate(BeginDate) = False Then
                BeginDate = Date
            Else
                BeginDate = CDate(BeginDate)
            End If
            If IsDate(EndDate) = False Then
                EndDate = Date
            Else
                EndDate = CDate(EndDate)
            End If
        Case 4
            If Price > Price_Original Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>促销礼品的当前零售价不能高于原始零售价</li>"
            End If
            Discount = 8
            BeginDate = Date
            EndDate = Date
        Case 5
            If Price > Price_Original Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>降价" & ChannelShortName & "的当前零售价不能高于原始零售价</li>"
            End If
            If Discount2 = "" Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>请指定降价" & ChannelShortName & "的折扣率！</li>"
            Else
                Discount2 = Abs(PE_CDbl(Discount2))
                If Discount2 <= 0 Or Discount2 >= 10 Then
                    FoundErr = True
                    ErrMsg = ErrMsg & "<li>请指定正确的降价" & ChannelShortName & "折扣率</li>"
                End If
            End If
            Discount = Discount2
        End Select
        
    End If
    If Unit = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>" & ChannelShortName & "单位不能为空！</li>"
    Else
        Session("Unit") = Unit
    End If
    
    If EnableWholesale = "Yes" Then
        If Price_Wholesale1 <= 0 Or Number_Wholesale1 <= 0 Or Price_Wholesale2 <= 0 Or Number_Wholesale2 <= 0 Or Price_Wholesale3 <= 0 Or Number_Wholesale3 <= 0 Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请输入批发价和起批数量</li>"
        End If
        If Number_Wholesale2 < Number_Wholesale1 Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>第二级起批数量不能小于第一级起批数量</li>"
        End If
        If Price_Wholesale2 > Price_Wholesale1 Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>第二级批发价不能大于第一级批发价</li>"
        End If
        If Number_Wholesale3 < Number_Wholesale2 Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>第三级起批数量不能小于第二级起批数量</li>"
        End If
        If Price_Wholesale3 > Price_Wholesale2 Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>第三级批发价不能大于第二级批发价</li>"
        End If
    End If
    
    
    If SalePromotionType > 0 Then
        If MinNumber < 1 Then MinNumber = 1
        If PresentNumber < 1 Then PresentNumber = 1
        If SalePromotionType = 2 Or SalePromotionType = 4 Then
            If PresentID = "" Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>请指定赠品ID</li>"
            End If
        End If
    Else
        MinNumber = 1
        PresentNumber = 1
        PresentID = ""
    End If
    
    Dim rsField
    Set rsField = Conn.Execute("select * from PE_Field where ChannelID=-5 or ChannelID=" & ChannelID & "")
    Do While Not rsField.EOF
        If rsField("EnableNull") = False Then
            If Trim(Request(rsField("FieldName"))) = "" Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>请输入" & rsField("Title") & "！</li>"
            End If
        End If
        rsField.MoveNext
    Loop
    
    
    If FoundErr = True Then
        Set rsField = Nothing
        Exit Sub
    End If
    
    If ProducerName <> "" Then
        SaveProducer (ProducerName)
    End If
    If TrademarkName <> "" Then
        SaveTrademark (TrademarkName)
    End If
    
    Keyword = "|" & ReplaceBadChar(Keyword) & "|"

    If EnableSale = "Yes" Then
        EnableSale = True
    Else
        EnableSale = False
    End If

    Call SaveVote

    If SpecialID = "" Then
        arrSpecialID = Split("0", ",")
    Else
        arrSpecialID = Split(SpecialID, ",")
    End If
    
    '将绝对地址转化为相对地址
    Dim strSiteUrl
    strSiteUrl = Request.ServerVariables("HTTP_REFERER")
    strSiteUrl = LCase(Left(strSiteUrl, InStrRev(strSiteUrl, "/") - 1))
    strSiteUrl = Left(strSiteUrl, InStrRev(strSiteUrl, "/")) & ChannelDir & "/"
    ProductExplain = Replace(ProductExplain, strSiteUrl, "[InstallDir_ChannelDir]")
    ProductExplain = Replace(ProductExplain, UploadDir, "{$UploadDir}")

    strSiteUrl = InstallDir & ChannelDir & "/"
    ProductExplain = Replace(ProductExplain, strSiteUrl, "[InstallDir_ChannelDir]")

    Set rsProduct = Server.CreateObject("adodb.recordset")
    If Action = "SaveAdd" Then
        ProductID = GetNewID("PE_Product", "ProductID")
        
        For i = 0 To UBound(arrSpecialID)
            Conn.Execute ("insert into PE_InfoS (ModuleType,ItemID,SpecialID) values (" & ModuleType & "," & ProductID & "," & PE_CLng(arrSpecialID(i)) & ")")
        Next
        
        sql = "select top 1 * from PE_Product"
        rsProduct.Open sql, Conn, 1, 3
        rsProduct.AddNew
        rsProduct("ProductKind") = ProductKind
        rsProduct("ProductID") = ProductID
        rsProduct("ChannelID") = ChannelID
        rsProduct("BuyTimes") = 0
        rsProduct("OrderNum") = 0
        rsProduct("Inputer") = username

    ElseIf Action = "SaveModify" Then
        If ProductID <= 0 Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>不能确定ProductID的值</li>"
        Else
            sql = "select * from PE_Product where ProductID=" & ProductID
            rsProduct.Open sql, Conn, 1, 3
            If rsProduct.BOF And rsProduct.EOF Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>找不到此" & ChannelShortName & "，可能已经被其他人删除。</li>"
                rsProduct.Close
                Set rsProduct = Nothing
                Exit Sub
            End If

            If UseCreateHTML > 0 And ObjInstalled_FSO = True Then
                Dim tClass, ProductPath
                Set tClass = Conn.Execute("select ParentDir,ClassDir from PE_Class where ClassID=" & rsProduct("ClassID") & "")
                If tClass.BOF And tClass.EOF Then
                    ParentDir = "/"
                    ClassDir = ""
                Else
                    ParentDir = tClass("ParentDir")
                    ClassDir = tClass("ClassDir")
                End If
                ProductPath = HtmlDir & GetItemPath(StructureType, ParentDir, ClassDir, rsProduct("UpdateTime")) & GetItemFileName(FileNameType, ChannelDir, rsProduct("UpdateTime"), rsProduct("ProductID"))
            End If
            
            Dim rsInfo, sqlInfo, j
            i = 0
            sqlInfo = "select * from PE_InfoS where ModuleType=" & ModuleType & " and ItemID=" & ProductID & " order by InfoID"
            Set rsInfo = Server.CreateObject("adodb.recordset")
            rsInfo.Open sqlInfo, Conn, 1, 3
            Do While Not rsInfo.EOF
                If i > UBound(arrSpecialID) Then
                    rsInfo.Delete
                Else
                    rsInfo("SpecialID") = arrSpecialID(i)
                End If
                rsInfo.Update
                rsInfo.MoveNext
                i = i + 1
            Loop
            rsInfo.Close
            Set rsInfo = Nothing
            If (i - 1) < UBound(arrSpecialID) Then
                For j = i To UBound(arrSpecialID)
                    If PE_CLng(arrSpecialID(j)) <> 0 Then
                        Conn.Execute ("insert into PE_InfoS (ModuleType,ItemID,SpecialID) values (" & ModuleType & "," & ProductID & "," & PE_CLng(arrSpecialID(j)) & ")")
                    End If
                Next
            End If
        End If
    End If
    rsProduct("ClassID") = ClassID
    rsProduct("ProductNum") = ProductNum
    rsProduct("BarCode") = BarCode
    rsProduct("ProductName") = ProductName
    rsProduct("ProductModel") = ProductModel
    rsProduct("ProductStandard") = ProductStandard
    rsProduct("Keyword") = Keyword
    rsProduct("ProducerName") = ProducerName
    rsProduct("TrademarkName") = TrademarkName
    rsProduct("ProductIntro") = ProductIntro
    rsProduct("ProductExplain") = ProductExplain
    rsProduct("ProductThumb") = ProductThumb
    rsProduct("UploadFiles") = UploadFiles
    rsProduct("ProductType") = ProductType
    rsProduct("Discount") = Discount
    rsProduct("BeginDate") = BeginDate
    rsProduct("EndDate") = EndDate
    rsProduct("LimitNum") = LimitNum
    rsProduct("Price_Original") = Price_Original
    rsProduct("Price") = Price
    rsProduct("Price_Market") = Price_Market
    rsProduct("Price_Member") = Price_Member
    rsProduct("Price_Agent") = Price_Agent
    If EnableWholesale = "Yes" Then
        rsProduct("EnableWholesale") = True
        rsProduct("Price_Wholesale1") = Price_Wholesale1
        rsProduct("Number_Wholesale1") = Number_Wholesale1
        rsProduct("Price_Wholesale2") = Price_Wholesale2
        rsProduct("Number_Wholesale2") = Number_Wholesale2
        rsProduct("Price_Wholesale3") = Price_Wholesale3
        rsProduct("Number_Wholesale3") = Number_Wholesale3
    Else
        rsProduct("EnableWholesale") = False
        rsProduct("Price_Wholesale1") = 0
        rsProduct("Number_Wholesale1") = 0
        rsProduct("Price_Wholesale2") = 0
        rsProduct("Number_Wholesale2") = 0
        rsProduct("Price_Wholesale3") = 0
        rsProduct("Number_Wholesale3") = 0
    End If
    
    rsProduct("Unit") = Unit
    rsProduct("Stocks") = Stocks
    rsProduct("AlarmNum") = AlarmNum
    rsProduct("Weight") = Weight
    rsProduct("SalePromotionType") = SalePromotionType
    rsProduct("MinNumber") = MinNumber
    rsProduct("PresentNumber") = PresentNumber
    rsProduct("PresentID") = PresentID
    rsProduct("PresentPoint") = PresentPoint
    rsProduct("PresentExp") = PresentExp
    rsProduct("PresentMoney") = PresentMoney
    
    rsProduct("OnTop") = PE_CBool(Trim(Request("OnTop")))
    rsProduct("IsHot") = PE_CBool(Trim(Request("IsHot")))
    rsProduct("IsElite") = PE_CBool(Trim(Request("IsElite")))
    rsProduct("Hits") = PE_CLng(Trim(Request("Hits")))
    rsProduct("Stars") = PE_CLng(Trim(Request("Stars")))
    rsProduct("UpdateTime") = UpdateTime
    rsProduct("CreateTime") = UpdateTime
    rsProduct("DownloadUrl") = Trim(Request("DownloadUrl"))
    rsProduct("Remark") = Trim(Request("Remark"))
    rsProduct("ServiceTerm") = PE_CLng(Trim(Request("ServiceTerm")))
    Session("ServiceTerm") = PE_CLng(Trim(Request("ServiceTerm")))
    rsProduct("SkinID") = PE_CLng(Trim(Request("SkinID")))
    rsProduct("TemplateID") = PE_CLng(Trim(Request("TemplateID")))
    rsProduct("VoteID") = VoteID
    rsProduct("EnableSale") = EnableSale
    rsProduct("Deleted") = False
    rsProduct("EnableSingleSell") = PE_CBool(Trim(Request.Form("EnableSingleSell")))
    rsProduct("DependentProducts") = ReplaceBadChar(Trim(Request.Form("DependentProducts")))

    If Not (rsField.BOF And rsField.EOF) Then
        rsField.MoveFirst
        Do While Not rsField.EOF
            If Trim(Request(rsField("FieldName"))) <> "" Or rsField("EnableNull") = True Then
                rsProduct(Trim(rsField("FieldName"))) = Trim(Request(rsField("FieldName")))
            End If
            rsField.MoveNext
        Loop
    End If
    Set rsField = Nothing
    
    rsProduct.Update
    rsProduct.Close
    Set rsProduct = Nothing
    Call UpdateChannelData(ChannelID)

    Response.Write "<br><br>"
    Response.Write "<table class='border' align=center width='500' border='0' cellpadding='2' cellspacing='1'>"
    Response.Write "  <tr align=center>"
    Response.Write "    <td  height='22' colspan='3' align='center' class='title'> "
    If Action = "SaveAdd" Then
        Response.Write "<b>添加" & ChannelShortName & "成功</b>"
    Else
        Response.Write "<b>修改" & ChannelShortName & "成功</b>"
    End If
    Response.Write "    </td>"
    Response.Write "  </tr>"
    If EnableSale = False Then
        Response.Write "  <tr class='tdbg'> "
        Response.Write "    <td height='50' colspan='3'><font color='#0000FF'>注意：</font><br> &nbsp;&nbsp;&nbsp;&nbsp;" & ChannelShortName & "只是保存在数据库，还没有开始销售！</td>"
        Response.Write "  </tr>"
    End If
    Response.Write "  <tr class='tdbg'> "
    Response.Write "    <td width='150' align='center' valign='top' rowspan='3'><img src='" & GetProductThumb(ProductThumb) & "' width='150'></td>"
    Response.Write "    <td width='100' align='right' class='tdbg5'><strong>所属栏目：</strong></td>"
    Response.Write "    <td width='250'>" & ShowClassPath() & "</td>"
    Response.Write "  </tr>"
    Response.Write "  <tr class='tdbg'> "
    Response.Write "    <td width='100' align='right' class='tdbg5'><strong>" & ChannelShortName & "名称：</strong></td>"
    Response.Write "    <td width='250'>" & PE_HTMLEncode(ProductName) & "</td>"
    Response.Write "  </tr>"
    Response.Write "  <tr class='tdbg'> "
    Response.Write "    <td width='100' align='right' class='tdbg5'><strong>关 键 字：</strong></td>"
    Response.Write "    <td width='250'>" & Mid(Keyword, 2, Len(Keyword) - 2) & "</td>"
    Response.Write "  </tr>"
    Response.Write "  <tr class='tdbg'> "
    Response.Write "    <td height='40' colspan='3' align='center'>"
    Response.Write "【<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Modify&ProductID=" & ProductID & "'>修改此" & ChannelShortName & "</a>】&nbsp;"
    Response.Write "【<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Add&ProductKind=" & ProductKind & "&ClassID=" & ClassID & "&SpecialID=" & SpecialID & "'>继续添加" & ChannelShortName & "</a>】&nbsp;"
    Response.Write "【<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Manage&ClassID=" & ClassID & "'>" & ChannelShortName & "管理</a>】&nbsp;"
    Response.Write "【<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Show&ProductID=" & ProductID & "'>查看" & ChannelShortName & "信息</a>】"
    Response.Write "    </td>"
    Response.Write "  </tr>"
    Response.Write "</table>" & vbCrLf

    Session("Keyword") = Trim(Request("Keyword"))
    Session("ProductModel") = ProductModel
    Session("ProductStandard") = ProductStandard
    Session("ProducerName") = ProducerName
    Session("TrademarkName") = TrademarkName
    Session("SkinID") = PE_CLng(Trim(Request("SkinID")))
    Session("TemplateID") = PE_CLng(Trim(Request("TemplateID")))

    Call ClearSiteCache(0)
    Call CreateAllJS

    If EnableSale = True And UseCreateHTML > 0 And ObjInstalled_FSO = True And Trim(Request("CreateImmediate")) = "Yes" Then
        Response.Write "<br><iframe id='CreateProduct' width='100%' height='210' frameborder='0' src='Admin_CreateProduct.asp?ChannelID=" & ChannelID & "&Action=CreateProduct2&ClassID=" & ClassID & "&SpecialID=" & SpecialID & "&ProductID=" & ProductID & "&ShowBack=No'></iframe>"
    End If

End Sub

Sub Show()
    If ProductID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定" & ChannelShortName & "ID！</li>"
        Exit Sub
    End If
    
    Dim rsProduct, PurviewChecked, PurviewChecked2
    PurviewChecked = False
    PurviewChecked2 = False
    Set rsProduct = Conn.Execute("Select * from PE_Product where ProductID=" & ProductID & "")
    If rsProduct.BOF And rsProduct.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到" & ChannelShortName & "！</li>"
        rsProduct.Close
        Set rsProduct = Nothing
        Exit Sub
    End If
    ClassID = rsProduct("ClassID")

    Call CheckClassPurview(Action, ClassID)
    If FoundErr = True Then
        rsProduct.Close
        Set rsProduct = Nothing
        Exit Sub
    End If

    Dim arrSpecialID
    arrSpecialID = GetSpecialIDArr(ModuleType, ProductID)

    
    Response.Write "<SCRIPT language='javascript'>" & vbCrLf
    Response.Write "function resizepic(thispic){" & vbCrLf
    Response.Write "  if(thispic.width>600) thispic.width=600;" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function bbimg(o){" & vbCrLf
    Response.Write "  var zoom=parseInt(o.style.zoom, 10)||100;" & vbCrLf
    Response.Write "  zoom+=event.wheelDelta/12;" & vbCrLf
    Response.Write "  if (zoom>0) o.style.zoom=zoom+'%';" & vbCrLf
    Response.Write "  if (zoom>0) o.style.zoom=zoom+'%';" & vbCrLf
    Response.Write "  return false;" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "var tID=0;" & vbCrLf
    Response.Write "function ShowTabs(ID){" & vbCrLf
    Response.Write "  if(ID!=tID){" & vbCrLf
    Response.Write "    TabTitle[tID].className='title5';" & vbCrLf
    Response.Write "    TabTitle[ID].className='title6';" & vbCrLf
    Response.Write "    Tabs[tID].style.display='none';" & vbCrLf
    Response.Write "    Tabs[ID].style.display='';" & vbCrLf
    Response.Write "    tID=ID;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</SCRIPT>" & vbCrLf
    
    Response.Write "<br>您现在的位置：&nbsp;<a href='Admin_Product.asp?ChannelID=" & ChannelID & "'>" & ChannelShortName & "管理</a>&nbsp;&gt;&gt;&nbsp;"
    If ParentID > 0 Then
        Dim sqlPath, rsPath
        sqlPath = "select ClassID,ClassName from PE_Class where ClassID in (" & ParentPath & ") order by Depth"
        Set rsPath = Conn.Execute(sqlPath)
        Do While Not rsPath.EOF
            Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&ClassID=" & rsPath(0) & "'>" & rsPath(1) & "</a>&nbsp;&gt;&gt;&nbsp;"
            rsPath.MoveNext
        Loop
        rsPath.Close
        Set rsPath = Nothing
    End If
    Response.Write "<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&ClassID=" & ClassID & "'>" & ClassName & "</a>&nbsp;&gt;&gt;&nbsp;查看" & ChannelShortName & "信息："
    Response.Write rsProduct("ProductName") & "<br><br>"
    Response.Write "<table width='100%'  border='0' align='center' cellpadding='0' cellspacing='0'>" & vbCrLf
    Response.Write "  <tr align='center'>" & vbCrLf
    Response.Write "    <td id='TabTitle' class='title6' onclick='ShowTabs(0)'>" & ChannelShortName & "信息</td>" & vbCrLf
    Response.Write "    <td id='TabTitle' class='title5' onclick='ShowTabs(1)'>所属专题</td>" & vbCrLf
    Response.Write "    <td id='TabTitle' class='title5' onclick='ShowTabs(2)'>自定义选项</td>" & vbCrLf
    Response.Write "    <td>&nbsp;</td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
    Response.Write "<table width='100%' border='0' align='center' cellpadding='5' cellspacing='0' class='border'>"
    Response.Write "  <tr align='center'>"
    Response.Write "    <td class='tdbg' height='200' valign='top'>"
    Response.Write "      <table width='98%' border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>"
    Response.Write "        <tbody id='Tabs' style='display:'>" & vbCrLf

    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "编号：</td>"
    Response.Write "  <td>" & PE_HTMLEncode(rsProduct("ProductNum")) & "</td>"
    Response.Write "  <td colspan='2' rowspan='6' align=center valign='middle'>" & "<img src='" & GetProductThumb(rsProduct("ProductThumb")) & "' width='150'><br>" & PE_HTMLEncode(rsProduct("ProductName")) & "</td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>条形码：</td>"
    Response.Write "  <td>" & PE_HTMLEncode(rsProduct("BarCode")) & "</td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "类别：</td>"
    Response.Write "  <td>"
    Select Case rsProduct("ProductKind")
    Case 1
        Response.Write "实物类" & ChannelShortName & ""
    Case 2
        Response.Write "软件类" & ChannelShortName & ""
    Case 3
        Response.Write "点卡类" & ChannelShortName & ""
    Case Else
        Response.Write "未知" & ChannelShortName & "类别"
    End Select
    Response.Write "  </td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "名称：</td>"
    Response.Write "  <td><strong>" & PE_HTMLEncode(rsProduct("ProductName")) & "</strong></td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>关键字：</td>"
    Response.Write "  <td>" & Mid(rsProduct("Keyword"), 2, Len(rsProduct("Keyword")) - 2) & "</td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "单位：</td>"
    Response.Write "  <td>" & PE_HTMLEncode(rsProduct("Unit")) & "</td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>库存数量：</td>"
    Response.Write "  <td width='200'>" & rsProduct("Stocks") & "</td>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "重量：</td>"
    Response.Write "  <td width='200'>" & rsProduct("Weight") & " Kg</td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "类型：</td>"
    Response.Write "  <td>"
    Select Case rsProduct("ProductType")
    Case 1
        Response.Write "正常销售"
    Case 2
        Response.Write "涨价销售"
    Case 3
        Response.Write "<font color='red'>特价处理&nbsp;&nbsp;&nbsp;&nbsp;折扣率: " & rsProduct("Discount") & "折&nbsp;&nbsp;&nbsp;&nbsp;优惠期限: " & rsProduct("BeginDate") & "至" & rsProduct("EndDate") & "</font>"
    Case 4
        Response.Write "促销礼品"
    Case 5
        Response.Write "降价促销"
    End Select
    Response.Write "</td>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "属性：</td>"
    Response.Write "  <td width='200'>"
    Select Case rsProduct("ProductType")
    Case 1
        Response.Write "<font color='#000000'>正</font> "
    Case 2
        Response.Write "<font color='green'>涨</font> "
    Case 3
        Response.Write "<font color='yellow'>特</font> "
    Case 4
        Response.Write "<font color='blue'>促</font> "
    Case 5
        Response.Write "<font color='red'>降</font> "
    End Select
    If rsProduct("OnTop") = True Then
        Response.Write "<font color=blue>顶</font> "
    Else
        Response.Write "&nbsp;&nbsp;&nbsp;"
    End If
    If rsProduct("IsHot") = True Then
        Response.Write "<font color=red>热</font> "
    Else
        Response.Write "&nbsp;&nbsp;&nbsp;"
    End If
    If rsProduct("IsElite") = True Then
        Response.Write "<font color=green>荐</font> "
    Else
        Response.Write "&nbsp;&nbsp;&nbsp;"
    End If
    If Trim(rsProduct("ProductThumb")) <> "" Then
        Response.Write "<font color=blue>图</font>"
    Else
        Response.Write "&nbsp;&nbsp;"
    End If
    Response.Write "</td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "价格：</td>"
    Response.Write "  <td colspan='3'>原始零售价："
    If rsProduct("Price") = rsProduct("Price_Original") Then
        Response.Write Price2Str(rsProduct("Price_Original"))
    Else
        Response.Write "<font color='red'><STRIKE>" & Price2Str(rsProduct("Price_Original")) & "</STRIKE></font>"
    End If
    Response.Write "元&nbsp;&nbsp;&nbsp;&nbsp;"
    Response.Write "当前零售价：<font color='blue'>" & Price2Str(rsProduct("Price")) & "</font>元&nbsp;&nbsp;&nbsp;&nbsp;"
    Response.Write "市场参考价：" & Price2Str(rsProduct("Price_Market")) & "&nbsp;&nbsp;&nbsp;&nbsp;"
    Response.Write "会员零售价：" & Price2Str(rsProduct("Price_Member")) & "&nbsp;&nbsp;&nbsp;&nbsp;"
    Response.Write "代理零售价：" & Price2Str(rsProduct("Price_Agent")) & "<br>"
    'If rsProduct("Price_Wholesale") > 0 And rsProduct("Number_Wholesale") > 0 Then
    '    Response.Write "批量购买价：" & Price2Str(rsProduct("Price_Wholesale")) & "<br>"
    '    Response.Write "起批数量：" & Price2Str(rsProduct("Number_Wholesale")) & "<br>"
    'End If
    Response.Write "</td></tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>生 产 商：</td>"
    Response.Write "  <td>" & PE_HTMLEncode(rsProduct("ProducerName")) & "</td>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>品牌/商标：</td>"
    Response.Write "  <td>" & PE_HTMLEncode(rsProduct("TrademarkName")) & "</td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "型号：</td>"
    Response.Write "  <td>" & PE_HTMLEncode(rsProduct("ProductModel")) & "</td>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "规格：</td>"
    Response.Write "  <td>" & PE_HTMLEncode(rsProduct("ProductStandard")) & "</td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>上市时间：</td>"
    Response.Write "  <td width='200'>" & rsProduct("UpdateTime") & "</td>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>推荐等级：</td>"
    Response.Write "  <td width='200'>" & String(rsProduct("Stars"), "★") & "</td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>点击次数：</td>"
    Response.Write "  <td>" & rsProduct("Hits") & "</td>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>购买次数：</td>"
    Response.Write "  <td>" & rsProduct("BuyTimes") & "</td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>下载地址：</td>"
    Response.Write "  <td>" & PE_HTMLEncode(rsProduct("DownloadUrl")) & "</td>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>下载说明：</td>"
    Response.Write "  <td>" & PE_HTMLEncode(rsProduct("Remark")) & "</td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>服务期限：</td>"
    Response.Write "  <td>" & rsProduct("ServiceTerm") & " 年</td>"
    Response.Write "  <td width='100' align='right' class='tdbg5'>购物积分：</td>"
    Response.Write "  <td>" & rsProduct("PresentExp") & " 分</td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td align='right' class='tdbg5'>促销方案：</td>"
    Response.Write "  <td colspan='3'>"
    Select Case rsProduct("SalePromotionType")
    Case 0
        Response.Write "不促销"
    Case 1
        Response.Write "买 " & rsProduct("MinNumber") & rsProduct("Unit") & " 送 " & rsProduct("PresentNumber") & rsProduct("Unit") & " 同样的" & ChannelShortName & ""
    Case 2
        Response.Write "买 " & rsProduct("MinNumber") & rsProduct("Unit") & " 送 " & rsProduct("PresentNumber") & rsProduct("Unit") & " "
        Dim rsPresent
        Set rsPresent = Conn.Execute("select ProductName from PE_Product where ProductNum='" & rsProduct("PresentID") & "'")
        If rsPresent.BOF And rsPresent.EOF Then
            Response.Write "<font color='red'>错误的赠品（原因可能是赠品已经删除）</font>"
        Else
            Response.Write rsPresent(0)
        End If
        rsPresent.Close
        Set rsPresent = Nothing
    End Select
    Response.Write "  </td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td align='right' class='tdbg5'>" & ChannelShortName & "简介：</td>"
    Response.Write "  <td colspan='3'>" & PE_HTMLEncode(rsProduct("ProductIntro")) & "</td>"
    Response.Write "</tr>"
    Response.Write "<tr class='tdbg'>"
    Response.Write "  <td align='right' class='tdbg5'>" & ChannelShortName & "说明：</td>"
    Response.Write "  <td colspan='3'>" & Replace(Replace(rsProduct("ProductExplain"), "[InstallDir_ChannelDir]", InstallDir & ChannelDir & "/"), "{$UploadDir}", UploadDir) & "</td>"
    Response.Write "</tr>"

    Response.Write "        </tbody>" & vbCrLf
    
    Call ShowTabs_Special(arrSpecialID, " disabled")

    Call ShowTabs_MyField_View(rsProduct)

    Response.Write "      </table>"
    Response.Write "    </td>"
    Response.Write "  </tr>"
    Response.Write "</table>" & vbCrLf


    Response.Write "<form name='formA' method='get' action='Admin_Product.asp'><p align='center'>"
    Response.Write "<input type='hidden' name='ChannelID' value='" & ChannelID & "'>"
    Response.Write "<input type='hidden' name='ProductID' value='" & ProductID & "'>"
    Response.Write "<input type='hidden' name='Action' value=''>" & vbCrLf
    If rsProduct("Deleted") = False Then
        PurviewChecked = CheckClassPurview("Manage", ClassID)
        If PurviewChecked = True Then
            Response.Write "<input type='submit' name='submit' value=' 修 改 ' onclick=""document.formA.Action.value='Modify'"">&nbsp;&nbsp;"
            Response.Write "<input type='submit' name='submit' value=' 删 除 ' onclick=""document.formA.Action.value='Del'"">&nbsp;&nbsp;"
        End If
        If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
            Response.Write "<input type='submit' name='submit' value=' 移 动 ' onclick=""document.formA.Action.value='MoveToClass'"">&nbsp;&nbsp;"
        End If
        If PurviewChecked2 = True Then
            If rsProduct("EnableSale") = False Then
                Response.Write "<input type='submit' name='submit' value='开始销售' onclick=""document.formA.Action.value='StartSale'"">&nbsp;&nbsp;"
            Else
                Response.Write "<input type='submit' name='submit' value='开始销售' onclick=""document.formA.Action.value='StopSale'"">&nbsp;&nbsp;"
            End If
        End If
        If PurviewChecked = True Then
            If rsProduct("OnTop") = False Then
                Response.Write "<input type='submit' name='submit' value='设为固顶' onclick=""document.formA.Action.value='SetOnTop'"">&nbsp;&nbsp;"
            Else
                Response.Write "<input type='submit' name='submit' value='取消固顶' onclick=""document.formA.Action.value='CancelOnTop'"">&nbsp;&nbsp;"
            End If
            If rsProduct("IsHot") = False Then
                Response.Write "<input type='submit' name='submit' value='设为热卖' onclick=""document.formA.Action.value='SetHot'"">&nbsp;&nbsp;"
            Else
                Response.Write "<input type='submit' name='submit' value='取消热卖' onclick=""document.formA.Action.value='CancelHot'"">&nbsp;&nbsp;"
            End If
            If rsProduct("IsElite") = False Then
                Response.Write "<input type='submit' name='submit' value='设为推荐' onclick=""document.formA.Action.value='SetElite'"">"
            Else
                Response.Write "<input type='submit' name='submit' value='取消推荐' onclick=""document.formA.Action.value='CancelElite'"">"
            End If
        End If
    Else
        If AdminPurview = 1 Or AdminPurview_Channel = 1 Then
            Response.Write "<input type='submit' name='submit' value='彻底删除' onclick=""if(confirm('确定要彻底删除此" & ChannelShortName & "吗？彻底删除后将无法还原！')==true){document.formA.Action.value='ConfirmDel';}"">&nbsp;&nbsp;"
            Response.Write "<input type='submit' name='submit' value=' 还 原 ' onclick=""document.formA.Action.value='Restore'"">"
        End If
    End If
    Response.Write "</p></form>"

    rsProduct.Close
    Set rsProduct = Nothing

    Response.Write "<table width='100%' border='0' cellpadding='2' cellspacing='0'><tr class='tdbg'><td>"
    Response.Write "<li>上一" & ChannelItemUnit & ChannelShortName & "："
    Dim rsPrev
    Set rsPrev = Conn.Execute("Select Top 1 P.ProductID,P.ProductName,C.ClassID,C.ClassName from PE_Product P left join PE_Class C On P.ClassID=C.ClassID Where P.ChannelID=" & ChannelID & " and P.Deleted=" & PE_False & " and P.ProductID<" & ProductID & " order by P.ProductID desc")
    If rsPrev.EOF Then
        Response.Write "没有了"
    Else
        Response.Write "[<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&ClassID=" & rsPrev("ClassID") & "'>" & rsPrev("ClassName") & "</a>] <a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Show&ProductID=" & rsPrev("ProductID") & "'>" & rsPrev("ProductName") & "</a>"
    End If
    rsPrev.Close
    Set rsPrev = Nothing
    Response.Write "</li></td</tr><tr class='tdbg'><td><li>下一" & ChannelItemUnit & ChannelShortName & "："
    Dim rsNext
    Set rsNext = Conn.Execute("Select Top 1 P.ProductID,P.ProductName,C.ClassID,C.ClassName from PE_Product P left join PE_Class C On P.ClassID=C.ClassID Where P.ChannelID=" & ChannelID & " and P.Deleted=" & PE_False & " and P.ProductID>" & ProductID & " order by P.ProductID asc")
    If rsNext.EOF Then
        Response.Write "没有了"
    Else
        Response.Write "[<a href='Admin_Product.asp?ChannelID=" & ChannelID & "&ClassID=" & rsNext("ClassID") & "'>" & rsNext("ClassName") & "</a>] <a href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Show&ProductID=" & rsNext("ProductID") & "'>" & rsNext("ProductName") & "</a>"
    End If
    rsNext.Close
    Set rsNext = Nothing
    Response.Write "</li></td></tr></table><br>" & vbCrLf

    Dim InfoType
    InfoType = PE_CLng(Trim(Request("InfoType")))

    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr align='center' height='24'><td"
    If InfoType = 0 Then
        Response.Write " class='title6'"
    Else
        Response.Write " class='title5' onclick=""window.location.href='Admin_Product.asp?Action=Show&ChannelID=" & ChannelID & "&ProductID=" & ProductID & "&InfoType=0'"""
    End If
    Response.Write ">相关评论</td><td"
    If InfoType = 1 Then
        Response.Write " class='title6'"
    Else
        Response.Write " class='title5' onclick=""window.location.href='Admin_Product.asp?Action=Show&ChannelID=" & ChannelID & "&ProductID=" & ProductID & "&InfoType=1'"""
    End If
    Response.Write ">相关订单</td>"
    Response.Write "<td>&nbsp;</td></tr></table>"
    
    strFileName = "Admin_Product.asp?Action=Show&ChannelID=" & ChannelID & "&ProductID=" & ProductID & "&InfoType=" & InfoType
    
    Select Case InfoType
    Case 0
        Call ShowComment(ProductID)
    Case 1
        Call ShowConsumeLog(ProductID)
    End Select

End Sub

Sub BatchPrice()
    If AdminPurview = 2 And AdminPurview_Channel > 2 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>对不起，你的权限不够！</li>"
        Exit Sub
    End If
    
    ProductID = ReplaceBadChar(ProductID)
    
    Call PopCalendarInit
    Response.Write "<form method='POST' name='myform' action='Admin_Product.asp' target='_self' onsubmit=""return confirm('确定要批量设置选定" & ChannelShortName & "的价格吗？');"">"
    Response.Write "  <table width='100%' border='0' align='center' cellpadding='0' cellspacing='0' class='border'>"
    Response.Write "    <tr class='title'>"
    Response.Write "      <td height='22' colspan='4' align='center'><b>批量变动" & ChannelShortName & "价格</td>"
    Response.Write "    </tr>"
    Response.Write "    <tr align='center'  class='tdbg'>"
    Response.Write "      <td class='tdbg' valign='top' width='300'><table width='100%' border='0' cellpadding='2' cellspacing='1'>"
    Response.Write "          <tr>"
    Response.Write "            <td align='center'><b>" & ChannelShortName & "范围</b></td>"
    Response.Write "          </tr>"

    Response.Write "            <tr><td><input type='radio' name='ProductType' value='1' checked>指定" & ChannelShortName & "ID：<input type='text' name='BatchProductID' value='" & ProductID & "' size='30'><br>"
    Response.Write "<input type='radio' name='ProductType' value='2'>指定栏目的" & ChannelShortName & "：<br><select name='BatchClassID' size='2' multiple style='height:360px;width:300px;'>" & GetClass_Option(5, 0) & "</select>"
    Response.Write "          </td></tr></table>"
    Response.Write "      </td>"
    Response.Write "      <td align='left' valign='top'>"
    Response.Write "<br>价格变动类型：</b><br>"
    Response.Write "<input type='radio' name='ActionType' value='4' checked>降价处理<br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='DiscountType4' value='1' checked>折扣率：<input name='Discount4' type='text' value='9' size='6' maxlength='6' style='text-align: center;'> 折&nbsp;&nbsp;&nbsp;&nbsp;选定" & ChannelShortName & "的价格＝指定基数×当前折扣<br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;降价基数：<input type='radio' name='BaseType4' value='1' checked>原始零售价<br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='BaseType4' value='2'>当前零售价（只对已降价" & ChannelShortName & "有效）<br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='BaseType4' value='3'>原始零售价×原折扣率（只对已降价" & ChannelShortName & "有效）<br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='DiscountType4' value='2'>指定价：<input name='Price4' type='text' value='' size='6' maxlength='6' style='text-align: right;'> 元&nbsp;&nbsp;&nbsp;&nbsp;选定" & ChannelShortName & "将统一按当前指定价格销售<br><br>"
    Response.Write "<input type='radio' name='ActionType' value='1'>特价处理<br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='DiscountType' value='1' checked>折扣率：<input name='Discount' type='text' value='8' size='6' maxlength='6' style='text-align: center;'> 折&nbsp;&nbsp;&nbsp;&nbsp;选定" & ChannelShortName & "的价格＝指定基数×当前折扣<br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;特价基数：<input type='radio' name='BaseType' value='1' checked>原始零售价<br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='BaseType' value='2'>当前零售价（只对已降价" & ChannelShortName & "有效）<br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='BaseType' value='3'>原始零售价×原折扣率（只对已降价" & ChannelShortName & "有效）<br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='DiscountType' value='2'>指定价：<input name='Price' type='text' value='' size='6' maxlength='6' style='text-align: right;'> 元&nbsp;&nbsp;&nbsp;&nbsp;选定" & ChannelShortName & "将统一按当前指定价格销售<br><br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;优惠期限：<input name='BeginDate' type='text' value='" & FormatDateTime(Date, 2) & "' size='10' maxlength='10'><a style='cursor:hand;' onClick='PopCalendar.show(document.myform.BeginDate, ""yyyy-m-d"", null, null, null, ""11"");'><img src='Images/Calendar.gif' border='0' Style='Padding-Top:10px' align='absmiddle'></a> 至 <input name='EndDate' type='text' value='" & FormatDateTime(DateAdd("m", 1, Date), 2) & "' size='10' maxlength='6'><a style='cursor:hand;' onClick='PopCalendar.show(document.myform.EndDate, ""yyyy-m-d"", null, null, null, ""11"");'><img src='Images/Calendar.gif' border='0' Style='Padding-Top:10px' align='absmiddle'></a><br>"
    Response.Write "<br><input type='radio' name='ActionType' value='2'>恢复为原始零售价"
    Response.Write "<br><input type='radio' name='ActionType' value='3'>当前价格不变<br><br>"
    Response.Write "<input type='checkbox' name='ModifyPrice_Member' value='Yes' checked> 重新指定会员价<br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='PriceMemberType' value='0' checked> 会员价＝原始零售价×<input name='Discount_Member' type='text' value='8' size='6' maxlength='6' style='text-align: center;'> 折<br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='PriceMemberType' value='1'> 会员价清零，改为按会员组中的折扣计算<br><br>"
    Response.Write "<input type='checkbox' name='ModifyPrice_Agent' value='Yes' checked> 重新指定代理价<br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='PriceAgentType' value='0' checked> 代理价＝原始零售价×<input name='Discount_Agent' type='text' value='5' size='6' maxlength='6' style='text-align: center;'> 折<br>"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='PriceAgentType' value='1'> 代理价清零，改为按会员组中的折扣计算<br>"
    Response.Write "</td>"
    Response.Write "    </tr>"
    Response.Write "  </table>"
    Response.Write "  <p align='center'>"
    Response.Write "   <input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "   <input name='Action' type='hidden' id='Action' value='DoBatchPrice'>"
    Response.Write "   <input name='add' type='submit'  id='Add' value=' 执行批量价格变动 ' style='cursor:hand;'>&nbsp; "
    Response.Write "   <input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick=""window.location.href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Manage';"" style='cursor:hand;'>"
    Response.Write "  </p><br>"
    Response.Write "</form>"
End Sub

Sub DoBatchPrice()
    If AdminPurview = 2 And AdminPurview_Channel > 2 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>对不起，你的权限不够！</li>"
        Exit Sub
    End If
    
    Dim rs, sql
    Dim ProductType, BatchProductID, BatchClassID
    Dim ActionType, DiscountType, Discount, BaseType, Price, BeginDate, EndDate
    Dim DiscountType4, Discount4, BaseType4, Price4
    Dim ModifyPrice_Member, PriceMemberType, Discount_Member
    Dim ModifyPrice_Agent, PriceAgentType, Discount_Agent
    
    ProductType = PE_CLng(Trim(Request("ProductType")))
    BatchProductID = Trim(Request("BatchProductID"))
    BatchClassID = Replace(Replace(Trim(Request("BatchClassID")), " ", ""), ",,", ",")
    ActionType = PE_CLng(Trim(Request("ActionType")))
    DiscountType = PE_CLng(Trim(Request("DiscountType")))
    Discount = PE_CDbl(Trim(Request("Discount")))
    BaseType = PE_CLng(Trim(Request("BaseType")))
    Price = PE_CDbl(Trim(Request("Price")))
    BeginDate = Trim(Request("BeginDate"))
    EndDate = Trim(Request("EndDate"))
    DiscountType4 = PE_CLng(Trim(Request("DiscountType4")))
    Discount4 = PE_CDbl(Trim(Request("Discount4")))
    BaseType4 = PE_CLng(Trim(Request("BaseType4")))
    Price4 = PE_CDbl(Trim(Request("Price4")))
    ModifyPrice_Member = Trim(Request("ModifyPrice_Member"))
    PriceMemberType = PE_CLng(Trim(Request("PriceMemberType")))
    Discount_Member = PE_CDbl(Trim(Request("Discount_Member")))
    ModifyPrice_Agent = Trim(Request("ModifyPrice_Agent"))
    PriceAgentType = PE_CLng(Trim(Request("PriceAgentType")))
    Discount_Agent = PE_CDbl(Trim(Request("Discount_Agent")))
    
    If ProductType = 1 Then
        If IsValidID(BatchProductID) = False Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请指定要批量变动价格的" & ChannelShortName & "的ID</li>"
        End If
    Else
        If IsValidID(BatchClassID) = False Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请指定要批量变动价格的" & ChannelShortName & "的栏目</li>"
        End If
    End If

    If ActionType = 1 Then
        If DiscountType = 1 Then
            If Discount <= 0 Or Discount >= 10 Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>请指定正确的折扣率</li>"
            End If
        End If
        If IsDate(BeginDate) = False Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请输入正确的开始日期</li>"
        End If
        If IsDate(EndDate) = False Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请输入正确的结束日期</li>"
        End If
    End If

    If ActionType = 4 Then
        If DiscountType4 = 1 Then
            If Discount4 <= 0 Or Discount4 >= 10 Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>请指定正确的折扣率</li>"
            End If
        End If
    End If
    
    If ModifyPrice_Member = "Yes" Then
        If PriceMemberType = 0 Then
            If Discount_Member <= 0 Or Discount_Member >= 10 Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>请指定正确的会员价折扣率！</li>"
            End If
        End If
    End If
    
    If ModifyPrice_Agent = "Yes" Then
        If PriceAgentType = 0 Then
            If Discount_Agent <= 0 Or Discount_Agent >= 10 Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>请指定正确的代理价折扣率！</li>"
            End If
        End If
    End If
    
    
    If FoundErr = True Then Exit Sub
    
    If ProductType = 1 Then
        sql = "select * from PE_Product where ProductID in (" & BatchProductID & ")"
    Else
        sql = "select * from PE_Product where ClassID in (" & BatchClassID & ")"
    End If
        
    Set rs = Server.CreateObject("adodb.recordset")
    rs.Open sql, Conn, 1, 3
    Do While Not rs.EOF
        Select Case ActionType
            Case 1
                Select Case DiscountType
                Case 1
                    Select Case BaseType
                    Case 1
                        rs("Price") = Round(rs("Price_Original") * Discount / 10, 2)
                    Case 2
                        rs("Price") = Round(rs("Price") * Discount / 10, 2)
                    Case 3
                        If rs("Discount") > 0 Then
                            rs("Price") = Round(rs("Price_Original") * rs("Discount") * Discount / 100, 2)
                        Else
                            rs("Price") = Round(rs("Price_Original") * Discount / 10, 2)
                        End If
                    End Select
                    rs("Discount") = Discount
                Case 2
                    rs("Price") = Price
                End Select
                rs("ProductType") = 3
                rs("BeginDate") = BeginDate
                rs("EndDate") = EndDate
        Case 2
            rs("ProductType") = 1
            rs("Price") = rs("Price_Original")
        Case 4
            Select Case DiscountType4
                Case 1
                    Select Case BaseType4
                    Case 1
                        rs("Price") = Round(rs("Price_Original") * Discount4 / 10, 2)
                    Case 2
                        rs("Price") = Round(rs("Price") * Discount4 / 10, 2)
                    Case 3
                        If rs("Discount") > 0 Then
                            rs("Price") = Round(rs("Price_Original") * rs("Discount") * Discount4 / 100, 2)
                        Else
                            rs("Price") = Round(rs("Price_Original") * Discount4 / 10, 2)
                        End If
                    End Select
                    rs("Discount") = Discount4
                Case 2
                    rs("Price") = Price4
                End Select
                rs("ProductType") = 5
        End Select
        
        If ModifyPrice_Member = "Yes" Then
            If PriceMemberType = 0 Then
                rs("Price_Member") = Round(rs("Price_Original") * Discount_Member / 10, 2)
            Else
                rs("Price_Member") = 0
            End If
        End If
        
        If ModifyPrice_Agent = "Yes" Then
            If PriceAgentType = 0 Then
                rs("Price_Agent") = Round(rs("Price_Original") * Discount_Agent / 10, 2)
            Else
                rs("Price_Agent") = 0
            End If
        End If
        
        rs.Update
        rs.MoveNext
    Loop
    rs.Close
    Set rs = Nothing
    Dim strMsg
    strMsg = "成功批量设置了选定" & ChannelShortName & "的价格！"
    If UseCreateHTML > 0 Then
        strMsg = strMsg & "请重新批量生成这些" & ChannelShortName & "的HTML页面！"
    End If
    Call WriteSuccessMsg(strMsg, ComeUrl)
    Call ClearSiteCache(0)
End Sub

Sub SavePrice()
    If AdminPurview = 2 And AdminPurview_Channel > 2 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>对不起，你的权限不够！</li>"
        Exit Sub
    End If
    
    If ProductID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定要批量变动价格的" & ChannelShortName & "的ID</li>"
        Exit Sub
    End If

    Dim rs, sql
    sql = "select * from PE_Product where ProductID in (" & ProductID & ")"
    Set rs = Server.CreateObject("adodb.recordset")
    rs.Open sql, Conn, 1, 3
    Do While Not rs.EOF
        rs("Unit") = Trim(Request("Unit" & rs("ProductID") & ""))
        rs("Stocks") = PE_CDbl(Trim(Request("Stocks" & rs("ProductID") & "")))
        rs("Price_Market") = PE_CDbl(Trim(Request("Price_Market" & rs("ProductID") & "")))
        rs("Price_Original") = PE_CDbl(Trim(Request("Price_Original" & rs("ProductID") & "")))
        rs("Price") = PE_CDbl(Trim(Request("Price" & rs("ProductID") & "")))
        rs("Price_Member") = PE_CDbl(Trim(Request("Price_Member" & rs("ProductID") & "")))
        rs("Price_Agent") = PE_CDbl(Trim(Request("Price_Agent" & rs("ProductID") & "")))
        
        rs.Update
        rs.MoveNext
    Loop
    rs.Close
    Set rs = Nothing
    Dim strMsg
    strMsg = "成功保存了价格修改结果！"
    If UseCreateHTML > 0 Then
        strMsg = strMsg & "请重新批量生成这些" & ChannelShortName & "的HTML页面！"
    End If
    Call WriteSuccessMsg(strMsg, ComeUrl)
    Call ClearSiteCache(0)
    
End Sub
'******************************************************************************************
'以下为批量设置属性使用的函数，各模块实现过程类似，修改时注意同时修改各模块内容。
'******************************************************************************************

Sub Batch()
    Call ShowJS_Product
    If AdminPurview = 2 And AdminPurview_Channel > 2 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>对不起，你的权限不够！</li>"
        Exit Sub
    End If
    
    ProductID = Replace(ProductID, " ", "")
    Response.Write "<form method='POST' name='myform' action='Admin_Product.asp' target='_self'>"
    Response.Write "  <table width='100%' border='0' align='center' cellpadding='0' cellspacing='0' class='border'>"
    Response.Write "    <tr class='title'>"
    Response.Write "      <td height='22' colspan='2' align='center'><b>批量修改" & ChannelShortName & "属性</td>"
    Response.Write "    </tr>"
    Response.Write "    <tr align='center'>"
    Response.Write "      <td class='tdbg' valign='top'>"
    Response.Write "        <table width='100%' border='0' cellpadding='2' cellspacing='1'>"
    Response.Write "          <tr>"
    Response.Write "            <td align='center'><b>" & ChannelShortName & "范围</b></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr>"
    Response.Write "            <td>"
    Response.Write "              <input type='radio' name='BatchType' value='1' checked>指定" & ChannelShortName & "ID：<br>"
    Response.Write "              <input type='text' name='BatchProductID' value='" & ProductID & "' size='28'><br>"
    Response.Write "              <input type='radio' name='BatchType' value='2'>指定栏目的" & ChannelShortName & "：<br>"
    Response.Write "              <select name='BatchClassID' size='2' multiple style='height:280px;width:180px;'>" & GetClass_Option(0, 0) & "</select><br><div align='center'>"
    Response.Write "      <input type='button' name='Submit' value='  选定所有栏目  ' onclick='SelectAll()'><br>"
    Response.Write "      <input type='button' name='Submit' value='取消选定所有栏目' onclick='UnSelectAll()'></div></td>"
    Response.Write "          </tr>"
    Response.Write "        </table>"
    Response.Write "      </td>"
    Response.Write "      <td valign='top'>"
    Response.Write "        <table width='100%' border='0' cellpadding='2' cellspacing='1'>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifyKeyword' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>关键字：</td>"
    Response.Write "            <td>"
    Response.Write "              <input name='Keyword' type='text' id='Keyword' value='" & Trim(Session("Keyword")) & "' size='30' maxlength='255'> <font color='#FF0000'>*</font> " & GetKeywordList("Admin", ChannelID)
    Response.Write "              <br><font color='#0000FF'>用来查找相关" & ChannelShortName & "，可输入多个关键字，中间用<font color='#FF0000'>“|”</font>隔开。不能出现&quot;'&?;:()等字符。</font>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifyUnit' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "单位：</td>"
    Response.Write "            <td><input name='Unit' type='text' value='' size='20' maxlength='20'> &lt;&lt; <select name='UnitList' onchange='document.myform.Unit.value=this.value;'>" & GetAllUnit() & "</select></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifyStocks' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>库存数量：</td>"
    Response.Write "            <td><input name='Stocks' type='text' value='1000' size='10' maxlength='10' style='text-align: right;' ONKEYPRESS=""event.returnValue=IsDigit();""></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifyAlarmNum' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>库存报警下限：</td>"
    Response.Write "            <td><input name='AlarmNum' type='text' value='10' size='10' maxlength='10' style='text-align: right;' ONKEYPRESS=""event.returnValue=IsDigit();""></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifyWeight' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "重量：</td>"
    Response.Write "            <td><input name='Weight' type='text' value='' size='10' maxlength='10' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit2();""> 千克（Kg）</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifySalePromotionType' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>促销方案：</td>"
    Response.Write "            <td> <input name='SalePromotionType' type='radio' value='0' checked onclick=''> 不促销<br>"
    Response.Write "<input name='SalePromotionType' type='radio' value='1' onclick=''><font color='red'> 买 <input name='MinNumber1' type='text' value='2' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 送 <input name='PresentNumber1' type='text' value='1' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 同样的" & ChannelShortName & "</font><br>"
    Response.Write "<input name='SalePromotionType' type='radio' value='2' onclick=''><font color='blue'> 买 <input name='MinNumber2' type='text' value='2' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 送 <input name='PresentNumber2' type='text' value='1' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 其他" & ChannelShortName & "&nbsp;&nbsp;&nbsp;赠品编号：<input name='PresentID' type='text' value='' size='20' maxlength='30'><input type='button' name='button21' value='...' onclick='SelectPresent(1)'></font><br>"

    Response.Write "<input name='SalePromotionType' type='radio' value='3' onclick=''><font color='red'> 买&nbsp;&nbsp; 就&nbsp;&nbsp; 送 <input name='PresentNumber3' type='text' value='1' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 同样的" & ChannelShortName & "</font><br>"
    Response.Write "<input name='SalePromotionType' type='radio' value='4' onclick=''><font color='blue'> 买&nbsp;&nbsp; 就&nbsp;&nbsp; 送 <input name='PresentNumber4' type='text' value='1' size='4' maxlength='4' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();""> 其他" & ChannelShortName & "&nbsp;&nbsp;&nbsp;赠品编号：<input name='PresentID2' type='text' value='' size='20' maxlength='30'><input type='button' name='button41' value='...' onclick='SelectPresent(2)'></font>"
    Response.Write "<br>买满××元返还××元现金（券），买满××元在促销" & ChannelShortName & "中任选等更多促销方案请到“促销方案管理”中设置。"

    Response.Write "          </td></tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifyPresentPoint' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>赠送" & PointName & "：</td>"
    Response.Write "            <td>购买一件此" & ChannelShortName & "可以得到<input name='PresentPoint' type='text' value='0' size='6' maxlength='9' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();"">" & PointName & "<br>买满××元可以得××" & PointName & "等更多促销方案，请到“促销方案管理”中设置。</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifyPresentExp' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>购物积分：</td>"
    Response.Write "            <td>购买一件此" & ChannelShortName & "可以得到<input name='PresentExp' type='text' value='0' size='6' maxlength='9' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();"">积分<br>买满××元可以得××积分等更多促销方案，请到“促销方案管理”中设置。</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifyPresentMoney' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>赠送现金券：</td>"
    Response.Write "            <td>购买一件此" & ChannelShortName & "可以得到<input name='PresentMoney' type='text' value='0' size='6' maxlength='9' style='text-align: center;' ONKEYPRESS=""event.returnValue=IsDigit();"">元现金券<br>买满××元可以得××元现金券等更多促销方案，请到“促销方案管理”中设置。</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifyOnTop' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "性质：</td>"
    Response.Write "            <td><input name='OnTop' type='checkbox' id='OnTop' value='Yes'> 固顶" & ChannelShortName & ""
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifyHot' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "性质：</td>"
    Response.Write "            <td><input name='IsHot' type='checkbox' id='IsHot' value='Yes'> 热销" & ChannelShortName & ""
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifyElite' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>" & ChannelShortName & "性质：</td>"
    Response.Write "            <td><input name='IsElite' type='checkbox' id='IsElite' value='Yes'> 推荐" & ChannelShortName & ""
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifyStars' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>推荐等级：</td>"
    Response.Write "            <td><select name='Stars' id='Stars'>" & GetStars(3) & "</select></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center' class='tdbg5'><input type='checkbox' name='ModifyHits' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>点击数：</td>"
    Response.Write "            <td><input name='Hits' type='text' id='Hits' value='0' size='10' maxlength='10'></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifyUpdateTime' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>更新时间：</td>"
    Response.Write "            <td><input name='UpdateTime' type='text' id='UpdateTime' value='" & Date & "' size='10' maxlength='10'> 只修改更新时间的日期部分，时间保留。</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifySkin' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>配色风格：</td>"
    Response.Write "            <td><select Name='SkinID'>" & GetSkin_Option(Session("SkinID")) & "</select>&nbsp;相关模板中包含CSS、颜色、图片等信息</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='30' align='center'><input type='checkbox' name='ModifyTemplate' value='Yes'></td>"
    Response.Write "            <td width='100' align='right' class='tdbg5'>版面设计模板：</td>"
    Response.Write "            <td><select Name='TemplateID'>" & GetTemplate_Option(ChannelID, 3, Session("TemplateID")) & "</select>&nbsp;相关模板中包含了版面设计的版式等信息</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td colspan='3' height='90'>说明：若要批量修改某个属性的值，请先选中其左侧的复选框，然后再设定属性值。</td>"
    Response.Write "          </tr>"
    Response.Write "        </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "  </table>"
    Response.Write "  <p align='center'>"
    Response.Write "    <input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "    <input name='Action' type='hidden' id='Action' value='DoBatch'>"
    Response.Write "    <input name='add' type='submit'  id='Add' value=' 执行批处理 ' style='cursor:hand;'>&nbsp; "
    Response.Write "    <input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick=""window.location.href='Admin_Product.asp?ChannelID=" & ChannelID & "&Action=Manage';"" style='cursor:hand;'>"
    Response.Write "  </p>"
    Response.Write "  <br>"
    Response.Write "</form>"
    Response.Write "<script language='javascript'>" & vbCrLf
    Response.Write "function SelectAll(){" & vbCrLf
    Response.Write "  for(var i=0;i<document.myform.BatchClassID.length;i++){" & vbCrLf
    Response.Write "    document.myform.BatchClassID.options[i].selected=true;}" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function UnSelectAll(){" & vbCrLf
    Response.Write "  for(var i=0;i<document.myform.BatchClassID.length;i++){" & vbCrLf
    Response.Write "    document.myform.BatchClassID.options[i].selected=false;}" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf
End Sub

Sub DoBatch()
    If AdminPurview = 2 And AdminPurview_Channel > 2 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>对不起，你的权限不够！</li>"
        Exit Sub
    End If
        
    Dim rs, sql, BatchType, BatchProductID, BatchClassID
    Dim Keyword, Unit, Stocks, AlarmNum, Weight, SalePromotionType, MinNumber, PresentNumber, PresentID, PresentPoint, PresentExp, PresentMoney, OnTop, IsHot, IsElite, Hits, Stars, UpdateTime, SkinID, TemplateID
    
    BatchType = PE_CLng(Trim(Request("BatchType")))
    BatchProductID = Trim(Request.Form("BatchProductID"))
    BatchClassID = FilterArrNull(Trim(Request.Form("BatchClassID")), ",")
    Keyword = Trim(Request.Form("Keyword"))
    Unit = Trim(Request.Form("Unit"))
    Stocks = PE_CDbl(Trim(Request("Stocks")))
    AlarmNum = PE_CDbl(Trim(Request("AlarmNum")))
    Weight = PE_CDbl(Trim(Request("Weight")))
    
    SalePromotionType = PE_CLng(Trim(Request.Form("SalePromotionType")))
    If SalePromotionType <= 2 Then
        MinNumber = PE_CLng(Trim(Request("MinNumber" & SalePromotionType)))
        PresentID = Trim(Request.Form("PresentID"))
    Else
        PresentID = Trim(Request.Form("PresentID2"))
    End If
    PresentNumber = PE_CLng(Trim(Request("PresentNumber" & SalePromotionType)))
    PresentPoint = PE_CLng(Trim(Request.Form("PresentPoint")))
    PresentExp = PE_CLng(Trim(Request.Form("PresentExp")))
    PresentMoney = PE_CLng(Trim(Request.Form("PresentMoney")))

    OnTop = Trim(Request.Form("OnTop"))
    IsHot = Trim(Request.Form("IsHot"))
    IsElite = Trim(Request.Form("IsElite"))
    Hits = PE_CLng(Trim(Request("Hits")))
    Stars = PE_CLng(Trim(Request.Form("Stars")))
    UpdateTime = PE_CDate(Trim(Request.Form("UpdateTime")))
    SkinID = PE_CLng(Trim(Request.Form("SkinID")))
    TemplateID = PE_CLng(Trim(Request.Form("TemplateID")))
    
    If BatchType = 1 Then
        If IsValidID(BatchProductID) = False Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请指定要批量修改的" & ChannelShortName & "的ID</li>"
        End If
    Else
        If IsValidID(BatchClassID) = False Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请指定要批量修改的" & ChannelShortName & "的栏目</li>"
        End If
    End If
    If Trim(Request("ModifyKeyword")) = "Yes" And Keyword = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请输入" & ChannelShortName & "关键字</li>"
    End If
    Keyword = "|" & ReplaceBadChar(Keyword) & "|"
    If Trim(Request("ModifyUnit")) = "Yes" And Unit = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请输入" & ChannelShortName & "单位</li>"
    End If

    If SalePromotionType > 0 Then
        If MinNumber < 1 Then MinNumber = 1
        If PresentNumber < 1 Then PresentNumber = 1
        If SalePromotionType = 2 Or SalePromotionType = 4 Then
            If PresentID = "" Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>请指定赠品ID</li>"
            End If
        End If
    Else
        MinNumber = 1
        PresentNumber = 1
        PresentID = ""
    End If

    If FoundErr = True Then
        Exit Sub
    End If
    
    If OnTop = "Yes" Then
        OnTop = True
    Else
        OnTop = False
    End If
    If IsElite = "Yes" Then
        IsElite = True
    Else
        IsElite = False
    End If
    If IsHot = "Yes" Then
        IsHot = True
    Else
        IsHot = False
    End If

    Set rs = Server.CreateObject("adodb.recordset")
    If BatchType = 1 Then
        sql = "select * from PE_Product where ChannelID=" & ChannelID & " and ProductID in (" & BatchProductID & ")"
    Else
        sql = "select * from PE_Product where ChannelID=" & ChannelID & " and ClassID in (" & BatchClassID & ")"
    End If
    rs.Open sql, Conn, 1, 3
    Do While Not rs.EOF
        If Trim(Request("ModifyKeyword")) = "Yes" Then rs("Keyword") = Keyword
        If Trim(Request("ModifyUnit")) = "Yes" Then rs("Unit") = Unit
        If Trim(Request("ModifyStocks")) = "Yes" Then rs("Stocks") = Stocks
        If Trim(Request("ModifyAlarmNum")) = "Yes" Then rs("AlarmNum") = AlarmNum
        If Trim(Request("ModifyWeight")) = "Yes" Then rs("Weight") = Weight
        If Trim(Request("ModifySalePromotionType")) = "Yes" Then
            rs("SalePromotionType") = SalePromotionType
            rs("MinNumber") = MinNumber
            rs("PresentNumber") = PresentNumber
            rs("PresentID") = PresentID
        End If
        If Trim(Request("ModifyPresentPoint")) = "Yes" Then rs("PresentPoint") = PresentPoint
        If Trim(Request("ModifyPresentExp")) = "Yes" Then rs("PresentExp") = PresentExp
        If Trim(Request("ModifyPresentMoney")) = "Yes" Then rs("PresentMoney") = PresentMoney
        If Trim(Request("ModifyOnTop")) = "Yes" Then rs("OnTop") = OnTop
        If Trim(Request("ModifyElite")) = "Yes" Then rs("IsElite") = IsElite
        If Trim(Request("ModifyHits")) = "Yes" Then rs("Hits") = Hits
        If Trim(Request("ModifyStars")) = "Yes" Then rs("Stars") = Stars
        If Trim(Request("ModifyHot")) = "Yes" Then rs("IsHot") = IsHot
        If Trim(Request("ModifyUpdateTime")) = "Yes" Then rs("UpdateTime") = DateAdd("d", DateDiff("d", rs("UpdateTime"), UpdateTime), rs("UpdateTime"))
        If Trim(Request("ModifySkin")) = "Yes" Then rs("SkinID") = SkinID
        If Trim(Request("ModifyTemplate")) = "Yes" Then rs("TemplateID") = TemplateID
        rs("CreateTime") = rs("UpdateTime")
        rs.Update
        rs.MoveNext
    Loop
    rs.Close
    Set rs = Nothing
    Call ClearSiteCache(0)
    Call WriteSuccessMsg("批量修改" & ChannelShortName & "属性成功！", "Admin_Product.asp?ChannelID=" & ChannelID)
    Call CreateAllJS
End Sub


'******************************************************************************************
'以下为设置固顶、推荐等属性使用的函数，各模块实现过程类似，修改时注意同时修改各模块内容。
'******************************************************************************************

Sub SetProperty()
    If ProductID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请先选定" & ChannelShortName & "！</li>"
    End If
    If Action = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>参数不足！</li>"
    End If
    If FoundErr = True Then Exit Sub
    
    Dim sqlProperty, rsProperty
    If InStr(ProductID, ",") > 0 Then
        ProductID = ReplaceBadChar(ProductID)
        sqlProperty = "select * from PE_Product where ProductID in (" & ProductID & ")"
    Else
        ProductID = PE_CLng(ProductID)
        sqlProperty = "select * from PE_Product where ProductID=" & ProductID
    End If
    Set rsProperty = Server.CreateObject("ADODB.Recordset")
    rsProperty.Open sqlProperty, Conn, 1, 3
    Do While Not rsProperty.EOF
        If CheckClassPurview(Action, rsProperty("ClassID")) = False Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>对 " & rsProperty("Title") & " 没有操作权限！</li>"
        Else
            ClassID = rsProperty("ClassID")
            Select Case Action
            Case "SetOnTop"
                rsProperty("OnTop") = True
            Case "CancelOnTop"
                rsProperty("OnTop") = False
            Case "SetHot"
                rsProperty("IsHot") = True
            Case "CancelHot"
                rsProperty("IsHot") = False
            Case "SetElite"
                rsProperty("IsElite") = True
            Case "CancelElite"
                rsProperty("IsElite") = False
            Case "StartSale"
                rsProperty("EnableSale") = True
            Case "StopSale"
                rsProperty("EnableSale") = False
            End Select
            rsProperty("CreateTime") = rsProperty("UpdateTime")
            rsProperty.Update
        End If
        rsProperty.MoveNext
    Loop
    rsProperty.Close
    Set rsProperty = Nothing

    Call UpdateChannelData(ChannelID)
    Call ClearSiteCache(0)
    Call WriteSuccessMsg("操作成功！", "Admin_Product.asp?ChannelID=" & ChannelID & "")
    Call CreateAllJS
End Sub


'******************************************************************************************
'以下为移动至栏目、专题等操作使用的函数，各模块实现过程类似，修改时注意同时修改各模块内容。
'******************************************************************************************

Sub DoMoveToClass()
    If AdminPurview = 2 And AdminPurview_Channel > 2 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>对不起，你的权限不够！</li>"
        Exit Sub
    End If
    
    Dim ProductType, BatchProductID, BatchClassID
    Dim tClassID
    
    ProductType = PE_CLng(Trim(Request("ProductType")))
    BatchProductID = Trim(Request.Form("BatchProductID"))
    BatchClassID = FilterArrNull(Trim(Request.Form("BatchClassID")), ",")
    tClassID = Trim(Request("tClassID"))
    
    If ProductType = 1 Then
        If IsValidID(BatchProductID) = False Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请指定要批量移动的" & ChannelShortName & "的ID</li>"
        End If
    Else
        If IsValidID(BatchClassID) = False Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请指定要批量移动的" & ChannelShortName & "的栏目</li>"
        End If
    End If
    If tClassID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定目标栏目！不能指定为外部栏目。</li>"
    Else
        tClassID = PE_CLng(tClassID)
        If tClassID = 0 Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>目标栏目不允许添加" & ChannelShortName & "</li>"
        End If
    End If
    If FoundErr = True Then Exit Sub
    
    Dim rsBatchMove, sqlBatchMove, ProductPath
    sqlBatchMove = "select P.ProductID,P.UploadFiles,P.UpdateTime,C.ParentDir,C.ClassDir from PE_Product P left join PE_Class C on P.ClassID=C.ClassID"
    If ProductType = 1 Then
        sqlBatchMove = sqlBatchMove & " where P.ProductID in (" & BatchProductID & ")"
    Else
        sqlBatchMove = sqlBatchMove & " where P.ClassID in (" & BatchClassID & ")"
    End If
    BatchProductID = ""
    Set rsBatchMove = Conn.Execute(sqlBatchMove)
    Do While Not rsBatchMove.EOF
        ProductPath = HtmlDir & GetItemPath(StructureType, rsBatchMove("ParentDir"), rsBatchMove("ClassDir"), rsBatchMove("UpdateTime")) & GetItemFileName(FileNameType, ChannelDir, rsBatchMove("UpdateTime"), rsBatchMove("ProductID"))
        If BatchProductID = "" Then
            BatchProductID = rsBatchMove("ProductID")
        Else
            BatchProductID = BatchProductID & "," & rsBatchMove("ProductID")
        End If
        rsBatchMove.MoveNext
    Loop
    rsBatchMove.Close
    Set rsBatchMove = Nothing
    If BatchProductID <> "" Then
        Conn.Execute ("update PE_Product set ClassID=" & tClassID & ",TemplateID=0,CreateTime=UpdateTime where ProductID in (" & BatchProductID & ")")
    End If

    Call WriteSuccessMsg("成功将选定的" & ChannelShortName & "移动到目标频道的目标栏目中！", "Admin_Product.asp?ChannelID=" & ChannelID & "")
    Call ClearSiteCache(0)
End Sub

Sub Del()
    'On Error Resume Next
    If ProductID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请先选定" & ChannelShortName & "！</li>"
        Exit Sub
    End If
    
    Dim sqlDel, rsDel, ProductPath, FileExt
    Dim trs
    sqlDel = "select P.ProductID,P.ProductName,P.UpdateTime,P.CreateTime,P.Inputer,P.EnableSale,P.Deleted,P.ClassID,C.ParentDir,C.ClassDir from PE_Product P left join PE_Class C on P.ClassID=C.ClassID"
    If InStr(ProductID, ",") > 0 Then
        sqlDel = sqlDel & " where P.ProductID in (" & ProductID & ") order by P.ProductID"
    Else
        sqlDel = sqlDel & " where P.ProductID=" & ProductID
    End If
    Set rsDel = Server.CreateObject("ADODB.Recordset")
    rsDel.Open sqlDel, Conn, 1, 3
    Do While Not rsDel.EOF
        Set trs = Conn.Execute("select top 1 ItemID from PE_OrderFormItem where ProductID=" & rsDel("ProductID") & "")
        If trs.BOF And trs.EOF Then
            PurviewChecked = False
            ClassID = rsDel("ClassID")
            If AdminPurview = 1 Or AdminPurview_Channel <= 2 Or (rsDel("Inputer") = username And rsDel("EnableSale") = False) Then
                PurviewChecked = True
            Else
                PurviewChecked = CheckClassPurview(Action, ClassID)
            End If
            
            If PurviewChecked = False Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>删除 <font color=red>" & rsDel("Title") & "</font> 失败！原因：没有操作权限！</li>"
            Else
                
                ProductPath = HtmlDir & GetItemPath(StructureType, rsDel("ParentDir"), rsDel("ClassDir"), rsDel("UpdateTime")) & GetItemFileName(FileNameType, ChannelDir, rsDel("UpdateTime"), rsDel("ProductID"))
                If fso.FileExists(Server.MapPath(ProductPath & FileExt_Item)) Then
                    fso.DeleteFile Server.MapPath(ProductPath & FileExt_Item)
                End If
        
                rsDel("Deleted") = True
                rsDel("CreateTime") = rsDel("UpdateTime")
            End If
        Else
            FoundErr = True
            ErrMsg = ErrMsg & "<li>" & rsDel("ProductName") & "因为有订单，所以不能被删除！</li>"
        End If
        rsDel.Update
        rsDel.MoveNext
    Loop
    rsDel.Close
    Set rsDel = Nothing
    Call UpdateChannelData(ChannelID)
    Call ClearSiteCache(0)
    Call WriteSuccessMsg("操作成功！", "Admin_Product.asp?ChannelID=" & ChannelID & "")
    Call CreateAllJS
End Sub

Sub DelFile()
    If AdminPurview = 2 And AdminPurview_Channel > 2 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>对不起，你的权限不够！</li>"
        Exit Sub
    End If
    'On Error Resume Next
    If ProductID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请先选定" & ChannelShortName & "！</li>"
        Exit Sub
    End If
    
    Dim sqlDel, rsDel, ProductPath, FileExt
    sqlDel = "select P.ProductID,P.UpdateTime,C.ParentDir,C.ClassDir from PE_Product P left join PE_Class C on P.ClassID=C.ClassID where P.ProductID in (" & ProductID & ") order by P.ProductID"
    Set rsDel = Conn.Execute(sqlDel)
    Do While Not rsDel.EOF
        ProductPath = HtmlDir & GetItemPath(StructureType, rsDel("ParentDir"), rsDel("ClassDir"), rsDel("UpdateTime")) & GetItemFileName(FileNameType, ChannelDir, rsDel("UpdateTime"), rsDel("ProductID"))
        If fso.FileExists(Server.MapPath(ProductPath & FileExt_Item)) Then
            fso.DeleteFile Server.MapPath(ProductPath & FileExt_Item)
        End If
        Conn.Execute ("update PE_Product set CreateTime=UpdateTime where ProductID=" & ProductID & "")
        rsDel.MoveNext
    Loop
    rsDel.Close
    Set rsDel = Nothing
    Call CloseConn
    Response.Redirect ComeUrl
End Sub

Sub ConfirmDel()
    If AdminPurview = 2 And AdminPurview_Channel > 1 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>对不起，你的权限不够！</li>"
        Exit Sub
    End If
    If ProductID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请先选定" & ChannelShortName & "！</li>"
        Exit Sub
    End If
    
    Dim sqlDel, rsDel
    sqlDel = "select UploadFiles,VoteID from PE_Product where ProductID in (" & ProductID & ")"
    Set rsDel = Conn.Execute(sqlDel)
    Do While Not rsDel.EOF
        Call DelUploadFiles(rsDel("UploadFiles"))
        Conn.Execute ("delete from PE_Vote where ID=" & rsDel("VoteID") & "")
        rsDel.MoveNext
    Loop
    rsDel.Close
    Set rsDel = Nothing
    Conn.Execute ("delete from PE_Product where ProductID in (" & ProductID & ")")
    Conn.Execute ("delete from PE_Comment where ModuleType=" & ModuleType & " and InfoID in (" & ProductID & ")")
    Conn.Execute ("delete from PE_ConsumeLog where ModuleType=" & ModuleType & " and InfoID in (" & ProductID & ")")
    Call CloseConn
    Response.Redirect ComeUrl
End Sub

Sub ClearRecyclebin()
    If AdminPurview = 2 And AdminPurview_Channel > 1 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>对不起，你的权限不够！</li>"
        Exit Sub
    End If
    Dim sqlDel, rsDel
    ProductID = ""
    sqlDel = "select ProductID,UploadFiles,VoteID from PE_Product where Deleted=" & PE_True & ""
    Set rsDel = Conn.Execute(sqlDel)
    Do While Not rsDel.EOF
        If ProductID = "" Then
            ProductID = rsDel(0)
        Else
            ProductID = ProductID & "," & rsDel(0)
        End If
        Call DelUploadFiles(rsDel("UploadFiles"))
        Conn.Execute ("delete from PE_Vote where ID=" & rsDel("VoteID") & "")
        rsDel.MoveNext
    Loop
    rsDel.Close
    Set rsDel = Nothing
    If ProductID <> "" Then
        Conn.Execute ("delete from PE_Product where Deleted=" & PE_True & " and ChannelID=" & ChannelID & "")
        Conn.Execute ("delete from PE_Comment where ModuleType=" & ModuleType & " and InfoID in (" & ProductID & ")")
        Conn.Execute ("delete from PE_ConsumeLog where ModuleType=" & ModuleType & " and InfoID in (" & ProductID & ")")
    End If
    Call CloseConn
    Response.Redirect ComeUrl
End Sub

Sub Restore()
    If AdminPurview = 2 And AdminPurview_Channel > 1 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>对不起，你的权限不够！</li>"
        Exit Sub
    End If
    If ProductID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请先选定" & ChannelShortName & "！</li>"
        Exit Sub
    End If
    Dim sqlDel
    If InStr(ProductID, ",") > 0 Then
        Conn.Execute ("update PE_Product set Deleted=" & PE_False & " where ProductID in (" & ProductID & ")")
    Else
        Conn.Execute ("update PE_Product set Deleted=" & PE_False & " where ProductID=" & ProductID & "")
    End If

    Call UpdateChannelData(ChannelID)
    Call ClearSiteCache(0)
    Call WriteSuccessMsg("操作成功！", "Admin_Product.asp?ChannelID=" & ChannelID & "")
    Call CreateAllJS
End Sub

Sub RestoreAll()
    If AdminPurview = 2 And AdminPurview_Channel > 1 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>对不起，你的权限不够！</li>"
        Exit Sub
    End If
    Conn.Execute ("update PE_Product set Deleted=" & PE_False & " where Deleted=" & PE_True & "")
    Call UpdateChannelData(ChannelID)
    Call ClearSiteCache(0)
    Call WriteSuccessMsg("操作成功！", "Admin_Product.asp?ChannelID=" & ChannelID & "")
    Call CreateAllJS
End Sub




Sub SaveProducer(getProducer)
    Dim rsProducer, sqlProducer
    If getProducer = "" Then Exit Sub
    getProducer = ReplaceBadChar(getProducer) 
    Set rsProducer = Server.CreateObject("adodb.recordset")
    sqlProducer = "Select * from PE_Producer Where ChannelID=" & ChannelID & " and ProducerName='" & getProducer & "'"
    rsProducer.Open sqlProducer, Conn, 1, 3
    If rsProducer.BOF And rsProducer.EOF Then
        rsProducer.AddNew
        rsProducer("ChannelID") = ChannelID
        rsProducer("ProducerName") = getProducer
        rsProducer("LastUseTime") = Now()
        rsProducer.Update
    Else
        rsProducer("LastUseTime") = Now()
        rsProducer.Update
    End If
    rsProducer.Close
    Set rsProducer = Nothing
End Sub

Sub SaveTrademark(getTrademark)
    Dim rsTrademark, sqlTrademark
    If getTrademark = "" Then Exit Sub
    getTrademark = ReplaceBadChar(getTrademark) 
    Set rsTrademark = Server.CreateObject("adodb.recordset")
    sqlTrademark = "Select * from PE_Trademark Where ChannelID=" & ChannelID & " and TrademarkName='" & getTrademark & "'"
    rsTrademark.Open sqlTrademark, Conn, 1, 3
    If rsTrademark.BOF And rsTrademark.EOF Then
        rsTrademark.AddNew
        rsTrademark("ChannelID") = ChannelID
        rsTrademark("TrademarkName") = getTrademark
        rsTrademark.Update
    End If
    rsTrademark.Close
    Set rsTrademark = Nothing
End Sub



Sub DelUploadFiles(strUploadFiles)
    On Error Resume Next
    If Trim(strUploadFiles) = "" Or ObjInstalled_FSO <> True Then Exit Sub
    Dim arrUploadFiles, strFileName, i
    If InStr(strUploadFiles, "|") > 0 Then
        arrUploadFiles = Split(strUploadFiles, "|")
        For i = 0 To UBound(arrUploadFiles)
            If Trim(arrUploadFiles(i)) <> "" Then
                strFileName = InstallDir & ChannelDir & "/" & UploadDir & "/" & arrUploadFiles(i)
                If fso.FileExists(Server.MapPath(strFileName)) Then
                    fso.DeleteFile (Server.MapPath(strFileName))
                End If
            End If
        Next
    Else
        strFileName = InstallDir & ChannelDir & "/" & strUploadFiles
        If fso.FileExists(Server.MapPath(strFileName)) Then
            fso.DeleteFile (Server.MapPath(strFileName))
        End If
    End If
End Sub

Sub GetComment(InfoID)
    Dim rsComment, sql
    Response.Write "<br>"
    Response.Write "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'><tr><td><strong>相关评论：</strong><br>"
    sql = "select * from PE_Comment where ModuleType=" & ModuleType & " and InfoID=" & InfoID
    Set rsComment = Conn.Execute(sql)
    If rsComment.EOF Then
        Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;暂时没有任何人对本" & ChannelShortName & "发表评论"
    Else
        Response.Write "<table width='100%' border='0' cellspacing='1' cellpadding='2' class='border' style='word-break:break-all'>"
        Response.Write "  <tr align='center' class='title'>"
        Response.Write "    <td width='30' height='22'><strong>ID</strong></td>"
        Response.Write "    <td height='22'><strong>内容</strong></td>"
        Response.Write "    <td width='60' height='22'><strong>评论人</strong></td>"
        Response.Write "    <td width='120' height='22'><strong>评论人IP</strong></td>"
        Response.Write "    <td width='120' height='22'><strong>评论时间</strong></td>"
        Response.Write "    <td width='100' height='22'><strong>操作</strong></td>"
        Response.Write "  </tr>"
        Do While Not rsComment.EOF
            Response.Write "  <tr class='tdbg'>"
            Response.Write "    <td width='30' align='center'>" & rsComment("CommentID") & "</td>"
            Response.Write "    <td><a href=# title='" & rsComment("Content") & "'>" & Left(rsComment("Content"), 25) & "</a>" & "</td>"
            Response.Write "    <td width='60' align='center'>" & rsComment("UserName") & "</td>"
            Response.Write "    <td width='120' align='center'>" & rsComment("IP") & "</td>"
            Response.Write "    <td width='120' align='center'>" & rsComment("WriteTime") & "</td>"
            Response.Write "    <td width='100' align='center'>"
            If AdminPurview = 1 Or AdminPurview_Channel = 1 Then
                If rsComment("ReplyName") <> "" Then
                    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;"
                Else
                    Response.Write "<a href='Admin_Comment.asp?ChannelID=" & ChannelID & "&Action=Reply&CommentID=" & rsComment("Commentid") & "'>回复</a>&nbsp;&nbsp;"
                End If
                Response.Write "<a href='Admin_Comment.asp?ChannelID=" & ChannelID & "&Action=Modify&CommentID=" & rsComment("Commentid") & "'>修改</a>&nbsp;&nbsp;"
                Response.Write "<a href='Admin_Comment.asp?ChannelID=" & ChannelID & "&Action=Del&CommentID=" & rsComment("CommentID") & "'>删除</a>"
            End If
            Response.Write "</td></tr>"
            If rsComment("ReplyName") <> "" Then
                Response.Write "<tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'""> "
                Response.Write "<td align='center'>&nbsp;</td>"
                Response.Write "<td colspan='4'>管理员【" & rsComment("ReplyName") & "】于 " & rsComment("ReplyTime") & " 回复：<br><div style='padding:0px 20px'>" & rsComment("ReplyContent") & "</div></td>"
                Response.Write "<td align='center'><a href='Admin_Comment.asp?ChannelID=" & ChannelID & "&Action=Reply&CommentID=" & rsComment("CommentID") & "'>修改回复内容</a></td>"
                Response.Write "</tr>"
            End If
            rsComment.MoveNext
        Loop
        Response.Write "</table>"
    End If
    rsComment.Close
    Set rsComment = Nothing
    Response.Write "</td></tr></table>"
End Sub


Function CheckClassPurview(Action, ClassID)
    Dim PurviewType, PurviewChecked, CheckParentPath, i
    PresentExp = 0
    If ClassID = "" Or IsNull(ClassID) Or Not IsNumeric(ClassID) Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>未指定所属栏目，或者指定的栏目不允许此操作！</li>"
    Else
        PurviewType = LCase(Action)
        ClassID = PE_CLng(ClassID)
        Select Case ClassID
        Case 0
            FoundErr = True
            ErrMsg = ErrMsg & "<li>指定的栏目不允许此操作！</li>"
        Case -1
            If AdminPurview = 2 And AdminPurview_Channel >= 3 And PurviewType <> "show" And PurviewType <> "preview" Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>对不起，你的权限不够！</li>"
            Else
                ClassName = "不指定任何栏目"
                Depth = -1
                ParentPath = ""
            End If
        Case Else
            Set tClass = Conn.Execute("select ClassName,ClassType,Depth,ParentID,ParentPath,Child,EnableAdd,PresentExp from PE_Class where ClassID=" & ClassID)
            If tClass.BOF And tClass.EOF Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>找不到指定的栏目！</li>"
            Else
                ClassName = tClass("ClassName")
                Depth = tClass("Depth")
                ParentPath = tClass("ParentPath")
                ParentID = tClass("ParentID")
                Child = tClass("Child")
                PresentExp = tClass("PresentExp")

                If PurviewType = "saveadd" Or PurviewType = "savemodify" Or PurviewType = "input" Then
                    If Child > 0 And tClass("EnableAdd") = False Then
                        FoundErr = True
                        ErrMsg = ErrMsg & "<li>指定的栏目不允许添加" & ChannelShortName & "</li>"
                    End If
                    If tClass("ClassType") = 2 Then
                        FoundErr = True
                        ErrMsg = ErrMsg & "<li>不能指定为外部栏目</li>"
                    End If
                End If
                If AdminPurview = 2 And AdminPurview_Channel = 3 Then
                    If ParentID > 0 Then
                        CheckParentPath = ParentPath & "," & ClassID
                    Else
                        CheckParentPath = ClassID
                    End If
                    Select Case PurviewType
                    Case "show", "preview"
                        PurviewChecked = CheckPurview_Class(arrClass_View, CheckParentPath)
                    Case "saveadd", "savemodify", "input"
                        PurviewChecked = CheckPurview_Class(arrClass_Input, CheckParentPath)
                    'Case "setpassed", "cancelpassed"
                    '    PurviewChecked = CheckPurview_Class(arrClass_Check, CheckParentPath)
                    Case Else
                        PurviewChecked = CheckPurview_Class(arrClass_Manage, CheckParentPath)
                    End Select
                    If PurviewChecked = False Then
                        FoundErr = True
                        ErrMsg = ErrMsg & "<li>对不起，你没有栏目的相应操作权限！</li>"
                    End If
                End If
            End If
            Set tClass = Nothing
        End Select
    End If
    If FoundErr = True Then
        CheckClassPurview = False
    Else
        CheckClassPurview = True
    End If
End Function

'******************************************************************************************
'以下为各模块单独使用的函数部分，仅在此模块中使用。
'******************************************************************************************

Function GetProductThumb(strUrl)
    If strUrl = "" Then
        GetProductThumb = InstallDir & "images/nopic.gif"
        Exit Function
    End If
    If Left(strUrl, 1) <> "/" And InStr(strUrl, "://") <= 0 Then
        GetProductThumb = InstallDir & ChannelDir & "/" & UploadDir & "/" & strUrl
    Else
        GetProductThumb = strUrl
    End If
End Function

Function GetAllUnit()
    Dim rsUnit, strUnit
    Set rsUnit = Conn.Execute("select DISTINCT Unit from PE_Product")
    strUnit = strUnit & "<option value=''>请选择</option>"
    Do While Not rsUnit.EOF
        strUnit = strUnit & "<option value='" & rsUnit(0) & "'>" & rsUnit(0) & "</option>"
        rsUnit.MoveNext
    Loop
    Set rsUnit = Nothing
    GetAllUnit = strUnit
End Function

Function GetAllModel()
    Dim rsModel, strModel
    Set rsModel = Conn.Execute("select DISTINCT top 50 ProductModel from PE_Product")
    Do While Not rsModel.EOF
        strModel = strModel & "<option value='" & rsModel(0) & "'>" & rsModel(0) & "</option>"
        rsModel.MoveNext
    Loop
    Set rsModel = Nothing
    GetAllModel = strModel
End Function

Function GetAllStandard()
    Dim rsStandard, strStandard
    Set rsStandard = Conn.Execute("select DISTINCT top 50 ProductStandard from PE_Product")
    Do While Not rsStandard.EOF
        strStandard = strStandard & "<option value='" & rsStandard(0) & "'>" & rsStandard(0) & "</option>"
        rsStandard.MoveNext
    Loop
    Set rsStandard = Nothing
    GetAllStandard = strStandard
End Function

Function Price2Str(val1)
    If IsNull(val1) Then
        Price2Str = ""
        Exit Function
    End If
    If val1 = 0 Then
        Price2Str = ""
        Exit Function
    End If
    Price2Str = FormatNumber(val1, 2, vbTrue, vbFalse, vbTrue)
End Function

Private Sub ShowManagePath(RootName)
    Response.Write "您现在的位置：&nbsp;" & ChannelName & "管理&nbsp;&gt;&gt;&nbsp;<a href='" & FileName & "'>" & RootName & "</a>&nbsp;&gt;&gt;&nbsp;"
    If ClassID > 0 Then
        If ParentID > 0 Then
            Dim sqlPath, rsPath
            sqlPath = "select ClassID,ClassName from PE_Class where ClassID in (" & ParentPath & ") order by Depth"
            Set rsPath = Conn.Execute(sqlPath)
            Do While Not rsPath.EOF
                Response.Write "<a href='" & FileName & "&ClassID=" & rsPath(0) & "'>" & rsPath(1) & "</a>&nbsp;&gt;&gt;&nbsp;"
                rsPath.MoveNext
            Loop
            rsPath.Close
            Set rsPath = Nothing
        End If
        Response.Write "<a href='" & FileName & "&ClassID=" & ClassID & "'>" & ClassName & "</a>&nbsp;&gt;&gt;&nbsp;"
    End If
    If ManageType = "My" Then
        Response.Write "<font color=red>" & username & "</font> 添加的" & ChannelShortName & ""
    Else
        Select Case SearchType
        Case 0
            Response.Write "所有" & ChannelShortName & ""
        Case 1
            Response.Write "正在销售的" & ChannelShortName & ""
        Case 2
            Response.Write "未销售的" & ChannelShortName & ""
        Case 3
            Response.Write "正常销售的" & ChannelShortName & ""
        Case 4
            Response.Write "涨价" & ChannelShortName & ""
        Case 5
            Response.Write "特价" & ChannelShortName & ""
        Case 6
            Response.Write "降价" & ChannelShortName & ""
        Case 7
            Response.Write "促销礼品" & ChannelShortName & ""
        Case 8
            Response.Write "有促销活动的" & ChannelShortName & ""
        Case 9
            Response.Write "实际库存报警的" & ChannelShortName & ""
        Case 10
            Response.Write "预订库存报警的" & ChannelShortName & ""
        Case 11
            Response.Write "已售完的" & ChannelShortName & ""
        Case 12
            Response.Write "所有固顶的" & ChannelShortName & ""
        Case 13
            Response.Write "所有热卖" & ChannelShortName & ""
        Case 14
            Response.Write "所有推荐" & ChannelShortName & ""
        Case 15
            Response.Write "所有批发的" & ChannelShortName & ""
        Case Else
            Select Case strField
                Case "ProductNum"
                    Response.Write ChannelShortName & "编号中含有 <font color=red>" & Keyword & "</font> "
                Case "ProductName"
                    Response.Write ChannelShortName & "名称中含有 <font color=red>" & Keyword & "</font> "
                Case "ProductIntro"
                    Response.Write ChannelShortName & "简介中含有 <font color=red>" & Keyword & "</font> "
                Case "ProductExplain"
                    Response.Write ChannelShortName & "介绍中含有 <font color=red>" & Keyword & "</font> "
                Case "Inputer"
                    Response.Write "<font color=red>" & Keyword & "</font> 添加"
                Case "ProducerName"
                    Response.Write "厂商为 <font color=red>" & Keyword & "</font> "
                Case "TrademarkName"
                    Response.Write "品牌为 <font color=red>" & Keyword & "</font> "
                Case Else
                    Response.Write ChannelShortName & "名称中含有 <font color=red>" & Keyword & "</font> "
            End Select
            Response.Write "的" & ChannelShortName
        End Select
    End If
End Sub
%>
<script language='VBscript'  src='../js/hzzpy.js'></script>
