<% Response.Charset="UTF-8"%>
<!--#include file="../plus/Preview.asp"-->
<!--#include file="json.inc"-->

<%
dim json,jsonStr
set json=new UsCMS_Json
json.JsonType="object"

'在线升级检测
if request.querystring("action")="Update" then
Server.ScriptTimeout=36000
Sip=Request.ServerVariables("LOCAL_ADDR")
SNname=Request.ServerVariables("Server_Name")
set Http=server.createobject("MSXML2.XMLHTTP")
 Http.open "POST","http://www.gamesp.cn/update/Version.Asp?str="&Ver&"&Sip="&Sip&"&SName="&Sname,false
 Http.setRequestHeader"Content-Length",Len(Ver)
 Http.setRequestHeader"CONTENT-TYPE","application/x-www-form-urlencoded"
 Http.send(Ver)
 tempstr=Http.responseText

%>




<div class="list" id="dialog_link">  
		<script type="text/javascript">
			$(function(){
				$('#dialog_link a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
     
      </td>
    </tr>
  </table> 
<table width='100%'>
<tr>
<td>当前版本：<%=Ver%> </td>
</tr>
<tr>
<td>服务器版本：<%=(tempstr)%></td>

</tr>
</table>
</div>
 <%
end if

'在线升级检测

'增加广告
if request.querystring("action")="AdAdd" then
  AdName=request.Form("AdName")
  AdTitle=request.Form("AdTitle")
  AdCode=request.Form("AdCode")
    set rs=server.CreateObject("adodb.recordset")
    sql="select * from UsCMSAd"
    rs.open sql,conn,1,3
    rs.addnew
	rs("AdName")=AdName
	rs("AdTitle")=AdTitle
	rs("AdCode")=AdCode
	rs("AdDate")=Date()
	rs.update
    rs.close
    set rs=nothing
  json.addData "type",1
  json.addData "message","增加广告成功"	
  jsonStr=json.getJson(json)
  set json=nothing
  response.write jsonstr
end if
'增加广告
'显示广告
if request.querystring("action")="adshow" then
  Adid=funstr(request.QueryString("Adid"))
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from UsCMSAd where Adid="&Adid
  rs.open sql,conn,1,3
  rs("AdDisplay")=True
  rs.update
  rs.close
  set rs=nothing
  json.addData "type",1
  json.addData "message","显示广告成功"	
  jsonStr=json.getJson(json)
  set json=nothing
  response.write jsonstr
end if
'显示广告

'隐藏广告
if request.querystring("action")="adhide" then
  Adid=funstr(request.QueryString("Adid"))
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from UsCMSAd where Adid="&Adid
  rs.open sql,conn,1,3
  rs("AdDisplay")=False
  rs.update
  rs.close
  set rs=nothing
  json.addData "type",1
  json.addData "message","隐藏广告成功"
  jsonStr=json.getJson(json)
  set json=nothing
  response.write jsonstr
  response.end
end if
'隐藏广告

'删除广告
if request.querystring("action")="addel" then
  Adid=funstr(request.QueryString("Adid"))
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from UsCMSAd where Adid="&Adid
  rs.open sql,conn,1,3
  if not rs.eof then
  rs.delete
  rs.update
  rs.close
  set rs=nothing
  json.addData "type",1
  json.addData "message","删除广告成功"
  jsonStr=json.getJson(json)
  set json=nothing
response.write jsonstr
  else
  json.addData "type",0
  json.addData "message","广告不存在"
  jsonStr=json.getJson(json)
  set json=nothing
response.write jsonstr
  end if  
end if
'删除广告

'链接修改
if request.QueryString("action")="LinkSave" then
  SiteID=request.form("SiteID")
  SiteName=request.form("SiteName")
  SiteUrl=request.form("SiteUrl")
  SiteTitle=funstr(request.form("SiteTitle"))
  SiteQQ=funstr(request.form("SiteQQ"))

    set rs=server.CreateObject("adodb.recordset")
    sql="select * from UsCMSLink where SiteID="&SiteID
    rs.open sql,conn,1,3
   
	rs("SiteName")=SiteName
	rs("SiteUrl")=SiteUrl
	rs("SiteTitle")=SiteTitle
	rs("SiteQQ")=SiteQQ
	rs.update
    rs.close
    set rs=nothing
json.addData "type",1
json.addData "message","修改链接成功"		'添加数据

jsonStr=json.getJson(json)			'获取最后生成的json字符串，本函数只有第一次调用有效
set json=nothing
response.write jsonstr	
end if
'链接修改

'增加友情链接
if request.querystring("action")="Linkadd" then
  SiteName=request.Form("SiteName")
  SiteUrl=request.Form("SiteUrl")
  SiteTitle=funstr(request.Form("SiteTitle"))
  SiteQQ=funstr(request.Form("SiteQQ"))
    set rs=server.CreateObject("adodb.recordset")
    sql="select * from UsCMSLink"
    rs.open sql,conn,1,3
    rs.addnew
	rs("SiteName")=SiteName
	rs("SiteUrl")=SiteUrl
	rs("SiteTitle")=SiteTitle
	rs("SiteQQ")=SiteQQ
	rs("SiteDisplay")=True
	rs.update
    rs.close
    set rs=nothing
  json.addData "type",1
  json.addData "message","增加链接成功"	
  jsonStr=json.getJson(json)
  set json=nothing
  response.write jsonstr
end if
'增加友情链接

'显示友情链接
if request.querystring("action")="show" then
  SiteID=funstr(request.QueryString("SiteID"))
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from UsCMSLink where SiteID="&SiteID
  rs.open sql,conn,1,3
  rs("SiteDisplay")=True
  rs.update
  rs.close
  set rs=nothing
  json.addData "type",1
  json.addData "message","显示链接成功"	
  jsonStr=json.getJson(json)
  set json=nothing
  response.write jsonstr
end if
'显示友情链接

'隐藏友情链接
if request.querystring("action")="hide" then
  SiteID=funstr(request.QueryString("SiteID"))
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from UsCMSLink where SiteID="&SiteID
  rs.open sql,conn,1,3
  rs("SiteDisplay")=False
  rs.update
  rs.close
  set rs=nothing
  json.addData "type",1
  json.addData "message","隐藏链接成功"
  jsonStr=json.getJson(json)
  set json=nothing
  response.write jsonstr
  response.end
end if
'隐藏友情链接


'删除友情链接
if request.querystring("action")="del" then
  SiteID=funstr(request.QueryString("SiteID"))
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from UsCMSLink where isdel=false and SiteID="&SiteID
  rs.open sql,conn,1,3
  if not rs.eof then
  rs("isdel")=True
  rs.update
  rs.close
  set rs=nothing
  json.addData "type",1
  json.addData "message","链接已进入回收站"
  jsonStr=json.getJson(json)
  set json=nothing
response.write jsonstr
  else
  json.addData "type",0
  json.addData "message","此链接未能进入回收站，可能是已经永久删除或者已经进入回收站"
  jsonStr=json.getJson(json)
  set json=nothing
response.write jsonstr
  end if  
end if
'删除友情链接

'恢复友情链接
if request.querystring("action")="nodel" then
  SiteID=funstr(request.QueryString("SiteID"))
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from UsCMSLink where isdel=true and SiteID="&SiteID
  rs.open sql,conn,1,3
  if not rs.eof then
  rs("isdel")=false
  rs.update
  rs.close
  set rs=nothing
  json.addData "type",1
  json.addData "message","友情链接已恢复"
  jsonStr=json.getJson(json)
  set json=nothing
response.write jsonstr
  else
  json.addData "type",0
  json.addData "message","友情链接未能恢复"
  jsonStr=json.getJson(json)
  set json=nothing
response.write jsonstr
  end if  
end if
'恢复友情链接

'永久删除友情链接
if request.querystring("action")="delall" then
i=1
do while i<=10
str="checkbox"&i
SiteID=funstr(request.Form(str))
if SiteID="" then
else
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from UsCMSLink where SiteID="&SiteID
  rs.open sql,conn,1,3
  rs.delete
  rs.update
end if
 i=i+1
loop
json.addData "type",1
json.addData "message","所有选择删除链接成功"
jsonStr=json.getJson(json)
set json=nothing
response.write jsonstr
end if
'永久删除友情链接

'更新站点信息
if request.querystring("action")="Info" then
webname=request.Form("webname")
weburl=request.Form("weburl")
webkey=request.Form("webkey")
webdis=request.Form("webdis")
webend=request.Form("webend")
webhtml=request.Form("webhtml")
webtemp=request.Form("webtemp")
str=webname&chr(13)&weburl&chr(13)&webkey&chr(13)&webdis&chr(13)&webend&chr(13)&webhtml&chr(13)&webtemp
url=server.MapPath("Site/config.Asp")
createfiles url,str
json.addData "type","1"
json.addData "message","更新站点信息成功"
jsonStr=json.getJson(json)
set json=nothing
response.write jsonstr
end if
'更新站点信息
%>
<%if request.QueryString("action")="doInfo" then%>

<div class="list" id="dialog_link">  
		<script type="text/javascript">
			$(function(){
				$('#dialog_link a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=doInfo&Type=Add');ST(0,0)" title="新增"><span class="ui-icon ui-icon-pencil" ></span>新增站点</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=doInfo&Type=Recycle');ST(0,0)" title="删除"><span class="ui-icon ui-icon-trash"></span>删除站点</a>      
      </td>
    </tr>
  </table> 
<table width="100%">
  <tr>
    <td>功能关闭</td>
  </tr>
</table>    
<%end if%>
<%
if request.QueryString("action")="Setup" then
str=openfile(server.MapPath("Site/config.asp"))
web=split(str,chr(13))
%>

<div class="list" id="dialog_link">  
		<script type="text/javascript">
			$(function(){
				$('#dialog_link a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=doInfo&Type=Add');ST(0,0)" title="新增"><span class="ui-icon ui-icon-pencil" ></span>新增站点</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=doInfo&Type=Recycle');ST(0,0)" title="删除"><span class="ui-icon ui-icon-trash"></span>删除站点</a>      
      </td>
    </tr>
  </table>         

<form id="form1" name="form1" method="post" action="System.asp?action=Info">
<table width="100%">
  <tr>
    <th>参数说明</th>    
    <th>参数值</th>    
  </tr>
  <tr> 
	<td style='width:10%'>网站名称：</td>
	<td><input type='text' name='webname' value='<%= web(0) %>' style='width:40%'><label style="display:none" for="webname" class="error" metaDone="true" generated="true"></label></td></tr>
  <tr>
	<td> 网站地址：</td>
	<td><input type='text' name='weburl' value='<%= web(1) %>' style='width:40%'><label style="display:none" for="weburl" class="error" metaDone="true" generated="true"></label></td></tr>
  <tr> 
	<td> 网站关键字：</td>
	<td><input type='text' name='webkey' value='<%= web(2) %>' style='width:40%'><label style="display:none" for="webkey" class="error" metaDone="true" generated="true"></label></td></tr>
  <tr> 
	<td>网站描述：</td>
	<td><input type='text' name='webdis' value='<%= web(3) %>' style='width:40%'><label style="display:none" for="webdis" class="error" metaDone="true" generated="true"></label></td></tr>
  <tr> 
	<td> 网站版权：</td>
	<td><textarea name="webend" rows="4" style='width:40%'><%= web(4) %></textarea></td></tr>
  <tr> 
	<td> 生成HTML目录：</td>
	<td><input type='text' name="webhtml" value="<%= web(5) %>" style='width:40%' /></td></tr>
  <tr> 
	<td> 模板目录：</td>
	<td><input type='text'  name="webtemp" value="<%= web(6) %>" style='width:40%' /></td></tr>
  <tr>
    <td></td>
	<td>
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onClick="$('#form1').submit();"><span class="ui-icon ui-icon-check"></span>保存</a>
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onClick="document.form1.reset();"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>重置</a>
	</td>
  </tr>
    <tr>
      <td style="height:5px;" colspan="3">
      </td>
    </tr>    

</table>
</form>

<table width="100%">
  <tr>
    <th>参数说明</th>    
    <th>参数值</th>    

  </tr>
  <tr align="left">
	<td style='width:10%'height="30">IIS版本：</td>
	<td ><%=Request.ServerVariables("SERVER_SOFTWARE")%>  </td>

  </tr>
  <tr>
	<td>服务器IP：</td>
	<td><%=Request.ServerVariables("LOCAL_ADDR")%></td>

  </tr>  
  <tr>
	<td>客户端IP：</td>
	<td><%=request.servervariables("remote_addr")%></td>

  </tr> 
  <tr>
	<td>服务器域名：</td>
	<td><%=Request.ServerVariables("Server_Name")%></td>

  </tr>    
  <tr>
	<td>软件安装路径：</td>
	<td><%=Request.ServerVariables("Appl_Physical_Path")%></td>

  </tr>     
     
  <tr>
	<td>软件版本信息：</td>
	<td><strong>版本名称：</strong>USCMS<strong> 版本号：</strong>2.0</td>

  </tr>
  <tr>
	<td>开发团队：</td>
	<td>USCMS&无忧影视</td>
  </tr>
</table>


</div>
<script>
$(document).ready(function() {

	var options = {
		beforeSubmit:  function(){showLoading(showSaveText);},
		success:       function(msg){
							hideLoading();
							showMessage(msg.message,msg.type);
							if(msg.type == '1'){
								ST(0,0);
								ShowDiv = "result_content";
								getPageContent("system.asp?action=Setup");
							}
						},
		type:      'post',
		dataType:  'json'
	};
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
		   webname: {required:true},
			weburl: {required:true},
			webkey: {required:true},
			webdis: {required:true}
		},
		messages: {
	 	   webname: {required: "请填写网站名称"},
			weburl: {required: "请填写网站地址"},
			webkey: {required: "请填写网站关键字"},
			webdis: {required: "请填写网站描述"}
		},
		submitHandler: function() {
			$('#form1').ajaxSubmit(options);
		}
	});
});
</script>
<%
end if
%>


<%'友情链接表单
if request.QueryString("action")="Link" then
isdel=request.QueryString("isdel")
page=Request.QueryString("page")
%>
		<script type="text/javascript">
			$(function(){
			<%if isdel="True" Then%>
				$('#form_del a').hover(
		    <%else%>
				$('#dialog_link a').hover(			
			<%end if%>
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  
<div class="list" id="dialog_link">

  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">


<a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=AddLink');ST(2,2);"><span class="ui-icon ui-icon-pencil" ></span>新增链接</a>

<a class="<%if isdel="True" Then%>ui-state-hover<%else%>ui-state-default ui-corner-all<%end if%>" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=Link&isdel=True');ST(2,2);" ><span class="ui-icon ui-icon-trash"></span>回收站</a>
          
      </td>
    </tr>
  </table> 
<form id="form_del" name="form_del" method="get" action="System.asp?action=delall">  
<table width="100%">
  <tr>
    <th>选择</th>    
    <th>序号</th>    
    <th>网站名称</th>
    <th>网站地址</th>
    <th>网站说明</th>
    <th>站长ＱＱ</th>
    <th>管理</th>
  </tr>
	<%
	set rs=server.CreateObject("adodb.recordset")
	if request.QueryString("isdel")="True" then
	sql="select * from UsCMSLink where isdel=True order by SiteID asc"
	else
	sql="select * from UsCMSLink where isdel=false order by SiteID asc"
	end if
	rs.open sql,conn,1,3 
		if not rs.eof then
		rs.pagesize=15
		pagecount=rs.pagecount
		page=int(request.QueryString("page"))
			if page<=0 then page=1
				if request.QueryString("page")="" then 
					page=1
				end if
			rs.absolutepage=page
				for i=1 to rs.PageSize
					if rs.EOF then 
				exit for
			end if
	%>
  <tr height="24"> 
	<%if request.QueryString("isdel")="True" then%>	
    <td><input name="checkbox<%= i %>" type="checkbox" value="<%= rs("SiteID") %>" checked="checked"/></td>
	<%else%>
    <td><input name="checkbox<%= i %>" type="checkbox" value="<%= rs("SiteID") %>"/></td>
	<%end if%>        
    <td><%= rs("SiteID") %></td>
    <td><%= rs("SiteName") %></td>
    <td><%= rs("SiteUrl") %></td>
    <td><%= rs("SiteTitle") %></td>
    <td><%= rs("SiteQQ") %></td>
	<%if request.QueryString("isdel")="True" then%>    
    <td>

    <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ajax_del('action=nodel&SiteID=<%=rs("SiteID")%>');" title="恢复"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>恢复</a>     
    </td>
	<%else%>    
    <td>
	<%if rs("SiteDisplay")=True then%>
    <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ajax_show('action=hide&SiteID=<%=rs("SiteID")%>');" title="隐藏"><span class="ui-icon ui-icon-locked"></span>隐藏</a>    
	<%else%>
    <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ajax_show('action=show&SiteID=<%=rs("SiteID")%>');" title="显示"><span class="ui-icon ui-icon-unlocked"></span>显示</a>     
	<%end if%>    
    <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ajax_modi('SiteID=<%=rs("SiteID")%>');" title="编辑"><span class="ui-icon ui-icon-pencil"></span>编辑</a>     
    <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ajax_del('action=del&SiteID=<%=rs("SiteID")%>');" title="删除"><span class="ui-icon ui-icon-trash"></span>删除</a>
    </td>
	<%end if%>     
  </tr>
  
 
<%rs.movenext:next:rs.close:set rs=nothing%>
  <tr>
  <%if request.QueryString("isdel")="True" then%>	  
    <td colspan="7" style="height:35px;">
    <a id="delbutton" class="ui-state-default ui-corner-all" href="javascript:;"><span class="ui-icon ui-icon-trash"></span>清空</a>  </td>
  <%else%>
    <td colspan="7" style="height:35px;">
    <a id="negative" class="ui-state-default ui-corner-all" href="javascript:;"><span class="ui-icon ui-icon-check"></span>全选/反选</a>
    <a id="delbutton" class="ui-state-default ui-corner-all" href="javascript:;"><span class="ui-icon ui-icon-trash"></span>永久删除</a>    
</td>
  <%end if%>    
  </tr>  
</table>
</form>
</div> 

<div class="digg">
  <span class="disabled" href="javascript:;">总计：<b><%=pagecount%></b> 页，当前第 <b><font color="#29a1d9"><%= page %> </font></b>页 </span>

  <%if page=1 then%><span class="disabled"> 首&nbsp;页</span><%else%>
  <span><a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=Link&isdel=<%=isdel%>&page=1');ST(2,2)"> 首&nbsp;页</a></span><%end if%>
  
  <%if page=1 then%><span class="disabled">上一页&nbsp;</span><%else%>
  <a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=Link&isdel=<%=isdel%>&page=<%=page-1%>');ST(2,2)">上一页&nbsp;</a><%end if%>

  <%for i=page to page+9:if i=page then%>
  <span class="current"><a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=Link&isdel=<%=isdel%>&page=<%=i%>');ST(2,2)"><%=i%></a></span>
  <%elseif i>pagecount then%><span class="disabled"><%=i%></span><%else%>
  <a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=Link&isdel=<%=isdel%>&page=<%=i%>');ST(2,2)"><%=i%></a><%end if:next%>

  <%if pagecount<page+1 then%><span class="disabled">下一页&nbsp;</span><%else%>
  <a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=Link&isdel=<%=isdel%>&page=<%=page+1%>');ST(2,2)">下一页&nbsp;</a><%end if%>

  <%if pagecount<page+1 then%><span class="disabled"> 尾&nbsp;页</span><%else%>
  <a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=Link&isdel=<%=isdel%>&page=<%=pagecount%>');ST(2,2)"> 尾&nbsp;页</a><%end if%>
</div> 
<% else %>
  </table>
</form>  
</div>
<div class="digg">暂时没有记录!</div>

<%end if%>

<div id="question" style="display:none;height:200px;top:50%;left:50%;"> 
<b >YES OR NO</b> <br />
<input type="button" id="yes" value="是:Yes"> 
<input type="button" id="no" value="否:No">

<input type="hidden" id="del_value" />
</div> 
<script>
$(document).ready(function() {
var question = $('#question')[0];

	    $('#negative').click(
		function(){
			$('#form_del input[@type=checkbox]').each(function(){
				$(this).attr('checked',!$(this).attr('checked'))
			})
		}
		);
//删除操作
	var options_del = {
		beforeSubmit:  function(){showLoading(showText);},
		success:       function(msg){
						hideLoading();
						showMessage(msg.message,msg.type);
						if(msg.type == '1'){
							ShowDiv = "result_content";
							getPageContent("system.asp?action=Link&page=<%=page%>&isdel=<%=isdel%>");
						}
					},
		type:      'post',
		dataType:  'json'
	};
	$("#delbutton").click(function(){
		$.blockUI(question);
	});
	
	$('#yes').click(function() {
			$.unblockUI();
			$('#form_del').ajaxSubmit(options_del);			
			return false;
		});
	$('#no').click($.unblockUI);
	
});

//显示隐藏
function ajax_show(str){
	$.ajax({
		url: "system.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('system.asp?action=Link');
			}
		}
	});
	return false;
}
//删除链接
function ajax_del(str){
	$.ajax({
		url: "system.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('system.asp?action=Link');
			}
		}
	});
	return false;
}
//编辑
function ajax_modi(str){
	$.ajax({
		url: "system.asp?action=LinkEdit",
		data: str,
		type:'get',
		dataType:"text",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideLoading();
			$('#result_content').html(msg);
		}
	});
	return false;
}

</script>
<%end if%>

<%
if request.QueryString("action")="LinkEdit" then
  SiteID=funstr(request.QueryString("SiteID"))
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from UsCMSLink where SiteID="&SiteID
  rs.open sql,conn,1,3
%>

		<script type="text/javascript">
			$(function(){
				$('#doLink a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  
<div class="list" id="dialog_link">

  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
<a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=AddLink');ST(2,2);"><span class="ui-icon ui-icon-pencil" ></span>新增链接</a>
<a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=Link&isdel=True');ST(2,2);" ><span class="ui-icon ui-icon-trash"></span>回收站</a>    
<a class="ui-state-hover" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=LinkEdit&SiteID=<%=SiteID%>');ST(2,2);" ><span class="ui-icon ui-icon-trash"></span>编辑链接</a>    
      </td>
    </tr>
  </table>
  <table width="100%">
  <form id="form1" name="form1" method="post" action="System.asp?action=LinkSave">
    <tr height="24">
      <td style="width:10%;">网站名称：</td>
      <td><input name=SiteName value="<%=rs("SiteName")%>" style="width:40%;"/><label style="display:none" for="SiteName" class="error" metaDone="true" generated="true"></label></td>
    </tr>
    <tr height="24">
      <td>网站说明：</td>
      <td><input name=SiteTitle value="<%=rs("SiteTitle")%>"  style="width:40%;"/></td>
    </tr>
    <tr height="24">
      <td>网站地址：</td>
      <td><input name=SiteUrl value="<%=rs("SiteUrl")%>" style="width:40%;" /><label style="display:none" for="SiteUrl" class="error" metaDone="true" generated="true"></label></td>
    </tr>
    <tr height="24">
      <td>站长ＱＱ：</td>
      <td><input name=SiteQQ value="<%=rs("SiteQQ")%>"  style="width:40%;"/><input name=SiteID value="<%=rs("SiteID")%>" type="hidden" /></td>
    </tr>
    
    <tr>
      <td></td>
      <td id=doLink style="height:40px;">
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onClick="$('#form1').submit();"><span class="ui-icon ui-icon-check"></span>保存</a>
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onClick="document.form1.reset();"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>重置</a>
      </td>
    </tr>
    <tr>
      <td colspan="2" style="height:5px;"></td>
    </tr> 
</form>  
</table>

</div>

<script>
$(document).ready(function() {

	var options = {
		beforeSubmit:  function(){showLoading(showSaveText);},
		success:       function(msg){
							hideLoading();
							showMessage(msg.message,msg.type);
							if(msg.type == 1){
								ST(2,2);
								ShowDiv = "result_content";
								getPageContent("system.asp?action=Link");
							}
						},
		type:      'post',
		dataType:  'json'
	};
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
		  SiteName: {required:true},
		   SiteUrl: {required:true}		
		},
		messages: {
	 	   SiteName: {required: "请填写网站名称"},
  
			SiteUrl: {required: "请填写网站地址"}		
		},
		submitHandler: function() {
			$('#form1').ajaxSubmit(options);
		}
	});
});
</script>
<%end if%>


<%'友情链接表单
if request.QueryString("action")="AddLink" then
%>
		<script type="text/javascript">
			$(function(){
				$('#doLink a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  
<div class="list" id="dialog_link">

  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
<a class="ui-state-hover" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=AddLink');ST(2,2);"><span class="ui-icon ui-icon-pencil" ></span>新增链接</a>
<a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=Link&isdel=True');ST(2,2);" ><span class="ui-icon ui-icon-trash"></span>回收站</a>    
      </td>
    </tr>
  </table>
  <table width="100%">
  <form id="form1" name="form1" method="post" action="system.asp?action=Linkadd">

  <tr>
    <td style="width:10%">网站名称：</td>
    <td><input name="SiteName" type="text" size="10" maxlength="50" style="width:40%"/><label style="display:none" for="SiteName" class="error" metaDone="true" generated="true"></label></td>
  </tr>
  <tr>  
    <td>网站地址：</td>
    <td><input name="SiteUrl" type="text" size="20" maxlength="100" value="http://" style="width:40%"/><label style="display:none" for="SiteUrl" class="error" metaDone="true" generated="true"></label></td>
  </tr>
  <tr>
    <td>网站说明：</td>
    <td><input name="SiteTitle" type="text" size="10" maxlength="50" style="width:40%"/></td>
  </tr>
  <tr>
    <td>站长ＱＱ：</td>
    <td><input name="SiteQQ" type="text" size="10" maxlength="10" style="width:40%"/><label style="display:none" for="SiteQQ" class="error" metaDone="true" generated="true"></label></td>
  </tr>
  
    <tr>
      <td></td>
      <td id=doLink style="height:40px;">
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onClick="$('#form1').submit();"><span class="ui-icon ui-icon-check"></span>保存</a>
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onClick="document.form1.reset();"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>重置</a>
      </td>
    </tr>
    <tr>
      <td colspan="2" style="height:5px;"></td>
    </tr>
  </form>
  </table>
</div>
<script>
$(document).ready(function() {
	hideMessage();
	var options = {
		beforeSubmit:  function(){showLoading(showSaveText);},
		success:       function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('system.asp?action=Link');
			}
		},
		type:      'post',
		dataType:  'json'
	};
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
		  SiteName: {required:true},
		  SiteQQ: {required:true,number:true},		  
		   SiteUrl: {required:true}
		},
		messages: {
	 	   SiteName: {required: "请填写网站名称"},
	 	   SiteQQ: {required: "QQ请填写数字"},		   
			linkurl: {required: "请填写网站地址"}
		},
		submitHandler: function() {
			$('#form1').ajaxSubmit(options);
		}
	});
});
</script>
<%end if%>

<%'友情链接表单
if request.QueryString("action")="Ad" then
%>
		<script type="text/javascript">
			$(function(){
				$('#dialog_link a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  
<div class="list" id="dialog_link">
<form id="form_del" name="form_del" method="get" action="System.asp?action=delall">
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doAd&Type=Add');ST(3,3)" title="新增"><span class="ui-icon ui-icon-newwin" ></span>新增广告</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doAd&Type=Recycle');ST(3,3)" title="回收站"><span class="ui-icon ui-icon-trash"></span>回收站</a>        
      </td>
    </tr>
  </table> 
  <table width="100%">

  <tr>
    <th>序号</th>    
    <th>广告名称</th>
    <th>广告说明</th>
    <th>广告代码</th>
    <th>功能</th>
  </tr>

	<%
	set rs=server.CreateObject("adodb.recordset")
	sql="select * from UsCMSAd order by Adid asc"
	rs.open sql,conn,1,3 
		if not rs.eof then
		rs.pagesize=10
		pagecount=rs.pagecount
		page=int(request.QueryString("page"))
			if page<=0 then page=1
				if request.QueryString("page")="" then 
					page=1
				end if
			rs.absolutepage=page
				for i=1 to rs.PageSize
					if rs.EOF then 
				exit for
			end if
	%>
    
  <tr align="center" height="24"> 
 
    <td height="30" align="left"><%= rs("Adid") %></td>
    <td height="30" align="left"><%= rs("AdName") %></td>
    <td height="30" align="left"><%= rs("AdTitle") %></td>
    <td height="30" align="left"><%= getstrlen(server.HTMLEncode(rs("AdCode")),50) %>...</td>
    <td height="30" align="left"><%if rs("AdDisplay")=True then%>
    <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ajax_show('action=adhide&Adid=<%=rs("Adid")%>');" title="隐藏"><span class="ui-icon ui-icon-locked"></span>隐藏</a>    
	<%else%>
    <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ajax_show('action=adshow&Adid=<%=rs("Adid")%>');" title="显示"><span class="ui-icon ui-icon-unlocked"></span>显示</a>     

	<%end if%>
    <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ajax_del('action=addel&Adid=<%=rs("Adid")%>');" title="删除"><span class="ui-icon ui-icon-trash"></span>删除</a>
    </td>
  </tr>
<%rs.movenext:next:rs.close:set rs=nothing%>

    <tr>
      <td colspan="5" style="height:5px;"></td>
    </tr>
  </table>
 </form>
</div> 

   
<div class="digg">
  <span class="disabled" href="javascript:;">总计：<b><%=pagecount%></b> 页，当前第 <b><font color="#29a1d9"><%= page %> </font></b>页 </span>

  <%if page=1 then%><span class="disabled"> 首&nbsp;页</span><%else%>
  <span><a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=From&page=1');ST(6,6)"> 首&nbsp;页</a></span><%end if%>
  
  <%if page=1 then%><span class="disabled">上一页&nbsp;</span><%else%>
  <a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=From&page=<%=page-1%>');ST(6,6)">上一页&nbsp;</a><%end if%>

  <%for i=page to page+9:if i=page then%>
  <span class="current"><a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=From&page=<%=i%>');ST(6,6)"><%=i%></a></span>
  <%elseif i>pagecount then%><span class="disabled"><%=i%></span><%else%>
  <a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=From&page=<%=i%>');ST(6,6)"><%=i%></a><%end if:next%>

  <%if pagecount<page+1 then%><span class="disabled">下一页&nbsp;</span><%else%>
  <a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=From&page=<%=page+1%>');ST(6,6)">下一页&nbsp;</a><%end if%>

  <%if pagecount<page+1 then%><span class="disabled"> 尾&nbsp;页</span><%else%>
  <a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=From&page=<%=pagecount%>');ST(6,6)"> 尾&nbsp;页</a><%end if%>
</div> 

<% else %>
  </table>
  </form>
</div>
<div class="digg">暂时没有记录!</div>
<%page=Request.QueryString("page")%>
<%end if%>
<script>


//显示隐藏
function ajax_show(str){
	$.ajax({
		url: "system.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('system.asp?action=Ad');
			}
		}
	});
	return false;
}
//删除广告
function ajax_del(str){
	$.ajax({
		url: "system.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('system.asp?action=Ad');
			}
		}
	});
	return false;
}
//编辑
function ajax_modi(str){
	$.ajax({
		url: "system.asp?action=AdEdit",
		data: str,
		type:'get',
		dataType:"text",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideLoading();
			$('#result_content').html(msg);
		}
	});
	return false;
}

