home *** CD-ROM | disk | FTP | other *** search
- var firstHitDone;
-
- function firstHit()
- {
- if (firstHitDone != 1)
- firstHitDone = gotoHit("hit1");
- }
-
- function gotoHit(where)
- { var a = document.anchors.item(where);
- if (a == null) {
- return 0;
- }
- if (a.length > 1) {
- return 0;
- }
- var s = document.body.createTextRange();
- if (s == null)
- return 0;
-
- s.moveToElementText(a);
- s.moveEnd("word");
-
-
- // IE only
- var height = 0;
- if (document.body && document.body.clientHeight)
- height = document.body.clientHeight;
- else
- height = window.innerHeight;
-
- // This puts items in the middle of the screen, but only forces movement when they are below
- // the bottom 1/5, so that we don't scroll too much and make the display jumpy
- var preferredMargin = height/2;
- var minimumMargin = height/5;
-
- if (s.offsetTop < 0)
- window.scrollBy(0, s.offsetTop - preferredMargin);
- else if (s.offsetTop > height - minimumMargin)
- window.scrollBy(0, s.offsetTop - preferredMargin);
-
- s.select();
- return 1;
- }