Get the relative top rather than the absolute top.

When writing the top to the cookie, subtract off the page offset. Fixes #584.

One thing to note is that ```window.pageYOffset``` is not compatible with < IE9.