
// global vars...

var bulletCount = 0 ;
var bulletName = "bullet" ;



// functions...


function showBullet(bullet) {
	document[bullet].src = "/gfx/bullet-over.gif" ;
}

function hideBullet(bullet) {
	document[bullet].src = "/gfx/bit.gif" ;
}

	// adds a heading to the navigation
function navHead(text) {
	if ( (text == "") || (text == null) ) {
		text = "&nbsp;" ;
	}
	document.write('<p><b>' + text + '</b></p>') ;
}


	// adds a link to the navigation
function navLink(url, text, description) {

	var bulletLabel = bulletName + bulletCount ;

		// remove index.* from the pathname of this page
	pathname = stripIndex(location.pathname) ;

		// If current page matches the URL passed to the function, display as text, not as a link
	if (pathname == stripIndex(url)) {
			// current page (higlighted)
		document.write('<p><img alt="-" src="/gfx/bullet-current.gif" width="10" height="9"><em>' + text + '</em> ') ;
	} else {
			// other links
		document.write('<p><img alt=" " src="/gfx/bit.gif" width="10" height="9" name="' + bulletLabel + '"><a href="' + url + '" onMouseOver="showBullet(\'' + bulletLabel + '\')" onMouseOut="hideBullet(\'' + bulletLabel + '\')">' + text + '</a> ') ;
	}
	
		// Only write a description if it's passed to the navLink function
	if (!( (description == "") || (description == null) )) {
		document.write(description) ;
	}
	document.write('</p>') ;
	
	bulletCount++ ;
	//alert( bulletLabel ) ;
}


	// strip index.* from file names
function stripIndex(pathToStrip) {
	s = pathToStrip.split("/") ;											// split path by slashes
	filename = s[s.length-1] ;												// isolate the filename in the path, i.e. what's after the final slash
	var finalSlashPosition = pathToStrip.indexOf(filename) ;				// identify at what position in the string the filename begins

	indexFiles = new Array('index.htm', 'index.html', 'index.shtml', 'index.shtm', 'index.cfm') ;
	for (i=0 ; i < indexFiles.length ; i++) {
		if (filename == indexFiles[i]) {
			pathToStrip = pathToStrip.substring(0,finalSlashPosition) ;
			break ;
		}
	}	

	return pathToStrip ;
}
