<%
'判断是否为空
Function ChkIsNull(Str,Msg)
	IF Str="" Then
		Response.Write "<script type='text/javascript'>"
		Response.Write "alert('" & Msg & "');"
		Response.Write "window.history.back(-1);"
		Response.Write "</script>"
		Response.End()
	End IF
End Function

'判断是否为数值
Function ChkIsNumber(Str,Msg)
	IF Not Isnumeric(Str) Then
		Response.Write "<script type='text/javascript'>"
		Response.Write "alert('" & Msg & "');"
		Response.Write "window.history.back(-1);"
		Response.Write "</script>"
		Response.End()
	End IF
End Function

'判断是否为数值
Function ChkIsNumbers(Str,Msg,Url)
	IF Not Isnumeric(Str) Then
		Response.Write "<script type='text/javascript'>"
		Response.Write "alert('" & Msg & "');"
		Response.Write "window.location.href='"&Url&"';"
		Response.Write "</script>"
		Response.End()
	End IF
End Function

'判断是否为数值
Function ChkNumber(Str,Msg)
	IF Not Isnumeric(Str) Then
		Response.Write Msg
		Response.End()
	End IF
End Function

Sub Success(Msg,Url)
	Response.Write "<script type='text/javascript'>"
	Response.Write "alert('" & Msg & "');"
	Response.Write "window.location.href='" & Url & "';"
	Response.Write "</script>"
	Response.End()
End Sub

Sub IsError(Msg)
	Response.Write "<script type='text/javascript'>"
	Response.Write "alert('" & Msg & "');"
	Response.Write "window.history.back(-1);"
	Response.Write "</script>"
	Response.End()
End Sub

  sub ok(str,url)
      response.Write "<script language=javascript>alert ('"&str&"');"
	  response.Write "window.document.location.href='"&url&"';"
	  response.Write "</script>"
  end sub

Sub ChkLogin(Login)
	IF Login="" OR Login=NULL Then
		Response.Write "<script type='text/javascript'>"
		Response.Write "alert('请返回到登陆页登陆!');"
		Response.Write "window.location.href='login.asp';"
		Response.Write "</script>"
		Response.End()
	End IF 
End Sub
'SQL过滤
Function Checkstr(Str) 
	if isnull(Str) then
	   checkStr = ""
	   exit Function
	else
	   Str=replace(Str,"'","")
	   Str=replace(Str,";","")
	   Str=replace(Str,"--","")
	   checkStr=Str
	end if
End Function

'后台各页面的分页函数:当前页码，   总记录数    每页显示记录数  文件名   参数条件
Function showpage(CurrentPage,TotalRecs,RecsPerPage,filename,queryChar)
	dim n,p,ii
	if TotalRecs mod RecsPerPage=0 then
		n= TotalRecs \ RecsPerPage
	else
		n= TotalRecs \ RecsPerPage+1
	end if
	If currentpage-1 mod 5=0 Then
		p=(currentpage-1) \ 5
	Else
		p=(currentpage-1) \ 5
	End If
 
	If currentPage=1 Then
		response.write "< "
	Else
		response.write "<a href='"&filename&querychar&"page="&Cstr(CurrentPage-1)&"' title='上一页'><</a> "
	End If
	If p*5>0 Then Response.Write "<a href='"&filename&querychar&"page="&Cstr(p*5)&"' title='Before5'>"&p*5&"</a>   "
	Response.Write "<b>"
	for ii=p*5+1 to P*5+5
		   If ii=currentPage Then
	          Response.Write "<span class='nav02_selected'>"+Cstr(ii)+"</span> "
		   Else
		      Response.Write "<a href='"&filename&querychar&"page="&Cstr(ii)&"' >"+Cstr(ii)+"</a>   "
		   End If
		If ii=n Then exit for
		'p=p+1
	next
	Response.Write "</b>"
	If ii<n Then Response.Write "<a href='"&filename&querychar&"page="&Cstr(ii)&"' title='After5' >"&P*5+6&"</a>"
	
	If currentPage=n Then
		Response.Write " >"
	Else
		Response.Write " <a href='"&filename&querychar&"page="&Cstr(CurrentPage+1)&"' title='下一页'>></a>"
	End If
End Function


'子分类递归
Function SubCategory(ParentID,Sapce)
	StrSql="SELECT * FROM T_Class WHERE ParentID=" & ParentID & " ORDER BY SortID DESC,ID ASC"
	SetRs Rs1,StrSql,conn,1,1
	IF Not Rs1.EOF Then
	Do While Not Rs1.EOF
	iCount = iCount + 1
	ClassName = Sapce & Rs1("ClassName")
	ClassID = Rs1("ID")
	%>	
	<option value="<%=ClassID%>" <%IF Cstr(ClassID)=Cstr(CID) Then Response.Write "Selected"%>><%=ClassName%></option>
	<%
		TempClassName = TempClassName & ClassName & ","
		TempClassID = TempClassID & ClassID & ","
		Sapce = Sapce + "&nbsp;&nbsp;&nbsp;&nbsp;"
		Call SubCategory(Rs1("ID"),Sapce)
	Rs1.movenext
	Loop
	End IF
	IF Len(Sapce)>24 Then
		Sapce = Left(Sapce,Len(Sapce)-24)
	Else
		Sapce = "&nbsp;&nbsp;&nbsp;&nbsp;"
	End IF
	DisRs Rs1
