My personal preference:
```
var docElem = doc.documentElement;
var scrollTopNode = docElem.clientHeight ? docElem : doc.body;
return scrollTopNode.scrollTop;
```
;-)