/*
     $Revision$
     $Id$

     File:        prj_show_scenario.js
*/

function prj_edit(prj_key)
{
  if (FcltMgr.startEdit(window))
    window.location.href = "prj_edit_scenario.asp?prj_key=" + prj_key + "&embedded=1";
}

function prj_graphics(prj_key)
{
  FcltMgr.openDetail("appl/CAD/default.asp?scenario_key=" + prj_key+ "&floor_key=-1", L("lcl_prj_verhuis_scenario") + ' ' + prj_key);
}

function prj_graphics_floor(prj_key, flr_key)
{
  FcltMgr.openDetail("appl/CAD/default.asp?scenario_key=" + prj_key + "&floor_key="+flr_key, L("lcl_prj_verhuis_scenario") + ' ' + prj_key);
}

function prj_report(prj_key)
{
  window.open("./prj_xml.asp?prj_key=" + prj_key);
}

function prj_submit(prj_key)
{
  FcltMgr.confirm(L("lcl_prj_commitOK"), function() {
      var data = {
          prj_key: prj_key
      };
      protectRequest.dataToken(data);
      $.post("prj_commit.asp",
          data,
          FcltCallbackAndThen(function(json) {
              FcltMgr.closeDetail(window, {
                  deleted: true
              })
          }),
          "json");
  });
}

function prj_cancel(prj_key)
{
  FcltMgr.confirm(L("lcl_prj_cancelOK"), function() {
      var data = {
          prj_key: prj_key
      };
      protectRequest.dataToken(data);
      $.post("prj_cancel.asp",
          data,
          FcltCallbackAndThen(function(json) {
              FcltMgr.closeDetail(window, {
                  deleted: true
              })
          }),
          "json");
  });
}

function prjMailCallback(data)
{
  FcltMgr.alert(L("lcl_prj_is_prjmai") + data.emails);
}
