<?xml version="1.0"?> 
<?xml-stylesheet href="xul.css" type="text/css"?> 
<!DOCTYPE window> 
<xul:window xmlns:html="http://www.w3.org/1999/xhtml"
        xmlns:xul ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 

  <html:script>
  function StartUp()
  {
    dump("Doing Startup...\n");
    appCore = XPAppCoresManager.Find("BrowserAppCore");  
    dump("Looking up BrowserAppCore...\n");
    if (appCore == null) {
      dump("Creating BrowserAppCore...\n");
      appCore = new BrowserAppCore();
      if (appCore != null) {
        dump("BrowserAppCore has been created.\n");
        appCore.Init("BrowserAppCore");
	    appCore.setToolbarWindow(window);
	    appCore.setContentWindow(window.parent.frames[1]);
	    appCore.setWebShellWindow(window.parent);
        appCore.setDisableCallback("DoDisableButtons();");
        appCore.setEnableCallback("DoEnableButtons();");
        dump("Adding BrowserAppCore to AppCoreManager...\n");
        XPAppCoresManager.Add(appCore);  
      }
    } else {
      dump("BrowserAppCore has already been created! Why?\n");
	}
  }

  function DoDisableButtons()
  {
    // Find buttons in the UI and disable them
    dump("Browser disabling buttons\n");
  }

  function DoEnableButtons()
  {
    // Find buttons in the UI and enable them
    dump("Browser enabling buttons\n");
  }

  function BrowserBack()
  {
    appCore = XPAppCoresManager.Find("BrowserAppCore");  
    if (appCore != null) {
	  dump("Going Back\n");
      appCore.back();
    } else {
      dump("BrowserAppCore has not been created!\n");
    }
  }

  function BrowserForward()
  {
    appCore = XPAppCoresManager.Find("BrowserAppCore");  
    if (appCore != null) {
	  dump("Going Forward\n");
      appCore.forward();
    } else {
      dump("BrowserAppCore has not been created!\n");
    }
  }

  function BrowserNewWindow()
  {
    appCore = XPAppCoresManager.Find("BrowserAppCore");  
    if (appCore != null) {
	  dump("Opening New Window\n");
      appCore.newWindow();
    } else {
      dump("BrowserAppCore has not been created!\n");
    }
  }

  function BrowserPrintPreview()
  {
    dump("BrowserPrintPreview\n");
  }

  function BrowserClose()
  {
    dump("BrowserClose\n");
  }

  function BrowserExit()
  {
    appCore = XPAppCoresManager.Find("BrowserAppCore");  
    if (appCore != null) {
	  dump("Exiting\n");
      appCore.exit();
    } else {
      dump("BrowserAppCore has not been created!\n");
    }
  }


  </html:script>


  <xul:commands>
    <xul:command name="nsCmd:StartUp" onCommand="StartUp();"/>
    <xul:command name="nsCmd:BrowserBack" onCommand="BrowserBack();"/>
    <xul:command name="nsCmd:BrowserForward" onCommand="BrowserForward();"/>
    <xul:command name="nsCmd:BrowserReload" onCommand="window.reload();"/>
    <xul:command name="nsCmd:BrowserStop" onCommand="window.stop();"/>
    <xul:command name="nsCmd:BrowserHome" onCommand="window.home();"/>
    <xul:command name="nsCmd:BrowserPrint" onCommand="window.print();"/>
    <xul:command name="nsCmd:BrowserNewWindow" onCommand="BrowserNewWindow();"/>
    <xul:command name="nsCmd:BrowserExit" onCommand="BrowserExit();"/>
    <!-- other parameters of command are assumed to have
      some useful initial value -->
  </xul:commands>
  <xul:menubar>
    <xul:menu name="File">
      <xul:menuitem name="New Window" cmd="nsCmd:BrowserNewWindow"/>
      <xul:separator/>
      <xul:menuitem name="Print Setup" cmd="nsCmd:BrowserPrintSetup"/>
      <xul:menuitem name="Print Preview" cmd="nsCmd:BrowserPrintPreview"/>
      <xul:menuitem name="Print" cmd="nsCmd:BrowserPrint"/>
      <xul:separator/>
      <xul:menuitem name="Close" cmd="nsCmd:BrowserClose"/>
      <xul:menuitem name="Exit" cmd="nsCmd:BrowserExit"/>
    </xul:menu>
    <xul:menu name="View">
      <xul:menuitem name="Reload" cmd="nsCmd:BrowserReload"/>
    </xul:menu>
    <xul:menu name="Go">
      <xul:menuitem name="Back" cmd="nsCmd:BrowserBack"/>
      <xul:menuitem name="Forward" cmd="nsCmd:BrowserForward" />
      <xul:menuitem name="Home" cmd="nsCmd:BrowserHome"/>
    </xul:menu>

  </xul:menubar>
  
  <xul:toolbox>
  
    <xul:toolbar>
          <html:button cmd="nsCmd:BrowserBack" style="font-size:smaller;background-color:rgb(192,192,192);">
                          <html:img src="resource:/res/toolbar/TB_Back.gif"/><html:br/>Back
          </html:button>
          <html:button cmd="nsCmd:BrowserForward" style="font-size:smaller;background-color:rgb(192,192,192);">
                          <html:img src="resource:/res/toolbar/TB_Forward.gif"/><html:br/>Forward
          </html:button>
          <html:button cmd="nsCmd:BrowserReload" style="font-size:smaller;background-color:rgb(192,192,192);">
                          <html:img src="resource:/res/toolbar/TB_Reload.gif"/><html:br/>Reload
          </html:button>
          <html:button cmd="nsCmd:BrowserStop" style="font-size:smaller;background-color:rgb(192,192,192);">
                          <html:img src="resource:/res/toolbar/TB_Stop.gif"/><html:br/>Stop
          </html:button>
          <html:button cmd="nsCmd:BrowserHome" style="font-size:smaller;background-color:rgb(192,192,192);">
                          <html:img src="resource:/res/toolbar/TB_Home.gif"/><html:br/>Home
          </html:button>
          <html:button cmd="nsCmd:BrowserPrint" style="font-size:smaller;background-color:rgb(192,192,192);">
                          <html:img src="resource:/res/toolbar/TB_Print.gif"/><html:br/>Print
          </html:button>
    	   <html:button cmd="nsCmd:BrowserHome">
             <html:img src="resource:/res/throbber/anims00.gif"/>
          </html:button>	      
    </xul:toolbar>
    <xul:toolbar style="background-color:rgb(192,192,192);">
          <html:button cmd="nsCmd:BrowserBookmarks" style="font-size:smaller;background-color:rgb(192,192,192);">
                          <html:img src="resource:/res/toolbar/TB_Bookmarks.gif"/>Bookmarks
          </html:button>
		      <html:input style="width:325px;"/>   
          <html:button cmd="nsCmd:BrowserWhatsRelated" style="font-size:smaller;background-color:rgb(192,192,192);">
                          <html:img src="resource:/res/toolbar/TB_WhatsRelated.gif"/>What's Related
          </html:button>
    </xul:toolbar>
    
    <xul:toolbar>
    	<html:button cmd="nsCmd:BrowserHome" style="font-size:smaller;background-color:rgb(192,192,192);">
             <html:img src="resource:/res/toolbar/TB_Location.gif"/>Mozilla.org
      </html:button>
    	<html:button cmd="nsCmd:BrowserHome" style="font-size:smaller;background-color:rgb(192,192,192);">
             <html:img src="resource:/res/toolbar/TB_Location.gif"/>Mozilla.org
      </html:button>
    	<html:button cmd="nsCmd:BrowserHome" style="font-size:smaller;background-color:rgb(192,192,192);">
             <html:img src="resource:/res/toolbar/TB_Location.gif"/>Mozilla.org
      </html:button>
    </xul:toolbar>
    
  </xul:toolbox>
  
</xul:window>

