Fix Bug 964413, ensure that highlighted anchor is never hidden behind header
Tweaking of scrollIntoView function and small refactor