<?xml version="1.0"?>


<?xml-stylesheet href="chrome://messenger/skin/addressbook/addressbook.css" type="text/css"?>

<?xul-overlay href="chrome://messenger/content/macMenuOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/baseMenuOverlay.xul"?>

<!DOCTYPE window [
<!ENTITY % abMainWindowDTD SYSTEM "chrome://messenger/locale/addressbook/abMainWindow.dtd" >
%abMainWindowDTD;
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
%brandDTD;
<!ENTITY % customizeToolbarDTD SYSTEM "chrome://global/locale/customizeToolbar.dtd">
%customizeToolbarDTD;
]>

<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:html="http://www.w3.org/1999/xhtml"
    id="addressbookWindow"
    title="&addressbookWindow.title;"
    windowtype="mail:addressbook"
    macanimationtype="document"
    persist="width height screenX screenY sizemode"
    toggletoolbar="true"
    onload="OnLoadAddressBook()"
    onunload="OnUnloadAddressBook()"
    lightweightthemes="true"
    fullscreenbutton="true"
    lightweightthemesfooter="status-bar">

  <stringbundleset id="stringbundleset">
    <stringbundle id="bundle_addressBook" src="chrome://messenger/locale/addressbook/addressBook.properties"/>
    <stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
    <stringbundle id="bundle_brand" src="chrome://branding/locale/brand.properties"/>
  </stringbundleset>

<script type="application/javascript" src="chrome://messenger/content/jsTreeView.js"/>
<script type="application/javascript" src="chrome://messenger/content/addressbook/abTrees.js"/>
<script type="application/javascript" src="chrome://messenger/content/accountUtils.js"/>
<script type="application/javascript" src="chrome://messenger/content/mailCore.js"/>
<script type="application/javascript" src="chrome://messenger/content/addressbook/addressbook.js"/>
<script type="application/javascript" src="chrome://messenger/content/addressbook/abCommon.js"/>
<script type="application/javascript" src="chrome://communicator/content/contentAreaClick.js"/>
<script type="application/javascript" src="chrome://global/content/printUtils.js"/>
<script type="application/javascript" src="chrome://messenger/content/msgPrintEngine.js"/>

<!-- move needed functions into a single js file -->
<script type="application/javascript" src="chrome://communicator/content/utilityOverlay.js"/>
<script type="application/javascript" src="chrome://global/content/nsDragAndDrop.js"/>
<script type="application/javascript" src="chrome://messenger/content/addressbook/abDragDrop.js"/>
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
<script type="application/javascript" src="chrome://messenger/content/addressbook/abResultsPane.js"/>
<script type="application/javascript" src="chrome://messenger/content/addressbook/abCardViewOverlay.js"/>
<script type="application/javascript" src="chrome://messenger/content/toolbarIconColor.js"/>

<commandset id="addressBook">
  <commandset id="CommandUpdate_AddressBook"
              commandupdater="true"
              events="focus,addrbook-select"
              oncommandupdate="CommandUpdate_AddressBook()"/>
  <commandset id="selectEditMenuItems"
              commandupdater="true"
              events="select"
              oncommandupdate="goUpdateSelectEditMenuItems()"/>
  <commandset id="undoEditMenuItems"
              commandupdater="true"
              events="undo"
              oncommandupdate="goUpdateUndoEditMenuItems()"/>
  <commandset id="globalEditMenuItems"
              commandupdater="true"
              events="focus"
              oncommandupdate="goUpdateGlobalEditMenuItems()"/>
    <command id="cmd_newlist" oncommand="goDoCommand('cmd_newlist');"/>
    <command id="cmd_newCard" oncommand="goDoCommand('cmd_newCard');"/>
    <command id="cmd_printcardpreview" oncommand="AbPrintPreviewCard();"/>
    <command id="cmd_printcard" oncommand="AbPrintCard();"/>
    <command id="cmd_properties" oncommand="goDoCommand('cmd_properties');" disabled="true"/>
    <command id="cmd_undo" oncommand="goDoCommand('cmd_undo')" disabled="true"/>
    <command id="cmd_redo" oncommand="goDoCommand('cmd_redo')" disabled="true"/>
    <command id="cmd_cut" oncommand="goDoCommand('cmd_cut')" disabled="true"/>
    <command id="cmd_copy" oncommand="goDoCommand('cmd_copy')" disabled="true"/>
    <command id="cmd_paste" oncommand="goDoCommand('cmd_paste')" disabled="true"/>
    <command id="cmd_delete" oncommand="goDoCommand('cmd_delete')"
             valueAddressBook="&deleteAbCmd.label;"
             valueCard="&deleteContactCmd.label;"
             valueCards="&deleteContactsCmd.label;"
             valueList="&deleteListCmd.label;"
             valueLists="&deleteListsCmd.label;"
             valueItems="&deleteItemsCmd.label;"
             disabled="true"/>
    <command id="cmd_selectAll" oncommand="goDoCommand('cmd_selectAll')" disabled="true"/>
    <command id="cmd_preferences"
             oncommand="openOptionsDialog('paneCompose', 'addressingTab');"/>
    <!-- Mac Window menu -->
    <command id="minimizeWindow" label="&minimizeWindow.label;" oncommand="window.minimize();"/>
    <command id="zoomWindow" label="&zoomWindow.label;" oncommand="zoomWindow();"/>
    <command id="Tasks:Mail" oncommand="toMessengerWindow();"/>
    <command id="cmd_CustomizeABToolbar"
             oncommand="CustomizeMailToolbar('ab-toolbox', 'CustomizeABToolbar')"/>
    <command id="cmd_chatWithCard" oncommand="goDoCommand('cmd_chatWithCard')" disabled="true" />
