<%@ LANGUAGE = JavaScript %>
<% /*
     $Revision$
     $Id$
*/ %>

<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/iface.inc" -->
<!-- #include file="../Shared/selector.inc" -->
<!-- #include file="../Shared/plaatsselector.inc" -->
<!-- #include file="alg.inc" -->

<%
FCLTHeader.Requires({ plugins:["jQuery", "kenmerk"] });

var locatie_key = getQParamInt("locatie_key", -1); // locatie
var vak_code = getQParam("vak_code", "");
var ter_func = getQParamInt("ter_func", -1);
var autosearch = getQParamInt("autosearch", 0) == 1;
var authparams = alg.checkAutorisation();

%>
<html>
  <head>
<%  FCLTHeader.Generate(); %>
    <script type="text/javascript">
    function doSubmit()
      {
          // Submitten met kenmerken
          doSubmitWithKenmerken();
      }

        function myModal()
        {
          var lvl = "T";
          var key = 0;
          var bld_key = "";
          var url = "load_kenmerk.asp?disc=" + "&urole=bo" + "&advanced=1" + "&onrgoed_key=" + bld_key + "&onrgoed_niveau=" + lvl;
          var titel = "<%=L("lcl_properties")%>";
          showKenmerkModal(url, titel)
        }
        $(document).ready(function() {<% if (autosearch) { %> document.forms.u2.submit();<%}%>});
    </script>
  </head>
  <body id="searchbody">
    <div id="search">
      <form name="u2" target="workFrame" action="alg_terreinsector_search_list.asp" method="get">
<%    BLOCK_START("searchtable", L("lcl_filterblok"));%>
          <tr>
            <td class="searchkolom1">
              <table><!-- x rijen, 2 kolommen: label + veld -->

<% //               <!-- Locatie, gebouw en verdieping -->
                    FCLTplaatsselector(authparams.ALGreadlevel, {
                                                                  locatiekey: locatie_key,
                                                                  startlevel: 2, // locatie
                                                                  eindlevel: 2, // locatie
                                                                  whenEmpty: L("lcl_search_generic")
                                                                });
              sql = "SELECT   alg_srtterreinsector_key, "
                  + lcl.xsqla('alg_srtterreinsec_omschrijving', 'alg_srtterreinsector_key')
                  + "    FROM alg_v_aanwezigsrtterreinsector "
                  + "ORDER BY UPPER("+lcl.xsql('alg_srtterreinsec_omschrijving', 'alg_srtterreinsector_key')+")";

              FCLTselector("srt",
                           sql,
                           { initKey: ter_func,
                             label: L("lcl_estate_terreinsector_man_sort"),
                             emptyOption: "",
                             trclass: "primsearch",
                             initEmpty: true
                           });
                           %>
                </tr>
              </table>
            </td><!-- end column 1 -->

            <td class="searchkolom2">
              <table><!-- x rijen, 2 kolommen: label + veld -->
              <!-- Zoektekst -->
                <tr class="primsearch">
                  <td class="label"><label for="descr"><%=L("lcl_estate_terreinsector_man_code")%>:</label></td>
                  <td><input type="text" class="fldsrch" name="descr" value="<%=safe.htmlattr(vak_code)%>"></td>
                </tr>
              </table>
            </td><!-- end column 1 -->
          </tr>
<%    BLOCK_END(); %>
<%
  var buttons =  [ {title: L("lcl_search"), action: "doSubmit()", id: "bSearch" },
                   {title: L("lcl_obj_advanced"), action: "myModal()", id:"bAdvanced" } ];
  CreateButtons(buttons, { entersubmit: true });
%>
      </form>
    </div> <!-- search -->

    <div id="result">
      <iframe width="100%" height="100%"
              src="../Shared/empty.asp"
              name="workFrame" id="workFrame"
              onload="FcltMgr.iframeLoaded(this)"
              frameborder="0" scrolling="no">
      </iframe>
    </div>
  </body>
</html>
