<?xml version="1.0"?>
<?xul-overlay href="chrome://global/content/platformGlobalOverlay.xul"?>

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

  <keyset id="browserKeySet">
    <key id="key_page_up" keycode="VK_PAGE_UP" shift="false" control="false" alt="false"
        onkeypress="
            var controller =
            document.commandDispatcher.getControllerForCommand('cmd_scrollPageUp');
            controller.doCommand('cmd_scrollPageUp');"/>
    <key id="key_page_down" keycode="VK_PAGE_DOWN" shift="false" control="false" alt="false"
        onkeypress="
            var controller =
            document.commandDispatcher.getControllerForCommand('cmd_scrollPageDown');
            controller.doCommand('cmd_scrollPageDown');"/>
    <key id="space" key=" " shift="false" control="false" alt="false"
        onkeypress="
			var v = document.commandDispatcher.focusedElement;
			
			if (v &amp;&amp; (v.localName == 'INPUT' || v.localName == 'TEXTAREA')) {
			  return true;
            }

            var controller =
            document.commandDispatcher.getControllerForCommand('cmd_scrollPageDown');
            controller.doCommand('cmd_scrollPageDown');
    "/>

    <key id="key_page_up" keycode="VK_UP" shift="false" control="false" alt="false"
        onkeypress="
            var controller =
            document.commandDispatcher.getControllerForCommand('cmd_scrollLineUp');
            controller.doCommand('cmd_scrollLineUp');"/>
    <key id="key_page_down" keycode="VK_DOWN" shift="false" control="false" alt="false"
        onkeypress="
            var controller =
            document.commandDispatcher.getControllerForCommand('cmd_scrollLineDown');
            controller.doCommand('cmd_scrollLineDown');"/>
    <key id="key_left" keycode="VK_LEFT" shift="false" control="false" alt="false"
        onkeypress="
            var controller =
            document.commandDispatcher.getControllerForCommand('cmd_scrollLeft');
            controller.doCommand('cmd_scrollLeft');"/>
    <key id="key_right" keycode="VK_RIGHT" shift="false" control="false" alt="false"
        onkeypress="
            var controller =
            document.commandDispatcher.getControllerForCommand('cmd_scrollRight');
            controller.doCommand('cmd_scrollRight');"/>
	</keyset>
</window>