</commandset>

<broadcasterset id="abBroadcasters">
  <!-- Edit Menu -->
  <broadcaster id="button_delete" disabled="true"/>
</broadcasterset>

<keyset id="tasksKeys">
  <!-- File Menu -->
  <key id="key_newMessage" key="&newMessageCmd.key;" modifiers="accel,shift" oncommand="AbNewMessage()"/>
  <key id="key_newCard" key="&newContact.key;" modifiers="accel"
       command="cmd_newCard"/>

  <key id="key_printCard" key="&printContactCmd.key;" command="cmd_printcard"
       modifiers="accel"/>
  <key id="key_close" key="&closeCmd.key;" modifiers="accel" oncommand="AbClose()"/>

  <!-- Edit Menu -->
  <key id="key_undo" key="&undoCmd.key;" modifiers="accel"/>
  <key id="key_redo"
       key="&undoCmd.key;"
       modifiers="accel,shift"/>
  <key id="key_cut" key="&cutCmd.key;" modifiers="accel"/>
  <key id="key_copy" key="&copyCmd.key;" modifiers="accel"/>
  <key id="key_paste" key="&pasteCmd.key;" modifiers="accel"/>

  <key id="key_delete" keycode="VK_BACK" command="cmd_delete"/>
  <key id="key_delete2" keycode="VK_DELETE" command="cmd_delete"/>
  <key id="key_selectAll" key="&selectAllCmd.key;" modifiers="accel"/>
  <key id="key_searchAddresses" key="&searchAddressesCmd.key;" oncommand="onAdvancedAbSearch();" modifiers="accel, shift"/>
  <key id="key_properties" command="cmd_properties" key="&propertiesCmd.key;" modifiers="accel"/>

  <!-- Tab/F6 Keys -->
  <key keycode="VK_TAB" oncommand="SwitchPaneFocus(event);" modifiers="control,shift"/>
  <key keycode="VK_TAB" oncommand="SwitchPaneFocus(event);" modifiers="control"/>
  <key keycode="VK_F6" oncommand="SwitchPaneFocus(event);" modifiers="control,shift"/>
  <key keycode="VK_F6" oncommand="SwitchPaneFocus(event);" modifiers="control"/>
  <key keycode="VK_F6" oncommand="SwitchPaneFocus(event);" modifiers="shift"/>
  <key keycode="VK_F6" oncommand="SwitchPaneFocus(event);"/>

  <key key="&quickSearchCmd.key;" oncommand="QuickSearchFocus();" modifiers="accel"/>
  <key id="key_mail"  key="&messengerCmd.commandkey;" oncommand="toMessengerWindow();" modifiers="accel"/>
  <!-- Mac Window keys -->
  <key id="key_minimizeWindow" command="minimizeWindow" key="&minimizeWindow.key;" modifiers="accel"/>
</keyset>

<keyset id="baseMenuKeyset"/>

<menupopup id="dirTreeContext">
  <menuitem id="dirTreeContext-properties"
            label="&editButton2.label;"
            accesskey="&editButton2.accesskey;"
            command="cmd_properties"/>
  <menuseparator/>
  <menuitem id="dirTreeContext-newcard" label="&newContactButton.label;"
            accesskey="&newContactButton.accesskey;" command="cmd_newCard"/>
  <menuitem id="dirTreeContext-newlist"
            label="&newlistButton.label;"
            accesskey="&newlistButton.accesskey;"
            command="cmd_newlist"/>
  <menuseparator/>
  <menuitem id="dirTreeContext-delete"
            label="&deleteButton2.label;"
            accesskey="&deleteButton2.accesskey;"
            observes="button_delete"
            oncommand="goDoCommand('button_delete');"/>
</menupopup>

<menupopup id="abResultsTreeContext">
  <menuitem id="abResultsTreeContext-properties"
            label="&editButton2.label;"
            accesskey="&editButton2.accesskey;"
            command="cmd_properties"/>
  <menuseparator/>
  <menuitem id="abResultsTreeContext-newmessage"
            label="&newmsgButton.label;"
            accesskey="&newmsgButton.accesskey;"
            oncommand="AbNewMessage()"/>
  <menuitem id="abResultsTreeContext-newim"
            label="&newIM.label;"
            accesskey="&newIM.accesskey;"
            command="cmd_chatWithCard"/>
  <menuseparator/>
  <menuitem id="abResultsTreeContext-delete"
            label="&deleteButton2.label;"
            accesskey="&deleteButton2.accesskey;"
            observes="button_delete"
            oncommand="goDoCommand('button_delete');"/>
