<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--#include file="conn.asp"-->
<!--#include file="common.asp"-->
<!--#include file="md5.asp"-->
<%
dim SortType
SortType=request("SortType")
if SortType<>"" then
	session("SortType")=SortType
end if
%>

<%
if Request("index")="7" then
	ID=Cint(request("ID"))
	sql="delete * from link where ID="&ID
	conn.execute (sql)
	response.write "<script>alert(""操作成功!"");document.URL=""admin.asp?page="&session("currentPage")&"#7"";</script>"
end if

if request("IsSubmit")="1" then
	Select case Request("index")
	case "1"
		Call submit1()
	case "2"
		Call submit2()
	case "3"
		Call submit3()
	case "4"
		Call submit4()
	case "5"
		Call submit5()
	case "6"
		Call submit6()	
	case "31"
		Call submit31()
	case "22"
		Call submit22()
	end Select
end if

sub submit1	
	SiteName=trim(replace(request("SiteName"),"'",""))
	SiteURL=trim(replace(request("SiteURL"),"'",""))
	MasterName=trim(replace(request("MasterName"),"'",""))
	MasterPSW=trim(replace(request("MasterPSW"),"'",""))
	ReMasterPSW=trim(replace(request("ReMasterPSW"),"'",""))
	Email=trim(replace(request("Email"),"'",""))
	DataBase=trim(replace(request("DataBase"),"'",""))
	
	if SiteName="" or SiteURL="" or MasterName="" or Email="" or DataBase="" then
		response.write "<script>alert(""请填写全部信息!"");document.URL=""admin.asp?page="&session("currentPage")&"#1"";</script>"
		exit sub		
	end if
		
	if MasterPSW<>"" then
		if MasterPSW<>ReMasterPSW then
			response.write "<script>alert(""两次输入密码不一致!"");document.URL=""admin.asp?page="&session("currentPage")&"#1"";</script>"
			exit sub		
		end if
		sql="update setting set SiteName='"&SiteName&"', SiteURL='"&SiteURL&"', MasterName='"&MasterName&"', MasterPSW='"&md5(MasterPSW)&"', Email='"&Email&"'"
	else
		sql="update setting set SiteName='"&SiteName&"', SiteURL='"&SiteURL&"', MasterName='"&MasterName&"', Email='"&Email&"'"
	end if
	conn.execute (sql)
	
	if sysDataBase<>DataBase then
		On Error Resume Next
		ObjInstalled=IsObjInstalled("Scripting.FSO_yitang_168")
		If ObjInstalled=false Then
			response.write "<script>alert(""您的服务器不支持FSO,所以数据库名称修改没有操作成功,其它操作成功!\n您可以手动更改数据库的名称以加强安全性."");document.URL=""admin.asp?page="&session("currentPage")&"#1"";</script>"
		end if
		
		set fso=Server.CreateObject("Scripting.FSO_yitang_168")
		
		Set MyFile = fso.GetFile(Server.MapPath(sysDataBase))
		MyFile.Copy (DataBase)
		MyFile.Delete
		
		if Err.Number>0 then
			response.write "<script>alert(""由于<"&Err.Description&">错误,所以数据库名称修改没有操作成功,其它操作成功!\n手动更改数据库的名称以加强安全性."");document.URL=""admin.asp?page="&session("currentPage")&"#1"";</script>"
		else
			set hf=fso.CreateTextFile(Server.mappath("dbconfig.asp"),true)
			hf.write "<" & "%" & vbcrlf
			hf.write "dim sysDataBase"& vbcrlf
			hf.write "sysDataBase="""&DataBase &"""" & vbcrlf
			hf.write "%" & ">"
			hf.close
			set hf=nothing
			response.write "<script>alert(""操作成功!"");document.URL=""admin.asp?page="&session("currentPage")&"&o=1#1"";</script>"
		end if
		set fso=nothing
	else
		response.write "<script>alert(""操作成功!"");document.URL=""admin.asp?page="&session("currentPage")&"&o=1#1"";</script>"
	end if
end sub

sub submit2
	PR=int(request("PR"))
	Alexa=int(request("Alexa"))
	GOOGLE=int(request("GOOGLE"))
	BaiDu=int(request("BaiDu"))
	
	IsConfirm=request("IsConfirm")
	IsVerify=request("IsVerify")
	IsActivation=request("IsActivation")
	IsCheckMaster=request("IsCheckMaster")
	SpecialNote=trim(replace(request("SpecialNote"),"'",""))
	WordsCount=int(request("WordsCount"))
	AltCount=int(request("AltCount"))
	StatCount=int(request("StatCount"))
	StatCountDis=request("StatCountDis")
	
	IsUploadLogo=request("IsUploadLogo")
	LogoWidth=int(request("LogoWidth"))
	LogoHeight=int(request("LogoHeight"))
	
	OrderBy=int(request("OrderBy"))
	MaxPerPage=int(request("MaxPerPage"))
	PageWidth=int(request("PageWidth"))
	Unit=trim(replace(request("Unit"),"'",""))
	alternation=int(request("alternation"))
	IsSort=request("IsSort")
	SortDisplayType=request("SortDisplayType")
	CountPerLine=request("CountPerLine")
	LinkShowType=request("LinkShowType")
	IsLogoPic=request("IsLogoPic")
	if IsConfirm="" or IsVerify="" or IsCheckMaster="" or SpecialNote="" or WordsCount="" or AltCount="" or LogoWidth="" or LogoHeight=""  or OrderBy="" or PageWidth="" or  Unit="" or MaxPerPage="" or alternation="" or StatCount="" or StatCountDis="" or IsSort="" or SortDisplayType="" or CountPerLine="" then
		response.write "<script>alert(""请填写全部信息!"");document.URL=""admin.asp?page="&session("currentPage")&"&o=2#2"";</script>"
		response.end
		exit sub		
	end if
	
	sql="update setting set PR="&PR&", Alexa="&Alexa&",GOOGLE="&GOOGLE&", BaiDu="&BaiDu&", IsConfirm="&IsConfirm&", IsVerify="&IsVerify&", IsActivation="&IsActivation&",IsCheckMaster="&IsCheckMaster&",SpecialNote='"&SpecialNote&"',WordsCount="&WordsCount&",AltCount="&AltCount&",StatCount="&StatCount&",StatCountDis="&StatCountDis&",IsUploadLogo="&IsUploadLogo&",LogoWidth="&LogoWidth&",LogoHeight="&LogoHeight&",OrderBy="&OrderBy&",MaxPerPage="&MaxPerPage&",PageWidth="&PageWidth&",Unit='"&Unit&"',alternation="&alternation&",IsSort="&IsSort&",SortDisplayType="&SortDisplayType&",CountPerLine="&CountPerLine&",LinkShowType="&LinkShowType&",IsLogoPic="&IsLogoPic
	conn.execute (sql)
	response.write "<script>alert(""操作成功!"");document.URL=""admin.asp?page="&session("currentPage")&"&o=2#2"";</script>"
	response.end
end sub

sub submit3
	L_SiteName=trim(replace(request("L_SiteName"),"'",""))
	L_SiteURL=trim(replace(request("L_SiteURL"),"'",""))
	L_Logo=trim(replace(request("L_Logo"),"'",""))
	L_Alt=trim(replace(request("L_Alt"),"'",""))
	if lcase(L_Logo)="http://" then
		L_Logo=""
	end if
	
	if L_SiteName="" or L_SiteURL="" or L_Alt="" then
		response.write "<script>alert(""请填写全部信息!"");document.URL=""admin.asp?page="&session("currentPage")&"&o=3#3;""</script>"
		exit sub		
	end if
	
	if not IsRightUrl(L_SiteURL) then
		response.write "<script>alert('错误的URL格式!');document.URL=""admin.asp?page="&session("currentPage")&"&o=3#3;"";</script>"
		exit sub		
	end if
	if L_Logo<>"" then
		if not IsRightUrl(L_Logo) then
			response.write "<script>alert('错误的URL格式!');document.URL=""admin.asp?page="&session("currentPage")&"&o=3#3;"";</script>"
			exit sub		
		end if
	end if
	
	sql="update setting set L_SiteName='"&L_SiteName&"', L_SiteURL='"&L_SiteURL&"', L_Logo='"&L_Logo&"', L_Alt='"&L_Alt&"'"
	conn.execute (sql)
	response.write "<script>alert(""操作成功!"");document.URL=""admin.asp?page="&session("currentPage")&"&o=3#3"";</script>"
end sub

sub submit5
	dim Y_SiteName
	dim Y_SiteURL
	dim Y_Logo
	dim Y_Alt
	
	Y_SiteName=trim(replace(request("Y_SiteName"),"'",""))
	Y_Logo=trim(replace(request("Y_Logo"),"'",""))
	Y_Alt=trim(replace(request("Y_Alt"),"'",""))
	Y_SiteURL=trim(replace(request("Y_SiteURL"),"'",""))
	Y_SiteURL=trim(replace(request("Y_SiteURL"),"'",""))

	if request("OwnerClass")<>"" then
		OwnerClass=request("OwnerClass")
	else
		OwnerClass=0
	end if
	
	if Y_SiteName="" or Y_Alt="" or len(Y_SiteURL)<8 or Y_SiteURL="" or len(Y_SiteURL)<8  or Y_SiteURL=""  then
		response.write "<script>alert(""请填写全部信息."");document.URL=""admin.asp?page="&session("currentPage")&"&o=5#5"";</script>"
		exit sub
	end if
	
	if (Y_SiteURL<>"" and lcase(left(Y_SiteURL,7))<>"http://") or (Y_MyLink<>"" and lcase(left(Y_MyLink,7))<>"http://") then
		response.write "<script>alert(""请注意您的URL格式,应以http://开头."");document.URL=""admin.asp?page="&session("currentPage")&"&o=5#5"";</script>"
		exit sub		
	end if

	if lcase(Y_Logo)="http://" then
		Y_Logo=""
	end if
	
	if not IsRightUrl(Y_SiteURL) then
		response.write "<script>alert('错误的URL格式!');document.URL=""admin.asp?page="&session("currentPage")&"&o=5#5"";</script>"
		exit sub		
	end if
	
	sql="select * from link where Y_SiteName='"&Y_SiteName&"'"
	rs.open sql,conn,1,3
	if not rs.eof then
		response.write "<script>alert(""这个站点已经存在了,请您更换一个."");document.URL=""admin.asp?page="&session("currentPage")&"&o=5#5"";</script>"
		exit sub	
	else
		rs.close	
	end if
	'取出系统限制
	sql="select * from setting"
	set rs=conn.execute (sql)
	if not rs.eof then
		PR=rs("PR")
		Alexa=rs("Alexa")
		Google=rs("Google")
		Baidu=rs("Baidu")
		
		IsConfirm=rs("IsConfirm")
		IsVerify=rs("IsVerify")
		IsActivation=rs("IsActivation")
		IsCheckMaster=rs("IsCheckMaster")
		
		WordsCount=rs("WordsCount")
		AltCount=rs("AltCount")
		L_SiteURL=rs("L_SiteURL")
		IsSort=rs("IsSort")
		
		rs.close
	end if

	if GetWordsCount(Y_SiteName)>WordsCount then
		response.write "<script>alert(""您的站点名称字数<"&GetWordsCount(Y_SiteName)&">大于系统规定字数<"&WordsCount&">."");document.URL=""admin.asp?page="&session("currentPage")&"&o=5#5"";</script>"
		exit sub		
	end if
	
	if GetWordsCount(Y_Alt)>AltCount then
		response.write "<script>alert(""您的站点介绍字数<"&GetWordsCount(Y_Alt)&">大于系统规定字数<"&AltCount&">."");document.URL=""admin.asp?page="&session("currentPage")&"&o=5#5"";</script>"
		exit sub		
	end if
		
	
	'第一步,判断我站链接和申请的URL是否为同一个域
	
	'第二步,判断是否加了我站代码
	if IsConfirm=true and session("IsCheckMaster")=true then
		url=Y_MyLink
		wstr=getHTTPPage(Y_SiteURL,"gb2312") 

		if not Instr(lcase(wstr),lcase("<a href=""http://"&request.ServerVariables("HTTP_HOST")&replace(request.ServerVariables("URL"),"admin.asp","linkforward.asp")))>0 then
			response.write "<script>alert(""对不起,没有在贵站指定的位置发现我站的链接,请首先在贵站为我站添加链接,谢谢!"");document.URL=""admin.asp?page="&session("currentPage")&"&o=5#5"";</script>"
			exit sub		
		end if
	end if
	'第三步,判断我站代码所在页面的PR值
	Y_MyLink_PR=getPR(Y_SiteURL)
	if PR>0 and session("IsCheckMaster")=true then
		if not Y_MyLink_PR>= PR then
			response.write "<script>alert(""对不起,我站的链接代码所在页面PR值<"&Y_MyLink_PR&">不符合我站的要求<"&PR&">"");document.URL=""admin.asp?page="&session("currentPage")&"&o=5#5"";</script>"
			exit sub		
		end if
	end if
	'第四步,判断我站链接所在网页的所属域名的Alexa排名
	Y_MyLink_Alexa=getAlexa(Y_SiteURL)
	if Alexa>0 and session("IsCheckMaster")=true then
		if CDbl(Alexa)<CDbl(Y_MyLink_Alexa) then
			response.write "<script>alert(""对不起,贵站的Alexa世界排名值<"&RW(Y_MyLink_Alexa)&">不符合我站的要求<"&Alexa&">"");document.URL=""admin.asp?page="&session("currentPage")&"&o=5#5"";</script>"
			exit sub
		end if
	end if
	'第五步,判断我站链接所在网页的所属域名的Google收录
	Y_MyLink_Google=getGoogle(Y_SiteURL)
	if Google>0 and session("IsCheckMaster")=true then
		if CDbl(Google)>CDbl(Y_MyLink_Google) then
			response.write "<script>alert(""对不起,贵站的Google收录值<"&Y_MyLink_Google&">不符合我站的要求<"&Google&">"");document.URL=""admin.asp?page="&session("currentPage")&"&o=5#5"";</script>"
			exit sub
		end if
	end if
	'第六步,判断我站链接所在网页的所属域名的Baidu收录
	Y_MyLink_Baidu=getBaidu(Y_SiteURL)
	if Baidu>0 and session("IsCheckMaster")=true then
		if CDbl(Baidu)>CDbl(Y_MyLink_Baidu) then
			response.write "<script>alert(""对不起,贵站的Baidu收录值<"&Y_MyLink_Baidu&">不符合我站的要求<"&Baidu&">"");document.URL=""admin.asp?page="&session("currentPage")&"&o=5#5"";</script>"
			exit sub
		end if
	end if
	
	'如果一切合格,添加到友情链接数据库中
	sql="select top 1 * from link order by id"
	rs.open sql,conn,1,3
	rs.addnew

	'如果系统要求管理员的添加动作也要检查
	if session("IsCheckMaster")=false then
		rs("goin")=1
		rs("goinToday")=1
		rs("inToday")=now
		rs("IsVerify")=true
	end if
	
	rs("username")=Y_SiteName
	rs("passsword")=Md5(Y_SiteName)

	rs("Y_SiteName")=Y_SiteName
	rs("Y_SiteURL")=Y_SiteURL
	rs("Y_Logo")=Y_Logo
	rs("Y_Alt")=Y_Alt
	rs("Y_SiteURL")=Y_SiteURL

	rs("PR")=Y_MyLink_PR
	rs("PRDate")=now()
	rs("Alexa")=Y_MyLink_Alexa
	rs("AlexaDate")=now()
	rs("Google")=Y_MyLink_Google
	rs("GoogleDate")=now()
	rs("Baidu")=Y_MyLink_Baidu
	rs("BaiduDate")=now()

	rs("jointime")=now()
	if IsSort=true then
	rs("OwnerClass")=OwnerClass
	end if
	rs.update
	
	response.write "<script>alert(""操作成功!"");document.URL=""admin.asp?page="&session("currentPage")&"&o=5#5"";</script>"
end sub

sub submit31
	HdClassID=request("HdClassID")
	HdClassName=request("HdClassName")
	HdClassStatus=request("HdClassStatus")

	ArrClassID=Split(HdClassID,"~")
	ArrClassName=Split(HdClassName,"~")
	ArrClassStatus=Split(HdClassStatus,"~")
	
	for i=0 to UBound(ArrClassStatus)
		Select Case int(ArrClassStatus(i))
			Case 1 '增加
				sql="insert into linkclass (ClassName) values('"&ArrClassName(i)&"')"
			Case 2 '删除
				sql="delete from linkclass where ID="&ArrClassID(i)
			Case 3 '修改
				sql="update linkclass set ClassName='"&ArrClassName(i)&"' where ID="&ArrClassID(i)
		end Select
		conn.execute(sql)
	next
	response.write "<script>alert(""操作成功!"");document.URL=""admin.asp?page="&session("currentPage")&"&o=31#31"";</script>"
end sub

sub submit22
	RadEmail=request("RadEmail")
	RadQQ=request("RadQQ")
	RadMSN=request("RadMSN")
	RadTel=request("RadTel")
	RadFax=request("RadFax")
	RadMobileTel=request("RadMobileTel")
	
	sql="update setting set RadEmail="&RadEmail&",RadQQ="&RadQQ&",RadMSN="&RadMSN&",RadTel="&RadTel&",RadFax="&RadFax&",RadMobileTel="&RadMobileTel
	conn.execute (sql)
	response.write "<script>alert(""操作成功!"");document.URL=""admin.asp?page="&session("currentPage")&"&o=22#22"";</script>"
end sub
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK href="css.css" type=text/css rel=stylesheet>
<%
if session("S_username")="" or session("S_userid")="" then
	Errmsg = Errmsg+"<li>您没有登录,或登录超时。"
	Call ErrList(Errmsg)
	response.end
end if
%>

<%
dim SiteName
dim SiteURL
dim MasterName
dim Email

dim PR
dim Alexa
dim GOOGLE
dim BaiDu

dim IsVerify
dim IsConfirm
dim IsActivation
dim IsCheckMaster
dim SpecialNote
dim WordsCount
dim AltCount
dim StatCount
dim StatCountDis
dim LogoWidth
dim LogoHeight
dim OrderBy
dim MaxPerPage
dim PageWidth
dim Unit
dim alternation
dim IsSort

dim L_SiteName
dim L_SiteURL
dim L_Logo
dim L_Alt

dim SortDisplayType
dim CountPerLine

dim RadEmail
dim RadQQ
dim RadMSN
dim RadTel
dim RadFax
dim RadMobileTel

dim LinkShowType
dim IsLogoPic
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")
	
	PR=rs("PR")
	Alexa=rs("Alexa")
	GOOGLE=rs("GOOGLE")
	BaiDu=rs("BaiDu")

	IsVerify=rs("IsVerify")
	IsConfirm=rs("IsConfirm")
	IsActivation=rs("IsActivation")
	IsCheckMaster=rs("IsCheckMaster")
	SpecialNote=rs("SpecialNote")
	WordsCount=rs("WordsCount")
	AltCount=rs("AltCount")
	StatCount=rs("StatCount")
	StatCountDis=rs("StatCountDis")
	
	IsUploadLogo=rs("IsUploadLogo")
	LogoWidth=rs("LogoWidth")
	LogoHeight=rs("LogoHeight")
	
	OrderBy=rs("OrderBy")
	MaxPerPage=rs("MaxPerPage")
	PageWidth=rs("PageWidth")
	Unit=rs("Unit")
	alternation=rs("alternation")
	IsSort=rs("IsSort")
	
	L_SiteName=rs("L_SiteName")
	L_SiteURL=rs("L_SiteURL")
	L_Logo=rs("L_Logo")
	L_Alt=rs("L_Alt")

	SortDisplayType=rs("SortDisplayType")
	CountPerLine=rs("CountPerLine")

	RadEmail=rs("RadEmail")
	RadQQ=rs("RadQQ")
	RadMSN=rs("RadMSN")
	RadTel=rs("RadTel")
	RadFax=rs("RadFax")
	RadMobileTel=rs("RadMobileTel")

	LinkShowType=rs("LinkShowType")
	IsLogoPic=rs("IsLogoPic")
	
	rs.close
	
	session("IsCheckMaster")=IsCheckMaster   ' 站长手动添加站点时,是否需要按系统设置的检查项目进行检查
	if session("IsCheckMaster")=false then
		MasWordsCount=255
		MasAltCount=65535
	else
		MasWordsCount=WordsCount
		MasAltCount=AltCount
	end if
end if
%>
<title><%response.write SiteName&"-自助友情链接系统 V1.7 - Power By DATA100.NET"%></title>
<script>
var o=<%=Cint(request("o"))%>;

function PageOnLoad(){
	if (o!=0)
		CloseOpen(o);
}

function CloseOpen(Num){
	if (Num==null || Num=="" || Num==0) return;
	var CurrObj=eval("Tab"+Num);
	var CurrImg=eval("document.all.CtrImg"+Num);
	if (CurrObj.style.display!="none"){
		CurrObj.style.display="none";
		CurrImg.src="img/collapsed_yes.gif"
	} else {
		CurrObj.style.display="";
		CurrImg.src="img/collapsed_no.gif"
	}
}

function submitform(Num){
	var CurrForm=eval("form"+Num);
	if (Num!=31 || Num!=22)
		if (checkform(CurrForm)==false) return false;
	
	CurrForm.action="admin.asp";
	CurrForm.method="post";
	CurrForm.submit();
}

function checkform(CurrForm){
	for(i=0;i<CurrForm.elements.length;i++){
		if (CurrForm.elements[i].IsCheck==1){
			if (CurrForm.elements[i].type=="radio"){
				var CurrObj=document.getElementsByName(CurrForm.elements[i].name);
				var CurrObjChecked=0;
				for (k=0;k<CurrObj.length;k++){
					if (CurrObj[k].checked==true) {
						CurrObjChecked=1;
						break;
					}
				}
				if (CurrObjChecked==0) {
					alert("请勾选"+CurrForm.elements[i].name);
					CurrForm.elements[i].focus();
					return false;
				}
			}else{
				if (CurrForm.elements[i].value=="" && CurrForm.elements[i].style.display!="none"){
					if (CurrForm.elements[i].name!="MasterPSW" && CurrForm.elements[i].name!="ReMasterPSW" && CurrForm.elements[i].name!="Y_Logo" ){
						alert("请添加必需信息。");
						CurrForm.elements[i].focus();
						return false;
					}
				} else {
					if (CurrForm.elements[i].name=="Email" || CurrForm.elements[i].name=="email" ){
						if (!checkemail (CurrForm.elements[i].value)){
							alert("请检查邮箱格式。");
							CurrForm.elements[i].select();
							return false;
						}
					}
					
				}
			}
		}
	}
}

function checkemail (emailstr){
	var pattern=/^([\u4E00-\u9FA5a-zA-Z\/0-9\-_]+@){1}([\u4E00-\u9FA5a-zA-Z\/0-9\-]{1,30}\.){1,3}([\u4E00-\u9FA5a-zA-Z\/0-9\-]{2,9})$/;
	return pattern.test(emailstr);
}

function admin_delete(ID){
	Num=7;
	var CurrForm=eval("form"+Num);
	CurrForm.ID.value=ID;
	CurrForm.action="admin.asp";
	CurrForm.method="post";
	CurrForm.submit();
}

function admin_check(ID){
	var width,height,left,top;
	width=450;
	height=200;
	left=screen.Width/2-width/2;
	top=(screen.Height-25)/2-height/2;
	window.open ('check2.asp?ID='+ID, '检查对方是否单方撤链', 'height='+height+', width='+width+', top='+top+',left='+left+', toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=yes')
}
function admin_uplogo(){
	var width,height,left,top;
	width=450;
	height=200;
	left=screen.Width/2-width/2;
	top=(screen.Height-25)/2-height/2;
	window.open ('data100_net_uplogo.asp', '上传LOGO', 'height='+height+', width='+width+', top='+top+',left='+left+', toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=yes')
}
function admin(ID){
	var width,height,left,top;
	width=600;
	height=550;
	left=screen.Width/2-width/2;
	top=(screen.Height-25)/2-height/2;
	window.open ('admin2.asp?ID='+ID, '详细设置', 'height='+height+', width='+width+', top='+top+',left='+left+', toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=yes')

}

function changecolor(Obj){
	var arr=showModalDialog("selcolor.html",window, "dialogWidth:20em; dialogHeight:16em; status:0; help:0");
	if (arr != null){	
		Obj.style.backgroundColor=arr;
	}
}

function GetRadioValue(Obj){
	for (var i=0;i<Obj.length;i++){
		if(Obj[i].checked==true){
			return Obj[i].value;
			break;
		}
	}
}

function GetNeedCode(){
	var vClassArr="";
	for (var i=0;i<transferclass.options.length;i++){
		if (transferclass.options[i].selected){
			vClassArr=vClassArr+"x"+transferclass.options[i].value;
		}
	}
	re=/^x/;
	vClassArr=vClassArr.replace(re,"");
	var vIsLogoPic=GetRadioValue(IsTop);
	
	var vDefaultPage=DefaultPage.value;
	var vDislayOrder=GetRadioValue(DislayOrder);
	var vLogoLine=LogoLine.value;
	var vLogoCount=LogoCount.value;
	var vWordLine=WordLine.value;
	var vWordCount=WordCount.value;
	var vTabWidth=TabWidth.value;
	var vTabWidthUnit=TabWidthUnit.options[TabWidthUnit.selectedIndex ].value;
	var vTabAlign=TabAlign.options[TabAlign.selectedIndex ].value;
	var vtTabBGColor=tTabBGColor.style.backgroundColor;
	var vsTabBorderColor=sTabBorderColor.style.backgroundColor;
	var vTabBGColor=TabBGColor.style.backgroundColor;
	var vTabBorderWidth=TabBorderWidth.value;
	var vTabBorderColor=TabBorderColor.style.backgroundColor;
	var vTabCellSpacing=TabCellSpacing.value;
	var vTabCellPadding=TabCellPadding.value;
	var vTabCellColor=TabCellColor.style.backgroundColor;
	var vTabLinHeight=TabLinHeight.value;
	var vTabLinHeightUnit=TabLinHeightUnit.options[TabLinHeightUnit.selectedIndex ].value;
	var vNeedCode;
	var vPageUrl;
	var re;
	re=/(?:admin.asp)[#]?\d?/gi;
	vPageUrl=window.location.href.replace(re,"transfer.asp");
	var Index;
	var Arr1;
	var Arr2;
	Index=0;
	vDefaultPage=vDefaultPage.replace(/\\/,"/");
	vPageUrl=vPageUrl.replace(/\\/,"/");
	if (vDefaultPage.search(/\w+\.\w+$/)==-1){
		if (vDefaultPage.search(/[\/|\\]$/)==-1){
			vDefaultPage=vDefaultPage+"/default.asp";
		} else {
			vDefaultPage=vDefaultPage.replace(/[\/|\\]$/,"/default.asp");
		}
	}
	
	Arr1=vDefaultPage.split("/");
	Arr2=vPageUrl.split("/");
	
	if (Arr1[2]!=Arr2[2]){
		alert("调用页面和本系统不在同一个域内,请更正.");
		return false;
	}
	
	var ResultIndex=0;
	var Jump="";
	var PageUrl="";
	CompareIndex=Arr1.length>=Arr2.length?Arr1.length:Arr2.length;
	for (i=0;i<CompareIndex;i++){
		if (Arr1[i]!=Arr2[i]){
			ResultIndex=i+1;
			break;
		}
	}
	for (i=0;i<(Arr1.length-ResultIndex);i++){
		Jump=Jump+"../";
	}
	for (i=ResultIndex-1;i<Arr2.length-1;i++){
		Jump=Jump+Arr2[i]+"/";
	}
	PageUrl=Jump;
	Jump=Jump+"transfer.asp";
	vNeedCode='<!--'+'#'+'include file="'+Jump+'"-->\n';
	vNeedCode=vNeedCode+"<"+"%\n"+"c"+"all ShowFriendLink(\""+vDislayOrder+"\","+
		vLogoLine+","+vLogoCount+","+
		vWordLine+","+vWordCount+",\""+
		vTabWidth+vTabWidthUnit+
		"\",\""+vTabAlign+"\",\""+
		vsTabBorderColor+"\",\""+vtTabBGColor+
		"\",\""+vTabBGColor+"\","+vTabBorderWidth+
		",\""+vTabBorderColor+"\","+
		vTabCellSpacing+","+vTabCellPadding+
		",\""+vTabCellColor+"\",\""+
		vTabLinHeight+vTabLinHeightUnit+"\",\""+
		vClassArr+
		"\",\""+PageUrl+"\","+vIsLogoPic+")\n%>\n";
	NeedCode.value=vNeedCode;
	
	copycode(NeedCode);
}

function copycode(obj){
	obj.select();
	objcopy=obj.createTextRange();
	objcopy.execCommand("Copy");
}

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

</script>

</head>
<body>
<SCRIPT FOR=window EVENT=onload LANGUAGE="JScript">
PageOnLoad();
</SCRIPT>

<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>&nbsp;管理员: <%=session("S_username")%></td>
                  <td width="30%" valign="bottom">&nbsp;</td>
                  <td align="right"><a class="atitle" href="logout.asp">安全退出</a>&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></td></tr></table>
      <a name="1" id="1"></a>
      <br>
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
      <form id="form1" name="form1">
        <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;基本信息设置</td>
                  <td align="right">
				  <img height="15" src="img/collapsed_yes.gif" width="15" style="cursor: hand;" id="CtrImg7"  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" style="display:none" id="Tab1">
                <tr bgcolor="#FFFFFF">
                  <td width="35%" height="20">站点名称:</td>
                  <td><input name="SiteName" type="text" size="50" maxlength="80" value="<%=SiteName%>"></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">首页地址:</td>
                  <td><input name="SiteURL" type="text" size="50" maxlength="80" value="<%=SiteURL%>"></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">站长大名:</td>
                  <td><input name="MasterName" type="text" size="50" maxlength="80" value="<%=MasterName%>"></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">新密码:</td>
                  <td><p>
                      <input name="MasterPSW" type="text" size="20" maxlength="50">
                (用于更改密码,不更改密码请<font color="#cc0000">留空</font>)</p></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">密码确认:</td>
                  <td><input name="ReMasterPSW" type="text" size="20" maxlength="50">
              (用于更改密码,不更改密码请<font color="#cc0000">留空</font>)</td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">联系邮箱:</td>
                  <td><input name="Email" type="text" size="50" maxlength="80" value="<%=Email%>">
                      <input name="index" type="hidden" id="index" value="1">
                      <input name="IsSubmit" type="hidden" id="IsSubmit" value="1"></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">数据库名称:</td>
                  <td><input name="DataBase" type="text" value="<%=sysDataBase%>" size="20" maxlength="50">
              (用于更改数据库名称,<font color="#cc0000">安全选项</font>)</td>
                </tr>
                <tr align="center" bgcolor="#FFFFFF">
                  <td height="20" colspan="2"><input type="button" name="Submit" value=" 确定修改 " onClick="submitform(1)"></td>
                </tr>
              </table>
              <!--显示与隐藏的表格-->
              <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td></td>
                </tr>
            </table></td>
        </tr>
      </form >
    </table>
    <a name="2" id="2"></a>
    <br>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
      <form name="form2" id="form2">
        <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;功能设置</td>
                  <td align="right">
				  <img height="15" src="img/collapsed_yes.gif" width="15"  style="cursor: hand;" id="CtrImg2"  name="CtrImg2" 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" style="display:none" id="Tab2">
                <tr bgcolor="#FFFFFF">
                  <td width="35%" height="20">PR值要求:</td>
                  <td>≧
                      <input name="PR" type="text" value=<%=PR%> size="12" maxlength="12"></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">Alexa排名要求:</td>
                  <td>≦
                    <input name="Alexa" type="text" value=<%=Alexa%> size="12" maxlength="12"></td></tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">GOOGLE收录要求:</td>
                  <td>≧
                    <input name="GOOGLE" type="text" value=<%=GOOGLE%> size="12" maxlength="12"></td></tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">BaiDu收录要求:</td>
                  <td>≧
                    <input name="BaiDu" type="text" value=<%=BaiDu%> size="12" maxlength="12"></td></tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">是否需要审核才能显示:</td>
                  <td><input name="IsVerify" type="radio" value=true  <%if IsVerify=true then response.write "checked"%>>
                    是
                      <input name="IsVerify" type="radio" value=false <%if IsVerify=false then response.write "checked"%>>
                      否 </td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">验证对方是否已经做好我站链接:</td>
                  <td>
					<input name="IsConfirm" type="radio" value=1 <%if IsConfirm=true then response.write "checked"%>> 是
					<input name="IsConfirm" type="radio" value=0 <%if IsConfirm=false then response.write "checked"%>> 否 
				</td></tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">是否需要激活才能显示:</td>
                  <td><input name="IsActivation" type="radio" value=true  <%if IsActivation=true then response.write "checked"%>>
                    是
                      <input name="IsActivation" type="radio" value=false <%if IsActivation=false then response.write "checked"%>>
                      否 </td>
                </tr>
				<tr bgcolor="#FFFFFF">
                  <td height="20">申请时的特别说明:</td>
                  <td><textarea cols="50" name="SpecialNote" rows="5"><%=SpecialNote%></textarea></td>
				</tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">站点名称字数限制:</td>
                  <td><input name="WordsCount" type="text" value=<%=WordsCount%> size="4" maxlength="4"></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">站点介绍字数限制:</td>
                  <td><input name="AltCount" type="text" id="AltCount" value=<%=AltCount%> size="4" maxlength="4"></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">LOGO尺寸要求:</td>
                  <td><input name="LogoWidth" type="text" value=<%=LogoWidth%> size="4" maxlength="4">
                    ×
                      <input name="LogoHeight" type="text" value=<%=LogoHeight%> size="4" maxlength="4"></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">是否可以上传LOGO到我站本地:</td>
                  <td><input name="IsUploadLogo" type="radio" value=true  <%if IsUploadLogo=true then response.write "checked"%>>
是
  <input name="IsUploadLogo" type="radio" value=false <%if IsUploadLogo=false then response.write "checked"%>>
否 (以提高我站页面打开速度)</td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">默认显示排序依据:</td>
                  <td><select name="OrderBy">
                      <option value=1 <%if OrderBy=1 then response.write "selected"%>>申请时间(关注我站先后)</option>
                      <option value=2 <%if OrderBy=2 then response.write "selected"%>>点入数(对我站贡献)</option>
                  </select></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">页面宽度:</td>
                  <td><input name="PageWidth" type="text" id="PageWidth" value="<%=PageWidth%>" size="4" maxlength="4">
                      <select name="Unit">
                        <option value="%">百分比</option>
                        <option value="px">像素</option>
                    </select></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">每页显示多少个站点:</td>
                  <td><input name="MaxPerPage" type="text" id="MaxPerPage" value=<%=MaxPerPage%> size="4" maxlength="4">
              (用于分页显示,为0时不分页,建议不分页显示) </td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">同一IP计数间隔:</td>
                  <td><input name="alternation" type="text" value=<%=alternation%> size="4" maxlength="4">
              分钟
                <input name="index" type="hidden" id="index" value="2"> 
				<input name="IsSubmit" type="hidden" id="IsSubmit" value="1"></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">站长手动添加站点时<br>
                  是否需要按系统设置的检查项目进行检查:</td>
                  <td><input name="IsCheckMaster" type="radio" value=true  <%if IsCheckMaster=true then response.write "checked"%>>
                    是
                      <input name="IsCheckMaster" type="radio" value=false <%if IsCheckMaster=false then response.write "checked"%>>
                    否 </td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">点入点出统计显示行数:</td>
                  <td><input name="StatCount" type="text" id="StatCount" value=<%=StatCount%> size="4" maxlength="4">
                  (0为不显示) 默认显示方式:
                    <input name="StatCountDis" type="radio" value=true <%if StatCountDis=true then response.write "checked"%>>
					展开
					<input name="StatCountDis" type="radio" value=false <%if StatCountDis=false then response.write "checked"%>>
				  折叠</td>
                </tr>
                    <tr bgcolor="#FFFFFF">
                      <td width="35%" height="20">是否开启分类功能:</td>
                      <td><input name="IsSort" type="radio" value=true <%if IsSort=true then response.write "checked"%>>
						是
						  <input name="IsSort" type="radio" value=false <%if IsSort=false then response.write "checked"%>>
						否 
						分类显示模式:
						<input name="SortDisplayType" type="radio" value=1 <%if SortDisplayType=1 then response.write "checked"%>>
						下拉列表
						  <input name="SortDisplayType" type="radio" value=2 <%if SortDisplayType=2 then response.write "checked"%>>
						平铺列表 平铺列表每行显示
						<input name="CountPerLine" type="text" id="CountPerLine" value=<%=CountPerLine%> size="4" maxlength="4">个
						</td>
                    </tr>
                    <tr bgcolor="#FFFFFF">
                      <td width="35%" height="20">Link页显示模式:</td>
                      <td>
						<input name="LinkShowType" type="radio" value=1 <%if LinkShowType=1 then response.write "checked"%>>
						简约模式<br>
						<input name="LinkShowType" type="radio" value=2 <%if LinkShowType=2 then response.write "checked"%>>
标准模式 标准模式下是否取消LOGO显示
<select name="IsLogoPic">
  <option value=0 <%if IsLogoPic=0 then response.write "selected"%>>否</option>
  <option value=1 <%if IsLogoPic=1 then response.write "selected"%>>是</option>
</select>
<br>
<input name="LinkShowType" type="radio" value=3 <%if LinkShowType=3 then response.write "checked"%>>
						联盟模式
					  </td>
                    </tr>
					<tr align="center" bgcolor="#FFFFFF">
                  <td height="20" colspan="2"><input type="button" name="Submit" value=" 确定修改 " onClick="submitform(2)"></td>
                </tr>
              </table>
              <!--显示与隐藏的表格-->
              <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td></td>
                </tr>
            </table></td>
        </tr>
      </form>
    </table>
	
    <a name="22" id="22"></a>
    <br>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
      <form name="form22" id="form22">
        <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;注册填写项目设置</td>
                  <td align="right">
				  <img height="15" src="img/collapsed_yes.gif" width="15"  style="cursor: hand;" id="CtrImg22"  name="CtrImg22" onClick="CloseOpen(22)">
				  &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" style="display:none" id="Tab22">
                <tr bgcolor="#FFFFFF">
                  <td width="35%" height="20">电子邮箱:</td>
                  <td>
<input name="RadEmail" type="radio" value=1 <%if RadEmail=1 then response.write " checked"%> >
不填
<input type="radio" name="RadEmail" value=2 <%if RadEmail=2 then response.write " checked"%> >
选填
<input type="radio" name="RadEmail" value=3 <%if RadEmail=3 then response.write " checked"%> >
必填</td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">QQ:</td>
                  <td>
<input type="radio" name="RadQQ" value=1 <%if RadQQ=1 then response.write " checked"%> >
不填
<input type="radio" name="RadQQ" value=2 <%if RadQQ=2 then response.write " checked"%> >
选填
<input type="radio" name="RadQQ" value=3 <%if RadQQ=3 then response.write " checked"%> >
必填</td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">MSN:</td>
                  <td>
<input type="radio" name="RadMSN" value=1 <%if RadMSN=1 then response.write " checked"%> >
不填
<input type="radio" name="RadMSN" value=2 <%if RadMSN=2 then response.write " checked"%> >
选填
<input type="radio" name="RadMSN" value=3 <%if RadMSN=3 then response.write " checked"%> >
必填</td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">电话:</td>
                  <td>
<input type="radio" name="RadTel" value=1 <%if RadTel=1 then response.write " checked"%> >
不填
<input type="radio" name="RadTel" value=2 <%if RadTel=2 then response.write " checked"%> >
选填
<input type="radio" name="RadTel" value=3 <%if RadTel=3 then response.write " checked"%> >
必填</td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">传真:</td>
                  <td>
<input type="radio" name="RadFax" value=1 <%if RadFax=1 then response.write " checked"%> >
不填
<input type="radio" name="RadFax" value=2 <%if RadFax=2 then response.write " checked"%> >
选填
<input type="radio" name="RadFax" value=3 <%if RadFax=3 then response.write " checked"%> >
必填</td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">手机:</td>
                  <td>
<input type="radio" name="RadMobileTel" value=1 <%if RadMobileTel=1 then response.write " checked"%> >
不填
<input type="radio" name="RadMobileTel" value=2 <%if RadMobileTel=2 then response.write " checked"%> >
选填
<input type="radio" name="RadMobileTel" value=3 <%if RadMobileTel=3 then response.write " checked"%> >
必填
<input name="index" type="hidden" id="index" value="22">
<input name="IsSubmit" type="hidden" id="IsSubmit" value="1"></td>
                </tr>
                <tr align="center" bgcolor="#FFFFFF">
                  <td height="20" colspan="2"><input type="button" name="Submit" value=" 确定修改 " onClick="submitform(22)"></td>
                </tr>
              </table>
              <!--显示与隐藏的表格-->
              <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td></td>
                </tr>
            </table></td>
        </tr>
      </form>
    </table>
	
	
        <a name="31" id="31"></a><br>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
          <form name="form31" id="form31">
            <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;友情链接分类管理</td>
                      <td align="right">
					  <img height="15" src="img/collapsed_yes.gif" width="15" style="cursor: hand;" id="CtrImg31"  name="CtrImg31" onClick="CloseOpen(31)">
					  &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" style="display:none" id="Tab31">
                    <tr bgcolor="#FFFFFF">
                      <td width="35%" height="20">友情链接分类管理:
                          <br>
                          <br>
                        (要启动&quot;分类功能&quot;<br>
                        首先确保在&quot;功能设置&quot;里<br>
                        开启分类功能)<br>
                        <input name="index" type="hidden" id="index" value="31">
                        <input name="IsSubmit" type="hidden" id="IsSubmit" value="1">
                        <input name="HdClassID" type="hidden" id="HdClassID" value="">
                        <input name="HdClassName" type="hidden" id="HdClassName" value="">                        
                        <input name="HdClassStatus" type="hidden" id="HdClassStatus" value="">
                      </td>
                      <td>
					  <table width="98%"  border="0" cellspacing="0" cellpadding="3">
                          <tr valign="top">
                            <td>
<script>
var ArrClass=new Array();
<%
sql="select * from linkclass "
set rs=conn.execute (sql)
if not rs.eof then
	while not rs.eof
%>	
	ArrClass.length++;
	ArrClass[ArrClass.length-1]=new Array(<%=rs("ID")%>,"<%=rs("ClassName")%>",0)
<%
	rs.movenext
	wend
	rs.close
end if
%>
</script>

<select id=SelLinkClass size="5" name="SelLinkClass" style="width:210px " onChange="SelectOne(this.options[this.selectedIndex].value,this.options[this.selectedIndex].text)">
</select>
<script>
ReWriteSel();
function SelectOne(Selvalue,Seltext){
	form31.HdNewSort.value=Selvalue;
	form31.TxNewSort.value=Seltext;
}

function NewOne(){
	if (form31.TxNewSort.value=="")
		form31.HdNewSort.value="";
}

function Clear(){
	form31.HdNewSort.value="";
	form31.TxNewSort.value="";
	ReWriteSel();
}

function Add(){
	if (form31.TxNewSort.value==""){
		alert("请输入分类名称");
		return false;
	}
	for (i=0;i<form31.SelLinkClass.length;i++){
		if (form31.TxNewSort.value==form31.SelLinkClass.options[i].text){
			alert("错误:重复项");
			return false;
		}
	}
	ArrClass.length++;
	RnaID=0-ArrClass.length
	ArrClass[ArrClass.length-1]=new Array(RnaID,form31.TxNewSort.value,1);
	ReWriteSel();
	SelLinkClass.options[SelLinkClass.length-1].selected=true;
	form31.HdNewSort.value=RnaID;
}

function Modify(){
	if (form31.HdNewSort.value==""){
		alert("请先选择一个分类");
		return false;
	}
	if (form31.TxNewSort.value==""){
		alert("请先给予一个新名称");
		return false;
	}
	for (i=0;i<form31.SelLinkClass.length;i++){
		if (form31.TxNewSort.value==form31.SelLinkClass.options[i].text){
			alert("错误:并未更改名称");
			return false;
		}
	}
	
	for (i=0;i<ArrClass.length;i++){
		if (ArrClass[i][0]==form31.HdNewSort.value){
			ArrClass[i][1]=form31.TxNewSort.value;
			ArrClass[i][2]=3;
			break;
		}
	}
	ReWriteSel();
	for (i=0;i<form31.SelLinkClass.length;i++){
		if (form31.SelLinkClass.options[i].value==form31.HdNewSort.value){
			form31.SelLinkClass.options[i].selected=true;
			break;
		}
	}
}

function Delete(){
	if (form31.HdNewSort.value==""){
		alert("请先选择一个分类");
		return false;
	}
	if(confirm("请确保此分类下没有友情链接站点,否则将使其处于无分类状态\n或者在删除此分类后,重新为此分类下的所有友情链接指定分类.")){
		for (i=0;i<ArrClass.length;i++){
			if (ArrClass[i][0]==form31.HdNewSort.value){
				ArrClass[i][1]=form31.TxNewSort.value;
				if (ArrClass[i][2]!=1){
					ArrClass[i][2]=2;
				} else{
					if (i==ArrClass.length-1){
						ArrClass.length--;
						break;
					}else{
						for (var j=i;j<ArrClass.length;i++){
							ArrClass[j]=ArrClass[j+1];
						}
						ArrClass.length--;
						break;
					}
				}
				break;
			}
		}
		form31.HdNewSort.value="";
		form31.TxNewSort.value="";
		ReWriteSel();
	}
}

function ReWriteSel(){
	SelLinkClass=form31.SelLinkClass;
	SelLinkClass.options.length=0;
	for (i=0;i<ArrClass.length;i++){
		if (ArrClass[i][2]!=2)
			SelLinkClass.options[SelLinkClass.length]=new Option(ArrClass[i][1],ArrClass[i][0]);
	}
}

function submitform31(){
	for (i=0;i<ArrClass.length;i++){
		if (ArrClass[i][2]!=0){
			form31.SelLinkClass.options[SelLinkClass.length]=new Option(ArrClass[i][1],ArrClass[i][0]);
			form31.HdClassID.value=form31.HdClassID.value+ArrClass[i][0]+"~";
			form31.HdClassName.value=form31.HdClassName.value+ArrClass[i][1]+"~";
			form31.HdClassStatus.value=form31.HdClassStatus.value+ArrClass[i][2]+"~";
		}
	}
	form31.HdClassID.value=form31.HdClassID.value.replace(/[~]$/,"");
	form31.HdClassName.value=form31.HdClassName.value.replace(/[~]$/,"");
	form31.HdClassStatus.value=form31.HdClassStatus.value.replace(/[~]$/,"");
	if (form31.HdClassID.value=="" || form31.HdClassID.value==null){
		alert("错误:没有任何改动");
		return false;
	}
	submitform(31);
}
</script>							
							
							
							</td>
                      </tr>
                          <tr valign="top">
                            <td><input name="TxNewSort" type="text" id="TxNewSort" maxlength="255" style="width:210px " onChange="NewOne()">
							  <input type="hidden" id="HdNewSort" name="HdNewSort">
							</td>
                          </tr>
                          <tr valign="top">
                            <td><input type="button" name="Submit" style="height:20px;" value=" 清空 " onClick="Clear()">
                              <input type="button" name="Submit" style="height:20px;" value=" 增加 " onClick="Add()">
                              <input type="button" name="Submit" style="height:20px;" value=" 修改 " onClick="Modify()">
                              <input type="button" name="Submit" style="height:20px;" value=" 删除 " onClick="Delete()"></td>
                          </tr>
                        </table>                      
                      </td>
                    </tr>
                    <tr align="center" bgcolor="#FFFFFF">
                      <td height="20" colspan="2"><font color=cc0000>以上操作完毕后,请按下面&quot;确定修改&quot;按钮,提交所有操作. </font>                         </td>
                    </tr>
                    <tr align="center" bgcolor="#FFFFFF">
                      <td height="20" colspan="2"><input type="button" name="Submit" value=" 确定修改 " onClick="submitform31(31)"></td>
                    </tr>
                  </table>
                  <!--显示与隐藏的表格-->
                  <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td></td>
                    </tr>
                </table></td>
            </tr>
          </form>
        </table>
        <a name="3" id="3"></a><br>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
          <form name="form3" id="form3">
            <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;我站链接方式</td>
                      <td align="right">
					  <img height="15" src="img/collapsed_yes.gif" width="15" style="cursor: hand;" id="CtrImg3"  name="CtrImg3" 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" style="display:none" id="Tab3">
                    <tr bgcolor="#FFFFFF">
                      <td width="35%" height="20">站点名称:</td>
                      <td><input name="L_SiteName" type="text" value="<%=L_SiteName%>" size="50" maxlength="80"></td>
                    </tr>
                    <tr bgcolor="#FFFFFF">
                      <td height="20">链接到:</td>
                      <td><input name="L_SiteURL" type="text" value="<%=L_SiteURL%>" size="50" maxlength="80"></td>
                    </tr>
                    <tr bgcolor="#FFFFFF">
                      <td height="20">链接图标:</td>
                      <td><input name="L_Logo" type="text" value="<%=L_Logo%>" size="50" maxlength="80"></td>
                    </tr>
                    <tr bgcolor="#FFFFFF">
                      <td height="20">链接说明:</td>
                      <td><input name="L_Alt" type="text" value="<%=L_Alt%>" size="50" maxlength="80">
                          <input name="index" type="hidden" id="index" value="3">
                          <input name="IsSubmit" type="hidden" id="IsSubmit" value="1"></td>
                    </tr>
                    <tr align="center" bgcolor="#FFFFFF">
                      <td height="20" colspan="2"><input type="button" name="Submit" value=" 确定修改 " onClick="submitform(3)"></td>
                    </tr>
                  </table>
                  <!--显示与隐藏的表格-->
                  <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td></td>
                    </tr>
                </table></td>
            </tr>
          </form>
        </table>
        <a name="4" id="4"></a><br>
    <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;调用代码获取</td>
                <td align="right">
				<img height="15" src="img/collapsed_yes.gif" width="15" style="cursor: hand;" id="CtrImg4"  name="CtrImg4" 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="99%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" style="display:none" id="Tab4">
              <tr bgcolor="#FFFFFF">
                <td height="20">调用代码所在页面:</td>
                <td><input name="DefaultPage" id="DefaultPage" type="text" value="http://<%=Request.ServerVariables("HTTP_HOST")%>" size="50" maxlength="80">
				</td>
              </tr>
              <tr bgcolor="#FFFFFF">
                <td width="35%" height="20">调用类别:</td>
                <td><select name="transferclass" id="transferclass" size="5" multiple style="width:210px;">
                      <option value=0 selected >全部</option>
					<%
					sql="select * from linkclass "
					set rs=conn.execute (sql)
					if not rs.eof then
						while not rs.eof
					%>	
						<option value=<%=rs("ID")%>><%=rs("ClassName")%></option>
					<%
						rs.movenext
						wend
						rs.close
					end if
					%>
                    </select></td>
              </tr>
              <tr bgcolor="#FFFFFF">
                <td width="35%" height="20">显示顺序:</td>
                <td>
<input name="DislayOrder" id="DislayOrder" type="radio" value="LOGO" checked onClick="ChangShowList(this.value)">先显示有LOGO的
<input name="DislayOrder" id="DislayOrder" type="radio" value="Word" onClick="ChangShowList(this.value)">先显示纯示文字的<br>
<input name="DislayOrder" id="DislayOrder" type="radio" value="AllLOGO" onClick="ChangShowList(this.value)">均视为有LOGO的
<input name="DislayOrder" id="DislayOrder" type="radio" value="AllWord" onClick="ChangShowList(this.value)">均视为纯示文字的</td>
              </tr>
			  <script>
			  function ChangShowList(ObjValue){
			  	if (!event.srcElement.checked) return;
				LogoLine.disabled=false;
				LogoCount.disabled=false;
				WordLine.disabled=false;
				WordCount.disabled=false;
				switch (ObjValue) {
				   case "AllLOGO" :
						WordLine.disabled=true;
						WordCount.disabled=true;
						break;
				   case "AllWord" :
						LogoLine.disabled=true;
						LogoCount.disabled=true;
						break;
				}
			  }
			  </script>
              <tr bgcolor="#FFFFFF">
                <td height="20">显示数量:</td>
                <td>
				显示<input name="LogoLine" type="text" id="LogoLine" value="1" size="4" maxlength="4">
				行有LOGO的,每行显示
				<input name="LogoCount" type="text" id="LogoCount" value="6" size="4" maxlength="4">
				个<br>
				显示<input name="WordLine" type="text" id="WordLine" value="1" size="4" maxlength="4">
				行单纯文字的,每行显示
				<input name="WordCount" type="text" id="WordCount" value="6" size="4" maxlength="4">
				个</td>
              </tr>
              <tr bgcolor="#FFFFFF">
                <td width="35%" height="20">调用级别:</td>
                <td><input name="IsTop" type="radio" id="radio" onClick="ChangShowList(this.value)" value="1" checked>
                必须为置顶项目(只有置顶的链接才被调用)
                  <input name="IsTop" id="radio2" type="radio" value="0" onClick="ChangShowList(this.value)">
                无要求</td>
              </tr>
              <tr bgcolor="#FFFFFF">
                <td width="35%" height="20">表格宽度:</td>
                <td><input name="TabWidth" type="text" id="TabWidth" value="90" size="4" maxlength="4">
                  <select name="TabWidthUnit" id="TabWidthUnit">
                    <option value="px">像素PX</option>
                    <option value="%" selected>百分比%</option>
                </select> </td>
              </tr>
              <tr bgcolor="#FFFFFF">
                <td width="35%" height="20">表格对齐方式:</td>
                <td><select name="TabAlign" id="TabAlign">
                  <option value="left">居左</option>
                  <option value="center" selected>居中</option>
                  <option value="right">居右</option>
                  </select>
			    </td>
			  </tr>
              <tr bgcolor="#FFFFFF">
                <td height="20">边框颜色:</td>
                <td>
				<table width="50" border="1" cellpadding="0" cellspacing="0" onClick="changecolor(sTabBorderColor)" id="sTabBorderColor" style="cursor: hand;background-color: #698cc3">
                  <tr>
                    <td>　</td>
                  </tr>
                </table>
				</td>
              </tr>
              <tr bgcolor="#FFFFFF">
                <td height="20">题头表格底色:</td>
                <td>
				<table width="50" border="1" cellpadding="0" cellspacing="0" onClick="changecolor(tTabBGColor)" id="tTabBGColor" style="cursor: hand;background-color: #698cc3">
                    <tr>
                      <td>　</td>
                    </tr>
                </table>
				</td>
              </tr>
			  <tr bgcolor="#FFFFFF">
                <td height="20">内表边框宽度:</td>
                <td><input name="TabBorderWidth" type="text" id="TabBorderWidth" value="0" size="4" maxlength="4">
                </td>
              </tr>
			  <tr bgcolor="#FFFFFF">
                <td height="20">内表边框颜色:</td>
                <td>
				<table width="50" border="1" cellpadding="0" cellspacing="0" onClick="changecolor(TabBorderColor)" id="TabBorderColor" style="cursor: hand;background-color: #d6e0ef">
                  <tr>
                    <td>　</td>
                  </tr>
                </table>
				</td>
              </tr>
			  <tr bgcolor="#FFFFFF">
                <td height="20">内表表格底色:</td>
                <td>
				<table width="50" border="1" cellpadding="0" cellspacing="0" style="background-color: #d6e0ef;cursor: hand;" onClick="changecolor(TabBGColor)" id="TabBGColor">
                  <tr>
                    <td>　</td>
                  </tr>
                </table>
				</td>
              </tr>
              <tr bgcolor="#FFFFFF">
                <td height="20">内表表格间距:</td>
                <td><input name="TabCellSpacing" type="text" id="TabCellSpacing" value="1" size="4" maxlength="4">
                </td>
              </tr>
              <tr bgcolor="#FFFFFF">
                <td height="20">内表表格填充:</td>
                <td><input name="TabCellPadding" type="text" id="TabCellPadding" value="1" size="4" maxlength="4">
                </td>
              </tr>
              <tr bgcolor="#FFFFFF">
                <td height="20">内表单元格颜色:</td>
                <td>
				<table width="50" border="1" cellpadding="0" cellspacing="0" onClick="changecolor(TabCellColor)" id="TabCellColor" style="cursor: hand;background-color: #ffffff">
                  <tr>
                    <td>　</td>
                  </tr>
                </table>
				</td>
              </tr>
              <tr bgcolor="#FFFFFF">
                <td height="20">内表每行高度:</td>
                <td><input name="TabLinHeight" type="text" id="TabLinHeight" value="33" size="4" maxlength="4">
                    <select name="TabLinHeightUnit" id="">
                      <option value="px" selected>像素PX</option>
                      <option value="%">百分比%</option>
                    </select></td>
              </tr>
              <tr bgcolor="#FFFFFF">
                <td height="20">调用代码:</td>
                <td><textarea cols="50" name="NeedCode" id="NeedCode" rows="10" onFocus="GetNeedCode()">点击这里获取代码</textarea></td>
              </tr>
              <tr align="center" bgcolor="#FFFFFF">
                <td height="20" colspan="2">　</td>
              </tr>
            </table>
            <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>
		  </td>
      </tr>
    </table>
    <a name="5" id="5"></a><br>
	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#698CC3">
      <form id="form5" name="form5">
        <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 session("IsCheckMaster")=false then
				response.write "站长不需要系统检查"
			else 
				response.write "站长需要系统检查"
			end if
				%>
                  ）</td>
                  <td align="right">
				  <img height="15" src="img/collapsed_yes.gif" width="15" style="cursor: hand;" id="CtrImg5"  name="CtrImg5" 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="100%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="d6e0ef" style="display:none" id="Tab5">
                <tr bgcolor="#FFFFFF">
                  <td height="20">
              <table width="99%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" style="display:" id="Tab51">
                <tr bgcolor="#FFFFFF">
                  <td width="35%" height="20">网站名称:</td>
                  <td><input name="Y_SiteName" type="text" id="Y_SiteName" size="60" maxlength="<%=MasWordsCount%>">
                      <font color=cc0000>(少于<%=MasWordsCount%>字)</font></td>
                </tr>
                <%if IsSort=true then%>
                <tr bgcolor=#FFFFFF>
                  <td height="20">站点所属类别:</td>
                  <td colspan="4"><select name="Y_SiteType" id="select" style="height:12px;width:325px;">
                      <option value=0  <%if int(OwnerClass)=0 then response.write " selected" end if%>> </option>
                      <%
	sql="select * from linkclass "
	set rs=conn.execute (sql)
	if not rs.eof then
		while not rs.eof
	%>
                      <option value=<%=rs("ID")%>><%=rs("ClassName")%></option>
                      <%
		rs.movenext
		wend
		rs.close
	end if
	%>
                    </select>
				</td>
                </tr>
                <%end if%>
                <tr bgcolor="#FFFFFF">
                  <td height="20">LOGO图片地址:</td>
                  <td><input name="Y_Logo" type="text" id="Y_Logo" value="http://" size="60" maxlength="200">
				  <%if IsUploadLogo then%>
				  <input type="button" name="Submit2" value="上传LOGO" onClick="admin_uplogo()">
				  <%end if%>
				  </td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">网站简介:</td>
                  <td><textarea cols="38" name="Y_Alt" rows="5" id="Y_Alt"></textarea>
                      <font color=cc0000>(少于<%=MasAltCount%>字)</font></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20">指向:</td>
                  <td><input name="Y_SiteURL" type="text" id="Y_SiteURL" value="http://" size="60" maxlength="200"></td>
                </tr>
              </table>
              <table width="99%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" style="display:" id="Tab53">
                <tr align="center" bgcolor="#FFFFFF">
                  <td height="20">
					<input name="index" type="hidden" id="index" value="5">
					<input name="IsSubmit" type="hidden" id="IsSubmit" value="1">
					<input type="button" name="Submit5" value=" 确定添加 " onClick="submitform(5)"></td>
                </tr>
              </table>
				</td>
                </tr>
                <%if IsSort=true then%>
                <%end if%>
              </table>
              <!--显示与隐藏的表格-->
              <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td></td>
                </tr>
            </table></td>
        </tr>
      </form >
	  </table>
    <a name="7" id="7"></a><br>
    <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 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 PR>0 then
				response.write "PR值≧"&PR
			else 
				response.write " 无PR值要求 "
			end if
			if Alexa>0 then
				response.write " Alexa排名"&Alexa&"以上 "
			else 
				response.write " 无Alexa排名值要求 "
			end if
			if Google>0 then
				response.write " Google收录"&Google&"以上 "
			else 
				response.write " 无Google收录要求 "
			end if
			if Baidu>0 then
				response.write " Baidu收录"&Baidu&"以上 "
			else 
				response.write " 无Baidu收录要求 "
			end if
			
			if IsConfirm=true then
				response.write "检查是否已做好我站链接 "
			else
				response.write "不检查是否已做好我站链接 "
			end if
			if IsVerify=true then
				response.write "需要审核"
			else
				response.write "不需要审核"
			end if
				%>）</td>
                <td align="right">
				<img height="15" src="img/collapsed_no.gif" width="15" style="cursor: hand;" id="CtrImg6"  name="CtrImg6" onClick="CloseOpen(6)">
				&nbsp; </td>
              </tr>
            </table>
            <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td></td>
              </tr>
            </table>
			
<%
function showordertype(d)
	Str=""
	if Cint(session("OrderBy"))=d then
		Str="<img border=0 width=15 height=10 src=""img/"&session("OrderType")&".gif""/>"
	end if
	showordertype=Str
end function
	
dim totalPut
dim CurrentPage
dim toPage
toPage="admin.asp"

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

session("currentPage")=currentPage

if session("SortType")>0 and IsSort=true then
	SqlSortType=" where OwnerClass="&session("SortType")
else
	SqlSortType=""
	session("SortType")=0
end if

d=request("d")
if d="" and session("OrderBy")="" then
	if OrderBy=2 then
		sql="select * from link "&SqlSortType&" order by goin desc"
	elseif OrderBy=1 then
	sql="select * from link "&SqlSortType&" order by jointime desc"
	end if
else
	if OrderBy=2 then
		OrderByCollectivity=" goin desc"
	elseif OrderBy=1 then
		OrderByCollectivity=" jointime desc"
	end if
	
	if d<>"" then
		if session("OrderBy")<>d then
			session("OrderBy")=d
			session("OrderType")="desc"
		else
			if session("OrderType")="desc" then
				session("OrderType")="asc"
			else
				session("OrderType")="desc"
			end if
		end if
	end if
	if session("OrderBy")<>"" then
		d=session("OrderBy")
	end if
	
	Select case d
		case "1"
			OrderBy="ID"
		case "2"
			OrderBy="Y_Logo"
		case "3"
			OrderBy="jointime"
		case "4"
			OrderBy="Y_SiteName"
		case "5"
			OrderBy="PR"
		case "6"
			OrderBy="Alexa"
		case "7"
			OrderBy="IsVerify"
		case "8"
			OrderBy="goin"
		case "9"
			OrderBy="goout"
		case "10"
			OrderBy="GOOGLE"
		case "11"
			OrderBy="BaiDu"
	end Select
		
	
	
	sql="select * from link "&SqlSortType&" order by "&OrderBy&" "&session("OrderType")&","&OrderByCollectivity
end if
%>
            <table width="99%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="d6e0ef" style="display:" id="Tab6">
              <tr align="center" bgcolor="d6e0ef">
                <td height="20"><a href="admin.asp?d=1">ID</a> <%=showordertype(1)%></td>
                <td><a href="admin.asp?d=2">站点LOGO</a> <%=showordertype(2)%></td>
                <td bgcolor="d6e0ef"><a href="admin.asp?d=3">申请日期</a> <%=showordertype(3)%></td>
                <td><a href="admin.asp?d=4">站点名称</a> <%=showordertype(4)%></td>
                <td><a href="admin.asp?d=5">PR</a> <%=showordertype(5)%></td>
                <td><a href="admin.asp?d=6">Alexa</a> <%=showordertype(6)%></td>
                <td><a href="admin.asp?d=10">GOOGLE</a> <%=showordertype(10)%></td>
                <td><a href="admin.asp?d=11">BaiDu</a> <%=showordertype(11)%></td>
                <td><a href="admin.asp?d=7">审核</a> <%=showordertype(7)%></td>
                <td><a href="admin.asp?d=8">点入</a> <%=showordertype(8)%></td>
                <td><a href="admin.asp?d=9">点出</a> <%=showordertype(9)%></td>
                <td><strong>管理</strong></td>
              </tr><form name="form6" id="form7"><input name="ID" type="hidden" id="ID"><input name="index" type="hidden" id="index" value="7"></form>
			  
<%
rs.open sql,conn,1,3
if Rs.eof and Rs.bof then
	response.Write("<tr bgcolor=f3f6fa><td height=30 align=center valign=bottom colspan=10><font color=red>还没有友情链接。</font></td></tr>")
else
	if request("MaxPerPage")<>"" then
		session("MaxPerPage")=Cint(request("MaxPerPage"))
	end if
	if session("MaxPerPage")="" then
		session("MaxPerPage")=15
	end if
	totalPut=rs.recordcount
	if currentpage<1 then
		currentpage=1
	end if
	MaxPerPage=session("MaxPerPage")
	if (currentpage-1)*MaxPerPage>totalput then
		if (totalPut mod MaxPerPage)=0 then
			currentpage= totalPut \ MaxPerPage
		else
			currentpage= totalPut \ MaxPerPage + 1
		end if
	end if
	if currentPage=1 then
		showContent
		showpage totalput,MaxPerPage,toPage
	else
		if (currentPage-1)*MaxPerPage<totalPut then
			rs.move  (currentPage-1)*MaxPerPage
			dim bookmark
			bookmark=rs.bookmark
			showContent
			showpage totalput,MaxPerPage,toPage
		else
			currentPage=1
			showContent
			showpage totalput,MaxPerPage,toPage
		end if
	end if
	rs.close
end if 
		
sub showContent
	dim i 
	i=0
	do while not rs.eof 
		ID = rs("ID")
		Y_SiteName = rs("Y_SiteName")
		Y_SiteURL = rs("Y_SiteURL")
		Y_Logo = rs("Y_Logo")
		Y_Alt = rs("Y_Alt")
		PR = rs("PR")
		Alexa = rs("Alexa")
		GOOGLE = rs("GOOGLE")
		BaiDu = rs("BaiDu")
		goin = rs("goin")
		goout = rs("goout")
		jointime = rs("jointime")
		IsVerify = rs("IsVerify")
		
		jointime=year(jointime)&"-"&month(jointime)&"-"&day(jointime)
		if IsVerify=true then
			IsVerify="已"
		else
			IsVerify="未"
		end if
		
		Response.Write("<tr bgcolor=f3f6fa>")
		Response.Write(" <td align=center>"&ID&"</td>")
		Response.Write("  <td valign=top align=center bgcolor=f3f6fa width=""20%"">")
		if Y_Logo<>"" then
			Response.write ("<a 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 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>")
		Response.Write(" <td align=center>"&jointime&"</td>")
		Response.Write(" <td><a href="""&Y_SiteURL&""" target=_blank >"&Y_SiteName&"</a></td>")
		Response.Write(" <td align=center>"&PR&"</td>")
		Response.Write(" <td align=center>"&RW(Alexa)&"</td>")
		Response.Write(" <td align=center>"&GOOGLE&"</td>")
		Response.Write(" <td align=center>"&BaiDu&"</td>")
		Response.Write(" <td align=center>"&IsVerify&"</td>")
		Response.Write(" <td align=center>"&goin&"</td>")
		Response.Write(" <td align=center>"&goout&"</td>")
		Response.Write(" <td align=center><img alt=""直接删除"" style=""cursor: hand;"" onclick=""if(confirm('确实要删除该友情链接吗？')) {admin_delete("&ID&")}"" height=16 src=""img/delete.gif"" width=20> <img alt=""详细设置"" style=""cursor: hand;"" onclick=""admin("&ID&")"" height=16 src=""img/control.gif"" width=20> <img alt=""检查对方是否单方撤链"" style=""cursor: hand;"" onclick=""admin_check("&ID&")"" height=16 src=""img/check.gif"" width=20></td>")
		Response.Write("</tr>")

		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 "<tr><td colspan=10><table cellspacing=1 width='100%' border=0 ><form method=Post action="""&filename&"""><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&">首页</a>&nbsp;"
	response.write "<a href="&filename&"?page="&CurrentPage-1&">上一页</a>&nbsp;"
end if

if n-currentpage<1 then
	response.write "下一页 尾页"
else
	response.write "<a href="&filename&"?page="&(CurrentPage+1)&">"
	response.write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
end if
response.write "&nbsp;页次：<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
response.write "&nbsp;<input type='text'size=8 maxlength=8 name='MaxPerPage' value="&session("MaxPerPage")&">个/页 "
%>
转到：
<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></td></tr>"
end function

%>
            </table>
            <!--显示与隐藏的表格-->
            <table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td></td>
              </tr>
          </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>