End Function

'==== 字串输出为指定的长度 ====
Function LeftStr(Str, Lennum)
  dim p_num
  dim i,x
  if strlen(str)<=lennum then
    LeftStr=str
  else
    p_num=0
    x=0
    do while not p_num > lennum-2
      x=x+1
      if asc(mid(str,x,1))<0 then
        p_num=int(p_num) + 2
      else
        p_num=int(p_num) + 1
      end if
      LeftStr=left(trim(str),x)&"..."
    loop
  end if
  response.write LeftStr
End Function

Function CutStr(Str,StrLen)
	Dim L,T,C
	l=len(Str)
	t=0
	For i=1 to l
	c=Abs(Asc(Mid(Str,i,1)))
	if c>255 then
	t=t+2
	else
	t=t+1
	end if
	if t>=StrLen - 1 then
	CutStr=left(Str,i)&"..."
	exit for
	else
	CutStr=Str
	end if
	next
	CutStr=replace(CutStr,chr(10),"")
End Function

Function StrLen(Str)
  dim p_len, xx
  p_len=0
  strlen=0
  if trim(str)<>"" then
    p_len=len(trim(str))
    for xx=1 to p_len
    if asc(mid(str,xx,1))<0 then
      strlen=int(strlen) + 2
    else
      strlen=int(strlen) + 1
    end if
    next
  end if
End Function
'===========================================
'新闻列表
Function NewsList(UserID,Recycle)
	Call ConnectionDataBase
	Sql = "SELECT ID,NewsTitle,AddTime FROM T_News WHERE Recycle="& Recycle &" AND UserID="&UserID&" ORDER BY SortID DESC,AddTime DESC,ID DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		Response.Write "对不起,目前没有相关记录!"
	Else
		n=0
		Rs.pagesize=12
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		Response.write "<input name='ChkBox' type='checkbox' value='"& Rs("ID") &"' />" & n+1 & "."
		%>
		<a href="vip_newsedit.asp?action=modi&id=<%=Rs("ID")%>"><%LeftStr Rs("NewsTitle"),30%></a> [<%=Formatdatetime(Rs("AddTime"),2)%>]<br />
		<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function
'新闻列表
Function NewsList1(UserID,Recycle)
	Call ConnectionDataBase
	Sql = "SELECT ID,NewsTitle,AddTime FROM T_News WHERE Recycle="& Recycle &" AND UserID="&UserID&" ORDER BY SortID DESC,AddTime DESC,ID DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		Response.Write "对不起,目前没有相关记录!"
	Else
		n=0
		Rs.pagesize=20
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		Response.write n+1 & "."
		%>
		<a href="unewsinfor.asp?UserID=<%=UserID%>&newsid=<%=Rs("ID")%>"><%LeftStr Rs("NewsTitle"),30%></a> [<%=Formatdatetime(Rs("AddTime"),2)%>]<br />
		<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

'促销信息
Function SalesList(UserID,Recycle)
	Call ConnectionDataBase
	Sql = "SELECT ID,NewsTitle,AddTime FROM T_Sales WHERE Recycle="& Recycle &" AND UserID="&UserID&" ORDER BY SortID DESC,AddTime DESC,ID DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		Response.Write "对不起,目前没有相关记录!"
	Else
		n=0
		Rs.pagesize=12
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		Response.write "<input name='ChkBox' type='checkbox' value='"& Rs("ID") &"' />" & n+1 & "."
		%>
		<a href="vip_salesedit.asp?action=modi&id=<%=Rs("ID")%>"><%LeftStr Rs("NewsTitle"),30%></a> [<%=Formatdatetime(Rs("AddTime"),2)%>]<br />
		<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

Sub SelectNewsList(ClassID,Length)
Call ConnectionDataBase
icount=1
img="images/new_80.gif"
IF ClassID=5 Then img="images/new_63.gif"
Sql = "SELECT Top 3 InfoID,Title,OnTop,UpdateTime FROM Cl_Article WHERE Deleted=0 AND ClassID="&ClassID&" ORDER BY OnTop asc,SortID DESC,UpdateTime DESC,InfoID DESC"
SetRs Rs,Sql,conn,1,1
Do While Not Rs.Eof
	newImg="images/new_71.gif"
	IF Rs("OnTop")=0 And Formatdatetime(Rs("UpdateTime"),2)<>Formatdatetime(now(),2) Then newImg="images/new_83.gif"
	classname="news_bline"
	IF icount=3 Then classname="news_blast"
