<!-- #include file="../access.asp" -->
<!-- #include file="../html_clear.asp" -->

<%'容错处理
function index_to_html()
On Error Resume Next
%>
<%
'首页基本信息内容读取替换
set rs=server.createobject("adodb.recordset")
sql="select web_name,web_url,web_image,web_title,web_keywords,web_contact,web_tel,web_TopHTML,web_BottomHTML,web_description,web_copyright,web_theme from en_web_settings"
rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then
web_name=rs("web_name")
web_url=rs("web_url")
web_image=rs("web_image")
web_title=rs("web_title")
web_keywords=rs("web_keywords")
web_description=rs("web_description")
web_copyright=rs("web_copyright")
web_theme=rs("web_theme")
web_consult=rs("web_contact")
web_TopHTML=rs("web_TopHTML")
web_BottomHTML=rs("web_BottomHTML")
web_tel=rs("web_tel")
end if
rs.close
set rs=nothing
%>
<% '文件夹获取
'搜索文件夹获取
set rs_1=server.createobject("adodb.recordset")
sql="select FileName,FolderName from web_Models_type where [id]=45"
rs_1.open(sql),cn,1,1
if not rs_1.eof and rs_1("FolderName")<>"" then
Search_FolderName="/English/"&rs_1("FolderName")
end if
rs_1.close
set rs_1=nothing

'案例内容文件夹获取
set rs_1=server.createobject("adodb.recordset")
sql="select FileName,FolderName from web_Models_type where [id]=52"
rs_1.open(sql),cn,1,1
if not rs_1.eof and rs_1("FolderName")<>"" then
CasesContent_FolderName="/English/"&rs_1("FolderName")
end if
rs_1.close
set rs_1=nothing

'文章内容文件夹获取
set rs_1=server.createobject("adodb.recordset")
sql="select FileName,FolderName from web_Models_type where [id]=39"
rs_1.open(sql),cn,1,1
if not rs_1.eof and rs_1("FolderName")<>"" then
ArticleContent_FolderName="/English/"&rs_1("FolderName")
end if
rs_1.close
set rs_1=nothing

'产品内容文件夹获取
set rs_1=server.createobject("adodb.recordset")
sql="select FileName,FolderName from web_Models_type where [id]=40"
rs_1.open(sql),cn,1,1
if not rs_1.eof and rs_1("FolderName")<>"" then
ProductContent_FolderName="/English/"&rs_1("FolderName")
end if
rs_1.close
set rs_1=nothing
%>

<% '读取模板内容
'模板类型获取
set rs_1=server.createobject("adodb.recordset")
sql="select FileName,FolderName from web_Models_type where [id]=37"
rs_1.open(sql),cn,1,1
if not rs_1.eof then
Model_FileName=rs_1("FileName")
if rs_1("FolderName")<>"" then
Model_FolderName="/"&rs_1("FolderName")
end if
end if
rs_1.close
set rs_1=nothing

TemplatePath="/templates/"&web_theme&"/"&Model_FileName
replace_code=ReadFromUTF(TemplatePath,"utf-8") 

%>
<%
replace_code=replace(replace_code,"$web_name$",web_name)
replace_code=replace(replace_code,"$web_url$",web_url)
replace_code=replace(replace_code,"$web_image$",web_image)
replace_code=replace(replace_code,"$web_title$",web_title)
replace_code=replace(replace_code,"$web_keywords$",web_keywords)
replace_code=replace(replace_code,"$web_description$",web_description)
replace_code=replace(replace_code,"$web_copyright$",web_copyright)
replace_code=replace(replace_code,"$web_theme$",web_theme)
replace_code=replace(replace_code,"$web_consult$",web_consult)
replace_code=replace(replace_code,"$web_TopHTML$",web_TopHTML)
replace_code=replace(replace_code,"$web_BottomHTML$",web_BottomHTML)
replace_code=replace(replace_code,"$web_tel$",web_tel)
replace_code=replace(replace_code,"$search_FolderName$",search_FolderName)

