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

     File:               CNT/cnt_show_contract.asp
     Description:        Functie bestaand contractrecord toont
     Parameters:         cnt_key              Contract key
     Context:
     Note:

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

var cnt_key = getQParamInt("cnt_key");

var cnt_info = cnt.cnt_contract_info(cnt_key); // Nog heel beperkt
var this_cnt = cnt.func_enabled_contract(cnt_key, cnt_info); // Wat heb ik zoal aan rechten op dit contract?
user.auth_required_or_abort(this_cnt.canReadAny); // Heb ik enige lees rechten op dit contract?

if (cnt_info.locked_user_key == user_key)
  cnt.unlock(cnt_key);

var hasFOBOread = this_cnt.canFOread || this_cnt.canBOread;
var subjectMail = L("lcl_cnt_subject").format(cnt_info.nummer_intern, cnt_info.omschrijving, cnt_info.discipline_omschrijving);

var defemail_key = -1;
var defemail_type =  "";
if (cnt_info.bedrijf_key)
{
  defemail_key = cnt_info.bedrijf_key;
  defemail_type =  "B";
}
else if (cnt_info.perslid_key)
{
  defemail_key = cnt_info.perslid_key;
  defemail_type =  "P";
}
// else if (cnt_info.afdeling_key) Dan blijft defemail_key = -1. Het bestand queuemail.asp kan dan toch geen email adres bepalen.nnnnnnnnnnnnnnnnn

// Wat is het hoogste volgnummer voor dit contract.
var ssql = "SELECT MAX(cnt_contract_versie) hoogste"
         + "  FROM cnt_contract"
         + " where cnt_contract_nummer_intern = " + safe.quoted_sql(cnt_info.nummer_intern);
var soRs = Oracle.Execute(ssql);
var maxversie = soRs("hoogste").Value;
soRs.Close();

// Bekijk of ik een facturatieschema heb
var fsql = "SELECT COUNT(*) FROM cnt_factuurschema WHERE cnt_contract_key = " + cnt_key;
var foRs = Oracle.Execute(fsql);
var hasFactuurschema = foRs(0).Value > 0;
foRs.close();

var urlMail = "../shared/queuemail.asp?pcode=CNTMAI&defemail_key=" + defemail_key
            + "&defemail_type=" + defemail_type
            + "&key=" + cnt_key
            + "&subject=" + Server.URLencode(subjectMail)
            + "&mailfrom=" + (hasFOBOread? 1 : 0);

%>
<html>
  <head>