</script>
<%end if%>
<%if request.QueryString("action")="doAd" then%>
<%if request.QueryString("Type")="Add" then%>
 
		<script type="text/javascript">
			$(function(){
				$('#doAd a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  
<div class="list" id="dialog_link">
<form id="form1" name="form1" method="post" action="system.asp?action=AdAdd">
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-hover" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doAd&Type=Add');ST(3,3)" title="新增"><span class="ui-icon ui-icon-newwin" ></span>新增广告</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doAd&Type=Recycle');ST(3,3)" title="回收站"><span class="ui-icon ui-icon-trash"></span>回收站</a>        
      </td>
    </tr>
  </table> 
<table width="100%">
  <tr width=100>
    <td style="width:5%">广告名称：</td>
    <td height="30" align="left" style="width:70%"><input name="AdName" type="text" size="20" maxlength="50" style="width:40%" /><label style="display:none" for="AdName" class="error" metaDone="true" generated="true"></label></td></tr>
  <tr width=100>
    <td>广告说明：</td>
    <td align="left"><input name="AdTitle" type="text" size="20" maxlength="50" style="width:40%" /><label style="display:none" for="AdTitle" class="error" metaDone="true" generated="true"></label></td></tr>
  <tr width=100>
    <td>广告代码：</td>
    <td align="left"><textarea name="AdCode" rows="4" style="width:40%"></textarea><label style="display:none" for="AdCode" class="error" metaDone="true" generated="true"></label></td></tr>
    <tr>
      <td></td>
      <td id="doAd" style="height:40px;">
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onclick="$('#form1').submit();"><span class="ui-icon ui-icon-check"></span>保存</a>
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onclick="document.form1.reset();"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>重置</a>
      </td>
    </tr>
    <tr>
      <td style="height:5px;" colspan="2">
      </td>
    </tr> 
</table>
</form>
</div>
<script>
$(document).ready(function() {
	hideMessage();
	var options = {
		beforeSubmit:  function(){showLoading(showSaveText);},
		success:       function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('system.asp?action=Ad');
			}
		},
		type:      'post',
		dataType:  'json'
	};
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
		  AdName: {required:true},
		  AdTitle: {required:true,number:true},		  
		   AdCode: {required:true}
		},
		messages: {
	 	   AdName: {required: "请填写广告名称"},
	 	   AdTitle: {required: "请填写广告说明",number:"请输入半角数字"},		   
			AdCode: {required: "请填写广告代码"}
		},
		submitHandler: function() {
			$('#form1').ajaxSubmit(options);
		}
	});
});
</script>
  <%else%>