'顶部文字读取
Common_TxtTop=""
set rs=server.createobject("adodb.recordset")
sql="select top 1 [id],ADtype,[ADcode] from en_web_ads  where [position]=37 and view_yes=1 order by [time] desc"
rs.open(sql),cn,1,1
if not rs.eof then
if rs("ADtype")=4 then
Common_TxtTop=Common_TxtTop&rs("ADcode")
else
Common_TxtTop=Common_TxtTop&"<script src='/ADs/"&rs("id")&".js' type='text/javascript'></script>"
end if 
else
Common_TxtTop=Common_TxtTop&""
end if
rs.close
set rs=nothing

'顶部导航
set rs=server.createobject("adodb.recordset")
sql="select * from en_web_menu_type where TopNav=1 order by [order]"
rs.open(sql),cn,1,1
if not rs.eof then
web_TopMenu=web_TopMenu&"<ul id='sddm'>"
for i=1 to rs.recordcount
if i=1 then
web_TopMenu=web_TopMenu&"<li class='CurrentLi'><a href='"&rs("url")&"'>"&rs("name")&"</a></li> "
else

set rss=server.createobject("adodb.recordset")
sql="select * from en_web_menu where view_yes=1 and [position]="&rs("id")&" order by [order]"
rss.open(sql),cn,1,1
if not rss.eof then
web_TopMenu=web_TopMenu&"<li><a href='"&rs("url")&"' onmouseover=mopen('m"&i&"') onmouseout='mclosetime()'>"&rs("name")&"</a> "
web_TopMenu=web_TopMenu&"<div id='m"&i&"' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'>"
do while not rss.eof
web_TopMenu=web_TopMenu&"<a href='"&rss("url")&"'>"&rss("name")&"</a> "
rss.movenext
loop
web_TopMenu=web_TopMenu&"</div></li> "
else
web_TopMenu=web_TopMenu&"<li><a href='"&rs("url")&"'>"&rs("name")&"</a></li> "
end if
rss.close
set rss=nothing

end if
rs.movenext
next
web_TopMenu=web_TopMenu&"</ul>"
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_TopMenu$",web_TopMenu)
replace_code=replace(replace_code,"$Common_TxtTop$",Common_TxtTop)



'首页顶部幻灯广告读取替换
set rs=server.createobject("adodb.recordset")
sql="select top 10 name,url,image,ADcode from en_web_ads  where [position]=36 and view_yes=1 order by [order]"
rs.open(sql),cn,1,1
if not rs.eof then
for i=1 to rs.recordcount
if rs("adcode")<>"" then
BackAD="background:"&rs("ADcode")&" center 0 no-repeat;"
else
BackAD="background:#FFF center 0 no-repeat;"
end if
web_TopIMGAD=web_TopIMGAD&"<li _src=""url(/images/up_images/"&rs("image")&")"" style='"&BackAD&"'><a href='"&rs("url")&"' target='_blank'></a></li>"

rs.movenext
next
else
web_TopIMGAD=web_TopIMGAD&"无数据"
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_TopIMGAD$",web_TopIMGAD)


'企业介绍
set rs=server.createobject("adodb.recordset")
sql="select top 1  [name],[folder],[id],[pid],[ppid],[image],[content] from [en_category] where ClassType=5 and ppid=1 order by [order]"
rs.open(sql),cn,1,1
if not rs.eof then
ItemID=rs("id")
WebAboutName=rs("name")
WebAboutFolderName=rs("folder")
WebAboutImage=rs("image")
WebAboutContent=left(ClearHtml(rs("content")),570)

select case rs("ppid")
case 1
ClassSQL="cid"
WebAboutFolder="/English/"&rs("folder") 
case 2
ClassSQL="pid"
set rs0=server.createobject("adodb.recordset")
sql="select [name],[folder],[id],[pid],[ppid] from [en_category] where id="&rs("pid")
rs0.open(sql),cn,1,1
if not rs0.eof then
WebAboutFolder="/English/"&rs0("folder")&"/"&rs("folder")
end if
rs0.close
set rs0=nothing
case 3
ClassSQL="ppid"
set rs0=server.createobject("adodb.recordset")
sql="select [name],[folder],[id],[pid],[ppid] from [en_category] where id="&rs("pid")
rs0.open(sql),cn,1,1
if not rs0.eof then
set rs00=server.createobject("adodb.recordset")
sql="select [name],[folder],[id],[pid],[ppid] from [en_category] where id="&rs0("pid")
rs00.open(sql),cn,1,1
if not rs00.eof then
WebAboutFolder="/English/"&rs00("folder")&"/"&rs0("folder")&"/"&rs("folder") 
end if
rs00.close
set rs00=nothing
end if
rs0.close
set rs0=nothing
end select
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$WebAboutName$",WebAboutName)
replace_code=replace(replace_code,"$WebAboutFolderName$",WebAboutFolderName)
replace_code=replace(replace_code,"$WebAboutFolder$",WebAboutFolder)
replace_code=replace(replace_code,"$WebAboutImage$",WebAboutImage)
replace_code=replace(replace_code,"$WebAboutContent$",WebAboutContent)