<%  FCLTHeader.Generate() %>
    <script type="text/javascript">

      cnt_key = <%=cnt_key%>;
      srtdisc = <%=cnt_info.discipline_key%>;
      var cnt_nummer = "<%=safe.jsstring(cnt_info.nummer_intern)%>";
      $(function()
      {
        $('textarea').autogrow();
        FcltMgr.resized(window)
      });

      function cnt_edit_typecnt(img, cnt_key)
      {
        FcltMgr.openModalDetail("../cnt/cnt_change_cnttype.asp?cnt_key=" + cnt_key,
                                L("lcl_shared_contract") + " " + cnt_nummer,
                                { callback: function(data) { if (data.refresh) FcltMgr.reload() } }
                               );
      }

      function cnt_delete()
      {
        FcltMgr.confirm(L("lcl_cnt_delete").format("<%=safe.jsstring(cnt_info.nummer_intern+(cnt_info.versie?'.'+cnt_info.versie:''))%>"), function() {
            var data = {
                cnt_key: cnt_key
            };
            <% protectRequest.dataToken("data"); %>
            $.post("cnt_delete.asp",
                data,
                FcltCallbackClose,
                "json");
        });
      }

      function cnt_change()
      {
        if (FcltMgr.startEdit(window))
          window.location.href = "cnt_edit_contract.asp?cnt_key=<%=cnt_key%>&embedded=1";
      }

      function cnt_copy()
      {
        FcltMgr.openDetail("appl/cnt/cnt_contract.asp?cnt_key=" + cnt_key + "&srtdisc=" + srtdisc + "&cnt_copy=1",  L("lcl_cnt_copy") + " " + L("lcl_contract").toLowerCase());
      }

      function cnt_factuurschema()
      {
        var url = "appl/cnt/cnt_factuurschema.asp?cnt_key=<%=cnt_key%>";
        FcltMgr.openDetail(url, L("lcl_cnt_factuurschema")+" "+<%=cnt_key%>);

      }

      function cnt_newversion()
      {
        // Vraag om een ingangsdatum,
        // maak dan een kopie van dit contract (splits) waarbij de oude eindigt op die datum
        // en de nieuwe begint op die datum, en het volgende versienummer krijgt.
        // Alle flexkenmerken worden ook meegenomen, inclusief files
        FcltMgr.openModalDetail("cnt_split.asp?cnt_key=" + cnt_key, L("lcl_cnt_newversion"),
                                { width:500, height: 360, callback: function(data)
                                                {
                                                    if (data.refresh)
                                                        parent.FcltMgr.reload(); // Parent omdat scope bedragen gewijzigd kunnen zijn.
                                                }
                                            });
      }

      function cnt_add_invoice()
      { // todo: dit is natuurlijk geen jsstring maar een..
        FcltMgr.openDetail("appl/fin/fin_factuur.asp?referentie=C<%=safe.jsstring(cnt_info.nummer_intern)%>", L("lcl_menu_fin_fe"));
      }
      function cnt_orders()
      {
        FcltMgr.openDetail("appl/mld/mld_melding.asp?meldracht=1&urole=fe&cnt_key=" + cnt_key, L("lcl_cnt_new_order") );
      }

      function cnt_print()
      {
         FcltMgr.windowopen('./cnt_xml.asp?cnt_key='+<%=cnt_key%>);
      }

      function cnt_inactivate()
      {
        FcltMgr.confirm(L("lcl_cnt_inactivate_upd").format("<%=safe.jsstring(cnt_info.nummer_intern)%>"), function() {
            var data = {
                cnt_key: cnt_key
            };
            <% protectRequest.dataToken("data"); %>
            $.post("cnt_inactivate.asp",
                data,
                FcltCallbackRefresh,
                "json");
        });
      }

      function cnt_approve()
      {
        FcltMgr.confirm(L("lcl_cnt_approve").format("<%=safe.jsstring(cnt_info.nummer_intern)%>"), function() {
            var data = {
                cnt_key: cnt_key
            };
            <% protectRequest.dataToken("data"); %>
            $.post("cnt_approve.asp",
                data,
                FcltCallbackRefresh,
                "json");
        });
      }

      function cnt_reject()
      {
        url = "../cnt/cnt_reject.asp?cnt_key=" + cnt_key
        FcltMgr.openModalDetail(url,
                                L("lcl_cnt_contract") + " " + cnt_key,
                                {callback: FcltCallbackRefresh}
                               );
      }

      function cnt_forapproval()
      {
        FcltMgr.confirm(L("lcl_cnt_forward_forapproval").format("<%=safe.jsstring(cnt_info.nummer_intern)%>"), function() {
            var data = {
                cnt_key: cnt_key
            };
            <% protectRequest.dataToken("data"); %>
            $.post("cnt_forapproval.asp",
                data,
                FcltCallbackRefresh,
                "json");
        });
      }

      function cnt_mail()
      {
        function cntMailCallback(data)
        {
          FcltToast(L("lcl_cnt_is_cntmai") + data.emails);
        }

        var subject = "<%=safe.jsstring(subjectMail)%>";
        var url = "<%=safe.jsstring(protectQS.create(urlMail))%>";
        FcltMgr.openModalDetail(url, subject, { callback: cntMailCallback });
      }

    </script>

  </head>
  <body class="showmode">
