<%@language = "javascript" %>
<% /*
     $Revision$
     $Id$

    File:               SuggestFaq.asp
    Description:        Suggereer kostenplaatsen
    Parameters:         k             De eerste paar letters
    Globals:
    Context:
    Note:
*/ %>
<%
JSON_Result = true;
%>

<!-- #include file="../../Shared/common.inc" -->
<!-- #include file="../../fac/fac.inc" -->
<!-- #include file="./suggest.inc" -->

<%
var chars = getQParam("k", "");
var upperchars = chars.toUpperCase();
var fronto = getQParamInt("fronto", 0) == 1;
var bAll = getQParamInt("SuggestAll", 0) == 1;

chars = chars.replace(/\*/g,"%");

var extraInf = ", 'Extra' extra";

// Check if person is authorized for all accounts
sql = " SELECT " + safe.quoted_sql(chars) + " zoekstr, to_char(count(*))||' resultaten' n"
        + " FROM fac_faq WHERE "
        + (!fronto? " fac_faq_level < 2 AND " : "")
        + fac.createOrClause("UPPER(fac_faq_question)", upperchars)
        + " OR "
        + fac.createOrClause("UPPER(fac_faq_answer)", upperchars)
        + " ORDER BY fac_faq_rank DESC NULLS LAST"
        + "        , fac_faq_datum DESC"
        + "        , fac_faq_question";

WriteResult(sql, bAll, "zoekstr", "zoekstr", "n", "n", false, false, false);
%>
