<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="conn.asp"-->
<!--#include file="common.asp"-->
<%
dim SortType
SortType=request("SortType")
if SortType<>"" then
	session("SortType")=SortType
end if
%>
<%
function average(cou,coutime,now)
	if cou<1 then
		average=0.00
		exit function
	end if
	TotolDay=DateDiff("d",coutime,now)+1
	Rodgoin=Round(cou/TotolDay,2)
	averagecou=Rodgoin
end function

dim SiteName
dim SiteURL
dim MasterName
dim Email
dim PageWidth
dim Unit

dim PR
dim Alexa
dim Google
dim Baidu

dim IsConfirm
dim IsVerify
dim IsActivation
dim StatCount
dim IsSort
dim StatCountDis
dim SpecialNote
dim OrderBy
dim MaxPerPage
dim LogoWidth
dim LogoHeight

dim SortDisplayType
dim CountPerLine
dim LinkShowType

sql="select * from setting"
set rs=conn.execute (sql)
if not rs.eof then
	SiteName=rs("SiteName")
	SiteURL=rs("SiteURL")
	MasterName=rs("MasterName")
	Email=rs("Email")
	
	PageWidth=rs("PageWidth")
	Unit=rs("Unit")
	
	PR=rs("PR")
	Alexa=rs("Alexa")
	Google=rs("Google")
	Baidu=rs("Baidu")
	
	IsConfirm=rs("IsConfirm")
	IsVerify=rs("IsVerify")
	IsActivation=rs("IsActivation")
	StatCount=rs("StatCount")
	IsSort=rs("IsSort")
	StatCountDis=rs("StatCountDis")
	SpecialNote=rs("SpecialNote")
	OrderBy=rs("OrderBy")
	MaxPerPage=rs("MaxPerPage")
	LogoWidth=rs("LogoWidth")
	LogoHeight=rs("LogoHeight")
	
	SortDisplayType=rs("SortDisplayType")
	CountPerLine=rs("CountPerLine")
	LinkShowType=rs("LinkShowType")
	
	rs.close
end if
%>
<html>
<head>
<title><%response.write SiteName&" - 自助友情链接系统 1.7 - Power By DATA100.NET"%></title>
<LINK href="css.css" type=text/css rel=stylesheet>
<script>
function CloseOpen(Num){
	var CurrObj=eval("Tab"+Num);
	if (CurrObj.style.display!="none"){
		CurrObj.style.display="none";
		window.event.srcElement.src="img/collapsed_yes.gif"
	} else {
		CurrObj.style.display="";
		window.event.srcElement.src="img/collapsed_no.gif"
	}
}

function addgoout(ID){
	linkforward.linkforward.elements(0).value="goout";
	linkforward.linkforward.elements(1).value=ID;
	linkforward.linkforward.submit();
	setTimeout("window.location.reload()",1000);
}

function ReSort(SortType){
	document.URL="default.asp?SortType="+SortType;
}

function gotosearch(){
	formsearch.action="default.asp";
	formsearch.submit();
}
function gotocheck(txt){
	var width,height,left,top;
	width=500;
	height=200;
	left=screen.Width/2-width/2;
	top=(screen.Height-25)/2-height/2;
	window.open ('check3.asp?txt='+txt, '站点查看', 'height='+height+', width='+width+', top='+top+',left='+left+', toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=yes')

}

</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>

