<!--#include file="inc/config.asp"-->
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/function.asp"-->
<%
dim currentpage,totalpage,totalnum,recpage,urls,cid,pid,style,ckeywords,cdescription,PriceS,PriceE
recpage=15
dim id,Age2,Sex,Province,City,Key,carr,ctitle,ptitle,htitle,postions
if(request.QueryString("page")<>"") then
	currentpage=Clng(request.QueryString("page"))
else
	currentpage=1
end if
if(currentpage<=0) then
	currentpage=1
end if
if(request.QueryString("PriceS")<>"") then
	PriceS=Clng(request.QueryString("PriceS"))	
else
	PriceS=0
end if
if(request.QueryString("PriceE")<>"") then
	PriceE=Clng(request.QueryString("PriceE"))	
else
	PriceE=0
end if
if(request.QueryString("cid")<>"") then
	cid=Clng(request.QueryString("cid"))	
else
	cid=0
end if
if(request.QueryString("pid")<>"") then
	pid=Clng(request.QueryString("pid"))
else
	pid=2
end if
if(request.QueryString("province")<>"") then
	province=cint(request.querystring("province"))
else
	province=0
end if
if(request.QueryString("city")<>"") then
	city=cint(request.querystring("city"))
else
	city=0
end if
if(request.QueryString("keyword")<>"") then
	keyword=replace(request.querystring("keyword"),"'","")
else
	keyword=""
end if
urls="pid="&pid&"&cid="&cid&"&province="&province&"&city="&city&"&keyword="&keyword&"&PriceS="&PriceS&"&PriceE="&PriceE
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=keyword%>-分类信息-潍坊信息港</title>
<link href="style/index.css" rel="stylesheet" type="text/css" />
<meta name="keywords" content="<%=ckeywords%>" />
<meta name="description" content="<%=cdescription%>" />
<script type="text/javascript" src="/js/common.js"></script>
<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/js/areas.js"></script>
<script type="text/javascript">
function getCatalogs(pid,cid){
	$.ajax({
    url: '/member/getchilds.asp?classid='+pid,
    type: 'GET',
    dataType: 'xml',
    timeout: 3000,
    error: function(){
        alert('Error loading XML document');
    },
    success: function(xml){    
			var childs=$('#cid')[0];
			childs.length=0;
			childs.options[0]=new Option("不限",0);
			var i=1;
			var classid,classtitle;
			$(xml).find("root > catalog").each(function(){ 
				var t=$(this);
				classid=t.find("id").text();
				classtitle=t.find("title").text();
				childs.options[i]=new Option(classtitle,classid);							
				if(cid==classid){
					childs.options[i].selected=true;
				}
				i++;
			});
		}
	});
}
</script>
</head>
<body>
<!--#include file="head.asp"-->
<table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="24">当前位置：<a href="/">首页</a>＞信息搜索　</td>
  </tr>
