//
// Hit navigation JavaScript for the dtSearch 6
//
// Copyright 2000 dtSearch Corp.  
// 
// This JavaScript is included in both retrieved documents and in
// the search results list, to enable hit navigation using the
// button bar in the sample search form.  The button bar
// uses JavaScript to call these functions in the search results frame
// or in the retrieved document frame.

// The first two variables in this file may need to be changed
// if you modify dtsearch.asp to change the layout of search results.
//
// nFirstLink is the offset in search results of the first
//            link to a retrieved item.  
// nLinksPerItem is the number of links for each search results item.
//            nextDoc() and prevDoc() use these values to navigate through the
//            list of links on a search results page.
//
nFirstLink = 1;
nLinksPerItem = 4;

nDoc = -1;
nHit = 0;

function gotoHit(where) {
	if ((maxHits == 1) || (where == maxHits))
		window.location.hash = 'hit_last'
	else
 		window.location.hash = 'hit' + where;
	nHit = where;
 }

function nextHit() {
	if (nHit < maxHits) {
		window.scrollBy(0, 5);
		gotoHit(nHit+1);
		}
	}
function prevHit() {
	if (nHit > 0) {
		window.scrollBy(0, -5);
		gotoHit(nHit-1);
		}
	}
function setCurrentDoc(n) {
	nDoc = n;
	}

function gotoDoc(n) {
	nLink = nFirstLink + (n * nLinksPerItem);
	if (n < 0)
		return;
	if (nLink >= document.links.length)
		return;
	setCurrentDoc(n);
	link = document.links[nLink];
	parent.doc.window.location = link.href;

	if (link.y)
		// Netscape
		window.scrollTo(0, link.y);
	else
		// IE
		window.scrollTo(0, link.offsetTop + link.offsetHeight + link.offsetParent.offsetTop);
	}

function nextDoc() {
	gotoDoc(nDoc+1);
	}
function prevDoc() {
	gotoDoc(nDoc-1);
	}

