<%
function ProMenu(PID)
Dim str,rs,sql,AutoUrl
if PID="" then PID=0
sql="select ID,SortName from ["&Datapre&"_ProductSort] where Viewflag and ParentID="&PID&" order by ID"
set rs=db(sql,2)
if rs.eof then
PID=db("select ParentID from ["&Datapre&"_ProductSort] where Viewflag and ID="&PID&"",1)(0)
rs.close:set rs=nothing
sql="select ID,SortName from ["&Datapre&"_ProductSort] where Viewflag and ParentID="&PID&" order by ID"
set rs=db(sql,2)
end if
if not rs.eof then
do while not rs.eof
if IsHtml=1 then
AutoUrl=""&ProSortName&""&Separated&""&rs("ID")&Separated&"1."&HTMLName&""
else
AutoUrl="ProductList.asp?SortID="&rs(0)&""
end if
str=str&"<li><a href='"&AutoUrl&"'><span>"&rs(1)&"</span></a></li>"
rs.movenext
loop
end if
rs.close:set rs=nothing
ProMenu=str
end function

'产品列表 调用方法：ProList(分类ID,分类路径)
Function ProList(ID, SortPath,pwidth,pheight)
    Dim rs, sql,StringText
    Dim HideSort
	StringText=""   
    If ID = "" Then SortPath = "0,"
    
    Dim idCount
    Dim pages
    pages = ProInfo
    Dim pagec
    Dim page
    page = CLng(request("Page"))
    Dim pagenc
    pagenc = 5
    Dim pagenmax
    Dim pagenmin
    Dim pageprevious
    Dim pagenext
    'datafrom = ""&Datapre&"_Products"
    Dim datawhere
    datawhere = "where ViewFlag and Instr(SortPath,'"&SortPath&"')>0 "&HideSort& " "
    Dim sqlid
    Dim Myself, PATH_INFO, QUERY_STRING
    PATH_INFO = request.servervariables("PATH_INFO")
    QUERY_STRING = request.ServerVariables("QUERY_STRING")
    If QUERY_STRING = "" Then
        Myself = PATH_INFO & "?"
    ElseIf InStr(PATH_INFO & "?" & QUERY_STRING, "Page=") = 0 Then
        Myself = PATH_INFO & "?" & QUERY_STRING & "&"
    Else
        Myself = Left(PATH_INFO & "?" & QUERY_STRING, InStr(PATH_INFO & "?" & QUERY_STRING, "Page=") -1)
    End If
    Dim taxis
    taxis = "order by OrderNum,id desc "
    Dim i
    sql = "select count(ID) as idCount from ["&Datapre&"_Products]" & datawhere
    Set rs = db(sql,4)
    idCount = rs("idCount")
    If(idcount>0) Then
    If(idcount Mod pages = 0)Then
    pagec = Int(idcount / pages)
Else
    pagec = Int(idcount / pages) + 1
End If
sql = "select id from ["&Datapre&"_Products] " & datawhere & taxis
Set rs = db(sql,2)
rs.pagesize = pages
If page < 1 Then page = 1
If page > pagec Then page = pagec
If pagec > 0 Then rs.absolutepage = page
For i = 1 To rs.pagesize
    If rs.EOF Then Exit For
    If(i = 1)Then
    sqlid = rs("id")
Else
    sqlid = sqlid &","&rs("id")
End If
rs.movenext
Next
End If
If(idcount>0 And sqlid<>"") Then
sql = "select ID,ProductName,smallpic from ["&Datapre&"_Products] where id in("& sqlid &") "&taxis
Set rs = db(sql,4)
StringText=StringText&"<ul>"&vbCrLf
Dim AutoLink
While Not rs.EOF
    If ISHTML = 1 Then
        AutoLink = ""&ProName&""&Separated&""&rs("ID")&"."&HTMLName&""
    Else
        AutoLink = "ProductView.Asp?ID="&rs("ID")&""
    End If
