<?xml version="1.0"?>

<!--
   The contents of this file are subject to the Netscape Public
   License Version 1.1 (the "License"); you may not use this file
   except in compliance with the License. You may obtain a copy of
   the License at http://www.mozilla.org/NPL/
    
   Software distributed under the License is distributed on an "AS
   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
   implied. See the License for the specific language governing
   rights and limitations under the License.
    
   The Original Code is Mozilla Communicator client code, released
   March 31, 1998.
   
   The Initial Developer of the Original Code is Netscape
   Communications Corporation. Portions created by Netscape are
   Copyright (C) 1998-1999 Netscape Communications Corporation. All
   Rights Reserved.
   
   Contributor(s): 
  -->

<!DOCTYPE window SYSTEM "chrome://wallet/locale/walletContextOverlay.dtd">

<overlay id="walletContextOverlay"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <script type="application/x-javascript" src="chrome://wallet/content/walletOverlay.js"/>

  <script type="application/x-javascript">
  <![CDATA[

    function initContextItems() {

        // Determine if capture should be displayed and enabled.
        var captureState = getState(capture, 0);
        showItem("context-capture", (captureState != hide));
        setDisabledAttr("context-capture", (captureState == disable));

        // Determine if prefill should be displayed and enabled.
        var prefillState = getState(prefill, 0);
        showItem("context-prefill", (prefillState != hide));
        setDisabledAttr("context-prefill", (prefillState == disable));

        // Display show-saved-dat if either prefill or capture is being displayed
        showItem("context-formshow", captureState != hide || prefillState != hide);

        // Display separator if either prefill or capture is being displayed
        showItem("context-separator", captureState != hide || prefillState != hide);
    }

    // For some unexplainable reason, this overlay is loaded twice as can be demonstrated
    // by uncommenting the following "dump" statement which will get displayed twice
    //    dump("$$$$$$$$$$ HERE WE ARE IN walletContextOverlay.xul $$$$$$$$$$\n");
    // As a consequence, the block-image item appears twice in the context menu.  To
    // prevent that from happening, the "display:none" was added to the menuitem below

  ]]>
  </script>         

  <!-- context menu -->
  <popupset id="contentAreaContextSet" oncreate="initContextItems();"/>

  <popup id="contentAreaContextMenu">
    <menuitem id="context-formshow"
              value="&formshowCmd.label;"
              accesskey=""
              oncommand="formShow();"
              style="display:none;"
              insertafter="context-paste"/>
    <menuitem id="context-capture"
              value="&captureCmd.label;"
              accesskey=""
              oncommand="formCapture();"
              style="display:none;"
              insertafter="context-paste"/>
    <menuitem id="context-prefill"
              value="&prefillCmd.label;"
              accesskey=""
              oncommand="formPrefill();"
              style="display:none;"
              insertafter="context-paste"/>
    <menuseparator id="context-separator"
                   style="display:none;"
                   insertafter="context-paste"/>
  </popup>
</overlay>
