<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="collection.asp"-->
<!--#include file="Config.asp"-->
<%
dim types,p
  types = Request.form("type")
  key = Request.form("key")
  page = Request.QueryString("p")
  if page = "" then page = "1"
%>
<script type="text/javascript">
function index(p)
{
        var page = p?p:1;
        window.location = '?p=' + page + '&type=' + '<%=types%>' + '&key=' + '<%=key%>';
}
function gopage()
{
	var pInput = document.getElementById('pInput').value;
	index(pInput);
}
function splitAuthor(author)
{
	var authors = author.split(",");
	var str="";
	for (var i=0;i<authors.length;i++)
	{
		str += '<a href="<%=Xwsy_sWebUrl%>list.asp?type=author&key='+authors[i]+'" target="_blank" class="fclblack">'+authors[i]+"</a> ";
	}
	return str;
}
function ShowPages(curpage,totalpage,totalnum)
{
	var str = "";
	str += "<table border=\"0\" align=\"center\" cellspacing=\"0\" cellpadding=\"3\">";
	str += "<tr>";
	str += "<td>第" + curpage + "页/共[" + totalpage + "]页 [" + totalnum + "]条记录</td>";
	str += "<td>";
	
	if(curpage > 1)
	{
		var last_page = curpage - 1;
		str += "<a href=\"javascript:index(" + last_page + ")\" class=\"fclblack\"><img src=\"http://mat1.qq.com/book/images/v2/prev.gif\" alt=\"上一页\"  align=\"absmiddle\" border=\"0\"/></a>";
	}

	str += "</td>";

	var show_pages = 5;

	var start_page = curpage - show_pages;
	if(start_page < 1)
	{
		start_page = 1;
	}

	var end_page = curpage + show_pages;
	if(end_page > totalpage)
	{
		end_page = totalpage;
	}

	for(var i=start_page;i<=end_page;i++)
	{
		str += "<td><a href=\"javascript:index(" + i + ")\" class=\"fclblack\">[" + i + "]</a></td>";
	}

	if(curpage < totalpage)
	{
		var next_page = curpage + 1;
		str += "<td><a href=\"javascript:index(" + next_page + ")\" class=\"fclblack\"><img src=\"http://mat1.qq.com/book/images/v2/next.gif\" alt=\"下一页\" align=\"absmiddle\" border=\"0\"/></a></td>";
	}

	str += "<td>跳转到&nbsp;<input id=\"pInput\" type=\"text\" name=\"pInput\" style=\"width:20px;height:15px;border:1px solid #606060;line-height:16px;\"/>&nbsp;页&nbsp;<a href=\"javascript:gopage();\" class=\"fclblack\">GO</a></td>";
	str += "</tr>";
	str += "</table>";

	document.write(str);

}

</script>
<%
Server.ScriptTimeOut = 18000

dim Xurl,Encoding,xwsybook1
	
        Xurl = Trim("http://bookapp.book.qq.com/cgi-bin/lz_index?p=" & page & "&type=" & types & "&key=" & key & "")    '目标网站网页地址
		HTTPHtmlCode = Myxwsy.TempTrim (Myxwsy.Gethtmldata(Xurl,Encoding))
		if HTTPHtmlCode = "" then
		   OutErrors ("获取远程信息出错！请确定你的远程列表URL输入无误。")
		end if
		sTitle = Myxwsy.TempTrim (Myxwsy.CutFixed(HTTPHtmlCode,"<title>","_"))
        xwsybook1 = Myxwsy.TempTrim (Myxwsy.CutFixed(HTTPHtmlCode,"daohang/wssk.htm","<div style=""width:910px;margin:5px auto;"">"))
		xwsybook1 = Myxwsy.TempTrim (Myxwsy.CutFixed(xwsybook1,"<table width=""910"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">","<table width=""910"" height=""30"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" class=""tablebd1"">"))
		if xwsybook1 = "" then
		   OutErrors ("获取远程列表出错！请确定你的远程列表开始和结束代码输入无误。")
		end if
		xwsybook1 = Replace(xwsybook1,"a href=""http://book.qq.com/s/book/","a href=""reads.asp?bookid=")
		xwsybook1 = Replace(xwsybook1,"http://bookapp.book.qq.com/cgi-bin/lz_index?type=author&key=","list.asp?type=author&key=")
		xwsybook1 = Replace(xwsybook1,"http://bookapp.book.qq.com/cgi-bin/lz_index?type=press&key=","list.asp?type=press&key=")
		xwsybook1 = Replace(xwsybook1,"http://bookapp.book.qq.com/cgi-bin/lz_index?type=sort&key","list.asp?type=sort&key=")
		xwsybook1 = Replace(xwsybook1,"/index.shtml","")
		xwsybook2 = Myxwsy.TempTrim (Myxwsy.CutFixed(HTTPHtmlCode,"<table width=""910"" height=""30"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" class=""tablebd1"">","<div style=""width:910px;margin:5px auto;"">"))


%>
<!--#include file="top.asp"-->
<div class="leftshad"><div class="rightshad">
	<div class="maincol">
<%
        response.write ("<table><tr>")
		response.write (xwsybook1)
		response.write ("<table width=""910"" height=""30"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" class=""tablebd1"">")
		response.write (xwsybook2)
'		response.End
%>
<table width="910" height="30" border="0" align="center" cellpadding="0" cellspacing="0" class="tablebd1">
  <tr>
    <td>
	<script language="javascript">ShowPages<%response.write (xwsybook2)%></script>
    </td>
  </tr>
</table>
</div></div></div>
<!--#include file="end.asp"-->