StringText=StringText&"<li><a title="""&rs("ProductName")&""" href="""&AutoLink&"""><img width="""&pwidth&""" height="""&pheight&""" src='"&rs("smallpic")&"'><span>"&rs("ProductName")&"</span></a></li>"&vbCrLf
    rs.movenext
Wend
StringText=StringText&"</ul>"&vbCrLf
Else
StringText=StringText&"<center>暂无相关信息</center>"
    Exit Function
End If
StringText=StringText&"<div class=""clear""></div>"
StringText=StringText&"<div class=""page_list"">"&vbcrlf
StringText=StringText&"<div class=""list_info"">共"&idcount&"条&nbsp;&nbsp;"&pages&"条/页&nbsp;&nbsp;<span class=""disabled"">&nbsp;"&vbcrlf

pagenmin = page - pagenc
pagenmax = page+pagenc
If(pagenmin<1) Then pagenmin = 1
If ISHTML = 1 Then
    If ID = "" Then
        If(page>1) Then StringText=StringText&"<span><a href="""&ProSortName&""&Separated&"1."&HTMLName&""" title=""回到第一页"">&nbsp;&lt;&lt;&nbsp;</a></span>"
    Else
        If(page>1) Then StringText=StringText&"<span><a href="""&ProSortName&""&Separated&""&ID&""&Separated&"1."&HTMLName&""" title=""回到第一页"">&nbsp;&lt;&lt;&nbsp;</a></span> "
    End If
Else
    If(page>1) Then StringText=StringText&"<span><a href="""& myself &"Page=1"" title=""回到第一页"">&nbsp;&lt;&lt;&nbsp;</a> </span>"
End If
If page - (pagenc * 2 + 1)<= 0 Then
    pageprevious = 1
Else
    pageprevious = page - (pagenc * 2 + 1)