<body>
<iframe id="linkforward" src="linkforward.asp" frameborder="0" scrolling="no" width="0" height="0"></iframe>
<table  border="0" align="center" cellpadding="0" cellspacing="0" width="<%=PageWidth&Unit%>">
  <tr>
    <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
      <tr>
        <td bgcolor="#FFFFFF"><table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td></td>
            </tr>
          </table>
            <table width="99%" height="30"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="698cc3" class="title">
              <tr>
                <td><%response.write "&nbsp;<a class=""atitle"" href="""&SiteURL&""" target=_blank>"&SiteName&"</a>-<a class=""atitle"" href=""default.asp"">自助友情链接系统 V1.7</a>"%>
                </td>
                <td align="right"><img height="15" src="img/collapsed_no.gif" width="15" style="cursor: hand;" id="CtrImg1"  name="CtrImg1" onClick="CloseOpen(1)">&nbsp; </td>
              </tr>
            </table>
		  <table width=100% height=2  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>
            <!--显示与隐藏的表格-->
            <table width="99%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" id="Tab1">
              <tr bgcolor="#FFFFFF">
                <td height="20">申请步骤:注册账号-&gt;获得我站链接代码并在贵站添加我站链接代码-&gt;填写贵站信息-&gt;确认提交</td>
              </tr>
              <tr align="center" bgcolor="#FFFFFF">
                <td height="20" align="left">
			<%			
			if PR>0 then
				response.write "※ 本页面交换友情链接,要求贵站<font color=cc0000>PR值≧"&PR&"</font>,否则不能通过自动检查.<br>"
			end if
			if Alexa>0 then
				response.write "※ 本页面交换友情链接,要求贵站<font color=cc0000>Alexa排名"&Alexa&"</font>以上,否则不能通过自动检查.<br>"
			end if
			response.write "※  如果您打算使用LOGO图片,请注意图片格式为 "&LogoWidth&"×"&LogoHeight&" 像素.<br>"
			if IsVerify=true then
				response.write "※  所有申请的友情链接都要通过站长的<font color=cc0000>审核</font>才能显示.<br>"
			else
				response.write "※  站点审核功能已禁止,添加站点无需站长审核.<br>"
			end if
			if IsActivation=true then
				response.write "※  注意,申请成功后,需要从中贵站的链接入我站一次,进行<font color=cc0000>激活</font>才能显示.<br>"
			else
				response.write "※  无需激活,申请成功后即时显示.<br>"
			end if
			
			if SpecialNote<>"" then
				response.write replace(SpecialNote,chr(13),"<br>")&"<br>"
			end if
			
			%></td>
              </tr>
              <tr bgcolor="#FFFFFF">
                <td height="20">&nbsp;<a class=menu href="signup.asp" title="新用户申请">申请链接</a> &nbsp;<a class=menu href="login.asp?s=1" title="更正网站登录信息">修改信息</a> &nbsp;<a class=menu href="login.asp?s=1" title="获得我站友情链接代码">获得代码</a> &nbsp;<a class=menu href="login.asp?s=1" title="自行撤消贵站在我站的友情链接">撤消链接</a> &nbsp;<a class=menu href="login.asp?s=1" title="相互点入的次数统计">贡献统计</a> &nbsp;<a class=menu href="login.asp?s=2" title="管理员，查询,审核申请的友情链接">管理入口</a> 有任何问题,请联系:<a class=menu href="mailto:<%=Email%>"><%=MasterName%></a> </td>
              </tr>
            </table>
            <!--显示与隐藏的表格-->
		  <table width=100% height=2  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>
		  </td>
      </tr>
    </table>
    <%if StatCount>0 then%>
	<%
	if StatCountDis=true then
		IntImg="img/collapsed_no.gif"
		IntDisplay=""
	else
		IntImg="img/collapsed_yes.gif"
		IntDisplay="none"
	end if
	
	%>
	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
        <tr>
          <td valign="top" bgcolor="#FFFFFF">
			  <table width=100% height=2  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>
              <table width="99%" height="30"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="698cc3" class="title">
                <tr>
                  <td>&nbsp;站长工具</td>
                  <td align="right"><img alt="点击图标展开或折叠" height="15" src="<%=IntImg%>" width="15" style="cursor: hand;" id="CtrImg8"  name="CtrImg8" onClick="CloseOpen(2)">&nbsp; </td>
                </tr>
              </table>
<table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>
			<table width="99%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" id="Tab2">
			   <tr>
                  <td width="60%" bgcolor="#FFFFFF">您的站点是否符合我站要求:
					<input name="checkdomain" type="text" id="checkdomain" value="http://" size="30"> 
					<input type="button" name="Submit" value=" 检查 " onClick="gotocheck(checkdomain.value)"></td>
				  <form name="formsearch" id="formsearch">
                  <td bgcolor="#FFFFFF">站点搜索:
                    <input name="searchcontent" type="text" id="searchcontent" size="30">
                    <input type="button" name="Submit" value=" 搜索 " onClick="gotosearch()"></td>
				</form>
			</tr>
            </table>
<table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>
			</td>
        </tr>
    </table>	
    <br>
	
	<%
	'如果设置为显示平铺列表
	if IsSort=true and SortDisplayType=2 and LinkShowType<>3 then
	%>
	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
        <tr>
          <td valign="top" bgcolor="#FFFFFF"><table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td></td>
              </tr>
            </table>
              <table width="99%" height="30"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="698cc3" class="title">
                <tr>
                  <td>&nbsp;站点分类列表  </td>
                  <td align="right"><img alt="点击图标展开或折叠" height="15" src="<%=IntImg%>" width="15" style="cursor: hand;" id="CtrImg8"  name="CtrImg8" onClick="CloseOpen(3)">&nbsp; </td>
                </tr>
              </table>
<table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>
			<table width="99%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" id="Tab3">
			<tr>
         <td bgcolor="#FFFFFF">
					<%
					sql="select * from linkclass "
					set rs=conn.execute (sql)
					if not rs.eof then
						response.write "<table><tr>"
						i=0
						while not rs.eof
							if i mod CountPerLine =0 then response.write "</tr><tr>"
							response.write "<td>"
							if int(session("SortType"))=rs("ID") then
								response.write "<a href=""javascript:ReSort("&rs("ID")&")""><u><font color=#cc6600>"&rs("ClassName")&"</font></u></a>&nbsp;"
							else
								response.write "<a href=""javascript:ReSort("&rs("ID")&")"">"&rs("ClassName")&"</a>&nbsp;"
							end if
							response.write "</td>"
						rs.movenext
						i=i+1
						wend
						rs.close
						response.write "</tr></table>"
					end if
					%>
				  </td>
                  </tr>
            </table>
<table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>
<table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td></td>
              </tr>
          </table>
</td>
        </tr>
    </table>	
    <br>
	<%end if%>
	
	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
      <form id="form1" name="form1">
        <tr>
          <td valign="top" bgcolor="#FFFFFF"><table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td></td>
              </tr>
            </table>
              <table width="99%" height="30"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="698cc3" class="title">
                <tr>
                  <td>&nbsp;点入点出统计排行</td>
                  <td align="right"><img alt="点击图标展开或折叠" height="15" src="<%=IntImg%>" width="15" style="cursor: hand;" id="CtrImg8"  name="CtrImg8" onClick="CloseOpen(4)">&nbsp; </td>
                </tr>
              </table>
		  <table width=100% height=2  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>
		  <table width=100% height=2  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>
<table width="99%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="d6e0ef" style="display:<%=IntDisplay%>" id="Tab4">
  <tr valign="top" bgcolor="#FFFFFF">
    <td width="25%"><table width="98%"  border="0" align="left" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" style="display:">
      <tr bgcolor="#FFFFFF">
        <td width="25%" bgcolor="d6e0ef">&nbsp;总计点入排行</td>
      </tr>
      <tr bgcolor="#FFFFFF">
        <td><% call ShowTop("goin")%></td>
      </tr>
    </table></td>
    <td width="25%"><table width="98%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" style="display:">
      <tr bgcolor="#FFFFFF">
        <td width="25%" bgcolor="d6e0ef">&nbsp;今日点入排行</td>
      </tr>
      <tr bgcolor="#FFFFFF">
        <td><% call ShowTop("goinToday")%></td>
      </tr>
    </table></td>
    <td width="25%"><table width="98%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" style="display:">
      <tr bgcolor="#FFFFFF">
        <td width="25%" bgcolor="d6e0ef">&nbsp;总计点出排行</td>
      </tr>
      <tr bgcolor="#FFFFFF">
        <td><% call ShowTop("goout")%></td>
      </tr>
    </table></td>
    <td width="25%"><table width="98%"  border="0" align="right" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" style="display:">
      <tr bgcolor="#FFFFFF">
        <td width="25%" bgcolor="d6e0ef">&nbsp;今日点出排行</td>
      </tr>
      <tr bgcolor="#FFFFFF">
        <td><% call ShowTop("gooutToday")%></td>
      </tr>
    </table></td>
  </tr>
</table>
  <table width=100% height=2  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>
			</td>
        </tr>
      </form >
    </table>	
    <br>
	<%end if%>
	<%
	if replace(request("searchcontent"),"'","")<>"" then
		Session("searchcontent")=replace(request("searchcontent"),"'","")
	end if
	if request("viewall")=1 then
		Session("searchcontent")=""
		Session("Sqlsearchcontent")=""
	end if
	%>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
        <tr>
          <td bgcolor="#FFFFFF">
		  <table width=100% height=2  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>
              <table width="99%" height="30"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="698cc3" class="title">
                <tr>
                  <td>&nbsp;
				  <%
				  if IsSort=true and SortDisplayType=1 then
				  %>
				  <select name="select" style="width:100px;" onChange="ReSort(this.options[this.selectedIndex].value)">
                      <option value=0 >全部</option>
					<%
					sql="select * from linkclass "
					set rs=conn.execute (sql)
					if not rs.eof then
						while not rs.eof
					%>	
		<option value=<%=rs("ID")%> <%if int(session("SortType"))=rs("ID") then response.write " selected" end if%> ><%=rs("ClassName")%></option>
					<%
						rs.movenext
						wend
						rs.close
					end if
					%>
                    </select>友情链接列表<%else%>友情链接列表<%end if%>-(系统默认按
                  <%
			if OrderBy=1 then
				response.write "申请时间"
			elseif OrderBy=2 then
				response.write "点入数"
			end if
			%>
			排序)&nbsp; (
			<%if session("searchcontent")<>"" then%>
			<a href="?viewall=1"><font color="#FFFFFF"><u>取消查询</u></font></a> 
			<%end if%>
			
			<%if session("SortType")>0 then%>
			<a href="javascript:ReSort(0)"><font color="#FFFFFF"><u>全部分类</u></font></a>
			<%end if%>
			)&nbsp; 当前模式:
			<%
			if LinkShowType=1 then
			response.write "简约模式"
			elseif LinkShowType=2 then
			response.write "标准模式"
			elseif LinkShowType=3 then
			response.write "联盟模式"
			end if
			%></td>
                  <td align="right"><img height="15" src="img/collapsed_no.gif" width="15" style="cursor: hand;" id="CtrImg3"  name="CtrImg3" onClick="CloseOpen(5)">&nbsp; </td>
                </tr>
              </table>
		  <table width=100% height=2 border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>
			<table width="99%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="d6e0ef" id="Tab5">
			   <tr>
            <td bgcolor="#FFFFFF">
		<%
dim totalPut
dim CurrentPage

if not isempty(request("page")) then
	currentPage=cint(request("page"))
else
	currentPage=1
end if

if IsActivation=true then
	SqlActivation=" and goin>0"
else
	SqlActivation=""
end if

if IsVerify=true then
	SqlVerify=" and IsVerify=true"
else
	SqlVerify=""
end if

if session("SortType")>0 then
	SqlSortType=" and OwnerClass="&session("SortType")
else
	SqlSortType=""
end if
'if Session("searchcontent")<>"" then
'	Session("Sqlsearchcontent")=" and (Y_SiteName like '%"&Session("searchcontent")&"%' or Y_Alt like '%"&Session("searchcontent")&"%')"
'end if

if OrderBy=2 then
	sql="select * from link where Status<>1"&SqlActivation&SqlVerify&SqlSortType&" order by Isfixed, GoTop desc,goin desc"
elseif OrderBy=1 then
	sql="select * from link where Status<>1"&SqlActivation&SqlVerify&SqlSortType&" order by Isfixed,GoTop desc, jointime desc"
end if
'rs.CursorLocation=3 
rs.open sql,conn,1,3
if maxperpage=0 then maxperpage=rs.recordcount

if not Rs.eof then
	totalPut=rs.recordcount
	showContent
	if LinkShowType=2 then
	showpage totalput,MaxPerPage,"default.asp"
	end if
	rs.close
else
	Response.Write("<table width=100% height=50 border=0 cellpadding=1 cellspacing=1 bgcolor=d6e0ef align=center><tr><td align=center valign=middle bgcolor=ffffff>")
	response.write ("<b>没有找到你所查询的网站.</b>")
	Response.Write("</td></tr></table>")
end if 

sub showContent
	Select Case LinkShowType
		Case 1
			Call Simple
		Case 2
			Call Standard
		Case 3
			Call Union
	End Select
End Sub

Sub Union
	'第一步,建立分类数组
	dim ClassArr()
	ClassIndex=-1
	do while not rs.eof
		IsHere=0
		for i=0 to ClassIndex
			if rs("OwnerClass")=ClassArr(i) then
				IsHere=1
				exit for
			end if
		next
		if IsHere=0 then
			Redim Preserve ClassArr(ClassIndex+1)
			ClassArr(ClassIndex+1)=rs("OwnerClass")
			ClassIndex=ClassIndex+1
		end if
		rs.movenext
	loop
	'格式化数组
	dim FF
	FF=4 '每行显示数量
	ClassIndex=ClassIndex+1
	if ClassIndex>0 and ClassIndex mod FF <> 0 then
		Redim Preserve ClassArr(ClassIndex+(FF-ClassIndex mod FF)-1)
		ClassIndex=ClassIndex+(FF-ClassIndex mod FF)
	end if
	'输出内容
	%>
  <table width='100%' border=0 align=center cellpadding=1 cellspacing=1><tr>
	<%
	if ClassIndex<0 then
		response.write "<td> 没有链接</td>"
	else
		for i=1 to ClassIndex
			if i< ClassIndex and (i-1) mod FF = 0 then response.write "</tr><tr>"
			response.write "<td align='center' valign='top' width='"&(100/FF)&"%' >"
			ShowUnion ClassArr(i-1)
			response.write "</td>"
		next
	end if
	%>
	</tr></table>
	<%
End Sub

Sub ShowUnion (ClassId)
	if ClassId<>"" then
	response.write "<table width='100%'  border='0' align='center' cellpadding='1' cellspacing='1' bgcolor='d6e0ef' align='center' valign='top'>"
	response.write " <tr bgcolor='#FFFFFF'>"
	response.write "<td bgcolor='d6e0ef'>&nbsp;"
	response.write GetClassName2(ClassId)
	response.write "</td></tr>"
	response.write "<tr bgcolor='#FFFFFF'>"
	response.write "<td align='center' valign='top' height='200'>"
	Call ShowUnion2 (ClassId)
	response.write "</td></tr>"
	response.write "</table>"
	else
	response.write "<table width='100%'  border='0' align='center' cellpadding='1' cellspacing='1' bgcolor='d6e0ef' align='center' valign='top'>"
	response.write " <tr bgcolor='#FFFFFF'>"
	response.write "<td bgcolor='d6e0ef'>&nbsp;"

	response.write "</td></tr>"
	response.write "<tr bgcolor='#FFFFFF'>"
	response.write "<td align='center' valign='top' height='200'>"

	response.write "</td></tr>"
	response.write "</table>"
	end if
End Sub

Sub ShowUnion2 (ClassId)
	rs.movefirst
	response.write "<table width=100%  border=0 align=center cellpadding=0 cellspacing=0>"
	j=1
	do while not rs.eof
		if j>10 then exit do
		if rs("OwnerClass")=ClassId then
		response.write " <tr bgcolor='#FFFFFF'>"
		response.write "<td width='60%'>&nbsp;"
		response.write "<a href='"&rs("Y_SiteURL")&"' onclick='addgoout("&rs("Id")&")' title='"&rs("Y_Alt")&"' alt='"&rs("Y_SiteName")&"' target=_blank>"

		if (Instr(rs("Y_SiteName"),Session("searchcontent")) or Instr(rs("Y_SiteURL"),Session("searchcontent")) or Instr(rs("Y_Alt"),Session("searchcontent")) ) and Session("searchcontent")<>"" then
		response.write "<font color=red><u>"&rs("Y_SiteName")&"</u></font>"
		else
		response.write rs("Y_SiteName")
		end if
		response.write"</a>"
		response.write "</td>"
		response.write "<td width='20%'><· "&rs("goin")&" </td>"
		response.write "<td width='20%'>·> "&rs("goout")&" </td>"
		response.write "</tr>"
		j=j+1
		end if
		rs.movenext
	loop
	response.write "</table>"
	
	response.write ""
	response.write ""
End Sub

Sub Simple
	dim F
	F=6 '每行显示数量

	dim LogoArr()
	dim TextArr()
	LogoIndex=0
	TextIndex=0
	do while not rs.eof
		if rs("Y_Logo")<>"" then
			Redim Preserve LogoArr(LogoIndex)
			LogoArr(UBound(LogoArr))=rs("id")&"$"&rs("Y_SiteName")&"$"&rs("Y_SiteURL")&"$"&rs("Y_Logo")&"$"&rs("Y_Alt")
			LogoIndex=LogoIndex+1
		else
			Redim Preserve TextArr(TextIndex)
			TextArr(UBound(TextArr))=rs("id")&"$"&rs("Y_SiteName")&"$"&rs("Y_SiteURL")&"$"&rs("Y_Logo")&"$"&rs("Y_Alt")
			TextIndex=TextIndex+1
		end if
		rs.movenext
	loop

	if LogoIndex>0 and LogoIndex mod F <> 0 then
		Redim Preserve LogoArr(LogoIndex+(F-LogoIndex mod F)-1)
		LogoIndex=LogoIndex+(F-LogoIndex mod F)
		for i=0 to Ubound(LogoArr)
			if LogoArr(i)="" then
				LogoArr(i)="0"&"$"&SiteName&"$"&"signup.asp"&"$"&"img/yourplace.gif"&"$"&SiteName
			end if
		next
	end if
	if TextIndex>0 and TextIndex mod F <> 0 then
		Redim Preserve TextArr(TextIndex+(F-TextIndex mod F)-1)
		TextIndex=TextIndex+(F-TextIndex mod F)
		for i=0 to Ubound(TextArr)
			if TextArr(i)="" then
				TextArr(i)="0"&"$"&"您的位置"&"$"&"signup.asp"&"$"&"img/yourplace.gif"&"$"&"您的位置"
			end if
		next
	end if
	'rs.sort="Y_Logo desc"
	%>
  <table width='100%'  border='0' align='center' cellpadding='3' cellspacing='1' bgcolor="d6e0ef">
	<tr bgcolor='d6e0ef'>
	  <td>LOGO Link </td>
    </tr>
	<tr>
	  <td bgcolor="ffffff">
	  <table width='100%' border=0 align=center cellpadding=3 cellspacing=3><tr>
<%
if LogoIndex=0 then
	response.write "<td> 没有LOGO链接</td>"
else
	for i=1 to LogoIndex
		if i< LogoIndex and (i-1) mod F = 0 then response.write "</tr><tr>"
		TempArr=Split(LogoArr(i-1),"$")
		response.write "<td><a "
		if TempArr(0)<>0 then response.write "onclick=""addgoout("&TempArr(0)&")"""
		response.write " href='"&TempArr(2)&"' target=_blank title='"&TempArr(4)&"'>"
		response.write "<img src='"&TempArr(3)&"' width="&LogoWidth&" height="&LogoHeight
		if Instr(LogoArr(i-1),Session("searchcontent")) and Session("searchcontent")<>"" then
		response.write " border=1"
		else
		response.write " border=0"
		end if
		response.write "alt='"&TempArr(1)&"'"
		response.write "/>"
		response.write "</a>"
		response.write "</td>"
	next