%>
	<li class="<%=classname%>">
	  <div><strong>。</strong><a href="news_content.asp?id=<%=Rs("InfoID")%>"><%LeftStr Rs("Title"),Length%></a><br />
		<img src="<%=newImg%>" width="26" height="15" /><span class="h1">发布时间：[<%=Formatdatetime(Rs("UpdateTime"),2)%>]</span></div>
	  <img src="<%=img%>" class="top10" width="31" height="30" /> <br class="clear" />
	</li>
<%
icount=icount+1
Rs.Movenext
Loop
DisRs Rs
Call CloseDataBase
End Sub

'产品
Function ProductsList(UserID,Recycle)
	Call ConnectionDataBase
	Sql = "SELECT ID,ProName,ProPic,Price FROM T_Products WHERE Recycle="& Recycle &" And UserID="& UserID &" ORDER BY SortID DESC,AddTime DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		%>
      	<dl>
		<dd>对不起，暂时没有相关记录</dd>
		<dl>
		<%
	Else
		n=0
		Rs.pagesize=10
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		Css=""
		IF (n+1) mod 2=0 Then Css="class='probgcolor'"
		%>
		<dl <%=Css%>>
		<dt><input name='ChkBox' type='checkbox' value="<%=Rs("ID")%>" style="float:left" /><img src="/UpLoadFiles/Products/<%=Rs("ProPic")%>" width="100" height="65" style="float:left" /></dt><dd><%=Rs("ProName")%>&nbsp;</dd><dt><%=Rs("Price")%>&nbsp;</dt><dt><a href="vip_productsedit.asp?action=modi&id=<%=Rs("ID")%>">修改</a></dt>
		</dl>      
	<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

'产品
Function ProductsList1(UserID,Recycle,sqlwhere)
	Call ConnectionDataBase
	Sql = "SELECT ID,ProName,ProPic,Price FROM T_Products WHERE Recycle="& Recycle &" And UserID="& UserID & sqlwhere &" ORDER BY SortID DESC,AddTime DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		%>
      	对不起，暂时没有相关记录
		<%
	Else
		n=0
		Rs.pagesize=12
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		%>
		<li>
		<div style="height:96px;"><a href="uproductsinfor.asp?userid=<%=UserID%>&productid=<%=Rs("ID")%>"><img src="/UpLoadFiles/Products/<%=Rs("ProPic")%>" width="130" height="94" style="float:left" hspace="5" /></a></div>
		<div style="height:45px; padding-left:5px"><a href="uproductsinfor.asp?userid=<%=UserID%>&productid=<%=Rs("ID")%>"><%Response.Write "产品名称:" & Rs("ProName") & "</a><br/>产品价格:" & Rs("Price") %>元</div>
		<li>
  
	<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

Sub BaikeClass(bigid)
Call ConnectionDataBase
%>
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
  <%
  Sql="Select ID,ClassName From T_Class Where ParentID=0 And CateID="& bigid &" Order By SortID DESC,ID ASC"
  SetRs Rs,Sql,conn,1,1
  Do While Not Rs.Eof
  %>
  <tr>
	<td height="25"><a href="baikelist.asp?id=<%=Rs("ID")%>&bigid=<%=bigid%>" class="bkclassbig"><%=Rs("ClassName")%></a></td>
  </tr>
  <%
  Call SubBaikeClass(Rs("ID"),bigid)
  Rs.movenext
  Loop
  DisRs Rs
  Call CloseDataBase
  %>
  <tr>
	<td height="25">&nbsp;</td>
  </tr>
</table>
<%
End Sub

Sub SubBaikeClass(parentid,bigid)
Call ConnectionDataBase
%>
<tr>
	<td height="25">
	<table width="96%" border="0" align="right" cellpadding="0" cellspacing="0">
		<tr>
		  <td height="22" class="baikeclass">
		  <%
		  Sql1="Select ID,ClassName From T_Class Where ParentID="& parentid &" Order By SortID DESC,ID ASC"
		  SetRs Rs1,Sql1,conn,1,1
		  Do While Not Rs1.Eof
		  %>
		  <a href="baikelist.asp?id=<%=Rs1("ID")%>&bigid=<%=bigid%>" class="bkclasssmall"><%=Rs1("ClassName")%></a>
		  <%
		  Rs1.movenext
		  Loop
		  DisRs Rs1
		  %>
		  </td>
		</tr>
	</table>
	</td>
</tr>
<%
End Sub