'新闻动态
set rs=server.createobject("adodb.recordset")
sql="select top 1  [name],[folder],[id],[pid],[ppid] from [en_category] where ClassType=1 and ppid=1 order by [order]"
rs.open(sql),cn,1,1
if not rs.eof then
ItemID=rs("id")
WebNewNewsName=rs("name")
WebNewNewsFolderName=rs("folder")
select case rs("ppid")
case 1
ClassSQL="cid"
WebNewNewsFolder="/English/"&rs("folder") 
case 2
ClassSQL="pid"
set rs0=server.createobject("adodb.recordset")
sql="select [name],[folder],[id],[pid],[ppid] from [en_category] where id="&rs("pid")
rs0.open(sql),cn,1,1
if not rs0.eof then
WebNewNewsFolder="/English/"&rs0("folder")&"/"&rs("folder")
end if
rs0.close
set rs0=nothing
case 3
ClassSQL="ppid"
set rs0=server.createobject("adodb.recordset")
sql="select [name],[folder],[id],[pid],[ppid] from [en_category] where id="&rs("pid")
rs0.open(sql),cn,1,1
if not rs0.eof then
set rs00=server.createobject("adodb.recordset")
sql="select [name],[folder],[id],[pid],[ppid] from [en_category] where id="&rs0("pid")
rs00.open(sql),cn,1,1
if not rs00.eof then
WebNewNewsFolder="/English/"&rs00("folder")&"/"&rs0("folder")&"/"&rs("folder") 
end if
rs00.close
set rs00=nothing
end if
rs0.close
set rs0=nothing
end select
end if
rs.close
set rs=nothing

'top
set rsp=server.createobject("adodb.recordset")
sql="select top 1 [title],file_path,[description] from [en_article] where ArticleType=1 and cid='"&ItemID&"' and index_push=1 and view_yes=1 order by [time] desc"
rsp.open(sql),cn,1,1
if not rsp.eof then
rs_url=""
rs_url=ArticleContent_FolderName&"/"&rsp("file_path")

WebNewNewsListTop=WebNewNewsListTop&"<div class='text4'> <a href='"&rs_url&"' target='_blank' title='"&rsp("title")&"'>"&left(rsp("title"),45)&"</a></div>"
WebNewNewsListTop=WebNewNewsListTop&"<span class='text5'>&nbsp;&nbsp; &nbsp; "&left(rsp("description"),225)&""
WebNewNewsListTop=WebNewNewsListTop&"<span class='text6'>"
WebNewNewsListTop=WebNewNewsListTop&"<a href='"&rs_url&"' target='_blank' >Details</a>"
WebNewNewsListTop=WebNewNewsListTop&"</span></span>"

end if 
rsp.close
set rsp=nothing

'list
WebNewNewsList=WebNewNewsList&"<div class='DivList'><table class='MBlockTable' width='100%' border='0' cellspacing='0' cellpadding='0'>"
set rsp=server.createobject("adodb.recordset")
sql="select top 7 [title],file_path,[time] from [en_article] where ArticleType=1 and cid='"&ItemID&"'  and view_yes=1 order by [time] desc"
rsp.open(sql),cn,1,1
if not rsp.eof then
do while not rsp.eof 
rs_url=""
rs_url=ArticleContent_FolderName&"/"&rsp("file_path")
WebNewNewsList=WebNewNewsList&"<tr><td width='80%'>· <a href='"&rs_url&"' target='_blank' title='"&rsp("title")&"'>"&left(rsp("title"),40)&"</a></td>"
WebNewNewsList=WebNewNewsList&"<td width='20%'><span>"&year(rsp("time"))&"-"&month(rsp("time"))&"-"&day(rsp("time"))&"</span></td></tr>"
rsp.movenext
loop
end if 
rsp.close
set rsp=nothing

