<!--#include file="dbconfig.asp"-->
<%

dim ScriptWords
dim rs1_link
dim rs2_link
dim rs3_link
sub ShowFriendLink (DislayOrder,LogoLine,LogoCount,WordLine,WordCount,TabWidth,TabAlign,sTabBorderColor,tTabBGColor,TabBGColor,TabBorderWidth,TabBorderColor,TabCellSpacing,TabCellPadding,TabCellColor,TabLinHeight,OwnerClass,LinkUrl,IsTop)
	dim conn_link
	dim connstr_link
	dim db_link
	dim rs_link
	dim sLinkUrl_link
	dim sql_link
	dim SqlActivation_link
	dim sql1_link
	dim sql2_link
	dim sql3_link
	dim i_link
	
	dim SqlSetTop
	dim ClassStr
	
	db_link=LinkUrl&sysDataBase
	Set conn_link = Server.CreateObject("ADODB.Connection")
	Set rs_link=Server.CreateObject("ADODB.Recordset")
	connstr_link="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db_link)
	'connstr_link="driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath(""&db_link&"")
		
	conn_link.Open connstr_link
	
	response.write vbcrlf
	'response.write "<LINK href="""&LinkUrl&"css.css"" type=text/css rel=stylesheet>"&vbcrlf
	response.write "<IFRAME id=""Iframelinkforward"" dy=100 name=""linkforward"" SRC="""&LinkUrl&"linkforward.asp"" FRAMEBORDER=1 SCROLLING=no WIDTH=0 HEIGHT=0></IFRAME>"&vbcrlf
	response.write "<script>"&vbcrlf
	response.write "function addgoout(ID){"&vbcrlf
	response.write ""&vbcrlf
	response.write "	Iframelinkforward.linkforward.elements(0).value=""goout"";"&vbcrlf
	response.write "	Iframelinkforward.linkforward.elements(1).value=ID;"&vbcrlf
	response.write "	Iframelinkforward.linkforward.submit();"&vbcrlf
	response.write "	//setTimeout(""window.location.reload()"",1000);"&vbcrlf
	response.write "}"&vbcrlf
	response.write "</script>"&vbcrlf

	if LinkUrl="" then
		sLinkUrl_link="default.asp"
	else
		sLinkUrl_link=LinkUrl&"default.asp"
	end if
	dim PR_link
	dim Alexa_link
	dim IsConfirm_link
	dim IsVerify_link
	dim IsActivation_link
	dim SpecialNote_link
	dim OrderBy_link
	dim MaxPerPage_link
	dim LogoWidth_link
	dim LogoHeight_link
	

	sql_link="select * from setting"
	set rs_link=conn_link.execute (sql_link)
	if not rs_link.eof then
		PR_link=rs_link("PR")
		Alexa_link=rs_link("Alexa")
		IsConfirm_link=rs_link("IsConfirm")
		IsVerify_link=rs_link("IsVerify")
		IsActivation_link=rs_link("IsActivation")
		SpecialNote_link=rs_link("SpecialNote")
		OrderBy_link=rs_link("OrderBy")
		MaxPerPage_link=rs_link("MaxPerPage")
		LogoWidth_link=rs_link("LogoWidth")
		LogoHeight_link=rs_link("LogoHeight")
		rs_link.close
	end if
	

	if IsActivation_link=true then
		SqlActivation_link=" and goin>0"
	else
		SqlActivation_link=""
	end if
	
	if IsVerify_link=true then
		SqlActivation_link=" and IsVerify=true"
	else
		SqlActivation_link=""
	end if
	
	if IsTop=1 then
		SqlSetTop=" and Isfixed=true"
	else
		SqlSetTop=""
	end if
	if OwnerClass="0" then
		ClassStr=""
	else
		OwnerClass=Replace(OwnerClass,"x",",")
		ClassStr=" and OwnerClass in ("&OwnerClass&")"
	end if
	
	if OrderBy_link=2 then
		OrderBy_link=" order by Isfixed, goin desc"
	elseif OrderBy_link=1 then
		OrderBy_link=" order by Isfixed, jointime desc"
	end if
	
	sql1_link="select ID,Y_SiteName,Y_SiteURL,Y_Logo,Y_Alt,goin,goout,Isfixed from link where Status<>1"&SqlActivation_link&" and len(Y_Logo)>7 "&SqlSetTop&ClassStr&OrderBy_link
	sql2_link="select ID,Y_SiteName,Y_SiteURL,Y_Logo,Y_Alt,goin,goout,jointime,Isfixed from link where Status<>1"&SqlActivation_link&" and (isNull (Y_Logo) or  Y_Logo='') "&SqlSetTop&ClassStr&OrderBy_link
	sql3_link="select ID,Y_SiteName,Y_SiteURL,Y_Logo,Y_Alt,goin,goout,jointime,Isfixed from link where Status<>1"&SqlActivation_link&SqlSetTop&ClassStr&OrderBy_link
	
	if DislayOrder="LOGO" or DislayOrder="Word" then
		set rs1_link=conn_link.execute (sql1_link)
		set rs2_link=conn_link.execute (sql2_link)
	end if
	if DislayOrder="AllLOGO" or DislayOrder="AllWord" then
		set rs3_link=conn_link.execute (sql3_link)
	end if
	ScriptWords=ScriptWords& "	<table width="&TabWidth&" border=0 align="&TabAlign&" cellpadding=0 cellspacing=1 bgcolor="&sTabBorderColor&"><tr>"&vbcrlf
	ScriptWords=ScriptWords& "	<td bgcolor=ffffff>"&vbcrlf
	ScriptWords=ScriptWords& "	<table width=99% height=2  border=0 align=center cellpadding=0 cellspacing=0><tr><td></td></tr></table>"&vbcrlf
	ScriptWords=ScriptWords& "	<table width=99% border=0 align=center cellpadding=0 cellspacing=0 bgcolor="&tTabBGColor&" class=title>"&vbcrlf
	ScriptWords=ScriptWords& "	<tr><td align=""right"" height=""21"">"&vbcrlf
	ScriptWords=ScriptWords& "	<a class=atitile href="""&sLinkUrl_link&""" target=_blank><font color=""#333333"">更多友情链接>></font></a>"
	ScriptWords=ScriptWords& "&nbsp;</td></tr>"&vbcrlf
	ScriptWords=ScriptWords& "	</table>"&vbcrlf
	ScriptWords=ScriptWords& "	<table width=99% height=2  border=0 align=center cellpadding=0 cellspacing=0><tr><td></td></tr></table>"&vbcrlf
	
	if DislayOrder="AllLOGO" then
		if LogoLine>0 then
			call alllogo(rs3_link,DislayOrder,LogoLine,LogoCount,WordLine,WordCount,TabWidth,TabAlign,sTabBorderColor,tTabBGColor,TabBGColor,TabBorderWidth,TabBorderColor,TabCellSpacing,TabCellPadding,TabCellColor,TabLinHeight,LinkUrl,LogoWidth_link,LogoHeight_link)
			ScriptWords=ScriptWords& "	<table width=100% height=2  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>"&vbcrlf
		end if
	elseif DislayOrder="AllWord" then
		if WordLine>0 then
			call allword(rs3_link,DislayOrder,LogoLine,LogoCount,WordLine,WordCount,TabWidth,TabAlign,sTabBorderColor,tTabBGColor,TabBGColor,TabBorderWidth,TabBorderColor,TabCellSpacing,TabCellPadding,TabCellColor,TabLinHeight,LinkUrl,LogoWidth_link,LogoHeight_link)
			ScriptWords=ScriptWords& "	<table width=100% height=2  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>"&vbcrlf
		end if
	elseif DislayOrder="LOGO" then
		if LogoLine>0 then
			call logo(rs1_link,DislayOrder,LogoLine,LogoCount,WordLine,WordCount,TabWidth,TabAlign,sTabBorderColor,tTabBGColor,TabBGColor,TabBorderWidth,TabBorderColor,TabCellSpacing,TabCellPadding,TabCellColor,TabLinHeight,LinkUrl,LogoWidth_link,LogoHeight_link)
		end if
		if LogoLine>0 and LogoLine>0 then
			ScriptWords=ScriptWords& "	<table width=99% height=2  border=0 align=center cellpadding=0 cellspacing=0><tr><td></td></tr></table>"&vbcrlf
		end if
		if WordLine>0 then
			call word(rs2_link,DislayOrder,LogoLine,LogoCount,WordLine,WordCount,TabWidth,TabAlign,sTabBorderColor,tTabBGColor,TabBGColor,TabBorderWidth,TabBorderColor,TabCellSpacing,TabCellPadding,TabCellColor,TabLinHeight,LinkUrl,LogoWidth_link,LogoHeight_link)
			ScriptWords=ScriptWords& "	<table width=100% height=2  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>"&vbcrlf
		end if
	elseif DislayOrder="Word" then
		if WordLine>0 then
			call word(rs2_link,DislayOrder,LogoLine,LogoCount,WordLine,WordCount,TabWidth,TabAlign,sTabBorderColor,tTabBGColor,TabBGColor,TabBorderWidth,TabBorderColor,TabCellSpacing,TabCellPadding,TabCellColor,TabLinHeight,LinkUrl,LogoWidth_link,LogoHeight_link)
		end if
		if LogoLine>0 and LogoLine>0 then
			ScriptWords=ScriptWords& "	<table width=99% height=2  border=0 align=center cellpadding=0 cellspacing=0><tr><td></td></tr></table>"&vbcrlf
		end if
		if LogoLine>0 then
			call logo(rs1_link,DislayOrder,LogoLine,LogoCount,WordLine,WordCount,TabWidth,TabAlign,sTabBorderColor,tTabBGColor,TabBGColor,TabBorderWidth,TabBorderColor,TabCellSpacing,TabCellPadding,TabCellColor,TabLinHeight,LinkUrl,LogoWidth_link,LogoHeight_link)
			ScriptWords=ScriptWords& "	<table width=100% height=2  border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>"&vbcrlf
		end if
	end if

	ScriptWords=ScriptWords& "	</td>"&vbcrlf
	ScriptWords=ScriptWords& "	</tr></table>"&vbcrlf
	
	response.write ScriptWords
	'response.end
end sub

function logo(rs1_link,DislayOrder,LogoLine,LogoCount,WordLine,WordCount,TabWidth,TabAlign,sTabBorderColor,tTabBGColor,TabBGColor,TabBorderWidth,TabBorderColor,TabCellSpacing,TabCellPadding,TabCellColor,TabLinHeight,LinkUrl,LogoWidth_link,LogoHeight_link)
	ScriptWords=ScriptWords& "	<!--LOGO-->"&vbcrlf

	ScriptWords=ScriptWords& "	<table width=99% border="&TabBorderWidth&"  bordercolor="&TabBorderColor&" align=center cellpadding="&TabCellPadding&" cellspacing="&TabCellSpacing&" bgcolor="&TabBGColor&">"&vbcrlf
	dim i_link
	dim j_link
	dim Y_LogoSrc
	
	for i_link=1 to LogoLine
			ScriptWords=ScriptWords& "	<tr bgcolor="&TabCellColor&" style=""line-height:"&TabLinHeight&""">"&vbcrlf
			for j_link=1 to LogoCount
				if not rs1_link.eof then
					if rs1_link("Y_Logo")="" then
						Y_LogoSrc=LinkUrl&"img/nologo.gif"
					elseif lcase(left(rs1_link("Y_Logo"),7))<>"http://" then
						Y_LogoSrc=LinkUrl&rs1_link("Y_Logo")
					else
						Y_LogoSrc=rs1_link("Y_Logo")
					end if
					ScriptWords=ScriptWords& "	<td align=center height=20 width="""&(100/LogoCount)&"%"" ><a title="""&rs1_link("Y_Alt")&""" onclick=""addgoout("&rs1_link("ID")&")"" target=_blank href="""&rs1_link("Y_SiteURL")&"""><img border=0 width="&LogoWidth_link&" height="&LogoHeight_link&" alt="""&rs1_link("Y_Alt")&""" src="""&Y_LogoSrc&"""/></a></td>"&vbcrlf
					rs1_link.movenext
				else
					ScriptWords=ScriptWords& "	<td align=center height=20 width="""&(100/LogoCount)&"%"" ><a href="""&LinkUrl&"signup.asp"" target=_blank><img border=0 src="""&LinkUrl&"img/yourplace.gif""><a></td>"&vbcrlf
				end if
			next
			ScriptWords=ScriptWords& "	</tr>"&vbcrlf
	next

	ScriptWords=ScriptWords& "	</table>"&vbcrlf