</table>
<div class="br"></div>
<table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top" class="border"><table width="100%" border="0" cellspacing="1" cellpadding="0">
      <tr>
        <td width="14%" height="30" align="center" bgcolor="#EBF2FC">所属地区</td>
        <td width="55%" align="center" bgcolor="#EBF2FC">标题</td>
        <td width="15%" align="center" bgcolor="#EBF2FC">人气</td>
        <td width="16%" align="center" bgcolor="#EBF2FC">发布日期</td>
      </tr>
      <%			
			csql="select count(*) from t_info where IsCheck=1"
			if(pid>0) then
				csql=csql&" and ParentId="&pid
			end if
			if(cid>0) then
				csql=csql&" and CatalogId="&cid
			end if
			if(Province>0) then
				csql=csql&" and Province="&Province
			end if
			if(City>0) then
				csql=csql&" and City="&City
			end if
			if(keyword<>"") then
				csql=csql&" and Title like '%"&keyword&"%'"
			end if	
			if(PriceS>=0 and PriceE>PriceS) then
				csql=csql&" and Price>="&PriceS&" and Price<="&PriceE
			end if			
			sql="select top "&recpage&" id,InfoTypeId,Photo,UserId,Title,Price,Province,City,Area,PubDate,Hits,SavePath,Demons from t_info where PubDate<=(select min(PubDate) from (select top "&((currentpage-1)*recpage+1)&" PubDate from t_info where IsCheck=1"
			if(pid>0) then
				sql=sql&" and ParentId="&pid
			end if
			if(cid>0) then
				sql=sql&" and CatalogId="&cid
			end if
			if(Province>0) then
				sql=sql&" and Province="&Province
			end if
			if(City>0) then
				sql=sql&" and City="&City
			end if
			if(keyword<>"") then
				sql=sql&" and Title like '%"&keyword&"%'"
			end if	
			if(PriceS>=0 and PriceE>PriceS) then
				sql=sql&" and Price>="&PriceS&" and Price<="&PriceE
			end if	
			sql=sql&" order by PubDate desc) as t) and IsCheck=1"
			if(pid>0) then
				sql=sql&" and ParentId="&pid
			end if
			if(cid>0) then
				sql=sql&" and CatalogId="&cid
			end if
			if(Province>0) then
				sql=sql&" and Province="&Province
			end if
			if(City>0) then
				sql=sql&" and City="&City
			end if
			if(keyword<>"") then
				sql=sql&" and Title like '%"&keyword&"%'"
			end if	
			if(PriceS>=0 and PriceE>PriceS) then
				sql=sql&" and Price>="&PriceS&" and Price<="&PriceE
			end if	
			sql=sql&" order by PubDate desc"
			'response.write(sql)
			totalnum=conn.execute(csql)(0)
			totalpage=int((totalnum-1+recpage)/recpage)
			set rs=server.CreateObject("adodb.recordset")
			rs.open sql,conn,3,1
			if not rs.eof then
				carr=rs.GetRows()
			end if
			rs.close
			set rs=nothing
			if isarray(carr) then
				dim bg_color,bg_color1,bg_color2,j,catalogs
				bg_color1="#F0F7FF"
				bg_color2="#FFFFFF"
				for i=0 to ubound(carr,2)
					if(i mod 2=0) then
						bg_color=bg_color1
					else
						bg_color=bg_color2
					end if
			%>
      <tr>
        <td height="30" align="center"><a href="list.asp?province=<%=carr(6,i)%>&city=<%=carr(7,i)%>"><%=carr(8,i)%></a></td>
        <td class="padleft_10"><a href="show.asp?id=<%=carr(0,i)%>"><%=carr(4,i)%></a></td>
        <td align="center"><%=carr(10,i)%></td>
        <td align="center"><%=year(carr(9,i))&"-"&month(carr(9,i))&"-"&day(carr(9,i))%></td>
      </tr>
      <%
        	next
      else
        response.write("<tr><td colspan=""4"" height=""30"" align=""center"">暂时没有记录!</td></tr>")
      end if
		set carr=nothing
		%>
    </table>
    <div class="pages">
      <%
			dim n,p,startpage,endpage
			n=currentpage+1
			p=currentpage-1
			startpage=currentpage-5
			if(startpage<=0) then
				startpage=1
			end if
			endpage=currentpage+5
			if(currentpage<5) then
				endpage=10
			end if
			if(endpage>totalpage) then
				endpage=totalpage
			end if
			response.write("<a href=""?"&urls&"&page=1"">首</a>")
			response.write("<a href=""?"&urls&"&page="&(currentpage-1)&""">上一页</a>")
			'''''''''''''''''
			for j=startpage to endpage
					if(j=currentpage) then
						response.write("<a href=""#"" class=""current"">"&j&"</a>")
					else
						response.write("<a href=""?"&urls&"&page="&j&""">"&j&"</a>")
					end if
					if(j>(startPage+10)) then
						exit for
					end if
			next
			'''''''''''''''''''''''''''''''''''''
			response.write("<a href=""?"&urls&"&page="&(currentpage+1)&""">下一页</a>")
			response.write("<a href=""?"&urls&"&page="&totalpage&""">尾</a>")
			%>
    </div>
    </td>
    <td width="5" valign="top">&nbsp;</td>
    <td width="261" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
      <tr>
        <td height="56" align="center" bgcolor="#FFF9E3"><a href="publish.asp" target="_blank"><img src="images/fbxx.gif" alt="发布信息" width="171" height="45" border="0" /></a></td>
      </tr>
    </table>
      <div class="br"></div>
      <%
				set rs=server.CreateObject("adodb.recordset")
				sql="select id,title from catalogs where parentid="&PlugIn_InfoId&" order by id asc"
				rs.open sql,conn,3,1
				if not rs.eof and not rs.bof then
					first=rs.GetRows()
				else			
				end if
				rs.close
				set rs=nothing
				%>
      <form id="form1" name="form1" method="get" action="search.asp">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="29%" height="32" align="center">一级类：</td>
              <td width="71%"><select name="pid" id="pid" onchange="getCatalogs(this.options[this.selectedIndex].value,0)">
                <%
          dim sel
          for i=0 to ubound(first,2)
              if(first(0,i)=pid) then
                sel=" selected=""selected"""
              else
                sel=""
              end if
              response.Write("<option value="""&first(0,i)&""""&sel&">"&first(1,i)&"</option>"&Chr(10))    	
          next	
          %>
              </select></td>
            </tr>
            <tr>
              <td height="32" align="center">二级类：</td>
              <td>
                <select name="cid" id="cid">
                  <option>请选择二级分类</option>
                </select>
                <script type="text/javascript">
                getCatalogs(<%=pid%>,<%=cid%>);	
                </script>
              </td>
            </tr>
            <tr>
              <td height="32" align="center">地区：</td>
              <td>
              <select name="Province" id="Province" onchange="GetChilds(this.options[this.selectedIndex].value,0,'City')">
              <option value="0">选择城市</option>
              <script type="text/javascript">
              document.write(GetFirst(3,''));
              </script>
            </select>
            <select name="City" id="City">
              <option value="0">选择地区</option>
            </select>	
            <script type="text/javascript">
              GetChilds(3,0,'City');
            </script>
              </td>
            </tr>
            <tr>
              <td height="32" align="center">价格：</td>
              <td><input name="PriceS" type="text" id="PriceS" onkeypress="checkprice()" value="0" size="6" maxlength="6" />
~
  <input name="PriceE" type="text" id="PriceE" onkeypress="checkprice()" value="0" size="6" maxlength="6" /></td>
            </tr>
            <tr>
              <td height="32" align="center">关键字：</td>
              <td><input name="keyword" type="text" id="keyword" size="12" /></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td><input type="submit" name="button" id="button" value="开始搜索" /></td>
            </tr>
          </table>
      </form></td>
  </tr>
</table>
</td>
  </tr>
</table>
<!--#include file="root.asp"-->
</body>
</html>
<%
call connclose()
%>