<%
function getindexhtml
	dim index_templet,ret
	index_templet=ReadFile(server.MapPath("/templet/index.htm"))
	ret=index_templet
	ret=replace(ret,"$Head$",ReadFile(server.MapPath("/head.asp")))
	ret=replace(ret,"$Root$",ReadFile(server.MapPath("/root.asp")))
	ret=replace(ret,"$Index_ZhiDing$",getInfo(16,20,0,0,0,0,"",0,0,1,false))
	ret=replace(ret,"$Index_ReDian$",getInfo(8,20,0,0,0,0,"",0,1,0,0))
	ret=replace(ret,"$Index_GongGao$",GetNews(97,7,"id","",30,0,0,0,"&middot;"))
	ret=replace(ret,"$Index_XinShouShangLu$",GetNews(98,3,"id","",30,0,0,0,"&middot;"))
	ret=replace(ret,"$Index_TuiJian$",GetRemProducts())
	ret=replace(ret,"$FenLeiDaoHang$",GetCatalogNav())
	ret=replace(ret,"$Index_ShangWu$",getInfo(8,16,7,0,0,0,"",0,0,0,0))
	ret=replace(ret,"$Index_JiaoYu$",getInfo(7,16,8,0,0,0,"",0,0,0,0))
	ret=replace(ret,"$Index_Es$",getInfo(10,22,2,0,0,0,"",0,0,0,0))
	ret=replace(ret,"$Index_ZhaoPin$",getInfo(10,22,3,0,0,0,"",0,0,0,0))
	ret=replace(ret,"$Index_CheLiang$",getInfo(10,22,4,0,0,0,"",0,0,0,0))
	ret=replace(ret,"$Index_ShengHuo$",getInfo(10,22,5,0,0,0,"",0,0,0,0))
	ret=replace(ret,"$Index_JiaoYou$",getInfo(10,22,6,0,0,0,"",0,0,0,0))
	ret=replace(ret,"$Index_QiTa$",getInfo(10,22,9,0,0,0,"",0,0,0,0))
	ret=replace(ret,"$Flink$",GetFriendLink(4,8,0,"#ffffff","#ffffff"))	
	getindexhtml=ret
end function

function GetFriendLink(rows,cols,linktype,ItColor1,ItColor2)
dim rs,sql,TempArr
	set rs=server.CreateObject("adodb.recordset")
	if(Cint(linktype)=0) then
		sql="select Title,LinkUrl from friendlink where Flag="&linktype
	elseif(Cint(linktype=1)) then
		sql="select Title,LinkUrl,Pic from friendlink where Flag="&linktype
	end if
  	set rs=conn.execute(sql)
	if not rs.eof then
  		TempArr=rs.GetRows()  
  		rs.close
		set rs=nothing   
		GetFriendLink=GetFriendLink&"<table class=""line22"" cellspacing=""0"" cellpadding=""0"" width=""100%"" border=""0"">"&Chr(10)
		for i=0 to rows-1' ubound(TempArr,2)按行循环

				if i mod 2=0 then
					GetFriendLink=GetFriendLink&"<tr bgcolor="""&ItColor1&""">"&Chr(10)
				else
					GetFriendLink=GetFriendLink&"<tr bgcolor="""&ItColor2&""">"&Chr(10)
				end if

			for j=0 to cols-1'按列循环
				GetFriendLink=GetFriendLink&"<td><div align=""center"">"&Chr(10)
				if(linktype=0) then
					if(i*cols+j<=ubound(TempArr,2)) then
						GetFriendLink=GetFriendLink&"<a href="""&TempArr(1,i*cols+j)&""" title="""&TempArr(0,i*cols+j)&""" target=""_blank"">"&TempArr(0,i*cols+j)&"</a>"&Chr(10)
					else
						GetFriendLink=GetFriendLink&"<a href="""&SiteUrl&""" target=""_blank"">友情链接</a>"&Chr(10)
					end if
				else
					if(i*cols+j<=ubound(TempArr,2)) then
						GetFriendLink=GetFriendLink&"<a href="""&TempArr(1,i*cols+j)&""" target=""_blank""><img src="""&TempArr(2,i*cols+j)&""" alt="""&TempArr(0,i*cols+j)&""" width=""88"" height=""31"" border=""0"" /></a>"&Chr(10)
					else
						GetFriendLink=GetFriendLink&"<a href="""&SiteUrl&""" target=""_blank"">友情链接</a>"&Chr(10)
					end if
				end if
				GetFriendLink=GetFriendLink&"</div></td>"&Chr(10)
			next
		GetFriendLink=GetFriendLink&"</tr>"&Chr(10)
		next
		GetFriendLink=GetFriendLink&"</table>"&Chr(10)	
	else
		rs.close
		set rs=nothing
	end if
end function
%>
