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

    File:           alg_regio.asp
    Status:
    Description:

*/ %>
<!--#include file="../Shared/common.inc" -->
<!--#include file="../Shared/iface.inc" -->
<%
FCLTHeader.Requires({plugins:["jQuery"],
                         js: ["jquery-ui.js"]
                    })

var reg_key = getQParamInt("key", -1);
%>
<html>
  <head>
<%  FCLTHeader.Generate();
%>
    <script  type="text/javascript" >
<%    if (reg_key == -1) { %>FcltMgr.startEdit(window);<% } %>
      function algClose(params)
      {
          <% if (reg_key == -1)
             { %>
              if (params.cancel)
              {
                  FcltMgr.closeDetail(window, params );
                  return true;
              }
              FcltMgr.setTitle(L("lcl_region") +" "+ params.regio_key, {hot: false});
              if (!params.keepForm)
                  window.location.href = "alg_regio.asp?verynew=1&key=" + params.regio_key;
          <% } else { /* Bestaande regio bewerkt, switch naar show-mode */ %>
              if (!params.keepForm)
                  $("#algframe")[0].src = "alg_show_regio.asp?regio_key=<%=reg_key%>";
          <% } %>
      }
    </script>
  </head>
  <body>
  <%
    PAGE_START();
    if (reg_key == -1)
        var page="alg_edit_regio.asp"; // Maak een nieuw
    else
        var page="alg_show_regio.asp";
    page += "?regio_key="+reg_key;

    IFRAMER("algframe", page, { title: L("lcl_alg_regio_frame"),
                              FcltClose: "algClose" } );

    if (reg_key > -1)
    {
      page0 = "../alg/alg_district_search_list.asp?regiokey="+reg_key;
      IFRAMER("algdistrictframe", page0, { icon: "fa-list" } );

      var autfunction = ["WEB_ALGUSE", "WEB_ALGMAN"];
      var authparams = user.checkAutorisation(autfunction, true);
      if (authparams && authparams.ALGreadlevel <= 0 && authparams.PRSreadlevel < 9)
      {
        // tracking naar subframe :-)
        page1 = protectQS.create("../shared/status_info.asp?reg_key=" + reg_key);
        IFRAMER("alghistoryframe", page1, { icon: "fa-list", title: L("lcl_tracking")} );
      }
    }

    PAGE_END();
%>
  </body>
</html>
<% ASPPAGE_END(); %>
