<?xml version="1.0"?>

<bindings id="xulBindings"
   xmlns="http://www.mozilla.org/xbl"
   xmlns:html="http://www.w3.org/1999/xhtml"
   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  
  <binding id="thumb" extends="xul:box">
    <content>
      <xul:spring flex="1"/>
		  <xul:image inherits="src"/>
		  <xul:spring flex="1"/>
    </content>
  </binding>

  <binding id="scrollbar">
    <content>
      <xul:scrollbarbutton type="decrement">
	      <xul:image inherits="src"/>
	    </xul:scrollbarbutton>
      <xul:slider flex="1" inherits="curpos,maxpos,pageincrement,increment">
	      <xul:thumb inherits="align,src" flex="1"/>
      </xul:slider>
      <xul:scrollbarbutton type="increment">
	    <xul:image inherits="src"/>
	  </xul:scrollbarbutton>
    </content>
  </binding>

  <binding id="slider">
    <content>
	  <xul:button align="horizontal"/>
	</content>
  </binding>

  <binding id="tab">
    <content>
      <xul:image inherits="src" class="tab-left"/>
      <xul:text flex="1" inherits="value,crop,accesskey" crop="right" class="tab-text"/>
    </content>
  </binding>


  <binding id="menu-menubar">
    <content excludes="template,observes,menupopup">
      <xul:text class="menubar-text" inherits="value,accesskey,crop" crop="right"/>
    </content>
  </binding>

  <binding id="menu-menubar-iconic">
    <content excludes="template,observes,menupopup">
      <xul:image class="menubar-left"/>
      <xul:text class="menubar-text" inherits="value,accesskey,crop" crop="right"/>
    </content>
  </binding>

  <binding id="menu">
    <content autostretch="never" excludes="template,observes,menupopup">
      <xul:text class="menu-text" flex="1" align="left" inherits="value,accesskey,crop" crop="right"/>
      <xul:text class="menu-accel" inherits="acceltext:value"/>
      <xul:box autostretch="never" class="menu-right" inherits="menuactive,disabled">
        <xul:image/>
      </xul:box>
    </content>
    <interface>
      <property name="data" onset="this.setAttribute('data',val); return val;"
                            onget="return this.getAttribute('data');"/>
    </interface>  
  </binding>

  <binding id="menuitem">
    <content autostretch="never" excludes="template,observes,menupopup">
      <xul:text class="menu-text" flex="1" align="left" inherits="value,accesskey,crop" crop="right"/>
      <xul:text class="menu-accel" inherits="acceltext:value"/>
    </content>
    <interface>
      <property name="data" onset="this.setAttribute('data',val); return val;"
                            onget="return this.getAttribute('data');"/>
    </interface>  
  </binding>

  <binding id="menuitem-iconic">
    <content excludes="template,observes,menupopup">
      <xul:box class="menu-iconic-left" orient="vertical" autostretch="never" inherits="selected,menuactive,disabled">
        <xul:image/>
      </xul:box>
      <xul:text class="menu-iconic-text" flex="1" align="left" inherits="value,accesskey,crop" crop="right"/>
      <xul:text class="menu-iconic-accel" inherits="acceltext:value"/>
    </content>
    <interface>
      <property name="data" onset="this.setAttribute('data',val); return val;"
                            onget="return this.getAttribute('data');"/>
    </interface>  
  </binding>

  <binding id="menu-iconic">
    <content autostretch="never" excludes="template,observes,menupopup">
      <xul:box class="menu-iconic-left" orient="vertical" autostretch="never">
        <xul:image/>
      </xul:box>
      <xul:text class="menu-iconic-text" flex="1" align="left" inherits="value,accesskey,crop" crop="right"/>
      <xul:text class="menu-iconic-accel" inherits="acceltext:value"/>
      <xul:box orient="vertical" autostretch="never" class="menu-right" inherits="menuactive,disabled">
        <xul:image/>
      </xul:box>
    </content>
    <interface>
      <property name="data" onset="this.setAttribute('data',val); return val;"
                            onget="return this.getAttribute('data');"/>
    </interface>  
  </binding>
  
  <binding id="basetext">
    <interface>
      <!-- public interface -->
      <property name="value"      onset="return this.setAttribute('value',val);"
                                  onget="return this.getAttribute('value');"/>
      <property name="crop"       onset="return this.setAttribute('crop',val);"
                                  onget="return this.getAttribute('crop');"/>
      <property name="disabled"   onset="return this.setAttribute('disabled',val);"
                                  onget="return this.getAttribute('disabled');"/>
      <property name="src"        onset="return this.setAttribute('src',val);"
                                  onget="return this.getAttribute('src');"/>
      <property name="accesskey"  onset="return this.setAttribute('accesskey',val);"
                                  onget="return this.getAttribute('accesskey');"/>
      <property name="imgalign"   onset="return this.setAttribute('imgalign',val);"
                                  onget="return this.getAttribute('imgalign');"/>
    </interface>      
  </binding>
  
  <binding id="checkbox" extends="chrome://global/content/xulBindings.xml#basetext">
    <content>
      <xul:box flex="1" class="internal-box" autostretch="never" valign="top">
        <xul:box class="checkmark-box" autostretch="never">
          <xul:image class="checkbox-check"/>
        </xul:box>
        <xul:image class="checkbox-icon" inherits="src"/>
        <xul:html inherits="value,accesskey,crop" flex="1">
          <children/>
        </xul:html>
      </xul:box>
    </content>
    <interface>
      <!-- public interface -->
      <property name="checked"    onset="if (val) this.setAttribute('checked', 'true');
                                         else this.removeAttribute('checked');
                                         return val;"
                                  onget="var v = this.getAttribute('checked');
                                         if (v == 'true') return true; return false;"/>
    </interface>
    <handlers>
      <handler type="click" value="this.checked = !this.checked;"/>
      <handler type="keypress" key=" " value="this.checked = !this.checked;"/>
    </handlers>
  </binding>

  <!-- XUL <button>s -->
  <binding id="buttonleft" extends="chrome://global/content/xulBindings.xml#basetext">
    <content excludes="observes,template">
  	  <xul:box class="button-internal-box" autostretch="never" flex="1">
        <xul:image class="button-icon" inherits="src"/>
        <xul:box orient="vertical" class="button-text-container" autostretch="never" flex="1">
          <xul:text class="button-text" inherits="value,accesskey,crop"/>
        </xul:box>
      </xul:box>
    </content>
  </binding>

  <binding id="buttontop" extends="chrome://global/content/xulBindings.xml#basetext">
    <content excludes="observes,template">
  	  <xul:box class="button-internal-box" orient="vertical" autostretch="never" flex="1">
        <xul:image class="button-icon" inherits="src"/>
        <xul:box orient="vertical" class="button-text-container" autostretch="never" flex="1">
          <xul:text class="button-text" inherits="value,accesskey,crop"/>
        </xul:box>
      </xul:box>
    </content>
  </binding>
  
  <binding id="buttonright" extends="chrome://global/content/xulBindings.xml#basetext">
    <content excludes="observes,template">
  	  <xul:box class="button-internal-box" inherits="orient" autostretch="never" flex="1">
        <xul:box orient="vertical" class="button-text-container" autostretch="never" flex="1">
          <xul:text class="button-text" inherits="value,accesskey,crop"/>
        </xul:box>
        <xul:image class="button-icon" inherits="src"/>
      </xul:box>
    </content>
  </binding>

  <binding id="buttonbottom" extends="chrome://global/content/xulBindings.xml#basetext">
    <content excludes="observes,template">
  	  <xul:box class="button-internal-box" orient="vertical" autostretch="never" flex="1">
        <xul:box orient="vertical" class="button-text-container" autostretch="never" flex="1">
          <xul:text class="button-text" inherits="value,accesskey,crop"/>
        </xul:box>
        <xul:image class="button-icon" inherits="src"/>
      </xul:box>
    </content>
  </binding>
  
  <binding id="separator" extends="xul:spring"/>

  <!-- appending to the end so we don't make hyatt cry -->
  <binding id="progressmeter" extends="xul:box">
    <content excludes="observes,template">
      <xul:box class="progressmeter-internal-box" flex="1">
        <xul:stack class="progressmeter-stack" flex="1">
          <xul:progressbar class="progressmeter-progressbar" inherits="value,statusbar">
            <xul:box class="progress-bar"/>
            <xul:box class="progress-remainder"/>
          </xul:progressbar>
          <xul:box>
            <xul:spring flex="1"/>
            <xul:text class="progress-text" inherits="progresstext:value"/>
            <xul:spring flex="1"/>
          </xul:box>
        </xul:stack>
      </xul:box>
    </content>
    <interface>
      <property name="progresstext"   onset="return this.setAttribute('progresstext',val);"
                                      onget="return this.getAttribute('progresstext');"/>
      <property name="value"          onset="return this.setAttribute('value',val);"
                                      onget="return this.getAttribute('value');"/>
    </interface>
  </binding>

  <binding id="textfield" extends="xul:box">
    <content excludes="observes,template">
      <xul:box class="textfield-internal-box" flex="1">
        <html:input class="textfield-input" flex="1" inherits="value,type,maxlength,disabled,size,readonly"/>
      </xul:box>
    </content>
    <interface>
      <property name="value"      onset="document.getAnonymousNodes(this)[0].firstChild.value = val; return val;"
                                  onget="return document.getAnonymousNodes(this)[0].firstChild.value;"/>
      <property name="type"       onset="document.getAnonymousNodes(this)[0].firstChild.type = val; return val;"
                                  onget="return document.getAnonymousNodes(this)[0].firstChild.type;"/>
      <property name="maxlength"  onset="document.getAnonymousNodes(this)[0].firstChild.maxlength = val; return val;"
                                  onget="return document.getAnonymousNodes(this)[0].firstChild.maxlength;"/>
      <property name="disabled"   onset="document.getAnonymousNodes(this)[0].firstChild.disabled = val; return val;"
                                  onget="return document.getAnonymousNodes(this)[0].firstChild.disabled;"/>
      <property name="size"       onset="document.getAnonymousNodes(this)[0].firstChild.size = val; return val;"
                                  onget="return document.getAnonymousNodes(this)[0].firstChild.size;"/>
      <property name="readonly"   onset="document.getAnonymousNodes(this)[0].firstChild.readonly = val; return val;"
                                  onget="return document.getAnonymousNodes(this)[0].firstChild.readonly;"/>

      <method name="select">
        <body>
          document.getAnonymousNodes(this)[0].firstChild.select();
        </body>
      </method>

      <property name="controllers"    onget="return document.getAnonymousNodes(this)[0].firstChild.controllers;"/>
      <property name="textLength"     onget="return document.getAnonymousNodes(this)[0].firstChild.textLength;"/>
      <property name="selectionStart" onset="document.getAnonymousNodes(this)[0].firstChild.selectionStart = val; return val;"
                                      onget="return document.getAnonymousNodes(this)[0].firstChild.selectionStart;"/>
      <property name="selectionEnd"   onset="document.getAnonymousNodes(this)[0].firstChild.selectionEnd = val; return val;"
                                      onget="return document.getAnonymousNodes(this)[0].firstChild.selectionEnd;"/>

      <method name="setSelectionRange">
        <argument name="aSelectionStart"/>
        <argument name="aSelectionEnd"/>
        <body>
          document.getAnonymousNodes(this)[0].firstChild.setSelectionRange( aSelectionStart, aSelectionEnd );
        </body>
      </method>
    </interface>
    <handlers>
      <handler type="focus" value="this.setAttribute('focused','true'); document.getAnonymousNodes(this)[0].firstChild.focus(); "/>
      <handler type="blur" value="this.removeAttribute('focused'); document.getAnonymousNodes(this)[0].firstChild.blur();"/>
    </handlers>    
  </binding>

  <binding id="textarea" extends="chrome://global/content/xulBindings.xml#textfield">
    <content excludes="observes,template">
      <xul:box class="textarea-internal-box" flex="1">
        <html:textarea class="textfield-textarea" flex="1" inherits="value,disabled,rows,cols,readonly"/>
      </xul:box>
    </content>
  </binding>

  <binding id="text">
    <handlers>
      <handler type="click" value="var forElementID = this.getAttribute('for'); if(forElementID) var forElement = document.getElementById(forElementID); if(forElement) forElement.focus();"/>
    </handlers>
  </binding>
  
  <binding id="text-editable-display" extends="chrome://global/content/xulBindings.xml#text"/>
  
  <binding id="text-editable-edit" extends="xul:box">
    <content>
      <xul:box flex="1">
        <html:input type="text" inherits="value,type,maxlength,disabled,size,readonly"/>
      </xul:box>
    </content>
    <handlers>
      <handler type="blur" value="this.setAttribute('mode','display');"/>
    </handlers>
  </binding>

  <binding id="popups">
    <content>
      <!--xul:box class="popup-internal-box" orient="vertical" flex="1" style="overflow: auto">
        <children/>
      </xul:box-->

      <xul:arrowscrollbox class="popup-internal-box" flex="1" orient="vertical">
		  <!--xul:box class="popup-internal-box" orient="vertical"-->
			<children/>
		  <!--/xul:box-->
      </xul:arrowscrollbox>

    </content>
    <interface>
      <method name="openPopup">
        <argument name="element"/>
        <argument name="xpos"/>
        <argument name="ypos"/>
        <argument name="popuptype"/>
        <argument name="anchoralignment"/>
        <argument name="popupalignment"/>
        <body>
        <![CDATA[
          try {
            var popupSetBox = this.parentNode.boxObject.QueryInterface(Components.interfaces.nsIPopupSetBoxObject);
            var menuBox = this.parentNode.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject);
          } catch(e) {}
          if (popupSetBox)
            popupSetBox.createPopup(element, this, xpos, ypos, popuptype, anchoralignment, popupalignment);
          else if (menuBox)
            menuBox.openMenu(true);
        ]]>
        </body>
      </method>
      <method name="closePopup">
        <body>
        <![CDATA[
          try {
            var popupSetBox = this.parentNode.boxObject.QueryInterface(Components.interfaces.nsIPopupSetBoxObject);
            var menuBox = this.parentNode.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject);
          } catch(e) {}
          if (popupSetBox)
            popupSetBox.destroyPopup();
          else if (menuBox)
            menuBox.openMenu(false);
        ]]>
        </body>
      </method>
    </interface>     
  </binding>
  
  <binding id="toolbargrippy" extends="xul:button"/>

  <binding id="toolbox">
    <content orient="vertical">
      <xul:box orient="vertical" flex="1" class="internal-box">
        <children/>
      </xul:box>
      <xul:box class="collapsed-tray"/>
    </content>
    <interface>
      <method name="collapseToolbar">
        <argument name="toolbar"/>
        <body>
          var v = this.removeChild(toolbar);
          document.getAnonymousNodes(this)[1].appendChild(v);
        </body>
      </method>
      <method name="expandToolbar">
        <argument name="toolbar"/>
        <body>
          var v = document.getAnonymousNodes(this)[1].removeChild(toolbar);
          this.appendChild(v);
        </body>
      </method>
    </interface>
  </binding>

  <binding id="toolbar">
    <content>
      <xul:toolbargrippy inherits="grippytooltiptext:tooltiptext,grippytooltip:tooltip" 
                         onclick="var v = parentNode;
                                  var attr = v.getAttribute('collapsed');
                                  if (attr == 'true') {
                                    v.removeAttribute('collapsed');
                                    try {
                                      parentNode.parentNode.parentNode.expandToolbar(parentNode);
                                    }
                                    catch(e) {
                                      dump('huh?' + parentNode.parentNode.parentNode + '\n');
                                    }
                                  }
                                  else {
                                    v.setAttribute('collapsed', 'true');
                                    try {
                                      parentNode.parentNode.collapseToolbar(parentNode);
                                    }
                                    catch(e) {}
                                  }
                                  "/>
      <xul:box flex="1" class="toolbar-holder" inherits="collapsed">
        <children/>
      </xul:box>
    </content>
  </binding>

  <binding id="colorpicker" extends="xul:box">
    <interface>
      <property name="color" onset="return this.setAttribute('color', val);"
                             onget="return this.getAttribute('color');"/>
      <property name="selectedItem"/>
    </interface>

    <handlers>
      <handler type="click" value="dump('handler fired\n');"/>
    </handlers>

    <content>

      <xul:box flex="1" orient="vertical" onclick="parentNode.color = event.target.getAttribute('color');
                                                   try { parentNode.selectedItem.removeAttribute('selected'); } catch(e) { }
                                                   parentNode.selectedItem = event.target;
                                                   event.target.setAttribute('selected', 'true');">

      <xul:box align="horizontal">
        <xul:spring class="colorpickertile" style="background-color: #FFFFFF" color="#FFFFFF"/>
        <xul:spring class="colorpickertile" style="background-color: #FFCCCC" color="#FFCCCC"/>
        <xul:spring class="colorpickertile" style="background-color: #FFCC99" color="#FFCC99"/>
        <xul:spring class="colorpickertile" style="background-color: #FFFF99" color="#FFFF99"/>
        <xul:spring class="colorpickertile" style="background-color: #FFFFCC" color="#FFFFCC"/>
        <xul:spring class="colorpickertile" style="background-color: #99FF99" color="#99FF99"/>
        <xul:spring class="colorpickertile" style="background-color: #99FFFF" color="#99FFFF"/>
        <xul:spring class="colorpickertile" style="background-color: #CCFFFF" color="#CCFFFF"/>
        <xul:spring class="colorpickertile" style="background-color: #CCCCFF" color="#CCCCFF"/>
        <xul:spring class="colorpickertile" style="background-color: #FFCCFF" color="#FFCCFF"/>
      </xul:box>
      <xul:box align="horizontal">
        <xul:spring class="colorpickertile" style="background-color: #CCCCCC" color="#CCCCCC"/>
        <xul:spring class="colorpickertile" style="background-color: #FF6666" color="#FF6666"/>
        <xul:spring class="colorpickertile" style="background-color: #FFCC33" color="#FFCC33"/>
        <xul:spring class="colorpickertile" style="background-color: #FFFF66" color="#FFFF66"/>
        <xul:spring class="colorpickertile" style="background-color: #FFFF99" color="#FFFF99"/>
        <xul:spring class="colorpickertile" style="background-color: #66FF99" color="#66FF99"/>
        <xul:spring class="colorpickertile" style="background-color: #33FFFF" color="#33FFFF"/>
        <xul:spring class="colorpickertile" style="background-color: #66FFFF" color="#66FFFF"/>
        <xul:spring class="colorpickertile" style="background-color: #9999FF" color="#9999FF"/>
        <xul:spring class="colorpickertile" style="background-color: #FF99FF" color="#FF99FF"/>
      </xul:box>
      <xul:box align="horizontal">
        <xul:spring class="colorpickertile" style="background-color: #C0C0C0" color="#C0C0C0"/>
        <xul:spring class="colorpickertile" style="background-color: #FF0000" color="#FF0000"/>
        <xul:spring class="colorpickertile" style="background-color: #FF9900" color="#FF9900"/>
        <xul:spring class="colorpickertile" style="background-color: #FFCC66" color="#FFCC66"/>
        <xul:spring class="colorpickertile" style="background-color: #FFFF00" color="#FFFF00"/>
        <xul:spring class="colorpickertile" style="background-color: #33FF33" color="#33FF33"/>
        <xul:spring class="colorpickertile" style="background-color: #66CCCC" color="#66CCCC"/>
        <xul:spring class="colorpickertile" style="background-color: #33CCFF" color="#33CCFF"/>
        <xul:spring class="colorpickertile" style="background-color: #6666CC" color="#6666CC"/>
        <xul:spring class="colorpickertile" style="background-color: #CC66CC" color="#CC66CC"/>
      </xul:box>
      <xul:box align="horizontal">
        <xul:spring class="colorpickertile" style="background-color: #999999" color="#999999"/>
        <xul:spring class="colorpickertile" style="background-color: #CC0000" color="#CC0000"/>
        <xul:spring class="colorpickertile" style="background-color: #FF6600" color="#FF6600"/>
        <xul:spring class="colorpickertile" style="background-color: #FFCC33" color="#FFCC33"/>
        <xul:spring class="colorpickertile" style="background-color: #FFCC00" color="#FFCC00"/>
        <xul:spring class="colorpickertile" style="background-color: #33CC00" color="#33CC00"/>
        <xul:spring class="colorpickertile" style="background-color: #00CCCC" color="#00CCCC"/>
        <xul:spring class="colorpickertile" style="background-color: #3366FF" color="#3366FF"/>
        <xul:spring class="colorpickertile" style="background-color: #6633FF" color="#6633FF"/>
        <xul:spring class="colorpickertile" style="background-color: #CC33CC" color="#CC33CC"/>
      </xul:box>
      <xul:box align="horizontal">
        <xul:spring class="colorpickertile" style="background-color: #666666" color="#666666"/>
        <xul:spring class="colorpickertile" style="background-color: #990000" color="#990000"/>
        <xul:spring class="colorpickertile" style="background-color: #CC6600" color="#CC6600"/>
        <xul:spring class="colorpickertile" style="background-color: #CC9933" color="#CC9933"/>
        <xul:spring class="colorpickertile" style="background-color: #999900" color="#999900"/>
        <xul:spring class="colorpickertile" style="background-color: #009900" color="#009900"/>
        <xul:spring class="colorpickertile" style="background-color: #339999" color="#339999"/>
        <xul:spring class="colorpickertile" style="background-color: #3333FF" color="#3333FF"/>
        <xul:spring class="colorpickertile" style="background-color: #6600CC" color="#6600CC"/>
        <xul:spring class="colorpickertile" style="background-color: #993399" color="#993399"/>
      </xul:box>
      <xul:box align="horizontal">
        <xul:spring class="colorpickertile" style="background-color: #333333" color="#333333"/>
        <xul:spring class="colorpickertile" style="background-color: #660000" color="#660000"/>
        <xul:spring class="colorpickertile" style="background-color: #993300" color="#993300"/>
        <xul:spring class="colorpickertile" style="background-color: #996633" color="#996633"/>
        <xul:spring class="colorpickertile" style="background-color: #666600" color="#666600"/>
        <xul:spring class="colorpickertile" style="background-color: #006600" color="#006600"/>
        <xul:spring class="colorpickertile" style="background-color: #336666" color="#336666"/>
        <xul:spring class="colorpickertile" style="background-color: #000099" color="#000099"/>
        <xul:spring class="colorpickertile" style="background-color: #333399" color="#333399"/>
        <xul:spring class="colorpickertile" style="background-color: #663366" color="#663366"/>
      </xul:box>
      <xul:box align="horizontal">
        <xul:spring class="colorpickertile" style="background-color: #000000" color="#000000"/>
        <xul:spring class="colorpickertile" style="background-color: #330000" color="#330000"/>
        <xul:spring class="colorpickertile" style="background-color: #663300" color="#663300"/>
        <xul:spring class="colorpickertile" style="background-color: #663333" color="#663333"/>
        <xul:spring class="colorpickertile" style="background-color: #333300" color="#333300"/>
        <xul:spring class="colorpickertile" style="background-color: #003300" color="#003300"/>
        <xul:spring class="colorpickertile" style="background-color: #003333" color="#003333"/>
        <xul:spring class="colorpickertile" style="background-color: #000066" color="#000066"/>
        <xul:spring class="colorpickertile" style="background-color: #330099" color="#330099"/>
        <xul:spring class="colorpickertile" style="background-color: #330033" color="#330033"/>
      </xul:box>
      </xul:box>
    </content>
  </binding>

  
  <!-- XUL <statusbar> -->
  <binding id="statusbar" extends="xul:box"/>
    
  <binding id="statusbar-panel" extends="xul:button">
    <content excludes="observes,template" autostretch="never" valign="middle">
      <xul:image class="statusbar-panel-icon" inherits="src"/>
      <xul:text class="statusbar-panel-text" inherits="value,crop" crop="right" flex="1"/>
    </content>
    <interface>
      <property name="value"
                onget="return this.getAttribute('value');"
                onset="this.setAttribute('value',val); return val;"/>
      <property name="src"
                onget="return this.getAttribute('src');"
                onset="this.setAttribute('src',val); return val;"/>
    </interface>
  </binding>
  
  <binding id="browser">
    <interface>
      <property name="webBrowser"
                readonly="true"
                onget="return this.boxObject.QueryInterface(Components.interfaces.nsIBrowserBoxObject).webBrowser"/>
    </interface>
  </binding>

  <binding id="editor">
    <interface>
      <property name="editorShell"
                readonly="true"
                onget="return this.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).editorShell"/>
    </interface>
  </binding>

  <binding id="iframe">
    <interface>
      <property name="docShell"
                readonly="true"
                onget="return this.boxObject.QueryInterface(Components.interfaces.nsIIFrameBoxObject).docShell"/>
    </interface>
  </binding>

  <binding id="titledbox">
    <content>
	  <xul:box class="titledbox-title">
	    <children includes="title"/>
	  </xul:box>
	  <xul:box flex="1" class="titledbox-body" inherits="orient,autostretch,align,valign">
      <children/>
	  </xul:box>
    </content>    
  </binding>

  <binding id="titledboxvalue">
    <content>
	  <xul:box class="titledbox-title">
	    <xul:title inherits="value"/>
	  </xul:box>
	  <xul:box flex="1" class="titledbox-body" inherits="orient,autostretch,align,valign">
        <children/>
	  </xul:box>
    </content>    
  </binding>

  <binding id="title">
     <content>
	    <xul:text inherits="value"/>
	 </content>
  </binding>

  <binding id="autorepeatbutton-up">
     <content>
	    <xul:image class="autorepeatbutton-up"/>
	 </content>
  </binding>

  <binding id="autorepeatbutton-down">
     <content>
	    <xul:image class="autorepeatbutton-down"/>
	 </content>
  </binding>

  <binding id="scrollbox">
    <content>
	  <xul:box class="scrollbox-innerbox" inherits="orient,autostretch,align,valign">
	    <children/>
	  </xul:box>
	</content>
  </binding>

  <binding id="arrowscrollbox" extends="xul:stack">
    <content>
	  <xul:vbox 
	  onunderflow="
		  var button1 = this.firstChild;
		  var button2 = this.childNodes[2];
 		  button1.setAttribute('collapsed', 'true');
		  button2.setAttribute('collapsed', 'true');
      " 
	  onoverflow="
		  var button1 = this.firstChild;
		  var button2 = this.childNodes[2];
 		  button1.removeAttribute('collapsed');
		  button2.removeAttribute('collapsed');
      ">
	  <xul:autorepeatbutton autostretch="never" class="up" collapsed="true" 
	      oncommand="parentNode.childNodes[1].boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject).scrollByIndex(-1);"/>
	  <xul:scrollbox orient="vertical" flex="1">
		 <children/>
	  </xul:scrollbox>
	  <xul:autorepeatbutton autostretch="never" class="down" collapsed="true" 
	      oncommand="parentNode.childNodes[1].boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject).scrollByIndex(1);"/>
	  </xul:vbox>
    </content>
  </binding>

</bindings>