end function 

function alllogo(rs3_link,DislayOrder,LogoLine,LogoCount,WordLine,WordCount,TabWidth,TabAlign,sTabBorderColor,tTabBGColor,TabBGColor,TabBorderWidth,TabBorderColor,TabCellSpacing,TabCellPadding,TabCellColor,TabLinHeight,LinkUrl,LogoWidth_link,LogoHeight_link)
	ScriptWords=ScriptWords& "	<!--LOGO-->"&vbcrlf
	ScriptWords=ScriptWords& "	<table width=99% border="&TabBorderWidth&"  bordercolor="&TabBorderColor&" align=center cellpadding="&TabCellPadding&" cellspacing="&TabCellSpacing&" bgcolor="&TabBGColor&">"&vbcrlf
	for i_link=1 to LogoLine
		ScriptWords=ScriptWords& "	<tr bgcolor="&TabCellColor&" style=""line-height:"&TabLinHeight&""">"&vbcrlf
		for j_link=1 to LogoCount
			if not rs3_link.eof then
				if rs3_link("Y_Logo")="" or IsNull(rs3_link("Y_Logo")) then
					Y_LogoSrc=LinkUrl&"img/nologo.gif"
				elseif lcase(left(rs3_link("Y_Logo"),7))<>"http://" then
					Y_LogoSrc=LinkUrl&rs3_link("Y_Logo")
				else
					Y_LogoSrc=rs3_link("Y_Logo")
				end if
				ScriptWords=ScriptWords& "	<td align=center height=20 width="""&(100/LogoCount)&"%"" ><a title="""&rs1("Y_Alt")&""" onclick=""addgoout("&rs3_link("ID")&")"" target=_blank href="""&rs3_link("Y_SiteURL")&"""><img border=0 width="&LogoWidth_link&" height="&LogoHeight_link&" alt="""&rs3_link("Y_Alt")&""" src="""&Y_LogoSrc&"""/></a></td>"&vbcrlf
				rs3_link.movenext
			else
				ScriptWords=ScriptWords& "	<td align=center height=20 width="""&(100/LogoCount)&"%"" ><a href="""&LinkUrl&"signup.asp"" target=_blank><img border=0 src="""&LinkUrl&"img/yourplace.gif""><a></td>"&vbcrlf
			end if
		next
		ScriptWords=ScriptWords& "	</tr>"&vbcrlf
	next
	ScriptWords=ScriptWords& "	</table>"&vbcrlf