</menupopup>

<menupopup id="toolbar-context-menu"
           onpopupshowing="onViewToolbarsPopupShowing(event, 'ab-toolbox');">
  <menuseparator id="customizeABToolbarMenuSeparator"/>
  <menuitem id="CustomizeABToolbar"
            command="cmd_CustomizeABToolbar"
            label="&customizeToolbar.label;"
            accesskey="&customizeToolbar.accesskey;"/>
</menupopup>

<vbox id="titlebar">
  <hbox id="titlebar-content">
    <spacer id="titlebar-spacer" flex="1"/>
    <hbox id="titlebar-buttonbox-container" align="start">
      <hbox id="titlebar-buttonbox">
        <toolbarbutton class="titlebar-button" id="titlebar-min" oncommand="window.minimize();"/>
        <toolbarbutton class="titlebar-button" id="titlebar-max" oncommand="onTitlebarMaxClick();"/>
        <toolbarbutton class="titlebar-button" id="titlebar-close" oncommand="window.close()"/>
      </hbox>
    </hbox>
    <hbox id="titlebar-fullscreen-button"/>
  </hbox>
</vbox>

<toolbox id="ab-toolbox"
         class="toolbox-top"
         mode="full"
         defaultmode="full"
         iconsize="small"
         defaulticonsize="small"
         labelalign="end"
         defaultlabelalign="end">
  <toolbar type="menubar" id="addrbook-toolbar-menubar2" class="chromeclass-menubar" customizable="true"
           defaultset="menubar-items"
           context="toolbar-context-menu" mode="icons">

   <toolbaritem id="menubar-items" align="center">
     <menubar id="mail-menubar" style="border:0px;padding:0px;margin:0px;-moz-appearance:none">
        <menu id="menu_File" label="&fileMenu.label;" accesskey="&fileMenu.accesskey;">
            <menupopup id="menu_FilePopup" onpopupshowing="onOSXFileMenuInit();">
                <menu id="menu_New" label="&newMenu.label;" accesskey="&newMenu.accesskey;">
                    <menupopup id="menu_NewPopup">
                      <menuitem id="menu_newContact"
                                label="&newContact.label;"
                                accesskey="&newContact.accesskey;"
                                key="key_newCard" command="cmd_newCard"/>
                      <menuitem id="menu_newList"
                                label="&newListCmd.label;"
                                accesskey="&newListCmd.accesskey;"
                                command="cmd_newlist"/>
                      <menuitem id="menu_newAddrbook"
                                label="&newAddressBookCmd.label;"
                                accesskey="&newAddressBookCmd.accesskey;"
                                oncommand="AbNewAddressBook()"/>
                      <menuitem id="addLDAP" label="&newLDAPDirectoryCmd.label;"
                                accesskey="&newLDAPDirectoryCmd.accesskey;"
                                oncommand="AbNewLDAPDirectory()"/>
                      <menuseparator/>
                      <menuitem id="menu_newMessage"
                                label="&newMessageCmd.label;"
                                key="key_newMessage"
                                accesskey="&newMessageCmd.accesskey;"
                                oncommand="AbNewMessage()"/>
                    </menupopup>
                </menu>
                <menuseparator/>
                <menuitem id="menu_osxAddressBook"
                          label="&osxAddressBook.label;"
                          accesskey="&osxAddressBook.accesskey;"
                          oncommand="AbShowHideOSXAddressBook();"
                          checked="true" type="checkbox"/>
                <menuseparator/>
                <menuitem id="printMenuItem" label="&printContactCmd.label;"
                          accesskey="&printContactCmd.accesskey;"
                          key="key_printContact" command="cmd_printcard"/>
                <menuseparator id="menu_PageSetupSeparator"/>
                <menuitem id="printSetupMenuItem" label="&printSetupCmd.label;"
                          accesskey="&printSetupCmd.accesskey;"
                          oncommand="PrintUtils.showPageSetup()"/>
                <menuseparator id="menu_PrintAddrbookSeparator"/>
                <menuitem id="printAddressBook" label="&printAddressBook.label;"
                          accesskey="&printAddressBook.accesskey;"
                          oncommand="AbPrintAddressBook()"/>
                <menuseparator id="menu_FileCloseSeparator"/>
                <menuitem id="menu_close"
                          label="&closeCmd.label;"
                          key="key_close"
                          accesskey="&closeCmd.accesskey;"
                          oncommand="AbClose()"/>
            </menupopup>
        </menu>

        <menu id="menu_Edit" label="&editMenu.label;"
              accesskey="&editMenu.accesskey;">
          <menupopup id="menu_EditPopup">
            <menuitem id="menu_undo"
                      label="&undoCmd.label;"
                      key="key_undo"
                      accesskey="&undoCmd.accesskey;"
                      command="cmd_undo"/>
            <menuitem id="menu_redo"
                      label="&redoCmd.label;"
                      key="key_redo"
                      accesskey="&redoCmd.accesskey;"
                      command="cmd_redo"/>
            <menuseparator/>
            <menuitem id="menu_cut"
                      label="&cutCmd.label;"
                      key="key_cut"
                      accesskey="&cutCmd.accesskey;"
                      command="cmd_cut"/>
            <menuitem id="menu_copy"
                      label="&copyCmd.label;"
                      key="key_copy"
                      accesskey="&copyCmd.accesskey;"
                      command="cmd_copy"/>
            <menuitem id="menu_paste"
                      label="&pasteCmd.label;"
                      key="key_paste"
                      accesskey="&pasteCmd.accesskey;"
                      command="cmd_paste"/>
            <menuitem id="menu_delete"
                      label="&deleteCmd.label;"
                      key="key_delete"
                      accesskey="&deleteCmd.accesskey;"
                      command="cmd_delete"/>
            <menuseparator/>
            <menuitem id="menu_selectAll"
                      label="&selectAllCmd.label;"
                      key="key_selectAll"
                      accesskey="&selectAllCmd.accesskey;"
                      command="cmd_selectAll"/>

            <menuseparator/>
            <menuitem id="menu_search_addresses"
                      label="&searchAddressesCmd.label;"
                      accesskey="&searchAddressesCmd.accesskey;"
                      key="key_searchAddresses"
                      oncommand="onAdvancedAbSearch();"/>

            <menuseparator/>
            <!-- LOCALIZATION NOTE: set "hideSwapFnLnUI" to false in .dtd to enable the UI -->
            <menuitem label="&swapFirstNameLastNameCmd.label;"
                      accesskey="&swapFirstNameLastNameCmd.accesskey;"
                      hidden="&hideSwapFnLnUI;"
                      oncommand="AbSwapFirstNameLastName()"/>
            <menuitem id="menu_properties"
                      label="&propertiesCmd2.label;"
                      accesskey="&propertiesCmd2.accesskey;"
                      key="key_properties"
                      command="cmd_properties"/>
          </menupopup>
        </menu>

        <menu id="menu_View" label="&viewMenu.label;" accesskey="&viewMenu.accesskey;">
            <menupopup id="menu_View_Popup">
                <menu id="menu_Toolbars"
                      label="&viewToolbarsMenu.label;" accesskey="&viewToolbarsMenu.accesskey;"
                      onpopupshowing="onViewToolbarsPopupShowing(event, 'ab-toolbox');">
                  <menupopup id="view_toolbars_popup">
                    <menuitem id="menu_showTaskbar"
                              label="&showTaskbarCmd.label;" accesskey="&showTaskbarCmd.accesskey;"
                              oncommand="goToggleToolbar('status-bar', 'menu_showTaskbar')"
                              type="checkbox" checked="true"/>
                    <menuseparator id="viewMenuBeforeCustomizeABToolbarsSeparator"/>
                    <menuitem id="customizeABToolbars"
                              command="cmd_CustomizeABToolbar"
                              label="&customizeToolbar.label;"
                              accesskey="&customizeToolbar.accesskey;"/>
                  </menupopup>
                </menu>
                <menu id="menu_Layout"
                      label="&layoutMenu.label;"
                      accesskey="&layoutMenu.accesskey;">
                  <menupopup id="view_layout_popup"
                             onpopupshowing="InitViewLayoutMenuPopup(event);">
                    <menuitem id="menu_showDirectoryPane"
                              label="&showDirectoryPane.label;"
                              accesskey="&showDirectoryPane.accesskey;"
                              oncommand="togglePaneSplitter('dirTree-splitter');"
                              checked="true" type="checkbox"/>
                    <menuitem id="menu_showCardPane"
                              label="&showContactPane2.label;"
                              accesskey="&showContactPane2.accesskey;"
                              oncommand="togglePaneSplitter('results-splitter');"
                              checked="true" type="checkbox"/>
                  </menupopup>
                </menu>
                <menuseparator id="viewMenuAfterLayoutSeparator"/>
                <menu id="menu_ShowNameAs" label="&menu_ShowNameAs.label;" accesskey="&menu_ShowNameAs.accesskey;">
                    <menupopup id="menu_ShowNameAsPopup">
                        <menuitem type="radio" name="shownameas"
                                  id="firstLastCmd"
                                  label="&firstLastCmd2.label;"
                                  accesskey="&firstLastCmd2.accesskey;"
                                  oncommand="SetNameColumn('firstLastCmd')"/>
                        <menuitem type="radio" name="shownameas"
                                  id="lastFirstCmd"
                                  label="&lastFirstCmd.label;"
                                  accesskey="&lastFirstCmd.accesskey;"
                                  oncommand="SetNameColumn('lastFirstCmd')"/>
                        <menuitem type="radio" name="shownameas"
                                  id="displayNameCmd"
                                  label="&displayNameCmd.label;"
                                  accesskey="&displayNameCmd.accesskey;"
                                  oncommand="SetNameColumn('displayNameCmd')"/>
                    </menupopup>
                </menu>
                <menu id="sortMenu" label="&sortMenu.label;" accesskey="&sortMenu.accesskey;">
                    <menupopup id="sortMenuPopup" onpopupshowing="InitViewSortByMenu()">
                        <menuitem label="&GeneratedName.label;"
                                  id="cmd_SortByGeneratedName"
                                  accesskey="&GeneratedName.accesskey;"
                                  oncommand="SortResultPane('GeneratedName');" name="sortas" type="radio" checked="true"/>
                        <menuitem label="&PrimaryEmail.label;"
                                  id="cmd_SortByPrimaryEmail"
                                  accesskey="&PrimaryEmail.accesskey;"
                                  oncommand="SortResultPane('PrimaryEmail');" name="sortas" type="radio" checked="true"/>
                        <menuitem label="&ChatName.label;"
                                  id="cmd_SortByChatName"
                                  accesskey="&ChatName.accesskey;"
                                  oncommand="SortResultPane('ChatName');" name="sortas" type="radio" checked="true"/>
                        <menuitem label="&Company.label;"
                                  id="cmd_SortByCompany"
                                  accesskey="&Company.accesskey;"
                                  oncommand="SortResultPane('Company');" name="sortas" type="radio" checked="true"/>
                        <!-- LOCALIZATION NOTE:
                        Fields for phonetic are disabled as default and can be enabled by
                        editing "mail.addr_book.show_phonetic_fields"
                        -->
                        <menuitem label="&_PhoneticName.label;"
                                  id="cmd_SortBy_PhoneticName"
                                  hidden="true"
                                  accesskey="&_PhoneticName.accesskey;"
                                  oncommand="SortResultPane('_PhoneticName');" name="sortas" type="radio" checked="true"/>
                        <menuitem label="&NickName.label;"
                                  id="cmd_SortByNickName"
                                  accesskey="&NickName.accesskey;"
                                  oncommand="SortResultPane('NickName');" name="sortas" type="radio" checked="true"/>
                        <menuitem label="&SecondEmail.label;"
                                  id="cmd_SortBySecondEmail"
                                  accesskey="&SecondEmail.accesskey;"
                                  oncommand="SortResultPane('SecondEmail');" name="sortas" type="radio" checked="true"/>
                        <menuitem label="&Department.label;"
                                  id="cmd_SortByDepartment"
                                  accesskey="&Department.accesskey;"
                                  oncommand="SortResultPane('Department');" name="sortas" type="radio" checked="true"/>
                        <menuitem label="&JobTitle.label;"
                                  id="cmd_SortByJobTitle"
                                  accesskey="&JobTitle.accesskey;"
                                  oncommand="SortResultPane('JobTitle');" name="sortas" type="radio" checked="true"/>
                        <menuitem label="&CellularNumber.label;"
                                  id="cmd_SortByCellularNumber"
                                  accesskey="&CellularNumber.accesskey;"
                                  oncommand="SortResultPane('CellularNumber');" name="sortas" type="radio" checked="true"/>
                        <menuitem label="&PagerNumber.label;"
                                  id="cmd_SortByPagerNumber"
                                  accesskey="&PagerNumber.accesskey;"
                                  oncommand="SortResultPane('PagerNumber');" name="sortas" type="radio" checked="true"/>
                        <menuitem label="&FaxNumber.label;"
                                  id="cmd_SortByFaxNumber"
                                  accesskey="&FaxNumber.accesskey;"
                                  oncommand="SortResultPane('FaxNumber');" name="sortas" type="radio" checked="true"/>
                        <menuitem label="&HomePhone.label;"
                                  id="cmd_SortByHomePhone"
                                  accesskey="&HomePhone.accesskey;"
                                  oncommand="SortResultPane('HomePhone');" name="sortas" type="radio" checked="true"/>
                        <menuitem label="&WorkPhone.label;"
                                  id="cmd_SortByWorkPhone"
                                  accesskey="&WorkPhone.accesskey;"
                                  oncommand="SortResultPane('WorkPhone');" name="sortas" type="radio" checked="true"/>
                        <menuitem label="&Addrbook.label;"
                                  id="cmd_SortByaddrbook"
                                  accesskey="&Addrbook.accesskey;"
                                  oncommand="SortResultPane('addrbook');" name="sortas" type="radio" checked="true"/>
                        <menuseparator/>
                        <menuitem id="sortAscending" type="radio" name="sortdirection" label="&sortAscending.label;" accesskey="&sortAscending.accesskey;" oncommand="AbSortAscending()"/>
                        <menuitem id="sortDescending" type="radio" name="sortdirection" label="&sortDescending.label;" accesskey="&sortDescending.accesskey;" oncommand="AbSortDescending()"/>
                    </menupopup>
                </menu>
            </menupopup>
        </menu>

        <menu id="tasksMenu" label="&tasksMenu.label;" accesskey="&tasksMenu.accesskey;">
          <menupopup id="taskPopup">


        <!-- Moving the messengerCmd menu item item to the Window menu on the Mac -->
            <menuitem label="&importCmd.label;" accesskey="&importCmd.accesskey;" oncommand="toImport()"/>
            <menuitem label="&exportCmd.label;" accesskey="&exportCmd.accesskey;" oncommand="AbExport()"/>

            <menuitem id="menu_preferences"
                      label="&preferencesCmd2.label;"
                      accesskey="&preferencesCmd2.accesskey;"
                      command="cmd_preferences"/>
          </menupopup>
        </menu>

