<?xml version="1.0" encoding="UTF-8"?>

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

<?xul-overlay href="chrome://help/content/helpContextOverlay.xul"?>
<!DOCTYPE window [
    <!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
    %brandDTD;
    <!ENTITY % helpDTD SYSTEM "chrome://help/locale/help.dtd">
    %helpDTD;
]>

<window id="help"
        windowtype="mozilla:help"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        width="700"
        height="550"
        persist="width height screenX screenY"
        onload="init();"
        onunload="window.XULBrowserWindow.destroy();">

    <script type="application/x-javascript" src="chrome://help/content/toolbarCustomization.js"/>
    <script type="application/x-javascript" src="chrome://help/content/help.js"/>
    <script type="application/x-javascript" src="chrome://browser/content/sessionHistoryUI.js"/>
    <script type="application/x-javascript" src="chrome://global/content/findUtils.js"/>
    <script type="application/x-javascript" src="chrome://global/content/viewZoomOverlay.js"/>
    <script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>

    <menupopup id="backMenu" position="after_start"
        onpopupshowing="return createBackMenu(event);"
        oncommand="gotoHistoryIndex(event);"/>
    <menupopup id="forwardMenu" position="after_start"
        onpopupshowing="return createForwardMenu(event);"
        oncommand="gotoHistoryIndex(event);"/>
    <popupset id="contentAreaContextSet"/>
    <popup id="toolbar-context-menu">
      <menuitem command="cmd_CustomizeToolbars"
                label="&viewCustomizeToolbar.label;"
                accesskey="&viewCustomizeToolbar.accesskey;"/>
    </popup>    
    <broadcasterset id="helpBroadcasters">
        <broadcaster id="canGoBack"    disabled="true"/>
        <broadcaster id="canGoForward" disabled="true"/>
    </broadcasterset>
    <commandset id="globalEditMenuItems"/>
    <commandset id="selectEditMenuItems">
        <command id="cmd_close" oncommand="close();"/>
        <command id="Help:Home" oncommand="goHome();"/>
        <command id="Help:Back" oncommand="goBack();"       observes="canGoBack"/>
        <command id="Help:Forward" oncommand="goForward();" observes="canGoForward"/>
        <command id="Help:Find" oncommand="helpBrowser.find();"/>
        <command id="Help:FindAgain" oncommand="helpBrowser.findAgain();"/>      
	<command id="Help:ToggleSidebar" oncommand="toggleSidebar();"/>
	 <command id="cmd_closeWindow" oncommand="close();"/>
        <command id="cmd_textZoomReduce" oncommand="ZoomManager.prototype.getInstance().reduce();"/>
        <command id="cmd_textZoomEnlarge" oncommand="ZoomManager.prototype.getInstance().enlarge();"/>
        <command id="cmd_CustomizeToolbars" oncommand="CustomizeToolbar('help-toolbox');"/>
    </commandset>
    <commandset id="clipboardEditMenuItems"/>
    <commandset id="viewZoomCommands"/>
    <keyset id="keys">
        <key id="key_close"/>
        <key id="printKb" key="&printCmd.commandkey;" oncommand="print();"
            modifiers="accel"/>
        <keyset id="viewZoomKeys"/>
        <keyset id="navigationKeys"/>
        <key id="key_find" key="&findOnCmd.commandkey;"
            command="Help:Find" modifiers="accel"/>
        <key id="key_findAgain" key="&findAgainCmd.commandkey;"
            command="Help:FindAgain" modifiers="accel"/>
        <key id="key_closeWindow" key="&closeWindow.commandkey;"
            command="cmd_closeWindow" modifiers="accel"/>
        <key id="key_closeWindow2" keycode="VK_ESCAPE"
            command="cmd_closeWindow"/>
        <key id="key_textZoomEnlarge" key="&textZoomEnlargeCmd.commandkey;"
            command="cmd_textZoomEnlarge" modifiers="accel"/>
        <key id="key_textZoomEnlarge2" key="&textZoomEnlargeCmd.commandkey2;"
            command="cmd_textZoomEnlarge" modifiers="accel"/>
        <key id="key_textZoomReduce" key="&textZoomReduceCmd.commandkey;"
            command="cmd_textZoomReduce" modifiers="accel"/>
        <key id="key_textZoomReset" key="&textZoomResetCmd.commandkey;"
            oncommand="ZoomManager.prototype.getInstance().reset();" modifiers="accel"/>
        <key id="key_toggleSidebar" keycode="VK_F9" command="Help:ToggleSidebar"/>
        <key id="key_viewNextHelpPanel" keycode="VK_TAB" 
             oncommand="showRelativePanel(true);" modifiers="control"/>
        <key id="key_viewPrevHelpPanel" keycode="VK_TAB" 
             oncommand="showRelativePanel(false);" modifiers="control,shift"/>
    </keyset>
    <stringbundle id="bundle_viewZoom"/>
    <stringbundle id="findBundle"
        src="chrome://global/locale/finddialog.properties"/>
    <stringbundle id="bundle_help"
        src="chrome://help/locale/help.properties"/>

    <vbox flex="1">

        <toolbox id="help-toolbox" class="toolbox-top" mode="icons" iconsize="small" customizable="true">
            
            <toolbarpalette id="HelpToolbarPalette">
            
                <toolbarbutton id="help-sidebar-button"
                	class="toolbarbutton-1"
                	customizeable="true" label="&sidebarBtn.label;"
                	command="Help:ToggleSidebar"/>
                <toolbarbutton id="help-back-button" type="menu-button"
                        class="browserButton" label="&backButton.label;"
                        oncommand="if (event.target==this) goBack(); else gotoHistoryIndex(event);"
                        observes="canGoBack" context="backMenu"
                        tooltiptext="&backButton.tooltip;">
                    <menupopup context=""
                        onpopupshowing="createBackMenu(event);"/>
                </toolbarbutton>
                <toolbarbutton id="help-forward-button" type="menu-button"
                        class="browserButton"
                        label="&forwardButton.label;"
                        oncommand="if (event.target==this) goForward(); else gotoHistoryIndex(event);"
                        tooltiptext="&forwardButton.tooltip;"
                        observes="canGoForward">
                    <menupopup context=""
                        onpopupshowing="createForwardMenu(event);"/>
                </toolbarbutton>
                <toolbarbutton id="help-home-button"
                    class="browserButton" label="&homeButton.label;"
                    command="Help:Home"/>
                <toolbarbutton id="help-find-button"
                    class="toolbarbutton-1" label="&findBtn.label;"
                    command="Help:Find"/>
                <toolbarbutton id="help-zoom-small-button"
                    class="toolbarbutton-1" label="&textZoomReduceBtn.label;"
                    command="cmd_textZoomReduce"/>
                <toolbarbutton id="help-zoom-large-button"
                    class="toolbarbutton-1" label="&textZoomEnlargeBtn.label;"
                    command="cmd_textZoomEnlarge"/>    
                <toolbarbutton id="help-print-button" class="browserButton"
                    label="&printButton.label;"
                    oncommand="print();"
                    tooltiptext="&printButton.tooltip;"/>
                <toolbarbutton id="help-toolbar-customization" class="toolbarbutton-1"
                    label="&cmd_CustomizeToolbars.label;"
                    command="cmd_CustomizeToolbars"
                    tooltiptext="&customizeButton.tooltip;"/>
                
                <toolbaritem id="throbber-box" title="&throbberItem.title;"
                    align="center" pack="center">
                  <button id="help-throbber" tooltiptext="&throbber.tooltip;"
                    command="Help:Home"/>
                </toolbaritem>
            </toolbarpalette>
            <toolbar id="helpToolbar" toolbarname="Help Toolbar" class="toolbar-primary
                    chromeclass-toolbar" mode="icons" iconsize="small"
                    customizable="true"
                    defaultset="help-sidebar-button,separator,help-back-button,help-forward-button,help-home-button,separator,help-toolbar-customization,spring,help-print-button,separator,spacer,throbber-box"
                    context="toolbar-context-menu"/>
	    <toolbarset id="customToolbars"/>
        </toolbox>

        <hbox flex="1">
            <vbox id="helpsidebar-box" persist="width">

                <!-- glossary panel -->
                <toolbarbutton id="help-glossary-btn"
                    class="box-texttab texttab-sidebar"
                    label="&glossarytab.label;"
                    oncommand="showPanel('help-glossary')"
                    accesskey="&glossarytab.accesskey;"/>
                <tree id="help-glossary-panel" class="focusring"
                        flex="1" hidecolumnpicker="true"
                        hidden="true" datasources="rdf:null"
                        containment="http://home.netscape.com/NC-rdf#subheadings"
                        ref="urn:root" flags="dont-build-content"
                        onselect="onselect_loadURI(this)">
                    <template>
                        <rule>
                            <conditions>
                                <content uri="?uri"/>
                                <triple subject="?uri"
                                    predicate="http://home.netscape.com/NC-rdf#subheadings"
                                    object="?subheadings"/>
                                <member container="?subheadings"
                                    child="?subheading"/>
                            </conditions>
                            <bindings>
                                <binding subject="?subheading"
                                    predicate="http://home.netscape.com/NC-rdf#name"
                                    object="?name"/>
                            </bindings>

                            <action>
                                <treechildren>
                                    <treeitem uri="?subheading">
                                        <treerow>
                                            <treecell label="?name"/>
                                        </treerow>
                                    </treeitem>
                                </treechildren>
                            </action>
                        </rule>
                    </template>
                    <treecols>
                        <treecol id="GlossaryNameColumn" flex="1"
                            hideheader="true" primary="true"/>
                    </treecols>
                </tree>

                <toolbarbutton id="help-index-btn" class="box-texttab texttab-sidebar"
                    label="&indextab.label;"
                    oncommand="showPanel('help-index');expandAllIndexEntries();"
                    accesskey="&indextab.accesskey;"/>

                <tree id="help-index-panel" class="focusring"
                        flex="1" datasources="rdf:null"
                        hidecolumnpicker="true" hidden="true"
                        containment="http://home.netscape.com/NC-rdf#subheadings"
                        ref="urn:root"
                        flags="dont-build-content dont-test-empty"
                        onselect="onselect_loadURI(this)">
                    <template>
                        <rule>
                            <conditions>
                                <content uri="?uri"/>
                                <triple subject="?uri"
                                    predicate="http://home.netscape.com/NC-rdf#subheadings"
                                    object="?subheadings"/>
                                <member container="?subheadings"
                                    child="?subheading"/>
                            </conditions>
                            <bindings>
                                <binding subject="?subheading"
                                    predicate="http://home.netscape.com/NC-rdf#name"
                                    object="?name"/>
                            </bindings>

                            <action>
                                <treechildren>
                                    <treeitem uri="?subheading">
                                        <treerow>
                                            <treecell label="?name"/>
                                        </treerow>
                                    </treeitem>
                                </treechildren>
                            </action>
                        </rule>
                    </template>
                    <treecols>
                        <treecol id="IndexNameColumn" flex="1" hideheader="true"
                            primary="true" sortActive="true"
                            sortDirection="ascending" sort="?name"/>
                    </treecols>
                </tree>

                <toolbarbutton id="help-search-btn" class="box-texttab texttab-sidebar"
                    label="&searchtab.label;"
                    oncommand="showPanel('help-search')"
                    accesskey="&searchtab.accesskey;"/>

                <vbox id="help-search-panel" hidden="true" flex="1">
                    <hbox align="center">
                        <textbox id="findText" flex="1" oninput="doEnabling();"
                            onkeypress="if ((event.keyCode 
                                == KeyEvent.DOM_VK_ENTER) || (event.keyCode
                                == KeyEvent.DOM_VK_RETURN))
                                doFind();"/>
                        <button id="findButton" default="true" disabled="true"
                            label="&gobtn.label;" oncommand="doFind()"
                            flex="0"/>
                    </hbox>
                    <tree id="help-search-tree" class="focusring"
                            flex="1" hidecolumnpicker="true"
                            datasources="rdf:null"
                            containment="http://home.netscape.com/NC-rdf#child"
                            ref="urn:root" flags="dont-build-content"
                            onselect="onselect_loadURI(this)">
                        <template>
                            <rule>
                                <conditions>
                                    <content uri="?uri"/>
                                    <member container="?uri"
                                        child="?subheading"/>
                                </conditions>

                                <bindings>
                                    <binding subject="?subheading"
                                        predicate="http://home.netscape.com/NC-rdf#name"
                                        object="?name"/>
                                </bindings>

                                <action>
                                    <treechildren>
                                        <treeitem uri="?subheading">
                                            <treerow>
                                                <treecell label="?name"/>
                                            </treerow>
                                        </treeitem>
                                    </treechildren>
                                </action>
                            </rule>
                        </template>

                        <treecols>
                            <treecol id="ResultsColumn" flex="1"
                                hideheader="true" primary="true"
                                sortActive="true" sortDirection="ascending"
                                sort="?name"/>
                        </treecols>
                    </tree>
                </vbox>

                <toolbarbutton id="help-toc-btn" class="box-texttab texttab-sidebar"
                    label="&toctab.label;"
                    oncommand="showPanel('help-toc')"
                    accesskey="&toctab.accesskey;"/>
                <tree id="help-toc-panel" class="focusring" 
                        flex="1"  hidecolumnpicker="true"
                        datasources="rdf:null"
                        containment="http://home.netscape.com/NC-rdf#subheadings"
                        ref="urn:root" flags="dont-build-content"
                        onselect="onselect_loadURI(this)">
                    <template>
                        <rule>
                            <conditions>
                                <content uri="?uri"/>
                                <triple subject="?uri"
                                    predicate="http://home.netscape.com/NC-rdf#subheadings"
                                    object="?subheadings"/>
                                <member container="?subheadings"
                                    child="?subheading"/>
                            </conditions>

                            <bindings>
                                <binding subject="?subheading"
                                    predicate="http://home.netscape.com/NC-rdf#name"
                                    object="?name"/>
                            </bindings>

                            <action>
                                <treechildren>
                                    <treeitem uri="?subheading">
                                        <treerow>
                                            <treecell label="?name"/>
                                        </treerow>
                                    </treeitem>
                                </treechildren>
                            </action>
                        </rule>
                    </template>
                    <treecols>
                        <treecol id="NameColumn" flex="1" hideheader="true"
                            primary="true"/>
                    </treecols>
                </tree>

            </vbox>

            <splitter id="helpsidebar-splitter" collapse="before"
                    persist="state hidden" autostretch="never" state="open">
            </splitter>

            <vbox id="appcontent" flex="3">
                <!-- this box is temporary, pending XBLified <browser> -->
                <hbox id="browser" flex="1">
                    <!-- type attribute is used by frame construction to locate
                        iframes intended to hold (html) content -->
                    <browser context="contentAreaContextMenu"
                        type="content-primary" id="help-content"
                        src="about:blank" flex="1"/>
                </hbox>
            </vbox>
        </hbox>
    </vbox>
</window>
