// <!--
/*
Creates the navigation menus for multi-page HTML documents that have been produced via HTML Transit.
Each HTML page in a multi-page HTML translation contains a reference to this file:
<script type="text/javascript" language="JavaScript" src="/scripts/multipage.js"></script>

Calls to the functions below are inserted in the HTML document to insert the navigation elements in the appropriate places.

This script works in conjunction with another .js file (a table of contents file) that is in the same directory as the HTML document.  
That file defines two arrays: toc_titles and toc_files, that are used by the functions in this file.
*/


function GetNavigation() {
	var str = '';
	
	str += '' + (g_toc_pagenum) + ' of ' + (toc_titles.length-1) + ' : ';
	
	if (g_toc_pagenum > 0) {
		i = g_toc_pagenum - 1;
		str += '<a title="previous: ' + toc_titles[i] + '" href="' + toc_files[i] + '">' + 'previous' + '</a> | ';
	}
	
	str += '<a title="' + toc_titles[0] + '" href="' + toc_files[0] + '">' + 'contents' + '</a>';

	if (g_toc_pagenum < toc_titles.length-1) {
		i = g_toc_pagenum + 1;
		str += ' | <a title="next: ' + toc_titles[i] + '" href="' + toc_files[i] + '">' + 'next' + '</a>';
	}
	
	return str;
}


function GetToc() {
	s = '<span style="font-weight:bold;">Table of contents:</span> <ul>';
	s = '<ul>';
	for (i = 0; i < toc_titles.length; i++) {
		if (g_toc_pagenum == i) {
			s += '<li><span title="' + toc_titles[i] + '">' + '<strong>' + toc_titles[i] + '</strong>' + '</span></li>';
		} else {
			s += '<li><a title="' + toc_titles[i] + '" href="' + toc_files[i] + '">' + toc_titles[i] + '</a></li>';
		}
	}
	
	s += '</ul>';
	
	return s;
}


function PrintMultiHeader() {
	if (typeof toc_titles != 'undefined') {
		s = '<div class="multipage-toc" style="margin-right:180px; border-bottom:1px dotted; padding-left:0px; padding-bottom:5px; "><div style="ttext-align:center; font-size:12px">' + GetNavigation() + '</div></div>';
		document.write(s);
	}
}


function PrintMultiFooter() {
	if (typeof toc_titles != 'undefined') {
		s = '<br><div class="multipage-toc" style="ppadding-left:10px; border-top:1px dotted;"><div style="ttext-align:center; bborder-top:1px dotted; padding-top:2px; font-size:12px">' + GetNavigation() + '</div>';
		//s += '<div class="multipage-toc">' . GetToc() . '</div>';
		s += '<br>';
		s += GetToc() + '</div>';
		document.write(s);
	}
}

// -->