Sub BaikePic(table,bigid)
	Call ConnectionDataBase
	Sql="Select Top 1 ID,FilePath From "& table &" Where [Position]=1 And Recycle=0 And FilePath<>'' Order By SortID DESC,ID DESC"
	SetRs Rs,Sql,conn,1,1
	IF Not Rs.Eof Then Response.Write("<a href='baikeinfor.asp?id="&Rs("ID")&"&bigid="&bigid&"'><img src='UpLoadFiles/Baike/"&Rs("FilePath")&"' width='120' height='86' /></a>")
	DisRs Rs
	Call CloseDataBase
End Sub

Sub BaikeTopOne(table,bigid)
	Call ConnectionDataBase
	Sql="Select Top 1 ID,NewsTitle,Content From "& table &" Where [Position]=2 And Recycle=0 Order By SortID DESC,ID DESC"
	SetRs Rs,Sql,conn,1,1
	IF Not Rs.Eof Then
	%>
	<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
	  <tr>
		<td height="28" align="center"><a href="baikeinfor.asp?id=<%=Rs("ID")%>&bigid=<%=bigid%>" class="fonttitle"><%=Rs("NewsTitle")%></a></td>
	  </tr>
	  <tr>
		<td class="fontcont" >
		<%
		Content=RemoveHTML(Rs("Content"))
		LeftStr Content,96
		%>[<a href="baikeinfor.asp?id=<%=Rs("ID")%>&bigid=<%=bigid%>" class="fontnews">更多</a>]</td>
	  </tr>
	</table>
	<%
	End IF
	DisRs Rs
	Call CloseDataBase
End Sub

Sub BaikeRecommend(table,bigid)
%>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="2" class="margintop">
  <tr>
    <%
	Call ConnectionDataBase
	Sql="Select Top 20 ID,NewsTitle,AddTime From "& table &" Where [Position]=3 And Recycle=0 Order By SortID DESC,ID DESC"
	SetRs Rs,Sql,conn,1,1
	n=0
	Do While Not Rs.Eof
	%>
	<td height="23" class="boderx"><a href="baikeinfor.asp?id=<%=Rs("ID")%>&bigid=<%=bigid%>" class="fontnews"><%LeftStr Rs("NewsTitle"),13%></a><em><font color="#969696" size="-1"><%=Formatdatetime(Rs("AddTime"),2)%></font></em></td>
	<%
	n=n+1
	IF n mod 2 =0 Then Response.Write("</tr><tr>")
	Rs.movenext
	Loop
	DisRs Rs
	Call CloseDataBase
	%>
  </tr>  
</table>
<%
End Sub

Sub BaikeTopHits(table,bigid)
%>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="0" class="margintop">
  <%
	Call ConnectionDataBase
	Sql="Select Top 15 ID,NewsTitle,AddTime From "& table &" Where Recycle=0 Order By Hits DESC,SortID DESC,ID DESC"
	SetRs Rs,Sql,conn,1,1
	Do While Not Rs.Eof
	%>
  <tr>
	<td height="23" class="boderx"><a href="baikeinfor.asp?id=<%=Rs("ID")%>&bigid=<%=bigid%>" class="fontnews"><%LeftStr Rs("NewsTitle"),13%></a><em><font color="#969696" size="-1"><%=Formatdatetime(Rs("AddTime"),2)%></font></em></td>
  </tr>
  <%
	Rs.movenext
	Loop
	DisRs Rs
	Call CloseDataBase
	%>
</table>
<%
End Sub

Function RemoveHTML(strHTML) 
	Dim objRegExp, Match, Matches 
	Set objRegExp = New Regexp 
	objRegExp.IgnoreCase = True 
	objRegExp.Global = True 
	'取闭合的<> 
	objRegExp.Pattern = "<.+?>" 
	'进行匹配 
	if strHTML = "" or IsNull(strHTML) then
	   RemoveHTML = ""
	else   
	Set Matches = objRegExp.Execute(strHTML) 
	' 遍历匹配集合，并替换掉匹配的项目 
	For Each Match in Matches 
	strHtml=Replace(strHTML,Match.Value,"") 
	Next 
	RemoveHTML=strHTML 
	end if
	Set objRegExp = Nothing 
End Function 

'百科列表
Function BaikeList(table,classid,bigid)
	Call ConnectionDataBase	
	Sql = "SELECT ID,NewsTitle,AddTime FROM "& table &" WHERE Recycle=0 AND (ClassID="&classid&" Or ClassID in (select id from t_class where parentid="&ClassID&")) ORDER BY SortID DESC,AddTime DESC,ID DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		Response.Write "<tr><td colspan='2'>对不起,目前没有相关记录!</td></tr>"
	Else
		n=0
		Rs.pagesize=15
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		%>
		<tr>
            <td height="30" class="boderx"><a href="baikeinfor.asp?id=<%=Rs("ID")%>&bigid=<%=bigid%>" class="fontnews"><%=Rs("NewsTitle")%></a></td>
            <td class="boderx"><em><font color="#969696" size="-1"><%=Formatdatetime(Rs("AddTime"),2)%></font></em></td>
          </tr>
		<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