<div class="list" id="dialog_link">  
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doAd&Type=Add');ST(3,3)" title="新增"><span class="ui-icon ui-icon-newwin" ></span>新增广告</a>
        <a class="ui-state-hover" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doAd&Type=Recycle');ST(3,3)" title="删除"><span class="ui-icon ui-icon-trash"></span>回收站</a>       
      </td>
    </tr>
  </table> 
  <table width="100%">
    <tr height="24">
      <td>该功能已关闭</td>
    </tr>
  </table> 
</div> 
<%end if%>

<%end if%>


<%if request.QueryString("action")="doFrom" then%>
  <%if request.QueryString("Type")="Add" then%>
<div class="list" id="dialog_link">  
		<script type="text/javascript">
			$(function(){
				$('#doFrom a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>   
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-hover" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doFrom&Type=Add');ST(6,6)" title="新增"><span class="ui-icon ui-icon-pencil" ></span>新增来源</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doFrom&Type=Recycle');ST(6,6)" title="删除"><span class="ui-icon ui-icon-trash"></span>回收站</a>      
      </td>
    </tr>
  </table> 
  <table width="100%">
  <form id="form1" name="form1" method="post" action="System.asp?action=doFrom&Type=Save">
    <tr>
      <td style="height:5px;" colspan="2">
      </td>
    </tr>    
    <tr height="24">
      <td style="width:10%">来源名称：</td>
      <td><input style="width:40%" name="FromTitle"/><label style="display:none" for="FromTitle" class="error" metaDone="true" generated="true"></label></td>
    </tr>  
    <tr height="24">
      <td>来源地址</td>
      <td><input style="width:40%" name="FromUrl" /><label style="display:none" for="FromUrl" class="error" metaDone="true" generated="true"></label></td>  
    </tr>
    <tr>
      <td></td>
      <td id=doFrom style="height:40px;">
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onclick="$('#form1').submit();"><span class="ui-icon ui-icon-check"></span>保存</a>
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onclick="document.form1.reset();"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>重置</a>
      </td>
    </tr>
    <tr>
      <td style="height:5px;" colspan="2">
      </td>
    </tr>    
  </form>
  </table>  
</div>    
<script>
	var options = {
	beforeSubmit:function(){showLoading(showSaveText);},
	 	 success:function(msg){
				 hideLoading();
				 showMessage(msg.message,msg.type);
						  if(msg.type == '1'){
						  ST(6,6);
						  ShowDiv = "result_content";
						  getPageContent("System.asp?action=From");
							   }
						},
		type:      'post',
		dataType:  'json'
	};

	$("#form1").validate({
		errorClass: "wrong",
		rules: {
			FromTitle: {required:true},
			  FromUrl: {required:true,url:true}
		},
		messages: {
			FromTitle: {required: "请填写来源标题"},
			  FromUrl: {required: "请填写来源地址"}
		},
		submitHandler: function() {
			$('#form1').ajaxSubmit(options);
		}
	});

</script>  
  <%elseif request.QueryString("Type")="Recycle" then%>
<div class="list" id="dialog_link">  
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doFrom&Type=Add');ST(6,6)" title="新增"><span class="ui-icon ui-icon-pencil" ></span>新增来源</a>
        <a class="ui-state-hover" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doFrom&Type=Recycle');ST(6,6)" title="删除"><span class="ui-icon ui-icon-trash"></span>回收站</a>       
      </td>
    </tr>
  </table> 
  <table width="100%">
    <tr height="24">
      <td>该功能已关闭</td>
    </tr>
  </table> 
</div>  
  <%
  Elseif Request.QueryString("Type")="Save" Then
  FromTitle=Request.Form("FromTitle")
    FromUrl=Request.Form("FromUrl")
  Set Rs=Server.CreateObject("Adodb.RecordSet")
  Sql="Select * From UsCMSFrom"
  Rs.Open Sql,Conn,1,3
  Rs.AddNew
  RS("FromTitle") = FromTitle
    RS("FromUrl") = FromUrl  
  Rs.Update
  Rs.CLose
  Set Rs=Nothing
  Response.Write("{message:'新增来源成功',type:1}") 
  Elseif Request.QueryString("Type")="Del" Then   
  Fromid=FunStr(Request.QueryString("Fromid"))
  Set Rs=Server.CreateObject("Adodb.RecordSet")
  Sql="Select * From UsCMSFrom Where Fromid="&Fromid
  Rs.Open Sql,Conn,1,3
  Rs.Delete
  Rs.Update
  Rs.CLose
  Set Rs=Nothing   
  Response.Write("{message:'删除来源成功',type:1}")   
  Else
  End if
  %>    

<%end if%>
<%if request.QueryString("action")="From" then%>
		<script type="text/javascript">
			$(function(){
				$('#dialog_link a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  
<div class="list" id="dialog_link">
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doFrom&Type=Add');ST(6,6)" title="新增"><span class="ui-icon ui-icon-pencil" ></span>新增来源</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doFrom&Type=Recycle');ST(6,6)" title="回收站"><span class="ui-icon ui-icon-trash"></span>回收站</a>        
      </td>
    </tr>
  </table>  
  <table width="100%">
    <tr height="24">
      <th>ID</th>
      <th>来源名称</th>
      <th>来源地址</th>
      <th>管理</th>
    </tr>
    <%
  	  Set Rs=Server.CreateObject("Adodb.Recordset")
	  Sql="select * from UsCMSFrom order by Fromid asc"
	  Rs.open sql,conn,1,3 
	    If Not Rs.Eof Then
 	      Rs.Pagesize=15
		  Pagecount=Rs.pagecount
		  Page=int(request.QueryString("page"))
		  If page<=0 then page=1
		    If request.QueryString("page")="" then 
			  page=1
		    End if
		    Rs.absolutepage=page
		    For i=1 to rs.PageSize
			  If rs.EOF then 
		    Exit for
	      End if
    %>  
    <tr height="24">
      <td><%= Rs("Fromid") %></td>
      <td><%= Rs("FromTitle") %></td>
      <td><%= Rs("FromUrl") %></td>
      <td>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ajax_do('action=doFrom&Type=Del&Fromid=<%=Rs("Fromid")%>');" title="删除"><span class="ui-icon ui-icon-trash"></span>删除</a></td>
    </tr>
    <%
      Rs.movenext
  	  Next
	  Rs.close
	  Set Rs=Nothing
    %>  
    <tr>
      <td colspan="9" style="height:5px;"></td>
    </tr>
  </table>
</div>  

<div class="digg">
  <span class="disabled" href="javascript:;">总计：<b><%=pagecount%></b> 页，当前第 <b><font color="#29a1d9"><%= page %> </font></b>页 </span>

  <%if page=1 then%><span class="disabled"> 首&nbsp;页</span><%else%>
  <span><a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=From&page=1');ST(6,6)"> 首&nbsp;页</a></span><%end if%>
  
  <%if page=1 then%><span class="disabled">上一页&nbsp;</span><%else%>
  <a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=From&page=<%=page-1%>');ST(6,6)">上一页&nbsp;</a><%end if%>

  <%for i=page to page+9:if i=page then%>
  <span class="current"><a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=From&page=<%=i%>');ST(6,6)"><%=i%></a></span>
  <%elseif i>pagecount then%><span class="disabled"><%=i%></span><%else%>
  <a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=From&page=<%=i%>');ST(6,6)"><%=i%></a><%end if:next%>

  <%if pagecount<page+1 then%><span class="disabled">下一页&nbsp;</span><%else%>
  <a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=From&page=<%=page+1%>');ST(6,6)">下一页&nbsp;</a><%end if%>

  <%if pagecount<page+1 then%><span class="disabled"> 尾&nbsp;页</span><%else%>
  <a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=From&page=<%=pagecount%>');ST(6,6)"> 尾&nbsp;页</a><%end if%>
</div> 

<% else %>
  </table>
</div>
<div class="digg">暂时没有记录!</div>
<%page=Request.QueryString("page")%>
<%end if%>
<script>
function ajax_do(str){
	$.ajax({
		url: "System.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('System.asp?action=From');
			}
		}
	});
	return false;
}
</script>
<%end if%>
 
 
<%if request.QueryString("action")="doAuthor" then%>
  <%if request.QueryString("Type")="Add" then%>
<div class="list" id="dialog_link">  
		<script type="text/javascript">
			$(function(){
				$('#doAuthor a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>   
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-hover" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doAuthor&Type=Add');ST(5,5)" title="新增"><span class="ui-icon ui-icon-person" ></span>新增作者</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doAuthor&Type=Recycle');ST(5,5)" title="删除"><span class="ui-icon ui-icon-trash"></span>回收站</a>      
      </td>
    </tr>
  </table> 
  <table width="100%">
  <form id="form1" name="form1" method="post" action="System.asp?action=doAuthor&Type=Save">
    <tr>
      <td style="height:5px;" colspan="2">
      </td>
    </tr>    
    <tr height="24">
      <td style="width:10%">作者名称：</td>
      <td><input style="width:40%" name="AuthorName"/><label style="display:none" for="AuthorName" class="error" metaDone="true" generated="true"></label></td>
    </tr>  
    <tr>
      <td></td>
      <td id=doAuthor style="height:40px;">
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onclick="$('#form1').submit();"><span class="ui-icon ui-icon-check"></span>保存</a>
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onclick="document.form1.reset();"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>重置</a>
      </td>
    </tr>
    <tr>
      <td style="height:5px;" colspan="2">
      </td>
    </tr>    
  </form>
  </table>  
</div>    
<script>
	var options = {
	beforeSubmit:function(){showLoading(showSaveText);},
	 	 success:function(msg){
				 hideLoading();
				 showMessage(msg.message,msg.type);
						  if(msg.type == '1'){
						  ST(5,5);
						  ShowDiv = "result_content";
						  getPageContent("System.asp?action=Author");
							   }
						},
		type:      'post',
		dataType:  'json'
	};

	$("#form1").validate({
		errorClass: "wrong",
		rules: {
			AuthorName: {required:true}
		},
		messages: {
			AuthorName: {required: "请填写作者名称"}
		},
		submitHandler: function() {
			$('#form1').ajaxSubmit(options);
		}
	});

</script>  
  <%elseif request.QueryString("Type")="Recycle" then%>
<div class="list" id="dialog_link">  
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doAuthor&Type=Add');ST(5,5)" title="新增"><span class="ui-icon ui-icon-person" ></span>新增作者</a>
        <a class="ui-state-hover" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doAuthor&Type=Recycle');ST(5,5)" title="删除"><span class="ui-icon ui-icon-trash"></span>回收站</a>       
      </td>
    </tr>
  </table> 
  <table width="100%">
    <tr height="24">
      <td>该功能已关闭</td>
    </tr>
  </table> 
</div>  
  <%
  Elseif Request.QueryString("Type")="Save" Then
  AuthorName=Request.Form("AuthorName")
  Set Rs=Server.CreateObject("Adodb.RecordSet")
  Sql="Select * From UsCMSAuthor"
  Rs.Open Sql,Conn,1,3
  Rs.AddNew
  RS("AuthorName") = AuthorName
  Rs.Update
  Rs.CLose
  Set Rs=Nothing
  Response.Write("{message:'新增作者成功',type:1}") 
  Elseif Request.QueryString("Type")="Del" Then   
  Authorid=FunStr(Request.QueryString("Authorid"))
  Set Rs=Server.CreateObject("Adodb.RecordSet")
  Sql="Select * From UsCMSAuthor Where Authorid="&Authorid
  Rs.Open Sql,Conn,1,3
  Rs.Delete
  Rs.Update
  Rs.CLose
  Set Rs=Nothing   
  Response.Write("{message:'删除作者成功',type:1}")   
  Else
  End if
  %>    

<%end if%>
<%if request.QueryString("action")="Author" then%>
		<script type="text/javascript">
			$(function(){
				$('#dialog_link a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  
<div class="list" id="dialog_link">
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doAuthor&Type=Add');ST(5,5)" title="新增"><span class="ui-icon ui-icon-person" ></span>新增作者</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=doAuthor&Type=Recycle');ST(5,5)" title="回收站"><span class="ui-icon ui-icon-trash"></span>回收站</a>        
      </td>
    </tr>
  </table>  
  <table width="100%">
    <tr height="24">
      <th>ID</th>
      <th>作者名称</th>
      <th>管理</th>
    </tr>
    <%
  	  Set Rs=Server.CreateObject("Adodb.Recordset")
	  Sql="select * from UsCMSAuthor order by Authorid asc"
	  Rs.open sql,conn,1,3 
	    If Not Rs.Eof Then
 	      Rs.Pagesize=15
		  Pagecount=Rs.pagecount
		  Page=int(request.QueryString("page"))
		  If page<=0 then page=1
		    If request.QueryString("page")="" then 
			  page=1
		    End if
		    Rs.absolutepage=page
		    For i=1 to rs.PageSize
			  If rs.EOF then 
		    Exit for
	      End if
    %>  
    <tr height="24">
      <td><%= Rs("Authorid") %></td>
      <td><%= Rs("AuthorName") %></td>
      <td>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onclick="ajax_do('action=doAuthor&Type=Del&Authorid=<%=Rs("Authorid")%>');" title="删除"><span class="ui-icon ui-icon-trash"></span>删除</a></td>
    </tr>
    <%
      Rs.movenext
  	  Next
	  Rs.close
	  Set Rs=Nothing
    %>  
    <tr>
      <td colspan="9" style="height:5px;"></td>
    </tr>
  </table>
</div>  

<div class="digg">
  <span class="disabled" href="javascript:;">总计：<b><%=pagecount%></b> 页，当前第 <b><font color="#29a1d9"><%= page %> </font></b>页 </span>

  <%if page=1 then%><span class="disabled"> 首&nbsp;页</span><%else%>
  <span><a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=Author&page=1');ST(5,5)"> 首&nbsp;页</a></span><%end if%>
  
  <%if page=1 then%><span class="disabled">上一页&nbsp;</span><%else%>
  <a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=Author&page=<%=page-1%>');ST(5,5)">上一页&nbsp;</a><%end if%>

  <%for i=page to page+9:if i=page then%>
  <span class="current"><a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=Author&page=<%=i%>');ST(5,5)"><%=i%></a></span>
  <%elseif i>pagecount then%><span class="disabled"><%=i%></span><%else%>
  <a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=Author&page=<%=i%>');ST(5,5)"><%=i%></a><%end if:next%>

  <%if pagecount<page+1 then%><span class="disabled">下一页&nbsp;</span><%else%>
  <a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=Author&page=<%=page+1%>');ST(5,5)">下一页&nbsp;</a><%end if%>

  <%if pagecount<page+1 then%><span class="disabled"> 尾&nbsp;页</span><%else%>
  <a href="javascript:;" onclick="ShowDiv='result_content';getPageContent('System.asp?action=Author&page=<%=pagecount%>');ST(5,5)"> 尾&nbsp;页</a><%end if%>
</div> 

<% else %>
  </table>
</div>
<div class="digg">暂时没有记录!</div>
<%page=Request.QueryString("page")%>
<%end if%>
<script>
function ajax_do(str){
	$.ajax({
		url: "System.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('System.asp?action=Author');
			}
		}
	});
	return false;
}
</script>
<%end if%>


<%if request.QueryString("action")="doKeywords" then%>
  <%if request.QueryString("Type")="Add" then%>
<div class="list" id="dialog_link">  
		<script type="text/javascript">
			$(function(){
				$('#doKeywords a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>   
  <table width="100%" style="border-top:1px #cbe1ef solid;background:#ff0000;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-hover" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=doKeywords&Type=Add');ST(4,4)" title="新增"><span class="ui-icon ui-icon-pencil" ></span>新关键词</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=doKeywords&Type=Recycle');ST(4,4)" title="删除"><span class="ui-icon ui-icon-trash"></span>回收站</a>      
      </td>
    </tr>
  </table> 
  <table width="100%">
  <form id="form1" name="form1" method="post" action="System.asp?action=doKeywords&Type=Save">
    <tr>
      <td style="height:5px;" colspan="2">
      </td>
    </tr>    
    <tr height="24">
      <td style="width:10%">关键词名称：</td>
      <td><input style="width:40%" name="KeywordTitle"/><label style="display:none" for="KeywordTitle" class="error" metaDone="true" generated="true"></label></td>
    </tr>  
    <tr height="24">
      <td>关键词地址</td>
      <td><input style="width:40%" name="KeywordUrl" /><label style="display:none" for="KeywordUrl" class="error" metaDone="true" generated="true"></label></td>  
    </tr>
    <tr>
      <td></td>
      <td id=doKeywords style="height:40px;">
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onClick="$('#form1').submit();"><span class="ui-icon ui-icon-check"></span>保存</a>
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onClick="document.form1.reset();"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>重置</a>
      </td>
    </tr>
    <tr>
      <td style="height:5px;" colspan="2">
      </td>
    </tr>    
  </form>
  </table>  
</div>    
<script>
	var options = {
	beforeSubmit:function(){showLoading(showSaveText);},
	 	 success:function(msg){
				 hideLoading();
				 showMessage(msg.message,msg.type);
						  if(msg.type == '1'){
						  ST(4,4);
						  ShowDiv = "result_content";
						  getPageContent("System.asp?action=Keywords");
							   }
						},
		type:      'post',
		dataType:  'json'
	};

	$("#form1").validate({
		errorClass: "wrong",
		rules: {
			KeywordTitle: {required:true},
			  KeywordUrl: {required:true,url:true}
		},
		messages: {
			KeywordTitle: {required: "请填写关键词"},
			  KeywordUrl: {required: "请填写关键词地址"}
		},
		submitHandler: function() {
			$('#form1').ajaxSubmit(options);
		}
	});

</script>  
  <%elseif request.QueryString("Type")="Recycle" then%>
<div class="list" id="dialog_link">  
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=doKeywords&Type=Add');ST(4,4)" title="新增"><span class="ui-icon ui-icon-pencil" ></span>新关键词</a>
        <a class="ui-state-hover" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=doKeywords&Type=Recycle');ST(4,4)" title="删除"><span class="ui-icon ui-icon-trash"></span>回收站</a>       
      </td>
    </tr>
  </table> 
  <table width="100%">
    <tr height="24">
      <td>该功能已关闭</td>
    </tr>
  </table> 
</div>  
  <%
  Elseif Request.QueryString("Type")="Save" Then
  KeywordTitle=Request.Form("KeywordTitle")
    KeywordUrl=Request.Form("KeywordUrl")
  Set Rs=Server.CreateObject("Adodb.RecordSet")
  Sql="Select * From UsCMSKeyword"
  Rs.Open Sql,Conn,1,3
  Rs.AddNew
  RS("KeywordTitle") = KeywordTitle
    RS("KeywordUrl") = KeywordUrl  
  Rs.Update
  Rs.CLose
  Set Rs=Nothing
  Response.Write("{message:'新关键词成功',type:1}") 
  Elseif Request.QueryString("Type")="Del" Then   
  Keywordid=FunStr(Request.QueryString("Keywordid"))
  Set Rs=Server.CreateObject("Adodb.RecordSet")
  Sql="Select * From UsCMSKeyword Where Keywordid="&Keywordid
  Rs.Open Sql,Conn,1,3
  Rs.Delete
  Rs.Update
  Rs.CLose
  Set Rs=Nothing   
  Response.Write("{message:'删除关键词成功',type:1}")   
  Else
  End if
  %>    

<%end if%>
<%if request.QueryString("action")="Keywords" then%>
		<script type="text/javascript">
			$(function(){
				$('#dialog_link a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  
<div class="list" id="dialog_link">
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=doKeywords&Type=Add');ST(4,4)" title="新增"><span class="ui-icon ui-icon-pencil" ></span>新关键词</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=doKeywords&Type=Recycle');ST(4,4)" title="回收站"><span class="ui-icon ui-icon-trash"></span>回收站</a>        
      </td>
    </tr>
  </table>  
  <table width="100%">
    <tr height="24">
      <th>ID</th>
      <th>关键词名称</th>
      <th>关键词地址</th>
      <th>管理</th>
    </tr>
    <%
  	  Set Rs=Server.CreateObject("Adodb.Recordset")
	  Sql="select * from UsCMSKeyword order by Keywordid asc"
	  Rs.open sql,conn,1,3 
	    If Not Rs.Eof Then
 	      Rs.Pagesize=15
		  Pagecount=Rs.pagecount
		  Page=int(request.QueryString("page"))
		  If page<=0 then page=1
		    If request.QueryString("page")="" then 
			  page=1
		    End if
		    Rs.absolutepage=page
		    For i=1 to rs.PageSize
			  If rs.EOF then 
		    Exit for
	      End if
    %>  
    <tr height="24">
      <td><%= Rs("Keywordid") %></td>
      <td><%= Rs("KeywordTitle") %></td>
      <td><%= Rs("KeywordUrl") %></td>
      <td>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ajax_do('action=doKeywords&Type=Del&Keywordid=<%=Rs("Keywordid")%>');" title="删除"><span class="ui-icon ui-icon-trash"></span>删除</a></td>
    </tr>
    <%
      Rs.movenext
  	  Next
	  Rs.close
	  Set Rs=Nothing
    %>  
    <tr>
      <td colspan="9" style="height:5px;"></td>
    </tr>
  </table>
</div>  

<div class="digg">
  <span class="disabled" href="javascript:;">总计：<b><%=pagecount%></b> 页，当前第 <b><font color="#29a1d9"><%= page %> </font></b>页 </span>

  <%if page=1 then%><span class="disabled"> 首&nbsp;页</span><%else%>
  <span><a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=Keywords&page=1');ST(4,4)"> 首&nbsp;页</a></span><%end if%>
  
  <%if page=1 then%><span class="disabled">上一页&nbsp;</span><%else%>
  <a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=Keywords&page=<%=page-1%>');ST(4,4)">上一页&nbsp;</a><%end if%>

  <%for i=page to page+9:if i=page then%>
  <span class="current"><a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=Keywords&page=<%=i%>');ST(4,4)"><%=i%></a></span>
  <%elseif i>pagecount then%><span class="disabled"><%=i%></span><%else%>
  <a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=Keywords&page=<%=i%>');ST(4,4)"><%=i%></a><%end if:next%>

  <%if pagecount<page+1 then%><span class="disabled">下一页&nbsp;</span><%else%>
  <a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=Keywords&page=<%=page+1%>');ST(4,4)">下一页&nbsp;</a><%end if%>

  <%if pagecount<page+1 then%><span class="disabled"> 尾&nbsp;页</span><%else%>
  <a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('System.asp?action=Keywords&page=<%=pagecount%>');ST(4,4)"> 尾&nbsp;页</a><%end if%>
</div> 

<% else %>
  </table>
</div>
<div class="digg">暂时没有记录!</div>
<%page=Request.QueryString("page")%>
<%end if%>
<script>
function ajax_do(str){
	$.ajax({
		url: "System.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('System.asp?action=Keywords');
			}
		}
	});
	return false;
}
</script>
<%end if%>