WebNewNewsList=WebNewNewsList&"</table><div class='clearfix'></div></div> "

'小文章幻灯
set rsp=server.createobject("adodb.recordset")
sql="select top 5 [title],file_path,[image],[time] from [en_article] where ArticleType=1  and cid='"&ItemID&"' and [image]<>'' and view_yes=1 order by [time] desc"
rsp.open(sql),cn,1,1
if not rsp.eof then
for i=1 to rsp.recordcount
rs_url=""
rs_url=ArticleContent_FolderName&"/"&rsp("file_path")
web_NewsIMGAD=web_NewsIMGAD&"<li><a href='"&rs_url&"' target='_blank'><img src='/images/up_images/"&rsp("image")&"' alt='"&left(rsp("title"),25)&"'/></a></li>" 

rsp.movenext
next

end if 
rsp.close
set rsp=nothing

replace_code=replace(replace_code,"$web_NewsIMGAD$",web_NewsIMGAD)
replace_code=replace(replace_code,"$WebNewNewsTitles$",WebNewNewsTitles)
replace_code=replace(replace_code,"$WebNewNewsList$",WebNewNewsList)
replace_code=replace(replace_code,"$WebNewNewsFolder$",WebNewNewsFolder)
replace_code=replace(replace_code,"$WebNewNewsName$",WebNewNewsName)
replace_code=replace(replace_code,"$WebNewNewsFolderName$",WebNewNewsFolderName)
replace_code=replace(replace_code,"$WebNewNewsListTop$",WebNewNewsListTop)



'企业公告
ItemID2=0
set rs=server.createobject("adodb.recordset")
sql="select top 1  [name],[folder],[id],[pid],[ppid] from [en_category] where id<>"&ItemID&" and ClassType=1 and ppid=1 order by [order]"
rs.open(sql),cn,1,1
if not rs.eof then
ItemID2=rs("id")
WebScrollNewsName=rs("name")
WebScrollNewsFolder="/English/"&rs("folder")
end if
rs.close
set rs=nothing

'列表
set rsp=server.createobject("adodb.recordset")
sql="select top 10 [title],file_path,[time] from [en_article] where ArticleType=1 and cid='"&ItemID2&"' and view_yes=1 order by [time] desc"
rsp.open(sql),cn,1,1
if not rsp.eof then
do while not rsp.eof 
rs_url=""
rs_url=ArticleContent_FolderName&"/"&rsp("file_path")
WebScrollNewsList=WebScrollNewsList&"· <a href='"&rs_url&"' target='_blank' title='"&rsp("title")&"'>"&left(rsp("title"),50)&"</a> <span>"&year(rsp("time"))&"/"&month(rsp("time"))&"/"&day(rsp("time"))&"</span> "
rsp.movenext
loop
end if 
rsp.close
set rsp=nothing

replace_code=replace(replace_code,"$WebScrollNewsName$",WebScrollNewsName)
replace_code=replace(replace_code,"$WebScrollNewsFolder$",WebScrollNewsFolder)
replace_code=replace(replace_code,"$WebScrollNewsList$",WebScrollNewsList)



'文章栏目列表
set rs=server.createobject("adodb.recordset")
sql="select top 2 [name],[folder],[id],[pid],[ppid] from [en_category] where id<>"&ItemID&" and id<>"&ItemID2&" and ClassType=1 and ppid=1 order by [order] "
rs.open(sql),cn,1,1
if not rs.eof then
for i=1 to 2

WebArticleList=WebArticleList&"<div class='l box box"&(1+i)&"'>"
WebArticleList=WebArticleList&"<div class='t_width1'>"
WebArticleList=WebArticleList&"<div class='channelT1'>"
WebArticleList=WebArticleList&"<div class='channelN'>"&rs("name")&"<span class='channelN1'></span>"
WebArticleList=WebArticleList&"</div>"
WebArticleList=WebArticleList&"<div class='channerN'><a href='/English/"&rs("Folder")&"/'>More</a>"
WebArticleList=WebArticleList&"</div>"
WebArticleList=WebArticleList&"</div>"
WebArticleList=WebArticleList&"</div>"
WebArticleList=WebArticleList&"<div class='i_br'> "
 
