<%
function cutstr(str,strlen,more,url)
if len(str)>strlen then
     str=left(str,strlen) & "......"
end if
if (len(str)>strlen) and more then
  str=str+"&nbsp;&nbsp;&nbsp;[url="+url+"]点这里查看详情[/url]"
end if
cutstr=str
end function

function strLength(str)
       ON ERROR RESUME NEXT
       dim WINNT_CHINESE
       WINNT_CHINESE    = (len("论坛")=2)
       if WINNT_CHINESE then
          dim l,t,c
          dim i
          l=len(str)
          t=l
          for i=1 to l
             c=asc(mid(str,i,1))
             if c<0 then c=c+65536
             if c>255 then
                t=t+1
             end if
          next
          strLength=t
       else 
          strLength=len(str)
       end if
       if err.number<>0 then err.clear
end function

function AutoUrl(str)
    on error resume next
    Set url=new RegExp
    url.IgnoreCase =True
    url.Global=True
    url.MultiLine = True
    url.Pattern = "^(http://[A-Za-z0-9\./=\?%\-&_~`@:+!]+)"
    str = url.Replace(str,"[url=$1]$1[/url]")
    url.Pattern = "(http://[A-Za-z0-9\./=\?%\-&_~`@:+!]+)$"
    str = url.Replace(str,"[url=$1]$1[/url]")
    url.Pattern = "^(www.[A-Za-z0-9\./=\?%\-&_~`@:+!]+)"
    str = url.Replace(str,"[url=http://$1]$1[/url]")
    url.Pattern = "(www.[A-Za-z0-9\./=\?%\-&_~`@:+!]+)$"
    str = url.Replace(str,"[url=http://$1]$1[/url]")
    set url=Nothing
    AutoUrl=str
end function