End If
If ISHTML = 1 Then
    If ID = "" Then
        If(pagenmin>1) Then StringText=StringText&"<span><a href="""&ProSortName&""&Separated&""&pageprevious&"."&HTMLName&""" title=""第"& pageprevious &"页"">&nbsp;&lt;&nbsp;</a></span>"
    Else
        If(pagenmin>1) Then StringText=StringText&"<span><a href="""&ProSortName&""&Separated&""&ID&""&Separated&""&pageprevious&"."&HTMLName&""" title=""第"& pageprevious &"页"">&nbsp;&lt;&lt;&nbsp;</a></span>"
    End If
Else
    If(pagenmin>1) Then StringText=StringText&"<a href="""& myself &"Page="& pageprevious &""" title=""第"& pageprevious &"页"">&nbsp;&lt;&lt;&nbsp;</a> "
End If
If(pagenmax>pagec) Then pagenmax = pagec
For i = pagenmin To pagenmax
    If(i = page) Then
    StringText=StringText&"&nbsp;<span class=""current"">"& i &"</span>&nbsp;"
Else
    If ISHTML = 1 Then
        If ID = "" Then
           StringText=StringText&"<a href="""&ProSortName&""&Separated&""&i&"."&HTMLName&""">"& i &"</a>"
        Else
           StringText=StringText&"<a href="""&ProSortName&""&Separated&""&ID&""&Separated&""&i&"."&HTMLName&""">"& i &"</a>"
        End If
    Else
       StringText=StringText&"<a href="""& myself &"Page="&i&""">"& i &"</a>"
    End If
End If
Next
If page+(pagenc * 2 + 1)>= pagec Then
    pagenext = pagec
Else
    pagenext = page+(pagenc * 2 + 1)
End If
If ISHTML = 1 Then
    If ID = "" Then
        If(pagenmax<pagec) Then StringText=StringText&" <a href="""&ProSortName&""&Separated&""&pagenext&"."&HTMLName&""" title=""跳转到第"&pagenext&"页"">&nbsp;&gt;&gt;&nbsp;</a> "
        If(page<pagec) Then StringText=StringText&" <a href="""&ProSortName&""&Separated&""&pagec&"."&HTMLName&""" title=""跳转到第"&pagec&"页"">&nbsp;&gt;&gt;&nbsp;</a>"
    Else
        If(pagenmax<pagec) Then StringText=StringText&" <a href="""&ProSortName&""&Separated&""&ID&""&Separated&""&pagenext&"."&HTMLName&""" title=""跳转到第"&pagenext&"页"">&nbsp;&gt;&gt;&nbsp;</a> "
        If(page<pagec) Then StringText=StringText&" <a href="""&ProSortName&""&Separated&""&ID&""&Separated&""&pagec&"."&HTMLName&""" title=""跳转到第"&pagec&"页"">&nbsp;&gt;&gt;&nbsp;</a>"
    End If
Else
    If(pagenmax<pagec) Then StringText=StringText&" <a href="""& myself &"Page="& pagenext &""" title=""跳转到第"&pagenext&"页"">&nbsp;&gt;&gt;&nbsp;</a> "
    If(page<pagec) Then StringText=StringText&" <a href="""& myself &"Page="& pagec &""" title=""跳转到第"&pagec&"页"">&nbsp;&gt;&gt;&nbsp;</a>"
End If
rs.Close
Set rs = Nothing
StringText=StringText&"</div></div>"&vbCrLf
ProList=StringText
End Function

Function Productcontent(ID)
Dim StringText
StringText=""
If ID = "" Or Not IsNumeric(ID) Then 
Call Alert("ID ErroR!","b-1"):response.end
ElseIf conn.Execute("select ID from ["&Datapre&"_Products] Where ViewFlag and  ID="&ID).EOF Then
StringText=StringText&" <center>信息不存在或不允许查看</center>"
Else
    Dim rs, sql,OtherPic    
    sql = "select OtherPic,UpdateTime,proper,proper_value,ProductName,Click_Count,BigPic,smallPic,Content from ["&Datapre&"_Products] where ViewFlag and ID="&ID
    set rs=db(sql,3)
    OtherPic = rs("OtherPic")
    If Not(IsNull(OtherPic)) and OtherPic<>"" Then
        OtherPic = Split(OtherPic, "*")
    End If
End If
StringText=StringText&"<table align=""center"">"
StringText=StringText&" <tr>"
StringText=StringText&"<td style=""line-height:200%;width:400px;"">产品名称："&rs("ProductName")&"<hr>"
StringText=StringText&"更新时间："&FormatDate(rs("updatetime"),13)&"<hr />"

Dim proper,proper_value,proper_1 ,proper_value_1,i
proper = rs("proper")
proper_value = rs("proper_value")
If proper <>"" and proper_value <> "" Then
    proper_1 = Split(proper, "§§§")
    proper_value_1 = Split(proper_value, "§§§")
For i = 0 To UBound(proper_value_1)
           StringText=StringText&" "&proper_1(i)&"："&proper_value_1(i)&"<hr />"
Next
End If
           StringText=StringText&" 浏览次数："
            StringText=StringText&"<script language=""javascript"" src=""HitCount.Asp?id="&ID&"&LX="&Datapre&"_Products""></script>"
           StringText=StringText&" <script language=""javascript"" src=""HitCount.Asp?action=count&LX="&Datapre&"_Products&id="&ID&"""></script>"
           StringText=StringText&"<hr />"
        If Not(isnull(OtherPic)) and OtherPic<>"" Then
           StringText=StringText&"<strong style=""color:red"">更多产品图片：</strong><br />"

Dim htmlshop
For htmlshop = 1 To UBound(OtherPic)

StringText=StringText&" <a href="""&trim(OtherPic(htmlshop))&""" title=""多图展示："&rs("ProductName")&""" rel=""lightbox[otherpic]""><img src="""&trim(OtherPic(htmlshop))&""" width=""110"" style=""border:1px solid #ccc; margin-left:5px; margin-right:5px; margin-top:5px""></a>"

Next
End If
StringText=StringText&"<br /></td>"
StringText=StringText&"<td style=""width:280px; text-align:center""><a href="""&rs("BigPic")&""" title="""&rs("ProductName")&""" rel=""lightbox""><img src="""&rs("BigPic")&""" width=""280"" title="""&rs("ProductName")&""" style=""border:1px #ccc"" border=""0""></a><br />"
StringText=StringText&"</td>"
StringText=StringText&"</tr>"
StringText=StringText&"<tr>"
StringText=StringText&"<td colspan=""2""><Strong>产品详细介绍：</Strong></td>"
StringText=StringText&"</tr>"
StringText=StringText&"<tr>"
StringText=StringText&"<td colspan=""2"" style=""line-height:200%"">"&rs("Content")&"</td>"
StringText=StringText&"</tr>"
StringText=StringText&"</table>"
rs.update
rs.Close:Set rs = Nothing
Productcontent=StringText
End Function 	
%>