end function 

function word(rs2_link,DislayOrder,LogoLine,LogoCount,WordLine,WordCount,TabWidth,TabAlign,sTabBorderColor,tTabBGColor,TabBGColor,TabBorderWidth,TabBorderColor,TabCellSpacing,TabCellPadding,TabCellColor,TabLinHeight,LinkUrl,LogoWidth_link,LogoHeight_link)
	ScriptWords=ScriptWords& "	<!--WORD-->"&vbcrlf
	ScriptWords=ScriptWords& "	<table width=99% border="&TabBorderWidth&"  bordercolor="&TabBorderColor&" align=center cellpadding="&TabCellPadding&" cellspacing="&TabCellSpacing&" bgcolor="&TabBGColor&">"&vbcrlf
	dim i_link
	dim j_link

	for i_link=1 to WordLine
		ScriptWords=ScriptWords& "	<tr bgcolor="&TabCellColor&" style=""line-height:"&TabLinHeight&""">"&vbcrlf
		for j_link=1 to WordCount
			if not rs2_link.eof then
				ScriptWords=ScriptWords& "	<td align=center height=20 width="""&(100/WordCount)&"%"" ><a onclick=""addgoout("&rs2_link("ID")&")"" target=_blank href="""&rs2_link("Y_SiteURL")&""" title="""&rs2_link("Y_Alt")&""">"&rs2_link("Y_SiteName")&"</a></td>"&vbcrlf
				rs2_link.movenext
			else
				ScriptWords=ScriptWords& "	<td align=center height=20 width="""&(100/WordCount)&"%"" ><a href="""&LinkUrl&"signup.asp"" target=_blank>您的位置</a></td>"&vbcrlf
			end if
		next
		ScriptWords=ScriptWords& "	</tr>"&vbcrlf
	next
	ScriptWords=ScriptWords& "	</table>"&vbcrlf