'top
TopID=0
set rsp=server.createobject("adodb.recordset")
sql="select top 1 [title],file_path,[time],id from [en_article] where ArticleType=1 and cid='"&rs("id")&"' and view_yes=1 order by [time] desc"
rsp.open(sql),cn,1,1
if not rsp.eof then
TopID=rsp("id")
rs_url=""
rs_url=ArticleContent_FolderName&"/"&rsp("file_path")

WebArticleList=WebArticleList&"<div class='newsTop'>"
WebArticleList=WebArticleList&"<div class='img'><span class='ri'>"&year(rsp("time"))&"</span><span class='ny' style='text-align:center'>"&month(rsp("time"))&"-"&day(rsp("time"))&"</span></div>"
WebArticleList=WebArticleList&"<div class='detail'>"
WebArticleList=WebArticleList&"<strong class='title'><a href='"&rs_url&"' target='_blank'>"&left(rsp("title"),45)&"</a></strong>"
WebArticleList=WebArticleList&"</div>"
WebArticleList=WebArticleList&"</div>"

end if 
rsp.close
set rsp=nothing

WebArticleList=WebArticleList&"<ul  class='main_list mt8'>"
set rsp=server.createobject("adodb.recordset")
sql="select top 10 [title],file_path,[time] from [en_article] where ArticleType=1 and id<>"&TopID&" and  cid='"&rs("id")&"' and view_yes=1 order by [time] desc"
rsp.open(sql),cn,1,1
if not rsp.eof then
for ix=1 to rsp.recordcount 
rs_url=""
rs_url=ArticleContent_FolderName&"/"&rsp("file_path")

WebArticleList=WebArticleList&"<li>"
WebArticleList=WebArticleList&"<em>"&year(rsp("time"))&"-"&month(rsp("time"))&"-"&day(rsp("time"))&"</em>"
WebArticleList=WebArticleList&"<a href='"&rs_url&"' target='_blank' style='width:75%;'>· "&left(rsp("title"),45)&"</a>"
WebArticleList=WebArticleList&"</li>"

rsp.movenext
next
end if 
rsp.close
set rsp=nothing

WebArticleList=WebArticleList&"</ul>"
WebArticleList=WebArticleList&"</div>"
WebArticleList=WebArticleList&"</div> "

rs.movenext
next
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$WebArticleList$",WebArticleList)



'精彩案例
set rs=server.createobject("adodb.recordset")
sql="select top 1  [name],[folder],[id],[pid],[ppid] from [en_category] where ClassType=3 and ppid=1 order by [order]"
rs.open(sql),cn,1,1
if not rs.eof then
ItemID=rs("id")
WebCaseName=rs("name")
WebCaseFolderName=rs("folder")
WebCaseFolder="/English/"&rs("folder")
end if
rs.close
set rs=nothing

set rsp=server.createobject("adodb.recordset")
sql="select top 24 [title],file_path,[image] from [en_article] where ArticleType=3 and cid='"&ItemID&"' and view_yes=1 order by OrderCount,[time] desc"
rsp.open(sql),cn,1,1
if not rsp.eof then
do while not rsp.eof 
rs_url=""
rs_url=CasesContent_FolderName&"/"&rsp("file_path")
WebCase_List=WebCase_List&"<li><A class='imgBorder'  href='"&rs_url&"' target='_blank' title='"&rsp("title")&"'><IMG alt='"&rsp("title")&"' src='/images/up_images/"&rsp("image")&"' ></a></li> "
rsp.movenext
loop
end if 
rsp.close
set rsp=nothing

replace_code=replace(replace_code,"$WebCase_List$",WebCase_List)
replace_code=replace(replace_code,"$WebCaseName$",WebCaseName)
replace_code=replace(replace_code,"$WebCaseFolderName$",WebCaseFolderName)
replace_code=replace(replace_code,"$WebCaseFolder$",WebCaseFolder)



