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

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

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

var regio_key = getQParamInt("regio_key", -1); //regio
var autosearch = getQParamInt("autosearch", 0) == 1;
var alg_startlevel = getQParamInt("alg_startlevel", 0); // Startlevel van plaatsselector, default Regio
var authparams = alg.checkAutorisation();
%>

<html>
  <head>
    <%  FCLTHeader.Generate(); %>
    <script type="text/javascript">
      function doSubmit()
      {
          // Submitten met kenmerken
          doSubmitWithKenmerken();
      }
      async function myModal(init)
      {
        var lvl = "E";
        var key = 0;
        var bld_key = "";
        var url = "load_kenmerk.asp?disc="
                                + "&urole=bo"
                                + "&advanced=1"
                                + "&hasFilter=1"
                                + "&onrgoed_key=" +bld_key
                                + "&onrgoed_niveau=" + lvl;
        var titel = L("lcl_properties");
        await showKenmerkModal(url, titel, init);
      }

      $(function() {
          <% if (autosearch) { %>
            document.forms.u2.submit(); 
          <% } %> 
          });
    </script>
  </head>
  <body id="searchbody">
    <form name="u2" target="workFrame" action="alg_regio_search_list.asp" method="get">
      <% SEARCH_PAGE_START({ header: L("lcl_filterblok") });
      SEARCH_BLOCK_START();
      //               <!-- Locatie, gebouw en verdieping -->
                    FCLTplaatsselector(authparams.ALGreadlevel, {
                                                                  regiokey: regio_key,
                                                                  startlevel: alg_startlevel, // Regio
                                                                  eindlevel: 0, // District
                                                                  whenEmpty: L("lcl_search_generic")
                                                                });
  SEARCH_BLOCK_END();
  SIMPLE_BLOCK_START();
    var buttons = [ {title: L("lcl_overview_list"), action: "doSubmit();", id: "bSearch", icon: "fa-clipboard-list" }
                  , {title: L("lcl_shared_advanced"), action: "myModal()", id: "bAdvanced", importance: 3, icon: "fa-filter" }
                  ];
    CreateButtons(buttons, { entersubmit: true, showIcons: true });
  SIMPLE_BLOCK_END();
  SEARCH_PAGE_END(); %>
      </form>

    <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>
<% ASPPAGE_END(); %>