end if
%></tr></table>
	  </td>
  </tr>
</table>
  <table width=100% height=5  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>
  <table width='100%'  border='0' align='center' cellpadding='3' cellspacing='1' bgcolor="d6e0ef">
	<tr bgcolor='d6e0ef'>
	  <td>Text Link </td>
    </tr>
	<tr>
	  <td bgcolor="ffffff">
	  <table width='100%' border=0 align=center cellpadding=3 cellspacing=3><tr>
<%
if TextIndex=0 then
	response.write "<td> 没有Text链接</td>"
else
	for i=1 to TextIndex
		if i< TextIndex and (i-1) mod F = 0 then response.write "</tr><tr>"
		TempArr=Split(TextArr(i-1),"$")
		response.write "<td><a "
		if TempArr(0)<>0 then response.write "onclick=""addgoout("&TempArr(0)&")"""
		response.write " href='"&TempArr(2)&"' target=_blank title='"&TempArr(4)&"'>"

		if Instr(TextArr(i-1),Session("searchcontent")) and Session("searchcontent")<>"" then
		response.write "<font color=red><u>"&TempArr(1)&"</u></font>"
		else
		response.write TempArr(1)
		end if
		
		response.write "</a>"
		response.write "</td>"
	next
end if
%></tr></table>
	  </td>
  </tr>
