
// global vars...

var bulletCount = 0 ;
var bulletName = "bullet" ;

var bulletShow = "/fsm-shared/common/bullet-over.gif" ;
var bulletHide = "/fsm-shared/common/bit.gif" ;

// functions...


function showBullet(bullet) {
	document[bullet].src = bulletShow ;
}

function hideBullet(bullet) {
	document[bullet].src = bulletHide ;
}

	// adds a heading to the navigation
function navHead(text) {
	if ( (text == "") || (text == null) ) {
		text = "&nbsp;" ;
	}
	document.write('<p><b>' + text + '</b></p>') ;
}



	// wrapper method opens link in new window
function navLinkNewWindow(url, text, description) {
	navLink(url, text, description, 'target="_blank"') ;
}


	// adds a link to the navigation
function navLink(url, text, description, linkAttributes) {
	
	var bulletLabel = bulletName + bulletCount ;
	
	
		// linkAttributes should be in the form ' field1="value" field2="value"'
	if (linkAttributes == null) {
		linkAttributes = "" ;
	}

		// 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="' + bulletShow + '" width="10" height="9"><em>' + text + '</em> ') ;
	} else {
			// other links
		document.write('<p><img alt=" " src="' + bulletHide + '" width="10" height="9" name="' + bulletLabel + '"><a href="' + url + '" onMouseOver="showBullet(\'' + bulletLabel + '\')" onMouseOut="hideBullet(\'' + bulletLabel + '\')" ' + linkAttributes + '>' + 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++ ;
}


	// 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 ;
}
