// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

var cancelButtonWriting = false;

function standardButton(moleculeFilename, scriptFilename)
{
	buttonNumber++;

	// Complain if either parameter is undefined or blank.

	var badParameterMsg = "";

	if (typeof(moleculeFilename) == "undefined")
		badParameterMsg = "undefined moleculeFilename \"m\".";

	else if (moleculeFilename == "")
		badParameterMsg = "blank moleculeFilename \"m\".";

	else if (typeof(scriptFilename) == "undefined")
		badParameterMsg = "undefined scriptFilename \"s\".";

	else if (scriptFilename == "")
		badParameterMsg = "blank scriptFilename \"s\".";

	if (badParameterMsg != "")
	{
		badParameterMsg = "Authoring error: standardButton(m, s) called with\n" +
			badParameterMsg +
			"\n (Button number " + buttonNumber + ")";
		alert(badParameterMsg);
		cancelButtonWriting = true;
		return;
	}

	// All parameters present. Proceed to set up array.	

	buttons[buttonNumber] = new Array();

	buttons[buttonNumber][iMoleculeFilename] = moleculeFilename;

//	if (buttonNumber > 1) // Inherit previous PDB file by default.
//		buttons[buttonNumber][iMoleculeFilename] = buttons[n-1][iMoleculeFilename];

	buttons[buttonNumber][iScript] = 'script ' + scriptFilename + ';';

	buttons[buttonNumber][iButtonType] = 'button'; // link, button, radio, or checkbox
	buttons[buttonNumber][iScriptPrefix] = 'display'; // reset, y, or yes to reset the display before running this script. noreset or no to leave the current view alone.
	buttons[buttonNumber][iButtonLabel] = 'View ' + buttonNumber;
	buttons[buttonNumber][iButtonPrefixText] = '<br>';
	buttons[buttonNumber][iButtonText] =
		"AUTHOR: PUT VIEW DESCRIPTION HERE (in buttons[" +
		buttonNumber + "][iButtonText]).";
	buttons[buttonNumber][iScriptCheckboxUnchecked] = '';
	buttons[buttonNumber][iDetailsText] = '';
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function button(script)
{
	with (document)
	{
		open();
		writeln("<embed");
		writeln("	type='application/x-spt'");
		writeln("	width=15");
		writeln("	height=15");
		writeln("	button=push");
		writeln("	target='chime_graphic'");
		writeln("	script='" + script + "'");
		writeln(">");
		close();
	}
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function footer()
{
	with (document)
	{
		open();

// history.back() runs you back thru all the button presses, so is useless.

		writeln("<form>");
		writeln("<input type=button value=\"Back\"");
		writeln("onClick=\"location.href='contents.htm'\">");
		writeln("</form>");

//		writeln("<table border=1><tr><td>");
//		writeln("</td></tr></table>");

		writeln("<p><a href=\"rightutl.htm\">Utilities</a>");
		writeln("<a href=\"rightucs.htm\">Color Schemes</a>");

		// This puts enough space at the bottom of each page so that
		// in continuous play mode, the current button can be placed
		// at the top of the page.
		if (parent.ContinuousPlay)
		{
			writeln("<hr>");
			writeln("<br><br><br><br><br><br><br><br><br><br>");
			writeln("<br><br><br><br><br><br><br><br><br><br>");
		}

		close();
	}

}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function wr_doc(to_write)
{
	with(document)
	{
		open();
		write(to_write);
		close();
	}
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function key_top()
{
	wr_doc(
//		"<table bgcolor='black'>" +
//		"<tr><td>" +
		"<a href='colors.htm' target='cpk_window'>" +
//		"<tt>" +
		"<font size='+2'><b>"
	);
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function key_bottom()
{
	wr_doc(
		"<font color='black'>&nbsp;</font>"+
		"</b></font>" +
//		"</tt>" +
		"</a>" //+
//		"</td></tr>" +
//		"</table>"
	);
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function C_key()
{
	wr_doc(
		"<font color='black'>&nbsp;</font>" +
		"<font color='#999999'>C</font>"
	);
}


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Fe_key()
{
	wr_doc(
		"<font color='black'>&nbsp;</font>" +
		"<font color='#FFA500'>Fe</font>"
	);
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function H_key()
{
	wr_doc(
		"<font color='black'>&nbsp;</font>" +
		"<font color='#FFFFFF'>H</font>"
	);
}


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function N_key()
{
	wr_doc(
		"<font color='black'>&nbsp;</font>" +
		"<font color='#8F8FFF'>N</font>"
	);
}



// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function O_key()
{
	wr_doc(
		"<font color='black'>&nbsp;</font>" +
		"<font color='#F00000'>O</font>"
	);
}



// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function S_key()
{
	wr_doc(
		"<font color='black'>&nbsp;</font>" +
		"<font color='#FFC832'>S</font>"
	);

}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function chon_key()
{
	key_top();
	C_key();
	H_key();
	O_key();
	N_key();
	key_bottom();
}


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function chonfe_key()
{
	key_top();
	C_key();
	H_key();
	O_key();
	N_key();
	Fe_key();
	key_bottom();
}


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function chon()
{
	key_top();
	C_key();
	H_key();
	O_key();
	N_key();
	key_bottom();
}


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function cons()
{
	key_top();
	C_key();
	N_key();
	O_key();
	S_key();
	key_bottom();
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function chons_key()
{
	key_top();
	C_key();
	H_key();
	N_key();
	O_key();
	S_key();
	key_bottom();
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