</table>
<%
End Sub

Sub Standard %>
<table width=100% height=2  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>
  <table width="99%"  border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="d6e0ef">
	<tr align="center" bgcolor="d6e0ef">
	  <td width="40%" align="center"><FONT color=#000000><B>网站名称</b></FONT></td>
		<%if IsSort=true then%>
	  <td width="15%" align="left"><FONT color=#000000><B>属性类别</B></FONT></td>
		<%end if%>
	  <td width="10%"><FONT color=#000000><B>注册时间</B></FONT></td>
		<td width="5%"><FONT color=#000000><B>PR</B></FONT></td>
		<td width="5%"><FONT color=#000000><B>ALEXA</B></FONT></td>
		<td width="10%"><FONT color=#000000><B>Google</B></FONT></td>
		<td width="10%"><FONT color=#000000><B>BaiDu</B></FONT></td>
	</tr>
</table>
<%
	dim i 
	i=0
	do while not rs.eof 
		ID = rs("ID")
		if Session("searchcontent")<>"" then
			Y_SiteName = replace(rs("Y_SiteName"),Session("searchcontent"),"<font color=red><u>"&Session("searchcontent")&"</u></font>")
		else
			Y_SiteName = rs("Y_SiteName")
		end if
		Y_SiteURL = rs("Y_SiteURL")
		Y_Logo = rs("Y_Logo")
		
		if Session("searchcontent")<>"" then
			Y_Alt = replace(rs("Y_Alt"),Session("searchcontent"),"<font color=red><u>"&Session("searchcontent")&"</u></font>")
		else
			Y_Alt = rs("Y_Alt")
		end if
		
		dim goin
		dim goout
		dim jointime
		dim OwnerClass
		dim OwnerClassName
		dim goinToday
		dim inToday
		dim gooutToday
		dim outToday
		dim pr
		dim alexa
		dim Google
		dim Baidu
		
		goin = rs("goin")
		goout = rs("goout")
		jointime = rs("jointime")
		OwnerClass = rs("OwnerClass")
		OwnerClassName = getclassname(OwnerClass)
		inToday = rs("inToday")
		if datediff("d",inToday,now()) >1 then
			goinToday=0
		else
			goinToday = rs("goinToday")
		end if
		
		outToday = rs("outToday")
		if datediff("d",outToday,now()) >1 then
			gooutToday=0
		else
			gooutToday = rs("gooutToday")
		end if

		pr=rs("PR")
		alexa=rs("Alexa")
		Google=rs("Google")
		Baidu=rs("Baidu")
		
		Response.Write("<TABLE width=99% align=center border=0 cellpadding=1 cellspacing=1 bgcolor=#000000>")
		Response.Write("<tr><td bgcolor=#ffffff>")
		Response.Write("<TABLE width=100% align=center border=0 cellpadding=0 cellspacing=0>")
		Response.Write("	<TR bgColor=#d6e0ef>")
		Response.Write(" <td width=""40%"">&nbsp;<a onclick=""addgoout("&ID&")"" href="""&Y_SiteURL&""" target=_blank ><b>"&Y_SiteName&"</b></a></td>")
		if IsSort=true then
		Response.Write(" <td width=""15%"">"&OwnerClassName&"</td>")
		end if
		Response.Write(" <td align=center width=""10%"">"&year(jointime)&"-"&month(jointime)&"-"&day(jointime)&"</td>")
		Response.Write(" <td align=center width=""5%"">"&pr&"</td>")
		Response.Write(" <td align=center width=""5%"">"&RW(alexa)&"</td>")
		Response.Write(" <td align=center width=""10%"">"&Google&"</td>")
		Response.Write(" <td align=center width=""10%"">"&Baidu&"</td>")
		Response.Write("</TR></table>")
		
		Response.Write("<table width=100% border=0 cellspacing=1 cellpadding=1>")
		Response.Write("<tr>")
		Response.Write("<td rowspan=2 bgcolor=f3f6fa>")
		if Y_Logo<>"" then
			Response.write ("<a onclick=""addgoout("&ID&")"" target=_blank href="""&Y_SiteURL&""" title="""&Y_Alt&"""><img border=0 width="&LogoWidth&" height="&LogoHeight&" alt="""&Y_SiteName&""" src="""&Y_Logo&"""/></a>")
		else
			Response.write ("<a onclick=""addgoout("&ID&")"" target=_blank href="""&Y_SiteURL&""" title="""&Y_Alt&"""><img border=0 width="&LogoWidth&" height="&LogoHeight&" alt="""&Y_SiteName&""" src=""img/nologo.gif""/></a>")
		end if
		Response.Write("</td><td colspan=2 bgcolor=f3f6fa>"&Y_Alt&"</td></tr>")
		Response.Write("<tr>")
					
		Response.Write("	<td width=50% bgcolor=f3f6fa>")
		Response.Write("	<table width=99% border=0 cellspacing=0 cellpadding=0><tr>")
		Response.Write("	<td width=20% bgcolor=f3f6fa><font color=999900>总计点入</font>:"&goin&"</td>")
		Response.Write("	<td width=20% bgcolor=f3f6fa><font color=999900>今天点入</font>:"&goinToday&"</td>")
		Response.Write("	<td width=20% bgcolor=f3f6fa><font color=999900>平均点入</font>:"&average(goin,signtime,now)&"</td>")
		Response.Write("	<td width=30% bgcolor=f3f6fa><font color=999900>最后点入</font>:"&year(inToday)&"-"&month(inToday)&"-"&day(inToday)&"</td>")
		Response.Write("	<td width=10% bgcolor=f3f6fa>&nbsp;</td>")
		Response.Write("	</tr></table></td>")

		Response.Write("	<td width=50% bgcolor=f3f6fa>")
		Response.Write("	<table width=99% border=0 cellspacing=0 cellpadding=0><tr>")
		Response.Write("	<td width=20% bgcolor=f3f6fa><font color=999900>总计点出</font>:"&goout&"</td>")
		Response.Write("	<td width=20% bgcolor=f3f6fa><font color=999900>今天点出</font>:"&gooutToday&"</td>")
		Response.Write("	<td width=20% bgcolor=f3f6fa><font color=999900>平均点出</font>:"&average(goout,signtime,now)&"</td>")
		Response.Write("	<td width=30% bgcolor=f3f6fa><font color=999900>最后点出</font>:"&year(outToday)&"-"&month(outToday)&"-"&day(outToday)&"</td>")
		Response.Write("	<td width=10% bgcolor=f3f6fa>&nbsp;</td>")
		Response.Write("	</tr></table></td>")

		Response.Write("	</tr></table>")
		Response.Write("</TD></TR></TABLE>")
		
		Response.Write("<table width=100% height=5  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>")



		i=i+1
		if i>=MaxPerPage then exit do
		rs.movenext
	loop
end sub 

function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
	n= totalnumber \ maxperpage
else
	n= totalnumber \ maxperpage+1
end if
response.write "<table cellspacing=1 width='99%' border=0 align=center bgcolor=d6e0ef>"
response.write "<form method=Post action="""&filename&"?channel="&channel&"""><tr><td align=right> "
if CurrentPage<2 then
	response.write "共<font color=red>"&totalnumber&"</font>个友情站点&nbsp;首页 上一页&nbsp;"
else
	response.write "共<font color=red>"&totalnumber&"</font>个友情站点&nbsp;<a href="&filename&"?channel="&channel&">首页</a>&nbsp;"
	response.write "<a href="&filename&"?page="&CurrentPage-1&"&channel="&channel&">上一页</a>&nbsp;"
end if

if n-currentpage<1 then
	response.write "下一页 尾页"
else
	response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&channel="&channel&">"
	response.write "下一页</a> <a href="&filename&"?page="&n&"&channel="&channel&">尾页</a>"
end if
response.write "&nbsp;页次：<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
response.write "&nbsp;<b>"&maxperpage&"</b>个/页 "
%>
转到：
<input type=hidden name="channel" value=<%=channel%>>
<select name='page' size='1' style="font-size: 9pt" onChange='javascript:submit()'>
  <%for i = 1 to n%>
  <option value='<%=i%>' <%if CurrentPage=cint(i) then%> selected <%end if%>>第<%=i%>页</option>
  <%next%>
</select>
<%   
response.write "</td></tr></FORM></table>"
end function

sub ShowTop(showtype)
	dim TopField
	dim TopImg
	dim TopAlt
	dim TopOtherCondition
	Select Case showtype
	Case "goin"
		TopField="goin"
		TopImg="<·"
		TopAlt="点"
		TopOtherCondition=""
	Case "goinToday"
		TopField="goinToday"
		TopImg="<·"
		TopAlt="点入"
		TopOtherCondition=" and datediff('d',inToday,now())=0"
	Case "goout"
		TopField="goout"
		TopImg="·>"
		TopAlt="点出"
		TopOtherCondition=""
	Case "gooutToday"
		TopField="gooutToday"
		TopImg="·>"
		TopAlt="点出"
		TopOtherCondition=" and datediff('d',outToday,now())=0"
	End Select
	sqlTop="select top "&StatCount&" ID,Y_SiteName,Y_SiteURL,Y_Alt,"&TopField&" from link where Status<>1 and "&TopField&">0 "&TopOtherCondition&" order by "&TopField&" desc"
	set rsTop=conn.execute (sqlTop)
	response.write "<table width=100%  border=0 align=center cellpadding=0 cellspacing=0>"
	for i=1 to StatCount
		if not rsTop.eof then
			response.write "<tr>"
			response.write "<td>&nbsp;<a onclick=""addgoout("&rsTop("ID")&")"" href="""&rsTop("Y_SiteURL")&""" title="""&rsTop("Y_Alt")&""" target=_blank>"&rsTop("Y_SiteName")&"</a></td>"
			response.write "<td width=""25%"">"&TopImg&"&nbsp;"&rsTop(4)&"</td>"
			response.write "</tr>"
			rsTop.movenext
		else
			response.write "<tr>"
			response.write "<td>&nbsp;</td>"
			response.write "<td width=""10%"">&nbsp;</td>"
			response.write "</tr>"
		end if
	next
	response.write "</table>"
	rsTop.close
	set rsTop=nothing
end sub
%>
						
						</td>
			</tr>
      </table>
              <!--显示与隐藏的表格-->
		  <table width=100% height=5  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>
			</td>
        </tr>
      </table>
<table width=100% height=5  border=0 cellpadding=0 cellspacing=0><tr><td align="right" >
<%
EndTime=Timer
Response.Write "<br>程序执行时间："&(EndTime-BeginTime)*1000&"毫秒"
%>
</td></tr></table>
	  
	  </td>
  </tr>
</table>

</body>
</html>
