<%
Function ShowPage(ByRef PageCount,RecordCount,CurrentPage,PageSize,LinkFile)
	Dim Retval,J,StartPage,EndPage
	If (RecordCount Mod PageSize)=0 Then
	    PageCount=RecordCount \ PageSize
	Else 
	    PageCount=RecordCount \ PageSize+1
	End If
	If PageCount=0 Then PageCount=1
	If CurrentPage="" Then CurrentPage=1 else CurrentPage=CInt(CurrentPage)
	Retval=Retval & "<table width='100%' border='0' cellspacing='0' cellpadding='0' style='font-size:12px'>"
    Retval=Retval & "<tr>"
    Retval=Retval & "<td height='20'>"
	If CurrentPage=1 Then              
		Retval=Retval & "<font style='color:#999999'>首页</font> | <font style='color:#999999'>前页</font> | " 
	Else
		Retval=Retval & "<a href='" & LinkFile & "Page=1'>首页</a> | <a href='" & LinkFile & "Page=" & CurrentPage - 1 & "'>前页</a> | "
	End If
	If  CurrentPage=PageCount Then             
		Retval=Retval & "<font style='color:#999999'>后页</font> | <font style='color:#999999'>末页</font>"
	Else
		Retval=Retval & "<a href='" & LinkFile & "Page=" & CurrentPage + 1 & "'>后页</a> | <a href='" & LinkFile & "Page=" & PageCount & "'>末页</a>"
	End if
	If RecordCount>0 Then
	    Retval=Retval & " | <b>"&CurrentPage&"</b>页/<b>"&CInt(PageCount)&"</b>页 | 共<b>"&RecordCount&"</b>条记录"
	End If
	Retval=Retval & "<td align='right'>"
	StartPage = CurrentPage-3
	EndPage = CurrentPage+3
	If StartPage<=0 Then
	    StartPage=1
	ElseIf StartPage>1 Then 
	    Retval=Retval & " <a href='" & LinkFile & "Page=1' style='font-family:webdings' title='首页'>9</a>"
	    Retval=Retval & " ... "
	End If	    
	If EndPage>PageCount Then EndPage=PageCount
	For J = StartPage to EndPage
		If J = CurrentPage Then
		    Retval = Retval & " <font color=#999999>" & J & "</font>"
		Else
		    Retval = Retval & " <a href='" & LinkFile & "Page=" & J & "'>" & J & "</a>"
		End If
	Next
	If EndPage < PageCount Then Retval= Retval & " ... <a href='" & LinkFile & "Page=" & PageCount & "' style='font-family:webdings' title='末页'>:</a>"
	Retval=Retval & "</td>"
	Retval=Retval & "</tr>"
    Retval=Retval & "</table>"
	ShowPage=Retval
End Function

Function HtmlEncode(str)
    If Trim(Str)="" Or IsNull(str) Then Exit Function
    str=Replace(str,">","&gt;")
    str=Replace(str,"<","&lt;")
    str=Replace(str,Chr(32),"&nbsp;")
    str=Replace(str,Chr(9),"&nbsp;")
    str=Replace(str,Chr(34),"&quot;")
    str=Replace(str,Chr(39),"&#39;")
    str=Replace(str,Chr(13),"")
    str=Replace(str,Chr(10) & Chr(10), "<p></p>")
    str=Replace(str,Chr(10),"<br>")
    HtmlEncode=str
End Function

Function HtmlUNEncode(str)
		If Trim(Str)="" Or IsNull(str) Then Exit Function
		str=Replace(str,"<br>",Chr(10))
 		str=Replace(str,"<p></p>",Chr(10) & Chr(10) )
 		str=Replace(str,"",Chr(13))
 		str=Replace(str,"&#39;",Chr(39))
 		str=Replace(str,"&quot;",Chr(34))  
  		'str=Replace(str,"&nbsp;",Chr(9))
 		str=Replace(str,"&nbsp;",Chr(32))
 		str=Replace(str,"&lt;","<") 
 		str=Replace(str,"&gt;",">")
 		HtmlUNEncode=str
End Function

'**************************************************
'函数名：gotTopic
'作  用：截字符串，汉字一个算两个字符，英文算一个字符
'参  数：str   ----原字符串
'       strlen ----截取长度
'返回值：截取后的字符串
'***************************************************
function walkgotTopic(str,strlen)
	if str="" then
		walkgotTopic=""
		exit function
	end if
	dim l,t,c, i
	str=replace(replace(replace(replace(str,"&nbsp;"," "),"&quot;",chr(34)),"&gt;",">"),"&lt;","<")
	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 then
			walkgotTopic=left(str,i) & "…"
			exit for
		else
			walkgotTopic=str
		end if
	next
	walkgotTopic=replace(replace(replace(replace(walkgotTopic," ","&nbsp;"),chr(34),"&quot;"),">","&gt;"),"<","&lt;")
end Function



 Sub StopSubmit()
    dim serverhttp1,serverhttp2
    serverhttp1=Cstr(Request.ServerVariables("HTTP_REFERER"))
    serverhttp2=Cstr(Request.ServerVariables("SERVER_NAME"))
    if mid(serverhttp1,8,len(serverhttp2))<>serverhttp2 then
        'Response.Redirect "/error.asp"
		Response.write "<script>alert('外部提交！');</script>"
        response.end
    end if
End Sub 





Function GetRndFileName()
	Dim tmpstr
	randomize
	tmpstr=Int(1000*rnd)
	tmpstr=""&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&tmpstr
	GetRndFileName=tmpstr
End Function



Function pictop(pagesize)
	Dim pagecount
	sql = "select * from tblWinsDttPhoto where 1=1"
	sql = sql &" order by photoid desc"
	rs.open sql,conn,1
	pagesize2=pagesize
	rs.pagesize=pagesize2
	ordercount=rs.recordcount
	curpage=Request.QueryString("page")
	if curpage=""  Then curpage=1
	if  not isnumeric(curpage) then curpage=1
	curpage = Cint(curpage)
	pagecount = rs.pagecount
	If pagecount>0 Then
		if curpage>pagecount then curpage=pagecount
	End If
	If Not Rs.Eof Then rs.absolutePage=curpage
End Function
  
Dim orderpagecount,ordercount,curpage,pagesize2,linkfile
%>