<%  SUBFRAME_START();
      var buttons = [];
      var isLocked = (cnt_info.locked_user_key && cnt_info.locked_user_key != user_key);
      if (cnt_info.verwijderdatum == null && !isLocked)
      {
        if (this_cnt.canChange)
          buttons.push({title: L("lcl_change"),     icon: "fa-fclt-edit", action:"cnt_change()" });
        if (this_cnt.canCopy)
          buttons.push({title: L("lcl_cnt_copy"), icon: "fa-copy", action: "cnt_copy()"});
        if (false && this_cnt.canOrder)
        { // Aanzet tot CONN#17536, maar nog rudimentair
          // TODO: heb ik MLD_ORDBOF rechten voor deze cnt_discipline en
          //       bestaan er mld_typeodrsrtdiscipline records daarvoor?
          // Of misschien beter, via meldracht: heb ik ORDUSE rechten (canSelfOrder?)
          buttons.push({title: L("lcl_shared_order"),  icon: "fa-wrench", action:"cnt_orders()" });
        }

        if (this_cnt.canSplit)
          buttons.push({title: L("lcl_cnt_newversion"), icon: "fa-bolt", action:"cnt_newversion()", tooltip: L("lcl_cnt_newversion_hint")});  // CNT#16529
        if (this_cnt.canInactivate)
          buttons.push({title: L("lcl_cnt_inactivate") , action:"cnt_inactivate()", icon: "fa-lock"});
        if (this_cnt.canDelete)
          buttons.push({title: L("lcl_delete"),  icon: "fa-trash-alt", action:"cnt_delete()" });
        if (this_cnt.canGoedkeur1 || this_cnt.canGoedkeur2 || this_cnt.canGoedkeur3 || this_cnt.canGoedkeur4 || this_cnt.canGoedkeur5)
        {
          buttons.push({title: L("lcl_approve"),  icon: "fa-check", action:"cnt_approve()" });
          buttons.push({title: L("lcl_reject"),  icon: "fa-times", action:"cnt_reject()" });
        }
        if (this_cnt.forApproval)
          buttons.push({title: L("lcl_cnt_forapproval"),  icon: "fa-forward", action:"cnt_forapproval()" });
      }
      if (0||this_cnt.canAddFactuur) //BVB1#79743
      buttons.push({ title: L("lcl_mld_invoicing"), icon: "fa-coins", action: "cnt_add_invoice()" });

      buttons.push({ icon: "fa-print", title: L("lcl_print"),          action: 'cnt_print()' });
      buttons.push({ icon: "fa-envelope", title: L("lcl_noti_cnt_email"), action: 'cnt_mail()' });

      IFRAMER_HEADER(L("lcl_cnt_frame_algemeen"), buttons);
      if (cnt_info.locked_user_key && cnt_info.locked_user_key != user_key)
      {
        var other = new Perslid(cnt_info.locked_user_key);
        SIMPLE_BLOCK_START();
%>        <div class="warning"><%=L("lcl_cnt_contract_locked").format(safe.html(other.naam()), toTimeString(cnt_info.locked_date))%>
            <div class="buttoncontainer" style="float:right">
<%            var buttonsM = [];
              buttonsM.push({ icon: "fa-fclt-refresh", title: L("lcl_refresh"), action: "parent.FcltMgr.reload()" });
              CreateButtons(buttonsM, { showIcons: true }) %>
            </div>
          </div><%
        SIMPLE_BLOCK_END();
      }
