<% 
Function GetConfig(num)
str=openfile(server.MapPath("Site/config.asp"))
web=split(str,chr(13))
GetConfig=web(num)
Response.write GetConfig
End Function



Function GetStrLen(str,a)
If IsNull(str) Or str = "" Then
getStrLen = 0
Else
Dim i, n, k, chrA, chrb
k = 0
n = Len(str)
For i = 1 To n
chrA = Mid(str, i, 1)
If Asc(chrA) >= 0 And Asc(chrA) <= 255 Then
k = k + 1
Else
k = k + 2
End If

chrb=chrb & chrA

if k>=a then
exit for
end if

Next

getStrLen = chrb
End If
End Function 
Function funstr(str)	 
str = replace(str, "<", "&lt;", 1, -1, 1)
str = replace(str, ">", "&gt;", 1, -1, 1)
str = replace(str, "=", "")
str = trim(str)
str = replace(str,"'","")
funstr = str
End Function

function openfile(url)
  set fso=server.CreateObject("scripting.filesystemobject")
   
  set mofile=fso.opentextfile(url,1)
  mo_top=mofile.readall()
  mofile.close
  openfile=mo_top
end function

sub createfiles(url,str)
urls=url
url= Zxj_ReplaceHtml("\\[^\\]+$", "", url)
  set fso=server.CreateObject("scripting.filesystemobject") 
   If AutoCreateFolder(url) Then 
   Else 
   End If
  set mofile=fso.createtextfile(urls,true)
  mofile.write str
  mofile.close
end sub
sub createfolder(folder)
  folderurl=server.MapPath(folder)
  set fso=server.CreateObject("scripting.filesystemobject") 
  if fso.folderexists(folderurl) then
  
  else
    fso.createfolder(folderurl)
  end if
end sub
function showtemp()
  set fso=server.CreateObject("scripting.filesystemobject")
  set ff=fso.getfolder(server.MapPath("../templates"))
  set openfs=ff.subfolders
  for each openf in openfs
  showtemp=showtemp&"<option value='"&openf.name&"'>"&openf.name&"</option>"
  next
  set fso=nothing
  set ff=nothing
  set openfs=nothing
end function

Function ClearHtml(Content) 
Content=Zxj_ReplaceHtml("&#[^>]*;", "", Content) 
Content=Zxj_ReplaceHtml("</?marquee[^>]*>", "", Content) 
Content=Zxj_ReplaceHtml("</?object[^>]*>", "", Content) 
Content=Zxj_ReplaceHtml("</?param[^>]*>", "", Content) 
Content=Zxj_ReplaceHtml("</?embed[^>]*>", "", Content) 
Content=Zxj_ReplaceHtml("</?table[^>]*>", "", Content) 
Content=Zxj_ReplaceHtml(" ","",Content) 
Content=Zxj_ReplaceHtml("</?tr[^>]*>", "", Content) 
Content=Zxj_ReplaceHtml("</?th[^>]*>","",Content) 
Content=Zxj_ReplaceHtml("</?p[^>]*>","",Content) 
Content=Zxj_ReplaceHtml("</?a[^>]*>","",Content) 
Content=Zxj_ReplaceHtml("</?img[^>]*>","",Content) 
Content=Zxj_ReplaceHtml("</?tbody[^>]*>","",Content) 
Content=Zxj_ReplaceHtml("</?li[^>]*>","",Content) 
Content=Zxj_ReplaceHtml("</?span[^>]*>","",Content) 
Content=Zxj_ReplaceHtml("</?div[^>]*>","",Content) 
Content=Zxj_ReplaceHtml("</?th[^>]*>", "", Content) 
Content=Zxj_ReplaceHtml("</?td[^>]*>", "", Content) 
Content=Zxj_ReplaceHtml("</?script[^>]*>", "", Content) 
Content=Zxj_ReplaceHtml("(javascript|jscript|vbscript|vbs):", "", Content) 
Content=Zxj_ReplaceHtml("on(mouse|exit|error|click|key)", "", Content) 
Content=Zxj_ReplaceHtml("<\\?xml[^>]*>", "", Content) 
Content=Zxj_ReplaceHtml("<\/?[a-z]+:[^>]*>", "", Content) 
Content=Zxj_ReplaceHtml("</?font[^>]*>", "", Content) 
Content=Zxj_ReplaceHtml("</?b[^>]*>","",Content) 
Content=Zxj_ReplaceHtml("</?u[^>]*>","",Content) 
Content=Zxj_ReplaceHtml("</?i[^>]*>","",Content)
Content=Zxj_ReplaceHtml("</?strong[^>]*>","",Content) 
ClearHtml=Content 
End Function 

Function Zxj_ReplaceHtml(patrn, strng,content) 
IF IsNull(content) Then 
content="" 
End IF 
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = true
regEx.Global = True
Zxj_ReplaceHtml=regEx.Replace(content,strng)
End Function


Function AutoCreateFolder(strPath)
   On Error Resume Next 
   
   Dim astrPath, ulngPath, i, strTmpPath 
   Dim objFSO 
   
   If InStr(strPath, "\") <=0 Or InStr(strPath, ":") <= 0 Then 
   AutoCreateFolder = False 
   Exit Function 
   End If 
   Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 
   If objFSO.FolderExists(strPath) Then 
   AutoCreateFolder = True 
   Exit Function 
   End If 
   astrPath = Split(strPath, "\") 
   ulngPath = UBound(astrPath) 
   strTmpPath = "" 
   For i = 0 To ulngPath 
   strTmpPath = strTmpPath & astrPath(i) & "\" 
   If Not objFSO.FolderExists(strTmpPath) Then 

   objFSO.CreateFolder(strTmpPath) 
   End If 
   Next 
   Set objFSO = Nothing 
   If Err = 0 Then 
   AutoCreateFolder = True 
   Else 
   AutoCreateFolder = False 
   End If 
End Function 

 %>