'品牌产品
set rs=server.createobject("adodb.recordset")
sql="select top 1  [name],[folder],[id],[pid],[ppid] from [en_category] where ClassType=2 and ppid=1 order by [order]"
rs.open(sql),cn,1,1
if not rs.eof then
ItemID=rs("id")
WebProductName=rs("name")
WebProductFolderName=rs("folder")
WebProductFolder="/English/"&rs("folder")
end if
rs.close
set rs=nothing
set rs=server.createobject("adodb.recordset")
sql="select top 15 [name],[folder],[id],[pid],[ppid] from [en_category] where pid="&ItemID&" and ClassType=2 order by [order] "
rs.open(sql),cn,1,1
if not rs.eof then
for i=1 to rs.recordcount
Block03_LeftItem_Title=Block03_LeftItem_Title&"<li><A href='"&WebProductFolderName&"/"&rs("Folder")&"'>"&rs("name")&"</A></li> "

Block03_LeftItem=Block03_LeftItem&"<div class='slideBox'>"
Block03_LeftItem=Block03_LeftItem&"<a class='sPrev' href='javascript:void(0)'></a>"
Block03_LeftItem=Block03_LeftItem&"<ul>"
				
set rsp=server.createobject("adodb.recordset")
sql="select top 24 [title],file_path,[image] from [en_article] where ArticleType=2 and pid='"&rs("id")&"' and view_yes=1 order by OrderCount,[time] desc"
rsp.open(sql),cn,1,1
if not rsp.eof then
do while not rsp.eof 
rs_url=""
rs_url=ProductContent_FolderName&"/"&rsp("file_path")

Block03_LeftItem=Block03_LeftItem&"<li>"
Block03_LeftItem=Block03_LeftItem&"<div class='pic'><a href='"&rs_url&"' target='_blank'><img alt='"&rsp("title")&"' src='/images/up_images/"&rsp("image")&"'/></a></div>"
Block03_LeftItem=Block03_LeftItem&"<div class='title'><A  href='"&rs_url&"' target='_blank' >"&left(rsp("title"),15)&"</A></div>"
Block03_LeftItem=Block03_LeftItem&"</li>"

rsp.movenext
loop
end if 
rsp.close
set rsp=nothing

Block03_LeftItem=Block03_LeftItem&"</ul>"
Block03_LeftItem=Block03_LeftItem&"<a class='sNext' href='javascript:void(0)'></a>"
Block03_LeftItem=Block03_LeftItem&"</div> "
			
rs.movenext
next
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$Block03_LeftItem$",Block03_LeftItem)
replace_code=replace(replace_code,"$Block03_LeftItem_Title$",Block03_LeftItem_Title)
replace_code=replace(replace_code,"$WebProductName$",WebProductName)
replace_code=replace(replace_code,"$WebProductFolderName$",WebProductFolderName)
replace_code=replace(replace_code,"$WebProductFolder$",WebProductFolder)



'友情链接
set rs=server.createobject("adodb.recordset")
sql="select  [name],[url],[image],follow_yes from [en_web_link] where view_yes=1 order by [order]"
rs.open(sql),cn,1,1
if not rs.eof then
do while not rs.eof
if rs("follow_yes")=1 then
NoFollow="rel='nofollow'"
else
NoFollow=""
end if 
web_link=web_link&"<a href='"&rs("url")&"' target='_blank' "&NoFollow&">"&rs("name")&"</a>"
rs.movenext
loop
else
web_link=web_link&"No Link."
end if
rs.close
set rs=nothing

replace_code=replace(replace_code,"$web_link$",web_link)
%>

<% '判断文件夹是否存在，否则创建
Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
If Fso.FolderExists(Server.MapPath(Model_FolderName))=false Then
NewFolderDir=Model_FolderName
call CreateFolderB(NewFolderDir)
end if
%>

<%'声明HTML文件名,指定文件路径
filepath="/English"&Model_FolderName&"/index.html"
%>

<% '读取模板
'******************************************
'功能：生成UTF-8文件
'******************************************
mappath =filepath
Set objStream = Server.CreateObject("ADODB.Stream")
With objStream
.Open
.Charset = "utf-8"
.Position = objStream.Size
.WriteText=replace_code
.SaveToFile server.mappath(mappath),2
.Close
End With
Set objStream = Nothing

%>
<%
end function
%>