<!--#INCLUDE FILE="conect.asp"-->
<%
page=request.querystring("page")
if page="" then page=1
page=cint(page)
gsql=request.form("sql")
if gsql="" then gsql=session("sql")
gsubm=request.form("subm")
thmonth=array("Á.¤.","¡.¾.","ÁÕ.¤.","àÁ.Â.","¾.¤.","ÁÔ.Â.","¡.¤.","Ê.¤.","¡.Â.","µ.¤.","¾.Â.","¸.¤.")

SQL="SELECT * FROM Question WHERE verify=true"
if gsubm="´Ù¤ÓµÍºÅèÒÊØ´" then
    gsql=""    
   SQL2=" ORDER BY Ldate DESC; "
elseif gsubm="¡ÃÍ§" and gsql<> "" then 
   SQL2= " and qtitle like '%" & gsql & "%'  ORDER BY IDQuestion DESC; "
elseif gsubm="´Ù·Ñé§ËÁ´" then 
   gsql=""    
   SQL2=" ORDER BY IDQuestion DESC; "
elseif  gsql<> "" then 
   SQL2= " and qtitle like '%" & gsql & "%'  ORDER BY IDQuestion DESC; "
else
    SQL2=" ORDER BY IDQuestion DESC; "
end if
session("sql")=gsql
SQL=SQL & SQL2
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn, 1, 3
On Error Resume Next
gtotal=rs.RecordCount
RS.pagesize=10
ttpage=rs.pagecount
rs.absolutepage=page
%>
<html>
<head>
<title>Welcome to Perspective Webboard</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<meta http-equiv="Content-Language" content="th">
<meta http-equiv="Pragma" content="no-cache">
<meta name="ProgId" content="FrontPage.Editor.Document">
<style type="text/css">
<!--
body {  margin: 0px  0px; padding: 0px  0px}
a:link { color: #005CA2; text-decoration: none}
a:visited { color: #005CA2; text-decoration: none}
a:active { color: #0099FF; text-decoration: underline}
a:hover { color: #0099FF; text-decoration: underline}
-->
</style>


<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=no,menubar=no,status=no' );
}
//-->
</SCRIPT>
</head>
<body bgcolor="EFA45A" topmargin="0" leftmargin="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"><br><b><font size="3" face="MS Sans Serif, Microsoft Sans Serif" color="#000000">Perspective Webboard</font></b> <br><br>
      <table width="700" border="1" cellspacing="0" cellpadding="0" bordercolor="#FF6600">
        <tr>
          <td>
		  
      <table border="0" cellpadding="0" cellspacing="0" width="700" bgcolor="#FFFFCC">
        <tr>
          <td  valign="top" width="700"> 
          <table border="0" width="700" height="41" cellpadding="0" cellspacing="0">
              <tr>
            <td width="599" height="37"  >
                  <table border="0" width="700" cellpadding="0" cellspacing="0">
                    <tr>
                  <td width="80%"></td>
                  <td width="34%" align="right">
                    <p align="right"><font color="ff0000" size="2" face="MS Sans Serif"><a href="javascript:displayWindow('newtopic.html','500','300')">µÑé§ËÑÇ¢éÍãËÁè</a>
                    &nbsp;</font>
                  </td>
                </tr>
              </table>
              <hr width="700" size="1" color="#FFCC00">
            </td>
          </tr>
        </table>
        <table border="0" width="700" >
          <tr>
            <td width="36"  align="center" >
            <font size="2" face="Tahoma"><b>àÅ¢·Õè</b></font>
            </td>
            <td width="400"  align="center" >
            <font size="2" face="Tahoma"><b>¢éÍ¤ÇÒÁ</b></font>
            </td>
            <td width="43"  align="center" >
            <font size="2" face="Tahoma"><b>à»Ô´</b></font>
            </td>
            <td width="44"  align="center" >
            <font size="2" face="Tahoma"><b>µÍº</b></font>
            </td>
            <td width="80"  align="center" >
            <font size="2" face="Tahoma"><b>â¾Êµìâ´Â</b></font>
            </td>
            <td width="82"  align="center" >
            <font size="2" face="Tahoma"><b>ÇÑ¹·Õè</b></font>
            </td>
          </tr>
          <tr>
<%count=1
 Do while Not RS.EOF and count <= 15	%>
            <td width="36"  style="border-top: 1 solid #FFCC00"><font size="2" face="MS Sans Serif">
              <p align="center"><%=  right("0000" & rs("IDQuestion"),5)%></font></td>
            <% if rs("qdate")+5 >date  then %>
            <td width="400"  style="border-top: 1 solid #FFCC00">&nbsp;&nbsp;<a href="view.asp?ID=<%=rs("IDQuestion")%>"><font size="2" face="MS Sans Serif"><%=rs("QTitle")%></font></a><font size="2" face="MS Sans Serif">&nbsp;
              </font><b><font color="#FF0000" size="1" face="Tahoma"><blink>ãËÁè
              !!</blink></font></b> </td>
	<% else %>
            <td  style="border-top: 1 solid #FFCC00">&nbsp;&nbsp;<a href="view.asp?ID=<%=rs("IDQuestion")%>"><font size="2" face="MS Sans Serif"><%=rs("QTitle")%></font></a></td>
	<% end if %>
            <td width="44"  align="center" style="border-top: 1 solid #FFCC00">
            <font size="2" face="MS Sans Serif"><%=rs("qview")%></font></td>
            <td width="80"  align="center" style="border-top: 1 solid #FFCC00"><font size="2" face="MS Sans Serif"><%=rs("Nanswer")%></font></td>
            <td width="82"  align="center" style="border-top: 1 solid #FFCC00"><font size="2" face="MS Sans Serif"><%=rs("Qname")%></font></td>
            <td width="68"  align="center" style="border-top: 1 solid #FFCC00"><font size="2" face="MS Sans Serif"><%=day(rs("Qdate")) & " " & thmonth(month(rs("Qdate"))-1) & " " & right(year(rs("Qdate"))+543,2)%></font></td>
          <%rs.MoveNext
     count=count+1
	%> 
	</tr>
	<%
	          loop
     rs.Close
     conn.close
     %>
          <tr>
            <td  colspan="7">
              <hr size="1" color="#FFCC00">
            </td>
          </tr>
          <tr>
            <td  colspan="7" align="center"><font size="2">Ë¹éÒ·Õè&nbsp:&nbsp:&nbsp: 
              <%
  if page=1 then
        response.write "<a href=index.asp?page=1>&lt;&lt;&lt;Prev" & "</a>&nbsp;&nbsp;" 
     else
        response.write "<a href=index.asp?page=" & page-1 & ">&lt;&lt;&lt;Prev</a>&nbsp;&nbsp;" 
     end if 
     for i = 1 to cint(ttpage)
        response.write " <a href=index.asp?page=" & i &  "><b>" & i & "</b></a> &nbsp;&nbsp;"
     next
     if cint(page)=cint(ttpage) then
        response.write "<a href=index.asp?page=" & ttpage & ">Next>>></a>" 
     else
       response.write "<a href=index.asp?page=" & page+1 & ">Next>>></a>" 
     end if 
	   response.write  "</font></center>"
%>
              </font></td>
          </tr>
        </table>
    </tr>
  </table>		  
		  
		  
		  
		  
		  
		  </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

</body>
</html>
<script runat=server language=vbscript>
Function chktag(txt)
   chktag = replace(txt,"<","&lt;")
End Function
</script>