Index: trunk/autoquest-htmlmonitor/src/main/js/autoquest-htmlmonitor.js
===================================================================
--- trunk/autoquest-htmlmonitor/src/main/js/autoquest-htmlmonitor.js	(revision 1822)
+++ trunk/autoquest-htmlmonitor/src/main/js/autoquest-htmlmonitor.js	(revision 1823)
@@ -228,5 +228,6 @@
     //{ "tag": "section", "actions": [  ] },
     { "tag": "select", "actions": [ "onchange",
-                                    "onfocus" ] },
+                                    "onfocus",
+                                    "onscroll" ] },
     { "tag": "small", "actions": [ "onclick" ] },
     //{ "tag": "source", "actions": [  ] },
@@ -303,4 +304,8 @@
             addDefaultEventHandling();
             
+            // the onload event is already fired and lost. So pretend it to happen.
+            handleEvent(document.getElementsByTagName("body").item(0), "onload",
+                        "/html[0]/body[0]", null);
+            
             // recall sending data each 100 seconds to ensure, that for browser windows staying
             // open the data will be send, as well.
@@ -588,6 +593,9 @@
     var eventType;
     var eventObj = null;
+    var preceedingScrollEventObj = null;
     var tagName;
     var unmonitored;
+    var x1, x2;
+    var y1, y2;
 
     if (!autoquestDestination) {
@@ -603,5 +611,5 @@
     if ((eventType === "onkeydown") && (node === document.body)) {
         // do not handle key downs on the body which are other than tabs (keycode 9)
-        if (event.keyCode !== 9) {
+        if ((event.keyCode !== 9) && (event.keyCode !== 13)) {
             return;
         }
@@ -613,5 +621,5 @@
         eventObj = autoquestRecordedEvents[autoquestRecordedEvents.length - 1];
 
-        if ((eventObj.type === eventName) && (eventObj.nodePath.indexOf(nodePath) === 0)) {
+        if ((eventObj.type === eventType) && (eventObj.nodePath.indexOf(nodePath) === 0)) {
             // the event is of the same type.
             if (eventObj.nodePath.length > nodePath.length) {
@@ -623,7 +631,41 @@
             }
             else if (eventType !== "onscroll") {
-                // we have the same event on the same element. If it is an onscroll, we should
+                // we have the same event on the same element. If it is an onscroll, we may
                 // reuse it. But it is not an onscroll. So we ignore the existing event.
                 eventObj = null;
+            }
+            else {
+                // we have a repeated onscroll. Check, if the scrolling direction can be determined
+                // and if it changed. If so created a new object. If not, stick to the existing one.
+                if (autoquestRecordedEvents.length > 1) {
+                    preceedingScrollEventObj =
+                        autoquestRecordedEvents[autoquestRecordedEvents.length - 2];
+                    
+                    if (preceedingScrollEventObj.type !== eventType) {
+                        preceedingScrollEventObj = null;
+                    }
+                }
+                
+                if (preceedingScrollEventObj != null) {
+                    x1 = preceedingScrollEventObj.scrollPosition[0] - eventObj.scrollPosition[0];
+                    x2 = eventObj.scrollPosition[0] - getScrollCoordinates(node)[0];
+                    y1 = preceedingScrollEventObj.scrollPosition[1] - eventObj.scrollPosition[1];
+                    y2 = eventObj.scrollPosition[1] - getScrollCoordinates(node)[1];
+                    
+                    if ((((x1 >= 0) && (x2 >= 0)) || ((x1 <= 0) && (x2 <= 0))) &&
+                        (((y1 >= 0) && (y2 >= 0)) || ((y1 <= 0) && (y2 <= 0))))
+                    {
+                        // The new scrolling is a continuation of the previous scrolling --> reuse
+                        // previous object
+                    }
+                    else {
+                        eventObj = null;
+                    }
+                }
+                else {
+                    // we cannot determine the preceeding scroll direction, so we have to store the
+                    // new event
+                    eventObj = null;
+                }
             }
         }
@@ -821,16 +863,20 @@
  */
 function getScrollCoordinates(node) {
-    if (node.scrollLeft || node.scrollTop) {
+    if (typeof node.scrollLeft !== 'undefined') {
         return [node.scrollLeft, node.scrollTop];
     }
-    else if ((node === window) && window.pageYOffset) {
+    else if ((node === window) && (typeof window.pageXOffset !== 'undefined')) {
         return [window.pageXOffset, window.pageYOffset];
     }
-    else if ((node == document) || (node == document.body) || (node == document.documentElement)) { 
-        if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
+    else if ((node === document) || (node === document.body) ||
+             (node === document.documentElement))
+    { 
+        if ((typeof document.body !== 'undefined') &&
+            (typeof document.body.scrollLeft !== 'undefined'))
+        {
             return [document.body.scrollLeft, document.body.scrollTop];
         }
-        else if (document.documentElement &&
-                 (document.documentElement.scrollLeft || document.documentElement.scrollTop))
+        else if ((typeof document.documentElement !== 'undefined') &&
+                 (typeof document.documentElement.scrollLeft !== 'undefined'))
         {
             return [document.documentElement.scrollLeft, document.documentElement.scrollTop];
