<%
'#################################################################################
'## Copyright (C) 2000-01 Michael Anderson and Pierre Gorissen
'## 
'## This program is free software; you can redistribute it and/or
'## modify it under the terms of the GNU General Public License
'## as published by the Free Software Foundation; either version 2
'## of the License, or any later version.
'##
'## All copyright notices regarding Snitz Forums 2000
'## must remain intact in the scripts and in the outputted HTML
'## The "powered by" text/logo with a link back to 
'## http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'## 
'## This program is distributed in the hope that it will be useful,
'## but WITHOUT ANY WARRANTY; without even the implied warranty of
'## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'## GNU General Public License for more details.
'## 
'## You should have received a copy of the GNU General Public License
'## along with this program; if not, write to the Free Software
'## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
'## 
'## Support can be obtained from support forums at:
'## http://forum.snitz.com 
'##
'## Correspondence and Marketing Questions can be sent to:
'## reinhold@bigfoot.com
'## 
'## or
'## 
'## Snitz Communications 
'## C/O: Michael Anderson
'## PO Box 200
'## Harpswell, ME 04079
'#################################################################################
%>
<!--#INCLUDE FILE="config.asp" -->  
<!--#include file="inc_functions.asp"-->
<!--#INCLUDE FILE="inc_top_short.asp" -->

<script language="Javascript">
<!-- hide

function insertsmilie(smilieface){

	window.opener.document.PostTopic.Message.value+=smilieface;
}
// -->
</script>


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<table border="0" width="95%" cellspacing="1" cellpadding="3" bgcolor="<% =strTableBorderColor %>" valign="top">
  <tr>
    <td bgcolor="<% =strCategoryCellColor %>"><a name="smilies"></a><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strCategoryFontColor %>" ><b>Smilies</b></font></td>
  </tr>
  <tr>
    <td bgcolor="<% =strForumCellColor %>">
    <p><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strForumFontColor %>">
    You've probably seen others use smilies before in email messages or other bulletin 
    board posts. Smilies are keyboard characters used to convey an emotion, such as a smile 
    <img border="0" src="<%= strImageURL %>icon_smile.gif"> or a frown 
    <img border="0" src="<%= strImageURL %>icon_smile_sad.gif">. This bulletin board 
    automatically converts certain text to a graphical representation when it is 
    inserted between brackets [].&nbsp; Here are the smilies that are currently 
    supported by <% =strForumTitle %>:<br>
    <table border="0" align="center" cellpadding="5">
      <tr valign="top">
        <td>
        <%
        if request.querystring("cat_id") = "" then
        %>
        <table bgcolor="<%=strTableBorderColor%>" border=1 cellpadding=1 cellspacing=1>
        <%
        	strsql = "select cat_id, cat_name from "&strTablePrefix&"smile_cat"
            set catRS1 = my_conn.execute(strsql)
            Do until catRS1.eof
        %>
        <tr bgcolor="<%=strForumCellColor%>">
        	<td><font face="<%=strDefaultFontFace%>" size=<%=strDefaultFontSize+1%>>
            <a href="<%=request.servervariables("script_name")%>?cat_id=<%=catRS1("cat_id")%>"><%=catRS1("cat_name")%></a>
            </td>
        </tr>
        <%
        	catRS1.movenext
            loop
            set carRS1=nothing
        %>
        </table>
        <%
        else
        %>
        <table border="0" align="center" cellpadding="5">
        <tr valign="top">
          <td>
        <table border="0" align="center">
        <%
        strsql = "select count(S_ID) AS TotalCount from " & strTablePrefix & "smiles "
		'strsql = strsql & "WHERE " & strTablePrefix & "SMILES.CAT_ID>" & 0
		strsql = strsql & "WHERE " & strTablePrefix & "SMILES.CAT_ID=" & request.querystring("cat_id")
		set drsCount = server.CreateObject("ADODB.RecordSet")
		drsCount.CacheSize= 30

    	drsCount.Open strsql, my_Conn,3
	
        			totalrecordcount = 0
                    totalrecordcount = drsCount("TotalCount")
        set drsCount =  nothing
        
        If totalrecordcount mod 2 = 0 then   
        strCount1 = totalrecordcount / 2   
        strCount2 = strCount1
        else   
        strCount1 = (totalrecordcount / 2) + 0.5   
        strCount2 = strCount1 - 1
        end if
        strTempCount = 0
        
        strsql = "SELECT S_DESC, S_URL, S_CODE FROM " & strTablePrefix & "SMILES WHERE CAT_ID=" & request.querystring("cat_id")
        Set drs = Server.CreateObject("ADODB.Recordset")
        drs.open strsql, my_conn, 3
      	if not (drs.eof or drs.bof) then
			drs.PageSize = strCount1
        	drs.AbsolutePage = 1
        	Do until strTempCount = strCount1
            smile_name = drs("S_DESC")
            smile_url = drs("S_URL")
            smile_code = drs("S_CODE")
           %>
          <tr>
            <td bgcolor="<% =strForumCellColor %>"><a href="Javascript:insertsmilie('[<%=smile_code%>]');"><img border="0" hspace="10" src="<%=strImageURL %><%=smile_url%>"></a></td>
            <td bgcolor="<% =strForumCellColor %>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><%=smile_name%></font></td>
            <td bgcolor="<% =strForumCellColor %>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">[<%=smile_code%>]</font></td>
          </tr>
          <%
          strTempCount = strTempCount + 1
          drs.movenext
          loop
	else%>
          <tr>
            <td bgcolor="<% =strForumCellColor %>" align=center><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>No smilies Found</b><br><a href="<%=request.servervariables("script_name")%>">Go Back</a></font></td>
          </tr>

<%		 
			Response.end
		end if
          
         %>
          
        </table>
        </td>
        <td>
        <table border="0" align="center">
        <%
        strsql = "SELECT S_DESC, S_URL, S_CODE FROM " & strTablePrefix & "SMILES WHERE CAT_ID=" & request.querystring("cat_id")
        Set drs = Server.CreateObject("ADODB.Recordset")
        drs.open strsql, my_conn, 3
			drs.PageSize = strCount1
			if strcount2 > 0 then
			drs.AbsolutePage = 2
			strTempCount = 0
        	Do until (strTempCount = strCount2) or (drs.eof)
            smile_name = drs("S_DESC")
            smile_url = drs("S_URL")
            smile_code = drs("S_CODE")
        %>
        	<tr>
            <td bgcolor="<% =strForumCellColor %>"><a href="Javascript:insertsmilie('[<%=smile_code%>]');"><img border="0" hspace="10" src="<%=strImageURL %><%=smile_url%>"></a></td>
            <td bgcolor="<% =strForumCellColor %>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><%=smile_name%></font></td>
            <td bgcolor="<% =strForumCellColor %>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">[<%=smile_code%>]</font></td>
          	</tr>
          <%
          strTempCount = strTempCount + 1
          drs.movenext
          loop
		  end if
          set drs = nothing
          %>
          </table>
          <%end if%>
        </td>
      </tr>
    </table>
    	</td>
  	</tr>
	</table>
    </td>
  </tr>
</table>
<div align="center">
<% if request.querystring("cat_id") <> "" then %>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="<%=request.servervariables("script_name")%>">Go Back</a></font>
<% End If %>
<!--#INCLUDE FILE="inc_footer_short.asp" -->
</div>