<!-- Mac window menu -->
    <script type="application/javascript" src="chrome://global/content/macWindowMenu.js"/>
    <commandset id="baseMenuCommandSet">
        <command id="minimizeWindow"
                 label="&minimizeWindow.label;"
                 oncommand="window.minimize();" />
        <command id="zoomWindow"
                 label="&zoomWindow.label;"
                 oncommand="zoomWindow();" />
    </commandset>
    <keyset id="baseMenuKeyset">
        <key id="key_minimizeWindow"
             command="minimizeWindow"
             key="&minimizeWindow.key;"
             modifiers="accel"/>
    </keyset>
    <menu id="windowMenu"
          label="&windowMenu.label;"
          datasources="rdf:window-mediator" ref="NC:WindowMediatorRoot"
          onpopupshowing="macWindowMenuDidShow();"
          hidden="false">
        <template>
        <rule>
            <menupopup>
                <menuitem uri="rdf:*"
                          label="rdf:http://home.netscape.com/NC-rdf#Name"
                          type="radio"
                          name="windowList"
                          oncommand="ShowWindowFromResource(event.target)"/>
            </menupopup>
        </rule>
        </template>
        <menupopup id="windowPopup">
            <menuitem command="minimizeWindow" key="key_minimizeWindow"/>
            <menuitem command="zoomWindow"/>
            <!-- decomment when "BringAllToFront" is implemented
                <menuseparator/>
                <menuitem label="&bringAllToFront.label;" disabled="true"/> -->
            <menuseparator id="sep-window-list"/>
        </menupopup>
    </menu>

      <!-- Help -->
      <menu id="helpMenu"/>
    </menubar>
   </toolbaritem>
  </toolbar>

  <toolbarpalette id="AddressBookToolbarPalette">
      <toolbarbutton class="toolbarbutton-1" id="button-newcard"
                     label="&newContactButton.label;" command="cmd_newCard"
                     tooltiptext="&newContactButton.tooltip;"/>
      <toolbarbutton class="toolbarbutton-1" id="button-newlist" label="&newlistButton.label;" tooltiptext="&newlistButton.tooltip;" command="cmd_newlist"/>
      <toolbarbutton class="toolbarbutton-1" id="button-editcard"
                     label="&editButton2.label;"
                     tooltiptext="&editButton2.tooltip;"
                     command="cmd_properties"/>
      <toolbarbutton class="toolbarbutton-1" id="button-newmessage" label="&newmsgButton.label;" tooltiptext="&newmsgButton.tooltip;" oncommand="AbNewMessage();"/>
      <toolbarbutton class="toolbarbutton-1" id="button-newim" label="&newIM.label;" tooltiptext="&newIM.tooltip;" command="cmd_chatWithCard"/>
      <toolbarbutton class="toolbarbutton-1" id="button-abdelete"
                     observes="button_delete" label="&deleteButton2.label;"
                     tooltiptext="&deleteButton2.tooltip;"
                     oncommand="goDoCommand('button_delete');"/>
      <toolbaritem id="search-container" title="&searchItem.title;"
                   align="center" flex="1"
                   class="chromeclass-toolbar-additional">
        <textbox id="peopleSearchInput" flex="1" timeout="800"
                 type="search"
                 placeholder="&SearchNameOrEmail.label;"
                 oncommand="onEnterInSearchBar();"/>
      </toolbaritem>
  </toolbarpalette>
  <!-- toolbar -->
  <toolbar id="ab-bar2" class="toolbar-primary chromeclass-toolbar"
           toolbarname="&showAbToolbarCmd.label;"
           accesskey="&showAbToolbarCmd.accesskey;"
           fullscreentoolbar="true" mode="full"
           customizable="true"
           context="toolbar-context-menu"
           iconsize="small"
           defaultset="button-newcard,button-newlist,spacer,button-editcard,button-newmessage,spacer,button-abdelete,spring,search-container">
   </toolbar>
   <toolbarset id="customToolbars" context="toolbar-context-menu"/>
  </toolbox>

  <!-- The main address book three pane -->
  <hbox id="abContent" flex="1">
    <vbox id="dirTreeBox" persist="width collapsed">
      <sidebarheader id="abDirTreeHeader" hidden="true" align="center">
        <label id="abDirTreeHeader-title" value="&dirTreeHeader.label;" control="dirTree"/>
      </sidebarheader>

      <!-- FIX ME - remove document.commandDispatcher.updateCommands() when tree selection calls this automatically -->
      <tree id="dirTree" class="abDirectory plain" seltype="single" minwidth="150" flex="1" persist="width"
            hidecolumnpicker="true"
            context="dirTreeContext"
            onselect="DirPaneSelectionChange(); document.commandDispatcher.updateCommands('addrbook-select');"
            ondblclick="DirPaneDoubleClick(event);"
            onclick="DirPaneClick(event);"
            onblur="goOnEvent(this,'blur')">

        <treecols>
          <treecol id="DirCol" flex="1" primary="true" hideheader="true"
                   crop="center" persist="width" ignoreincolumnpicker="true"/>
        </treecols>
        <treechildren/>
      </tree>
    </vbox>

    <splitter id="dirTree-splitter" collapse="before" persist="state"/>

    <vbox flex="1" minwidth="100">
      <description id="localResultsOnlyMessage"
                   value="&localResultsOnlyMessage.label;"/>
      <vbox id="blankResultsPaneMessageBox"
            flex="1" pack="center" align="center">
        <description id="blankResultsPaneMessage"
                     value="&blankResultsPaneMessage.label;"/>
      </vbox>
      <!-- results pane -->
      <tree id="abResultsTree" flex="1" enableColumnDrag="true" class="plain"
            context="abResultsTreeContext"
            onclick="AbResultsPaneOnClick(event);"
            onkeypress="AbResultsPaneKeyPress(event);"
            onselect="this.view.selectionChanged(); document.commandDispatcher.updateCommands('addrbook-select');"
            sortCol="GeneratedName"
            minheight="100" height="100"
            persist="height sortCol">

        <treecols id="abResultsTreeCols">
          <!-- these column ids must match up to the mork column names, except for GeneratedName and ChatName, see nsIAddrDatabase.idl -->
          <treecol id="GeneratedName"
                   persist="hidden ordinal width sortDirection" flex="1"
                   label="&GeneratedName.label;" primary="true"/>
          <splitter class="tree-splitter"/>
          <treecol id="PrimaryEmail"
                   persist="hidden ordinal width sortDirection" flex="1"
                   label="&PrimaryEmail.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="ChatName"
                   persist="hidden ordinal width sortDirection" flex="1"
                   label="&ChatName.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="Company"
                   persist="hidden ordinal width sortDirection" flex="1"
                   label="&Company.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="NickName"
                   persist="hidden ordinal width sortDirection" flex="1"
                   label="&NickName.label;" hidden="true"/>
          <splitter class="tree-splitter"/>
          <treecol id="SecondEmail"
                   persist="hidden ordinal width sortDirection" flex="1"
                   label="&SecondEmail.label;" hidden="true"/>
          <splitter class="tree-splitter"/>
          <treecol id="Department"
                   persist="hidden ordinal width sortDirection" flex="1"
                   label="&Department.label;" hidden="true"/>
          <splitter class="tree-splitter"/>
          <treecol id="JobTitle"
                   persist="hidden ordinal width sortDirection" flex="1"
                   label="&JobTitle.label;" hidden="true"/>
          <splitter class="tree-splitter"/>
          <treecol id="CellularNumber"
                   persist="hidden ordinal width sortDirection" flex="1"
                   label="&CellularNumber.label;" hidden="true"/>
          <splitter class="tree-splitter"/>
          <treecol id="PagerNumber"
                   persist="hidden ordinal width sortDirection" flex="1"
                   label="&PagerNumber.label;" hidden="true"/>
          <splitter class="tree-splitter"/>
          <treecol id="FaxNumber"
                   persist="hidden ordinal width sortDirection" flex="1"
                   label="&FaxNumber.label;" hidden="true"/>
          <splitter class="tree-splitter"/>
          <treecol id="HomePhone"
                   persist="hidden ordinal width sortDirection" flex="1"
                   label="&HomePhone.label;" hidden="true"/>
          <splitter class="tree-splitter"/>
          <treecol id="WorkPhone"
                   persist="hidden ordinal width sortDirection" flex="1"
                   label="&WorkPhone.label;"/>
          <splitter class="tree-splitter"/>
          <treecol id="addrbook"
                   persist="hidden ordinal width sortDirection" flex="1"
                   hidden="true"
                   label="&Addrbook.label;"/>
          <!-- LOCALIZATION NOTE: _PhoneticName may be enabled for Japanese builds. -->
          <!--
          <treecol id="_PhoneticName"
                   persist="hidden ordinal width sortDirection" flex="1"
                   label="&_PhoneticName.label;" hiddenbydefault="true"/>
          <splitter class="tree-splitter"/>
          -->
        </treecols>

        <treechildren ondraggesture="nsDragAndDrop.startDrag(event, abResultsPaneObserver);"/>
      </tree>

      <splitter id="results-splitter" collapse="after" persist="state"/>

      <!-- card view -->
      <hbox id="CardViewOuterBox" flex="1" minheight="100" height="200" persist="height">
        <vbox id="CardViewBox" flex="1">
          <vbox id="CardViewInnerBox" collapsed="true" flex="1">
            <description id="CardTitle"/>
            <hbox flex="1">
              <vbox id="cvbPhoto" class="cardViewGroup" align="center">
                <image id="cvPhoto" style="max-width: 10ch; max-height: 10ch;"/>
              </vbox>
              <vbox flex="1">
                <vbox id="cvbContact" class="cardViewGroup">
                  <description class="CardViewHeading" id="cvhContact">&contact.heading;</description>
                  <description class="CardViewLink" id="cvListNameBox">
                    <html:p><html:a href="" id="cvListName"/></html:p>
                  </description>
                  <description class="CardViewText" id="cvDisplayName"/>
                  <description class="CardViewText" id="cvNickname"/>
                  <description class="CardViewLink" id="cvEmail1Box">
                    <html:a href="" id="cvEmail1"/>
                  </description>
                  <description class="CardViewLink" id="cvEmail2Box">
                    <html:a href="" id="cvEmail2"/>
                  </description>
                </vbox>
                <vbox id="cvbHome" class="cardViewGroup">
                  <description class="CardViewHeading" id="cvhHome">&home.heading;</description>
                  <hbox>
                    <vbox flex="1">
                      <description class="CardViewText" id="cvHomeAddress"/>
                      <description class="CardViewText" id="cvHomeAddress2"/>
                      <description class="CardViewText" id="cvHomeCityStZip"/>
                      <description class="CardViewText" id="cvHomeCountry"/>
                    </vbox>
                    <vbox id="cvbHomeMapItBox" pack="end">
                      <button id="cvHomeMapIt" url="" label="&mapItButton.label;" oncommand="MapIt('cvHomeMapIt');" tooltiptext="&mapIt.tooltip;"/>
                    </vbox>
                  </hbox>
                  <description class="CardViewLink" id="cvHomeWebPageBox">
                    <html:a onclick="return openLink('cvHomeWebPage');" href="" id="cvHomeWebPage"/>
                  </description>
                </vbox>
                <vbox id="cvbOther" class="cardViewGroup">
                  <description class="CardViewHeading" id="cvhOther">&other.heading;</description>
                  <description class="CardViewText" id="cvBirthday"/>
                  <description class="CardViewText" id="cvCustom1"/>
                  <description class="CardViewText" id="cvCustom2"/>
                  <description class="CardViewText" id="cvCustom3"/>
                  <description class="CardViewText" id="cvCustom4"/>
                  <description class="CardViewText" id="cvNotes" style="white-space: pre-wrap;"/>
                  <hbox>
                    <image id="cvBuddyIcon"/>
                  </hbox>
                </vbox>
                <vbox id="cvbChat" class="cardViewGroup">
                  <description class="CardViewHeading" id="cvhChat">&chat.heading;</description>
                  <description class="CardViewText" id="cvGtalk"/>
                  <description class="CardViewText" id="cvAIM"/>
                  <description class="CardViewText" id="cvYahoo"/>
                  <description class="CardViewText" id="cvSkype"/>
                  <description class="CardViewText" id="cvQQ"/>
                  <description class="CardViewText" id="cvMSN"/>
                  <description class="CardViewText" id="cvICQ"/>
                  <description class="CardViewText" id="cvXMPP"/>
                  <description class="CardViewText" id="cvIRC"/>
                </vbox>
                <!-- the description and addresses groups are only for mailing lists -->
                <vbox id="cvbDescription" class="cardViewGroup">
                  <description class="CardViewHeading" id="cvhDescription">&description.heading;</description>
                  <description class="CardViewText" id="cvDescription"/>
                </vbox>
                <vbox id="cvbAddresses" class="cardViewGroup">
                  <description class="CardViewHeading" id="cvhAddresses">&addresses.heading;</description>
                </vbox>
              </vbox>

              <spacer width="20"/>

              <vbox flex="1">
                <vbox id="cvbPhone" class="cardViewGroup">
                  <description class="CardViewHeading" id="cvhPhone">&phone.heading;</description>
                  <description class="CardViewText" id="cvPhWork"/>
                  <description class="CardViewText" id="cvPhHome"/>
                  <description class="CardViewText" id="cvPhFax"/>
                  <description class="CardViewText" id="cvPhCellular"/>
                  <description class="CardViewText" id="cvPhPager"/>
                </vbox>
                <vbox id="cvbWork" class="cardViewGroup">
                  <description class="CardViewHeading" id="cvhWork">&work.heading;</description>
                  <description class="CardViewText" id="cvJobTitle"/>
                  <description class="CardViewText" id="cvDepartment"/>
                  <description class="CardViewText" id="cvCompany"/>
                  <hbox>
                    <vbox flex="1">
                      <description class="CardViewText" id="cvWorkAddress"/>
                      <description class="CardViewText" id="cvWorkAddress2"/>
                      <description class="CardViewText" id="cvWorkCityStZip"/>
                      <description class="CardViewText" id="cvWorkCountry"/>
                    </vbox>
                    <vbox id="cvbWorkMapItBox" pack="end">
                      <button id="cvWorkMapIt" url="" label="&mapItButton.label;" oncommand="MapIt('cvWorkMapIt');" tooltiptext="&mapIt.tooltip;"/>
                    </vbox>
                  </hbox>
                  <description class="CardViewLink" id="cvWorkWebPageBox">
                    <html:a onclick="return openLink('cvWorkWebPage');" href="" id="cvWorkWebPage"/>
                  </description>
                </vbox>
              </vbox>
            </hbox>
          </vbox>
        </vbox>
      </hbox>
    </vbox>
  </hbox>
  <panel id="customizeToolbarSheetPopup" noautohide="true">
    <iframe id="customizeToolbarSheetIFrame"
            style="&dialog.dimensions;"
            hidden="true"/>
  </panel>

  <statusbar id="status-bar" class="chromeclass-status">
    <statusbarpanel id="statusText" flex="1" value="&statusText.label;"/>
  </statusbar>
</window>
