<%
Function InterceptString(txt,length)
	dim x,y,ii
	txt=trim(txt)
	x = len(txt)
	y = 0
	if x >= 1 then
		for ii = 1 to x
			if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) >255 then '如果是汉字
				y = y + 2
			else
				y = y + 1
			end if
			if clng(y)>=clng(length) then
				txt = left(trim(txt),ii) '字符串限长
				InterceptString = txt 
				exit for
			else
				InterceptString = txt
			end if
		next
		
	else
		InterceptString = ""
	end if
End Function

Function testObject(str)
    On Error Resume Next
    Dim TestObj
    Set TestObj = Server.CreateObject(str)
    If Err.Number<>-2147221005 Then
	    testObject=True
	Else
	    testObject=False
	End If
    Set TestObj = Nothing
    Err.Clear
End Function
class Html_31
Public function fso_html()
fso_html=year(date) & right("00"&month(date),2)&right("0" & day(Now),2)
fso_html=fso_html&showrnd(8,9)&".htm"
end function
Public function showrnd(x,y)
redim n(x)
dim i,q
dim isok
for i=1 to x
Randomize
n(i)=round((y-1)* Rnd)+1
isok=false
do while not isok
  for q=1 to i
    if n(i)=n(q-1) then
     n(i)=Int((y-1)* Rnd)+1
  isok=false
     exit for
 end if
  isok=true
  next
loop
showrnd=showrnd&n(i)
next
end function
end class
Function transparam()
    Dim query, a, x, temp
    query = Split(Request.ServerVariables("QUERY_STRING"), "&")
    For Each x In query
        a = Split(x, "=")
        If StrComp(a(0), "page", vbTextCompare) <> 0 Then
            temp = temp & a(0) & "=" & a(1) & "&"
        End If
    Next
transparam=temp
End Function
Function HTMLEncode(String)
	String = Replace(String, CHR(13), "")
	String = Replace(String, CHR(10) & CHR(10), "</P><P>")
	String = Replace(String, CHR(10), "<BR>")
	HTMLEncode = String
End Function


%>