'经典案例
Function CaseList(UserID,Recycle)
	Call ConnectionDataBase
	Sql = "SELECT ID,ProName,ProPic FROM T_Case WHERE Recycle="& Recycle &" And UserID="& UserID &" ORDER BY SortID DESC,AddTime DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		%>
      	<dl>
		<dd>对不起，暂时没有相关记录</dd>
		<dl>
		<%
	Else
		n=0
		Rs.pagesize=10
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		Css=""
		IF (n+1) mod 2=0 Then Css="class='probgcolor'"
		%>
		<dl <%=Css%>>
		<dt><input name='ChkBox' type='checkbox' value="<%=Rs("ID")%>" style="float:left" /><img src="/UpLoadFiles/Products/<%=Rs("ProPic")%>" width="100" height="65" style="float:left" /></dt><dd><%=Rs("ProName")%>&nbsp;</dd><dt><a href="vip_caseedit.asp?action=modi&id=<%=Rs("ID")%>">修改</a></dt>
		</dl>      
	<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

'案例
Function CaseList1(UserID,Recycle)
	Call ConnectionDataBase
	Sql = "SELECT ID,ProName,ProPic FROM T_Case WHERE Recycle="& Recycle &" And UserID="& UserID &" ORDER BY SortID DESC,AddTime DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		%>
      	对不起，暂时没有相关记录
		<%
	Else
		n=0
		Rs.pagesize=12
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		%>
		<li>
		<div style="height:96px;"><a href="ucaseinfor.asp?userid=<%=UserID%>&productid=<%=Rs("ID")%>"><img src="/UpLoadFiles/Products/<%=Rs("ProPic")%>" width="130" height="94" style="float:left" hspace="5" /></a></div>
		<div style="height:45px; padding-left:5px"><a href="ucaseinfor.asp?userid=<%=UserID%>&productid=<%=Rs("ID")%>"><%Response.Write "案例名称:" & Rs("ProName") & "</a>"%></div>
		<li>
  
	<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

'设计团队
Function TeamList(UserID,Recycle)
	Call ConnectionDataBase
	Sql = "SELECT ID,Post,ProName,ProPic FROM T_Team WHERE Recycle="& Recycle &" And UserID="& UserID &" ORDER BY SortID DESC,AddTime DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		%>
      	<dl>
		<dd>对不起，暂时没有相关记录</dd>
		<dl>
		<%
	Else
		n=0
		Rs.pagesize=10
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		Css=""
		IF (n+1) mod 2=0 Then Css="class='probgcolor'"
		%>
		<dl <%=Css%>>
		<dt><input name='ChkBox' type='checkbox' value="<%=Rs("ID")%>" style="float:left" /><img src="/UpLoadFiles/Products/<%=Rs("ProPic")%>" width="100" height="65" style="float:left" /></dt><dd><%=Rs("ProName")%>&nbsp;</dd><dt><%=Rs("Post")%>&nbsp;</dt><dt><a href="vip_teamedit.asp?action=modi&id=<%=Rs("ID")%>">修改</a></dt>
		</dl>      
	<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

'设计团队
Function TeamList1(UserID,Recycle)
	Call ConnectionDataBase
	Sql = "SELECT ID,ProName,ProPic,Post FROM T_Team WHERE Recycle="& Recycle &" And UserID="& UserID &" ORDER BY SortID DESC,AddTime DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		%>
      	对不起，暂时没有相关记录
		<%
	Else
		n=0
		Rs.pagesize=12
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		%>
		<li>
		<div style="height:96px;"><a href="uteaminfor.asp?userid=<%=UserID%>&productid=<%=Rs("ID")%>"><img src="/UpLoadFiles/Products/<%=Rs("ProPic")%>" width="130" height="94" style="float:left" hspace="5" /></a></div>
		<div style="height:45px; padding-left:5px"><a href="uteaminfor.asp?userid=<%=UserID%>&productid=<%=Rs("ID")%>"><%Response.Write "姓名:" & Rs("ProName") & "</a><br/>职务:" & Rs("Post") %></div>
		<li>
  
	<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

'人才招聘
Function JobList(UserID,Recycle)
	Call ConnectionDataBase
	Sql = "SELECT ID,Dept,PostName,Deal FROM T_Job WHERE Recycle="& Recycle &" And UserID="& UserID &" ORDER BY SortID DESC,AddTime DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		%>
      	<dl>
		<dd>对不起，暂时没有相关记录</dd>
		<dl>
		<%
	Else
		n=0
		Rs.pagesize=10
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		Css=""
		IF (n+1) mod 2=0 Then Css="class='probgcolor'"
		%>
		<dl <%=Css%>>
		<dt><input name='ChkBox' type='checkbox' value="<%=Rs("ID")%>" style="float:left" /><%=Rs("PostName")%></dt><dd><%=Rs("Dept")%>&nbsp;</dd><dt><%=Rs("Deal")%>&nbsp;</dt><dt><a href="vip_jobedit.asp?action=modi&id=<%=Rs("ID")%>">修改</a></dt>
		</dl>      
	<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

