// Copyright 2004-9 Richard W. Adams

var alternateName;
var dates;
var firstLetter;
var primaryName;

//------------------------------------------------
function arrows(position) {
	var className = "navigation";
	if (position != null) {
		className += ' ' + position;
	}
	write('<p class="' + className + '"><a href="' + prevPage + '" onMouseOver="return stat(\'Go to previous page\')" onMouseOut="return erase()"><img src="' + root + '/img/a/ar-left.gif" title="Back" width="30" height="30"></a> ');
	write(' <a href="' + root   + 'bio/bio.htm?' + firstLetter + '" onMouseOver="return stat(\'Go to biographical index\')" onMouseOut="return erase()"><img src="' + root + 'img/a/ar-up.gif" title="People" width="30" height="30" /></a>');
	write(' <a href="' + root   + 'index.htm#lk" onMouseOver="return stat(\'Go to the Cyber Hymnal home page\')" onMouseOut="return erase()"><img src="' + root + 'img/a/ar-toc.gif" title="Home" width="30" height="30" /></a>');
	write(' <a href="' + nextPage + '" onMouseOver="return stat(\'Go to next page\')" onMouseOut="return erase()"><img src="' + root + '/img/a/ar-right.gif" border="0" title="Next" width="30" height="30"></a></p>');
}
//------------------------------------------------
// PURPOSE		Draw end of the page
// ARGUMENTS	Optional. If used, should be 2 or more data items we want about the individual.
function end() {
	if (arguments != null && arguments.length > 0) {
		var received = "End() function received ";
		write('<div class="wanted maintain"><hr />');
		if (arguments.length == 1) 		{
			write("<p>If you know " + arguments[0]);
			mail();
			write("</p>");
		} else {
			write('<p class="lead">Wanted</p><ul>');
			for (var i = 0; i < arguments.length; ++i) {
				var argument = arguments[i];
				if (argument == null)
					error(received + "null argument");
				else if (argument == '')
					error(received + "empty argument");
				else
					write('<li>' + argument + '</li>');
			}
			write('</ul>');
			help(arguments.length);
		}
		write('</div>');
	}
	write('<hr />');
	arrows();
	write('<p class="footer" title="When this page last changed">' + document.lastModified + '</p>');
}
//------------------------------------------------
// PURPOSE	Solicit help
function help(argumentCount) {
	write('<p>If you can help with ');
	if (argumentCount != null && argumentCount == 2)
		write('either');
	else
		write('any');
	write(' of these items');
	mail();
	write('</p>');
}
//------------------------------------------------
function init (
	level	 	, 	// Number of levels below site root
	primary		, 	// Name by which individual is primarily known
	alternate	, 	// Alternate name (empty sring if none)
	years	 	, 	// Birth & death years
	prev	 	, 	// Previous page's URL (starting at first level below bio directory), without extension, which must be .htm
	next			// Next page's URL (starting at first level below bio directory), without extension, which must be .htm
){
	if (argsOk(arguments.callee, true, true)) {
		dates = years;
		primaryName  = primary;
		alternateName = alternate;
		var page = location.href;
		firstLetter = page.charAt(page.lastIndexOf('/') + 1);
		root = "";
		for (var i = 0; i < level; ++i) {
	  		root += "../";
	  	}
		write('<title>' + primary + '</title>');
		prevPage = root + "bio/" + prev  + ".htm";
		nextPage = root + "bio/" + next  + ".htm";
		write('<link href="' + root + 'sty/tch-bio.css" rel="stylesheet" type="text/css" />');
	}
}
//------------------------------------------------
function doUnload() {
	closeCitation();
	closeChild();
	return true;
}
//------------------------------------------------
function onLoad(suffix) {
	var par = new String(window.parent.location);
	if (par.indexOf("bio.htm") == -1) {
		location = "bio.htm?" + suffix;
	}
}
//-----------------------------------------------------
function recognize
// PURPOSE	Insert a portait of a with a "special recognition border"
(
	caption		,	// Image caption (shown as tool tip on screen, as text below picture on printouts)
	file		,	// File name, without path (if optional extension is omitted, name must not have any periods; default extension is "jpg")
	width		,	// Image width (pixels)
	height		,	// Image height (pixels)
	rightAligned,	// True = Align image at right edge of screen (optional; default is false)
	credit		,	// Byline (optional)
	url			 	// URL for byline link (optional)
){
	portrait(caption, file, width, height, rightAligned, credit, url, "specialRecognition");
}
//------------------------------------------------
// PURPOSE Start drawing at the top of the page
function start() { 
	window.onunload =  function() { doUnload() }
	setDefaultLanguage();
	arrows("top");
	write('<h1>' + primaryName + '</h1>');
	if (alternateName.length > 0) {
		write('<h3>' + alternateName + '</h3>');
	}
	write('<h2>' + dates + '</h2><hr />');
}
//------------------------------------------------
