<!--#include file="inc/config.asp"-->
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/route_func.asp"-->
<%
dim id,currentpage,totalpage,totalnum,recpage,key,ctitle
recpage=20
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("id")<>"") then
	id=Clng(request.QueryString("id"))
else
	id=0
end if
if(id>0) then
	set rs=conn.execute("select Title from t_wenda_catalog where id="&id)
	if not rs.eof then
		ctitle=rs(0)
	end if
	rs.close
	set rs=nothing
end if
key=request.QueryString("key")
key=replace(key,"'","")
%>
<!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><%=ctitle%>-旅游问答</title>
<meta name="keywords" content="<%=ctitle%>-旅游问答" />
<meta name="description" content="<%=ctitle%>-旅游问答" />
<link href="style/global.css" rel="stylesheet" type="text/css" />
<link href="style/list.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/common.js"></script>
<script language="javascript">
function goto(frm)
{
	var gourl ="?id=<%=id%>&key=<%=key%>&";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	window.location.href(gourl);
}</script>
<style type="text/css">
<!--
.tel {	color: #128203;
}
.f_in{ border:1px solid #CCC; color:#333;}
-->
</style>
</head>

<body>
<div id="wrapper">
	<div id="page">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="25%"><a href="/"><img src="image/logo.gif" width="250" height="80" alt="$SiteName$" /></a></td>
        <td width="75%" valign="bottom">
        <div id="menu">
          <ul>
            <li><a href="/">网站首页</a></li>
            <li><a href="/routes.asp">旅游线路</a></li>
            <li><a href="/hotel.asp">特惠酒店</a></li>
            <li><a href="/meeting.asp">会议接待</a></li>
            <li><a href="/ticket.asp">景点门票</a></li>
            <li><a href="/picture/">风光图片</a></li>
            <li><a href="/wenda.asp" class="current">旅游问答</a></li>
          </ul>        
        </div>
        </td>
      </tr>
    </table>
    <!--#include file="nav.asp"-->
    <div class="br"></div>
		<div id="rows">
    	<div id="left">
    	  <div class="cont">
    	    <div class="topic">问题搜索</div>
          <div class="br"></div>
          <form id="form2" name="form2" method="get" action="wenda_list.asp">
            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td height="32" align="center" class="tel"><strong>关键字：</strong></td>
                <td><input name="key" type="text" id="key" size="10" /></td>
                <td><input type="image" name="imageField" id="imageField" src="image/but1.jpg" /></td>
              </tr>
            </table>
          </form>
<div class="br"></div>
  	    </div>
    	  <div class="br"></div>
    	  <div class="cont">
    	    <div class="topic">快速提问</div>
          <div class="br"></div>
    	    <form id="form3" name="form3" method="post" action="wenda_add.asp">
    	      <table width="90%" border="0" align="center" cellpadding="1" cellspacing="0">
    	        <tr>
    	          <td height="25">分类：
    	            <select name="CatalogId" id="CatalogId">
									<%=getSourceOption(0,"t_wenda_catalog")%>
                  </select>
                </td>
  	          </tr>
    	        <tr>
    	          <td height="25"><input name="Title" type="text" class="f_in" id="Title" onclick="if(this.value=='标题：') this.value='';" value="标题：" style="width:230px;" /></td>
  	          </tr>
    	        <tr>
    	          <td><textarea name="Content" class="f_in" id="Content" onclick="if(this.value=='内容：') this.value='';" style="width:230px; height:100px;">内容：</textarea></td>
  	          </tr>
    	        <tr>
    	          <td height="25" align="center">妮称：
   	            <input name="UserName" type="text" class="f_in" id="UserName" size="5" /> 
   	            验证码：
   	            <input name="vertcode" type="text" class="f_in" id="vertcode" size="4" /> <img src="/image.asp" onclick="this.src='/image.asp?time='+Math.random()"></td>
  	          </tr>
    	        <tr>
    	          <td height="25" align="center"><input type="submit" name="button2" id="button2" value="提交问题" /></td>
  	          </tr>
  	        </table>
  	      </form>
          <div class="br"></div>
    	  </div>
      </div>
      <div id="right">
        <table width="100%" border="0" cellspacing="0" cellpadding="1">
          <tr>
            <td width="20%"><img src="image/dh.gif" width="137" height="31" alt=" " /></td>
            <td width="80%"> &nbsp;◇ 您现在的位置：<a href="/">首页</a> &gt;&gt; <a href="/wenda.asp">旅游问答</a> &gt;&gt;<%=ctitle%></td>
          </tr>
        </table>
        <div class="br"></div>
        
        <div class="brd_t">
        	<div class="th">问题分类</div>
          <div class="wenda_catalog">
          	<%
						set rs=conn.execute("select id,title from t_wenda_catalog order by id asc")
						while not rs.eof
						%>
            <div class="item"><a href="wenda_list.asp?id=<%=rs(0)%>" <%if(id=rs(0)) then response.Write(" class=""bold""") end if%>><%=rs(1)%></a></div>
            <%
							rs.movenext
						wend
						rs.close
						set rs=nothing
						%>
          </div>
          <div class="br"></div>
        </div>
        <div class="br"></div>
        <div class="brd_t">
        	<div class="th"><%=ctitle%></div>
          <div class="wendas">
          	<div class="col1">标题</div>
            <div class="col2">提问者 </div>
            <div class="col3">点击</div>
            <div class="col4">日期</div>
            <div class="col5">状态</div>
          </div>      
          	<%
						csql="select count(*) from t_wenda where IsCheck=1"
						if(id>0) then
							csql=csql&" and CatalogId="&id
						end if
						if(key<>"") then
							csql=csql&" and Title like '%"&key&"%'"
						end if
						sql="select top "&recpage&" id,UserId,Title,[Status],PubDate,Hits from t_wenda where id<=(select min(id) from (select top "&((currentpage-1)*recpage+1)&" id from t_wenda where IsCheck=1"
						if(id>0) then
							sql=sql&" and CatalogId="&id
						end if
						if(key<>"") then
							sql=sql&" and Title like '%"&key&"%'"
						end if
						sql=sql&" order by id desc) as t) and IsCheck=1"
						if(id>0) then
							sql=sql&" and CatalogId="&id
						end if
						if(key<>"") then
							sql=sql&" and Title like '%"&key&"%'"
						end if
						sql=sql&" order by id desc"
						allrec=conn.execute(csql)(0)
						totalpage=int((allrec-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
							for i=0 to ubound(carr,2)
						%>
          <div class="wendas">
          	<div class="col1"><a href="ask/<%=carr(0,i)%>.html"><%=carr(2,i)%></a></div>
            <div class="col2"><%=carr(1,i)%></div>
            <div class="col3"><%=carr(5,i)%></div>
            <div class="col4"><%=carr(4,i)%></div>
            <div class="col5"><img src="image/status<%=carr(3,i)%>.gif" /></div>
          </div>  
          <%
						next
					else
						response.write("<p align=""center"">暂时没有记录!</p>")
					end if
					set carr=nothing
					%>
        </div>
        <div class="br"></div>
        <div align="center">
          <form name="form1" method="post" action="" style="margin:0 0 0 0">
				<%
        dim n,p
        n=currentpage+1
        p=currentpage-1
        if p>0then
        response.write("["&"<a href='?id="&id&"&key="&key&"&page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
        else response.write("上一页&nbsp;&nbsp;&nbsp;")
        end if 
        if (n-1)*recpage>=allrec then 
        response.write("下一页" )
        else
        response.Write("["&"<a href='?id="&id&"&key="&key&"&page="&cstr(n)&"'>下一页</a>]")
        end if
        response.write("&nbsp;共"&allrec&"条&nbsp;")
        response.Write("&nbsp;共"&totalpage&"页&nbsp;")
        response.Write("&nbsp;第"&currentpage&"页&nbsp;")
        %>
              <input type="hidden" name="hid" value="<%=totalpage%>">
    &nbsp;&nbsp;跳至
        <input name="page" type="text" size="5" onChange="goto(this.form)" style="border:1px solid #000000;height:14px ">
        页
        <input type="button" name="Button22" value="Go->" style="font-size:12px ;border:1px solid #000000;height:18px ">
            </form>
          </div>
      </div>
    </div>
    <div class="br"></div>
    <!--#include file="root.asp"-->
  </div>
</div>
</body>
</html>
<%
call connclose()
%>