'人才招聘
Function JobList1(UserID,Recycle)
	Call ConnectionDataBase
	Sql = "SELECT * FROM T_Job WHERE Recycle="& Recycle &" AND UserID="&UserID&" ORDER BY SortID DESC,AddTime DESC,ID DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		Response.Write "对不起,目前没有相关记录!"
	Else
		n=0
		Rs.pagesize=2
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		%>
		部门:<%=Rs("Dept")%><br />
		岗位:<%=Rs("PostName")%><br />
		学历:
		<%For i=0 To UBOUND(EduClass)
			  IF Rs("Edu")=EduClass(i,0) Then
				  Response.Write EduClass(i,1)
				  Exit For
			  End iF
		Next%>
		<br />
		性别:<%=Rs("Sex")%><br />
		工作年限:
		<%For i=0 To UBOUND(WorkClass)
			  IF Rs("IsWork")=WorkClass(i,0) Then
				  Response.Write WorkClass(i,1)
				  Exit For
			  End iF
		Next%>
		<br />
		待遇:<%=Rs("Deal")%><br />
		工作地点:<%=Rs("Address")%><br />
		岗位描述:<%=Rs("Content")%><br /><hr />
		<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

'在线留言
Function MsgList(UserID,Recycle)
	Call ConnectionDataBase
	Sql = "SELECT ID,Title,UserName,Tel,IsRead FROM T_Message WHERE Recycle="& Recycle &" And UserID="& UserID &" ORDER BY AddTime DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		%>
      	<dl>
		<dd>对不起，暂时没有相关记录</dd>
		<dl>
		<%
	Else
		n=0
		Rs.pagesize=10
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		Css=""
		IF (n+1) mod 2=0 Then Css="class='probgcolor'"
		%>
		<dl <%=Css%>>
		<dd><input name='ChkBox' type='checkbox' value="<%=Rs("ID")%>" style="float:left" /><%LeftStr Rs("Title"),12%><%IF Rs("IsRead")=false Then Response.Write(" <font color='#ff0000'>[未读]</font>")%></dd><dt><%=Rs("UserName")%>&nbsp;</dt><dt><%=Rs("Tel")%>&nbsp;</dt><dt><a href="vip_msgedit.asp?action=modi&id=<%=Rs("ID")%>">查看</a></dt>
		</dl>      
	<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

'友情链接
Function LinkList(UserID,Recycle)
	Call ConnectionDataBase
	Sql = "SELECT ID,PicPath,LinkName,Url FROM T_FriendLink WHERE Recycle="& Recycle &" And UserID="& UserID &" ORDER BY SortID DESC,AddTime DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		%>
      	<dl>
		<dd>对不起，暂时没有相关记录</dd>
		<dl>
		<%
	Else
		n=0
		Rs.pagesize=10
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		Css=""
		IF (n+1) mod 2=0 Then Css="class='probgcolor'"
		%>
		<dl <%=Css%>>
		<dt><input name='ChkBox' type='checkbox' value="<%=Rs("ID")%>" style="float:left" /><img src="/UpLoadFiles/FriendLink/<%=Rs("PicPath")%>" width="100" style="float:left" /></dt><dd><%=Rs("Url")%>&nbsp;</dd><dt><%=Rs("LinkName")%>&nbsp;</dt><dt><a href="vip_linkedit.asp?action=modi&id=<%=Rs("ID")%>">修改</a></dt>
		</dl>      
	<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

'招标信息
Function ZbList(UserID,Recycle)
	Call ConnectionDataBase
	Sql = "SELECT TenderID,Title,EndTime,AddTime,Accept FROM T_Tender WHERE Recycle="& Recycle &" And UserID="& UserID &" ORDER BY SortID DESC,AddTime DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		%>
      	<dl>
		<dd>对不起，暂时没有相关记录</dd>
		<dl>
		<%
	Else
		n=0
		Rs.pagesize=10
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		Css=""
		IF (n+1) mod 2=0 Then Css="class='probgcolor'"
		%>
		<dl <%=Css%>>
		<dd><input name='ChkBox' type='checkbox' value="<%=Rs("TenderID")%>" style="float:left" /><a href="addzb_s.asp?id=<%=Rs("TenderID")%>" target="_blank"><%LeftStr Rs("Title"),10%></a><%IF DateDiff("d",now(),Rs("EndTime"))<0 OR Rs("Accept")>0 Then Response.Write("<font color='#ff0000'>[结束]</font>")%> </dd><dt>
		<%
		Sql="select nickname from t_users where ID=" & rs("Accept")
		SetRs Rs2,Sql,conn,1,1
		IF Not Rs2.Eof Then Response.Write Rs2("nickname")
		DisRs Rs2
		%>
		&nbsp; </dd><dt><%=Formatdatetime(Rs("EndTime"),2)%>&nbsp;</dt><dt><%=Formatdatetime(Rs("AddTime"),2)%>&nbsp;</dt><dt><a href="addzb.asp?action=modi&id=<%=Rs("TenderID")%>">修改</a></dt>
		</dl>      
	<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

