code: function pageOffset(el) {
          var curleft = 0, curtop = 0;
          if (el.offsetParent) {
              do {
                  curleft += el.offsetLeft;
                  curtop += el.offsetTop;
              } while (el = el.offsetParent);
          }
          return [curleft, curtop];
      }
docs: Find out where an element is on the page From http://www.quirksmode.org/js/findpos.html