end function

function allword(rs3_link,DislayOrder,LogoLine,LogoCount,WordLine,WordCount,TabWidth,TabAlign,sTabBorderColor,tTabBGColor,TabBGColor,TabBorderWidth,TabBorderColor,TabCellSpacing,TabCellPadding,TabCellColor,TabLinHeight,LinkUrl,LogoWidth_link,LogoHeight_link)
	ScriptWords=ScriptWords& "	<!--WORD-->"&vbcrlf
	ScriptWords=ScriptWords& "	<table width=99% border="&TabBorderWidth&"  bordercolor="&TabBorderColor&" align=center cellpadding="&TabCellPadding&" cellspacing="&TabCellSpacing&" bgcolor="&TabBGColor&">"&vbcrlf
	dim i_link
	dim j_link
	for i_link=1 to WordLine
		ScriptWords=ScriptWords& "	<tr bgcolor="&TabCellColor&" style=""line-height:"&TabLinHeight&""">"&vbcrlf
		for j_link=1 to WordCount
			if not rs3_link.eof then
				ScriptWords=ScriptWords& "	<td align=center height=20 width="""&(100/WordCount)&"%"" ><a onclick=""addgoout("&rs3_link("ID")&")"" target=_blank href="""&rs3_link("Y_SiteURL")&""" title="""&rs3_link("Y_Alt")&""">"&rs3_link("Y_SiteName")&"</a></td>"&vbcrlf
				rs3_link.movenext
			else
				ScriptWords=ScriptWords& "	<td align=center height=20 width="""&(100/WordCount)&"%"" ><a href="""&LinkUrl&"signup.asp"" target=_blank>您的位置</a></td>"&vbcrlf
			end if
		next
		ScriptWords=ScriptWords& "	</tr>"&vbcrlf
	next
	ScriptWords=ScriptWords& "	</table>"&vbcrlf
end function 

%>