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

    File:           fac_adres.asp
    Status:
    Description:    wrapper voor adres bewerk / show

    Parameters:     adres_key

    Context:
    Note:

*/ %>
<!--#include file="../Shared/common.inc" -->
<!--#include file="../Shared/iface.inc" -->

<%
FCLTHeader.Requires({plugins:["suggest","jQuery"], js: ["jquery-ui.js"]})

  var autfunction = "WEB_ALGMSU";
    var authparams = user.checkAutorisation(autfunction);

  var adr_key = getQParamInt("key", -1);
  var fac_title = "";

  if (adr_key > -1)
  {
    sql = "SELECT mld_adres_naam "
        + "  FROM mld_adres "
        + " WHERE mld_adres_key = " + adr_key;

    oRs = Oracle.Execute (sql);
    if (!oRs.eof)
      fac_title  = oRs("mld_adres_naam").value;
    oRs.Close();
  }

  var readonly = !(authparams.PRSwritelevel< 9 || authparams.ALGwritelevel < 9);
%>
<html>
<head>
<%
   FCLTHeader.Generate();
%>
  <script  type="text/javascript" >
      <% if (adr_key > 0) { %>
        FcltMgr.setTitle("<%=L("lcl_adress") + ' ' + safe.jsstring(fac_title)%>", {hot:false});
      <% } %>

      function facClose(params)
      {
          <% if (adr_key == -1)
             { %>
              if (params.cancel)
              {
                  FcltMgr.closeDetail(window, params );
                  return true;
              }
              if (!params.keepForm)
                  window.location.href = "fac_adres.asp?verynew=1&key=" + params.adr_key;
          <% } else { /* Bestaand object bewerkt, switch naar show-mode */ %>
              if (params.close)
              {
                FcltMgr.closeDetail(window, { close: true})
              }
              if (!params.keepForm)
                  $("#facFrame")[0].src = "fac_show_adres.asp?adr_key=<%=adr_key%>";
          <% } %>
      }
    </script>
</head>

<body>
<%
if (adr_key == -1)
    var page="fac_edit_adres.asp"; // Maak een nieuw
else
    var page="fac_show_adres.asp";
page += "?adr_key=" + adr_key;

IFRAMER("facFrame", page, { FcltClose: "facClose" } );
%>
</body>
</html>