'有问有答
Function AskList(UserID,Recycle)
	Call ConnectionDataBase
	Sql = "SELECT ID,ClassID,Title,AddTime,iCount FROM T_Ask WHERE Recycle="& Recycle &" And UserID="& UserID &" ORDER BY AddTime DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		%>
      	<dl>
		<dd>对不起，暂时没有相关记录</dd>
		<dl>
		<%
	Else
		n=0
		Rs.pagesize=10
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		Css=""
		IF (n+1) mod 2=0 Then Css="class='probgcolor'"
		strsql="select classname from t_class where id="&Rs("ClassID")
		SetRs Rs1,strsql,conn,1,1
		IF Not Rs1.Eof Then classname=Rs1("classname")
		DisRs Rs1
		%>
		<dl style="height:22px" <%=Css%>>
		<dd><input name='ChkBox' type='checkbox' value="<%=Rs("ID")%>" style="float:left" /><a href="wenweninfor.asp?id=<%=Rs("ID")%>" class="fontnews" target="_blank"><%LeftStr Rs("Title"),10%></a></dd><dt><%=classname%>&nbsp;</dt><dt><%=Rs("iCount")%></dt><dt><%=Formatdatetime(Rs("AddTime"),2)%>&nbsp;</dt><dt><a href="vip_askedit.asp?action=modi&id=<%=Rs("ID")%>">修改</a></dt>
		</dl>      
	<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

Sub AskNew()
%>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="2" class="margintop">
  <tr>
    <%
	Call ConnectionDataBase
	Sql="Select Top 40 ID,Title,AddTime From T_Ask Where Recycle=0 Order By ID DESC"
	SetRs Rs,Sql,conn,1,1
	n=0
	Do While Not Rs.Eof
	%>
	<td height="23" class="boderx"><a href="wenweninfor.asp?id=<%=Rs("ID")%>" class="fontnews"><%LeftStr Rs("Title"),13%></a><em><font color="#969696" size="-1"><%=Formatdatetime(Rs("AddTime"),2)%></font></em></td>
	<%
	n=n+1
	IF n mod 2 =0 Then Response.Write("</tr><tr>")
	Rs.movenext
	Loop
	DisRs Rs
	Call CloseDataBase
	%>
  </tr>  
</table>
<%
End Sub

Sub AskIsOver(isover)
%>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="0" class="margintop">
  <%
	Call ConnectionDataBase
	Sql="Select Top 10 ID,Title,AddTime From T_Ask Where isover="&isover&" Order By ID DESC"
	SetRs Rs,Sql,conn,1,1
	Do While Not Rs.Eof
	%>
  <tr>
	<td height="23" class="boderx"><a href="wenweninfor.asp?id=<%=Rs("ID")%>" class="fontnews"><%LeftStr Rs("Title"),13%></a><em><font color="#969696" size="-1"><%=Formatdatetime(Rs("AddTime"),2)%></font></em></td>
  </tr>
  <%
	Rs.movenext
	Loop
	DisRs Rs
	Call CloseDataBase
	%>
</table>
<%
End Sub

Sub AskTop()
%>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="0" class="margintop">
  <%
	Call ConnectionDataBase
	Sql="Select Top 10 ID,Title,AddTime From T_Ask Where Recycle=0 Order By iCount DESC,ID DESC"
	SetRs Rs,Sql,conn,1,1
	Do While Not Rs.Eof
	%>
  <tr>
	<td height="23" class="boderx"><a href="wenweninfor.asp?id=<%=Rs("ID")%>" class="fontnews"><%LeftStr Rs("Title"),13%></a><em><font color="#969696" size="-1"><%=Formatdatetime(Rs("AddTime"),2)%></font></em></td>
  </tr>
  <%
	Rs.movenext
	Loop
	DisRs Rs
	Call CloseDataBase
	%>
</table>
<%
End Sub

Sub AskClass(bigid)
Call ConnectionDataBase
%>
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
  <%
  Sql="Select ID,ClassName From T_Class Where ParentID=0 And CateID="& bigid &" Order By SortID DESC,ID ASC"
  SetRs Rs,Sql,conn,1,1
  Do While Not Rs.Eof
  %>
  <tr>
	<td height="25"><a href="wenwenlist.asp?id=<%=Rs("ID")%>" class="bkclassbig"><%=Rs("ClassName")%></a></td>
  </tr>
  <%
  Call SubAskClass(Rs("ID"))
  Rs.movenext
  Loop
  DisRs Rs
  Call CloseDataBase
  %>
  <tr>
	<td height="25">&nbsp;</td>
  </tr>