%>
<%    if (cnt_info.verwijderdatum != null)
      {
        SIMPLE_BLOCK_START();
%>        <div class="cnt_deleted"><%=L("lcl_record_is_deleted")%></div><%
        SIMPLE_BLOCK_END();
      }
      if (cnt_info.contract_status == 1) // Gesloten
      {
        SIMPLE_BLOCK_START();
%>        <div class="cnt_inactive"><%=L("lcl_cnt_is_inactive")%></div><%
        SIMPLE_BLOCK_END();
      }

      var btns = [];

      // Ongebruikelijk weliswaar maar: in showmode een 'edit' knopje tonen voor wisselen opdrachttype
      // Wisselen zou te veel impact clientside hebben als het in editmode kan.
      if (this_cnt.canChangeSrt)
      {
        var sql = "SELECT cnt_ins_discipline_key"
                + " FROM cnt_disc_params"
                + " WHERE cnt_srtcontract_type = " + cnt_info.srtcontract_type
                + (cnt_info.bedrijf_key > 0 ? " AND BITAND (cnt_disc_params_binding, 1) = 1" : "")
                + (cnt_info.perslid_key > 0 ? " AND BITAND (cnt_disc_params_binding, 2) = 2" : "")
                + "   AND cnt_ins_discipline_key !=  " + cnt_info.discipline_key; // Huidige waarde niet laten zien.
        var oRs = Oracle.Execute(sql);
        if (!oRs.Eof) // er zijn andere mogelijk
        {
            btns.push({icon: "fa-fclt-edit", title: L("lcl_cnt_srttype"),  action: "cnt_edit_typecnt(this, " + cnt_key + ")", importance: 2});
        }
        oRs.Close();
      }

      BLOCK_START("cntInfo", L("lcl_cnt_general_info"), {icon: "fa-user-tag", buttons: btns});
        ROFIELDTR ("fldcntnr", L("lcl_cnt_intern_nr"), cnt_info.nummer_intern);
        ROFIELDTR ("fldshort", L("lcl_cnt_versie"), cnt_info.versie, {suppressEmpty: true});
        params = {};
        if (user.has("WEB_CNTMGT"))
        {
          params = { infoPointer: { Url:"appl/mgt/cnt_discipline.asp?id=" + cnt_info.discipline_key}}
        }
        ROFIELDTR ("flddisc", L("lcl_cnt_srttype"), cnt_info.discipline_omschrijving, params);
        ROFIELDTR ("fldoms", L("lcl_cnt_descr"), cnt_info.omschrijving);
        ROFIELDTR ("fldcntnr", L("lcl_cnt_contractnr"), cnt_info.nummer, {suppressEmpty: true});
        if (cnt_info.srtcontract_type != 6 && cnt_info.mantel_key != null)
        {
          params = { infoPointer: { Url:"appl/cnt/cnt_contract.asp?urole=bo&cnt_key=" + cnt_info.mantel_key,
                                    Title: L("lcl_details")
                                  }
                   }
          ROFIELDTR ("fldcontract", L("lcl_cnt_mantel"), cnt_info.mantelcontractnummer + (cnt_info.mantelversie ? "." + cnt_info.mantelversie : "") +" - " + cnt_info.mantelomschrijving, params);
        }
        ROTEXTAREATR("fldtxt", L("lcl_cnt_document"), cnt_info.document, {suppressEmpty: true, cntlink: true});
        ROFIELDTR ("flddep", L("lcl_cnt_owner"), cnt_info.afdeling_naam_eig);

        params = {};
        if (cnt_info.perslid_key_eig)
        {
          params = { infoPointer: { Url:"appl/fac/fac_user_info.asp?prs_key=" + cnt_info.perslid_key_eig,
                                    Title: L("lcl_details")
                                  }
                   }
          ROFIELDTR ("fldpers", L("lcl_cnt_contact_eig"), cnt_info.perslid_naam_eig, params);
        }

        params = {};
        if (cnt_info.perslid_key_beh)
        {
          params = { infoPointer: { Url:"appl/fac/fac_user_info.asp?prs_key=" + cnt_info.perslid_key_beh,
                                    Title: L("lcl_details")
                                  }
                   }
          ROFIELDTR ("fldpers", L("lcl_cnt_manager"), cnt_info.perslid_naam_beh, params);
        }
        ROTEXTAREATR("fldtxt", L("lcl_remark"), cnt_info.opmerking, {suppressEmpty: true, cntlink: true});
      BLOCK_END();

      BLOCK_START("cntData" , L("lcl_cnt_dates"), {icon: "fa-bell-school"});
        ROFIELDTR("fld", L("lcl_cnt_status"), cnt_info.contract_status_str);
        ROFIELDTR ("fld", L("lcl_cnt_date_start"), toDateString(cnt_info.looptijd_van));
        // fancy is: als deze periodes nu van toepassing zijn dat tonen (met class activeinterval)

        var fldcls = "fld";
        if (cnt_info.looptijd_tot < new Date())
          fldcls += " activeinterval";
        ROFIELDTR (fldcls, L("lcl_cnt_date_end"), toDateString(cnt_info.looptijd_tot));

        var today = new Date();
        var looptijd_tot = new Date(cnt_info.looptijd_tot);
        looptijd_tot.setHours(23,59,55,999); // Contract loopt tot het eind van de dag.
        if (looptijd_tot >= today && cnt_info.inactiveren)
        {
          ROCHECKBOXTR("fldautoclose", L("lcl_cnt_auto_close"), cnt_info.inactiveren);
        }

        fldcls = "fldcntperiod";
        if (cnt_info.opzegdatum <= new Date())
          fldcls += " activeinterval";
        ROFIELDTR (fldcls, L("lcl_cnt_cancel_period"), cnt_info.opzegtermijn_oms + " (" + toDateString(cnt_info.opzegdatum) + ")");

        fldcls = "fldcntperiod";
        if (cnt_info.rappeldatum <= new Date() && cnt_info.opzegdatum > new Date())
          fldcls += " activeinterval";
        ROFIELDTR (fldcls, L("lcl_cnt_rappel_period"), cnt_info.rappeltermijn_oms + " (" + toDateString(cnt_info.rappeldatum) + ")");

        // Heb ik rechten om verlengen aan te passen. Dan mag ik de waarde ook zien.
        if (cnt_info.isAbonnement || cnt_info.magAutomatischVerlengen)
        { // verlenging:  &1 = verlenging nee/ja
          //              &2 = keuze definitief (zie #23924)
          //              &4 = automatsch verlengen
          sql_verlengen = "SELECT " + (((cnt_info.verlenging & 2) == 2) ? "2" : "0") + ", " + safe.qL("lcl_No")  + ", 3 FROM DUAL"
                        + ( cnt_info.isAbonnement
                          ? " UNION SELECT -1, " + safe.qL("lcl_unknown") + ", 1 FROM DUAL"
                          + " UNION SELECT " + (((cnt_info.verlenging & 2) == 2) ? "3" : "1") + ", " + safe.qL("lcl_Yes") + ", 2 FROM DUAL"
                          : ""
                          )
                        + ( cnt_info.magAutomatischVerlengen
                          ? " UNION SELECT 5, " + safe.qL("lcl_cnt_prolongation_auto") + ", 4 FROM DUAL"
                          : ""
                          )
                        + " ORDER BY 3";
          FCLTselector("cntverlengen", sql_verlengen,
                        { label: L("lcl_cnt_verlengen"),
                          initKey: cnt_info.verlenging,
                          readonly: true
                        });
          if ((cnt_info.verlenging & 4) == 4)
          {
            ROFIELDTR (fldcls, L("lcl_cnt_prolongation_period"), cnt_info.verlengtermijn_oms );
          }
        }
      BLOCK_END();

      BLOCK_START("cntBedrijf" , L("lcl_cnt_effecter"), {icon: "fa-handshake"});
        if (cnt_info.srtcontract_type  == S("cnt_srttype_rental"))
        {
          params = { infoPointer: { Url:"appl/prs/prs_bedrijf.asp?bedrijf_key=" + cnt_info.bedrijf_key,
                                    Title: L("lcl_details")
                                  },
                     suppressEmpty: true
                   }
          ROFIELDTR ("fld", L("lcl_cnt_mutatie_huurder"), cnt_info.bedrijf_naam, params);
          ROFIELDTR ("flddep", L("lcl_cnt_afdeling"), cnt_info.afdeling_naam, {suppressEmpty: true});
        }
        else
        {
          params = { infoPointer: { Url:"appl/prs/prs_bedrijf.asp?bedrijf_key=" + cnt_info.bedrijf_key,
                                    Title: L("lcl_details")
                                  },
                     suppressEmpty: true
                   }
          ROFIELDTR ("fld", L("lcl_cnt_company"), cnt_info.bedrijf_naam, params);

          params = {};
          if (cnt_info.contactpersoon_key != null) {
              params = { infoPointer: { Url: "appl/prs/prs_contactpersoon.asp?cps_key=" + cnt_info.contactpersoon_key,
                                        Title: L("lcl_details")
                                      }};

              lsql = "SELECT " + S("prs_contactpers_string") + " naam"
                  + " FROM prs_contactpersoon cp"
                  + " WHERE cp.prs_contactpersoon_key = " + cnt_info.contactpersoon_key;
              var loRs = Oracle.Execute(lsql);
              ROFIELDTR ("fld", L("lcl_cnt_contact_prs"), loRs("naam").value, params);
              loRs.Close();
          }
          ROFIELDTR ("fld", L("lcl_prs_companies_dienst"), cnt_info.dienst_omschrijving, {suppressEmpty: true});
        }

        params = { infoPointer: { Url:"appl/prs/prs_perslid.asp?prs_key=" + cnt_info.perslid_key,
                                  Title: L("lcl_details")
                                },
                   suppressEmpty: true
                 }
        ROFIELDTR ("fld", L("lcl_person"), cnt_info.perslid_naam, params);
      BLOCK_END();

      if (cnt_info.toon_fin_info)
      {
        BLOCK_START("cntFindata" , L("lcl_cnt_fin_data"), {icon: "fa-coins"});
          ROFIELDTR ("fldkp", L("lcl_cnt_kostenplaats"), cnt_info.kostenplaats_naam, {suppressEmpty: true});
          ROFIELDTR ("fldkp", L("lcl_cnt_kostensoort"), cnt_info.kostensoort_naam ? cnt_info.kostensoort_naam+(cnt_info.kostensoort_btw ? " "+L("lcl_shared_inclBTW") : " "+L("lcl_shared_exclBTW")) : "", {suppressEmpty: true});

          var termijn = ((hasFactuurschema ? L("lcl_cnt_see_factuurschema") : safe.curr(cnt_info.termijnkosten)) || "")
                      + ((cnt_info.termijntermijn_oms ? " / " + cnt_info.termijntermijn_oms : "") || "");

          ROFIELDTR ("fld", L("lcl_cnt_period_sum")+ " " + L("lcl_valutasign"), termijn, {suppressEmpty: true, datatype: "currency"});  // currency werkt niet altijd door de tekst achter de waarde

          if (cnt_info.termijnjaarfactor != -1 && cnt_info.termijnjaarfactor != 1) {  // -1 is ongedefinieer/ongeldig, 1 is triviaal, staat hierboven al
            ROFIELDTR ("fld", L("lcl_cnt_contract_year")+ " " + L("lcl_valutasign"), (cnt_info.termijnjaarfactor * cnt_info.termijnkosten), {datatype: "currency", suppressEmpty: true});
          }
          ROFIELDTR ("fld", L("lcl_cnt_contract_sum") + " " + L("lcl_valutasign"), cnt_info.kosten,  {suppressEmpty: cnt_info.kosten!=0, datatype: "currency"});

          if (cnt_info.srtcontract_type == 6) // dit is een mantel
          {
              // Presenteer de som van de bijbehorende contracten.
              /* 0=actief, 1=inactief, 2=nieuw, 3=ter goedkeuring */
              var lsql = "SELECT SUM(cc.cnt_contract_kosten) cnt_contract_kosten, SUM(cc.cnt_contract_termijnkosten) cnt_contract_termijnkosten  "
                       + "  FROM cnt_contract cc, cnt_contract c"
                       + " WHERE cc.cnt_contract_status = 0 "
                       + "  AND cc.cnt_contract_looptijd_van >= c.cnt_contract_looptijd_van"
                       + "  AND cc.cnt_contract_looptijd_tot <= c.cnt_contract_looptijd_tot"
                       + "  AND cc.cnt_contract_mantel_key = c.cnt_contract_key"
                       + "  AND c.cnt_contract_key = " + cnt_key;
              var loRs = Oracle.Execute(lsql);

              // Ik denk dat de optelling van het termijnbedrag over het algemeen raar en verwarrend is.
              // ROFIELDTR ("fld", L("lcl_cnt_period_mantelsum") + " " + L("lcl_valutasign"), loRs("cnt_contract_termijnkosten").value,  {suppressEmpty: true, datatype: "currency"});
              ROFIELDTR ("fld", L("lcl_cnt_contract_mantelsum") + " " + L("lcl_valutasign"), loRs("cnt_contract_kosten").value,  {suppressEmpty: true, datatype: "currency"});
              loRs.Close();

          }
          ROFIELDTR ("fldshort", L("lcl_hour_rate")   + " " + L("lcl_valutasign"), cnt_info.uurloon, {suppressEmpty: true, datatype: "currency"});
          ROFIELDTR ("fldshort", L("lcl_cnt_discount"), cnt_info.korting, {suppressEmpty: true, datatype: "percentage"});
        BLOCK_END();
      }

      generateFlexKenmerkCode ({cnt_key    : cnt_key,
                                reado      : true,
                                this_cnt   : this_cnt
                               });
    SUBFRAME_END(); %>
  </body>
</html>
<% ASPPAGE_END(); %>