</table>
<%
End Sub

Sub SubAskClass(parentid)
Call ConnectionDataBase
%>
<tr>
	<td height="25">
	<table width="96%" border="0" align="right" cellpadding="0" cellspacing="0">
		<tr>
		  <td height="22" class="baikeclass">
		  <%
		  Sql1="Select ID,ClassName From T_Class Where ParentID="& parentid &" Order By SortID DESC,ID ASC"
		  SetRs Rs1,Sql1,conn,1,1
		  Do While Not Rs1.Eof
		  %>
		  <a href="wenwenlist.asp?id=<%=Rs1("ID")%>" class="bkclasssmall"><%=Rs1("ClassName")%></a>
		  <%
		  Rs1.movenext
		  Loop
		  DisRs Rs1
		  %>
		  </td>
		</tr>
	</table>
	</td>
</tr>
<%
End Sub

'有问有答
Function AskLists(classid,sqlwhere)
	Call ConnectionDataBase	
	IF classid>0 Then where="AND (ClassID="&classid&" Or ClassID in (select id from t_class where parentid="&ClassID&"))"
	Sql = "SELECT ID,Title,AddTime FROM T_Ask WHERE Recycle=0 "& where & sqlwhere &" ORDER BY AddTime DESC,ID DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
		Response.Write "<tr><td colspan='2'>对不起,目前没有相关记录!</td></tr>"
	Else
		n=0
		Rs.pagesize=15
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		%>
		<tr>
            <td height="30" class="boderx"><a href="wenweninfor.asp?id=<%=Rs("ID")%>" class="fontnews"><%=Rs("Title")%></a></td>
            <td class="boderx"><em><font color="#969696" size="-1"><%=Formatdatetime(Rs("AddTime"),2)%></font></em></td>
          </tr>
		<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

'有问有答
Function AnswerList(id,UserID,IsOver)
	Call ConnectionDataBase	
	Sql = "SELECT ID,UserID,content,AddTime,Good FROM T_Answer WHERE Recycle=0 And AskID="& id &" ORDER BY Good ASC,AddTime DESC,ID DESC"	
	SetRs Rs,Sql,conn,1,1
	IF Rs.eof And Rs.bof Then
	Else
		n=0
		Rs.pagesize=10
		IF Not isempty(request("page")) And isnumeric(request("page")) Then 				  
			p=cint(request("page"))   
			IF p>Rs.pagecount Then p=Rs.pagecount
		Else   
			p=1
		End IF             
		Rs.AbsolutePage=p
		Do While Not Rs.eof	
		StrSql="select logo,nickname from t_users where id="&Rs("UserID")
		SetRs Rs1,StrSql,conn,1,1
		IF Not Rs1.Eof Then
			logo="images/untitled.jpg"
			IF Rs1("logo")<>"" Then logo="UpLoadFiles/Users/"&Rs1("logo")
			nickname=Rs1("nickname")
		End IF
		DisRs Rs1
		%>
		<table width="98%" height="30" border="0" align="center" cellpadding="3" cellspacing="2" bgcolor="#F0F4F3" class="margintop">
            <tr>
              <td width="150" bgcolor="#FFFFFF"><table width="98%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="100" align="center"><img src="<%=logo%>" width="84" /></td>
                  </tr>
                  <tr>
                    <td height="25" align="center"><%=nickname%>
						<%
					IF Rs("Good") Then
						Response.Write("<br><font color='#ff0000'>最佳答案</font>")
					ElseIF IsOver=0 Then
						IF Session("DjbUserID")=UserID Then%>
						<br><a href="submit.asp?action=good&id=<%=Rs("ID")%>"><img src="images/good.gif" /></a>
						<%
						End IF
					End IF
					%>
					</td>
                  </tr>
              </table></td>
              <td valign="top" bgcolor="#FFFFFF"><table width="98%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="60" style="line-height:20px;"><%=Rs("Content")%> </td>
                  </tr>
                  <tr>
                    <td align="right">回答日期：<%=Rs("AddTime")%></td>
                  </tr>
              </table></td>
            </tr>
          </table>
		<%  
			n=n+1     
			Rs.movenext
			IF n>=Rs.pagesize Then Exit Do
		Loop
	End IF
End Function

Sub Information(classid)
	Call ConnectionDataBase
	Sql="Select Top 1 Content From T_Information Where CateID="&classid
	SetRs Rs,Sql,conn,1,1
	IF Not Rs.Eof Then Response.Write(Rs("Content"))
	DisRs Rs
	'Call CloseDataBase

End Sub
%>