// debugging alerts through # 2
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeWireframeAllCheckbox()
{
	var ckscv = "";
	var ckaw = "";
	var ckhv = "";
	if (!sidechainsVisible)
		ckscv = " checked";
	if (allWireframe)
		ckaw = " checked";
	if (!hydrogensVisible)
		ckhv = " checked";

	var allw =

"<form name='wireframeAllForm'> \
 \
<input type='checkbox' onClick='top.toggleSidechains()'" + ckscv + "> \
Hide sidechains. \
 \
<br><input type='checkbox' onClick='top.toggleWireframeAll()'" + ckaw + "> \
More detail: Show all non-water atoms colored by element. \
 \
<br><input type='checkbox' onClick='top.toggleHydrogens()'" + ckhv + "> \
Hide hydrogens. \
</form>";

	return allw;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeSmallWaterCheckbox()
{
	// This is called whenever the checkbox is offered. It always starts
	// with big water.
	waterIsSmall= false;

	var smallw =

"<form name='smallWaterForm'> \
<input type='checkbox' onClick='top.showWaterSmall()'> \
Smaller Water. \
</form>";

	return smallw;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeSmallLigandCheckbox()
{
	// This is called whenever the checkbox is offered. It always starts
	// with big ligand.
	top.ligandIsSmall= false;

	var smalll =

"<form name='smallLigandForm'> \
<input type='checkbox' onClick='top.showLigandSmall()'> \
Smaller Ligands+. \
</form>";

	return smalll;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeNonStandardCheckbox()
{
	var nsc =
"<form name='ligandForm' id='ligandForm'> \
Show "
	+ makeNotesLink("<b>Non-Standard</b>", "nsr") +
" amino acids and nucleotides as: \
<br>&nbsp; &nbsp; <input type='checkbox' name='starNSR' \
onClick='top.toggleNSRStars()'";

	if (top.starNonStandardResidues)
		nsc += " checked ";

	nsc +=
"><font face='sans-serif'><b>X</b></font>";

//Crosses \
//<img src='crosses_nucs.gif' title='Crosses on non-standard nucleotides' \
//border=1> <img src='crosses_aas.gif' \
//title='Cross on a non-standard amino acid' border=1> \

	nsc +=
"<br>&nbsp; &nbsp; <input type='checkbox' name='bsNSR' \
onClick='top.toggleNonStandardResidues()'";

	if (top.showNonStandardResidues)
		nsc += " checked ";

	nsc +=
">Balls and Sticks \
<br>If the display does not change, there are no non-standard \
residues (NSR). <b>Caution:</b> Some non-standard residues display \
as ligands+, failing to display as NSR: "
	+ makeNotesLink("More..", "nsr") +
"</form>";

	return nsc;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeHideRadios(cck, gck, ack, rck)
{
	var hr =
"<input type='radio' name='hidewhat' value='c'" + cck +
	" onClick='changeHideRadio()'>Chain&dagger; &nbsp; &nbsp; \
<input type='radio' name='hidewhat' value='g'" + gck +
	" onClick='changeHideRadio()'>Residue/Group &nbsp; &nbsp; \
<input type='radio' name='hidewhat' value='a'" + ack +
	" onClick='changeHideRadio()'>Atom \
<br> \
<input type='radio' name='hidewhat' value='r'" + rck +
	" onClick='changeHideRadio()'>Range of residues in one chain (2 clicks) \
";

	return hr;
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeHelpPrefix(helpname)
{
	var hp = "";
	var hhp = makeHiddenHelpPrefix(helpname);
	var fhp = makeFoundHelpPrefix(helpname);
	var chp = makeContactsHelpPrefix(helpname);
	var cshp = makeConsurfHelpPrefix(helpname);

	if ((hhp.length + fhp.length + chp.length + cshp.length) > 0)
	{
		hp += "<form><center>\n" + hhp;
		if (hhp.length > 0 && fhp.length > 0)
			hp += " &nbsp; ";
		hp += fhp;
		if ((hhp.length + fhp.length) > 0 && chp.length > 0)
			hp += " &nbsp; ";
		hp += chp;
		if ((hhp.length + fhp.length + chp.length) > 0 && cshp.length > 0)
			hp += " &nbsp; ";
		hp += cshp;
		hp += "</center></form><hr noshade>";
	}

//	alert("help.js #2: makeHelpPrefix():\n" + hp);
	return hp;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeHiddenHelpPrefix(helpname)
{
	if (match(helpname, "makehidehelp"))
		return "";

	var hhp = "";
	var hiddenTot = getHiddenTot();

	if (hiddenTot > 0)
	{
		hhp =
"Portions Hidden (\
<a href='javascript: doViewLink(hideIndex)'>Re-Display..<\/a>)\
";
	}

	return hhp;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeFoundHelpPrefix(helpname)
{
//	if (match(helpname, "precontacts"))
//		return "";

	var fhp = "";

	if (toFind != "")
	{
		var tf = toFind.replace(/ /g, "&nbsp;");
		fhp = "Halos&nbsp;around:&nbsp;<b>" + tf + ".</b>";

		if (!match(helpname, "makefindhelp"))
			fhp +=
				"&nbsp;(<a href='javascript: doViewLink(findIndex)'>Change<\/a>)";
	}

	return fhp;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeContactsHelpPrefix(helpname)
{
	if (!contactsShowing)
		return "";

	if (match(helpname, "contactsshown"))
		return "";

	var chp = 

	"<a href='javascript: returnToContacts()'>Return&nbsp;" +
	"to&nbsp;Contacts<\/a>";

	return chp;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeHideHelp()
{
	if (hideMode == "")
		hideMode = "c";

	var cck = gck = ack = rck = "";
	var hidden;
	var hiddenTot = getHiddenTot();

	var toHide;
	var lastHidden;
	if (hideMode == "c")
	{
		cck = " checked ";
		hidden = top.hiddenChains.length;
		toHide = "Chain";
		lastHidden = top.hiddenChains[hidden - 1];
	}
	else if (hideMode == "g")
	{
		gck = " checked ";
		hidden = top.hiddenGroups.length;
		toHide = "Residue/Group";
		lastHidden = top.hiddenGroups[hidden - 1];
	}
	else if (hideMode == "a")
	{
		ack = " checked ";
		hidden = top.hiddenAtoms.length;
		toHide = "Atom";
		lastHidden = top.hiddenAtoms[hidden - 1];
	}
	else if (hideMode == "r")
	{
		rck = " checked ";
		hidden = top.hiddenRanges.length;
		toHide = "Range";
		lastHidden = top.hiddenRanges[hidden - 1];
	}

	var ick = "";
	if (hiddenTot == 0)
		invertHidden = false;
	if (invertHidden)
		ick = " checked ";

//	alert("help.js #1: hidden = " + hidden);

	var hh =
"<form name='hideForm'>\n";

	if (hiddenRangeStart != "")
		hh += "<center><font color='red'><b>Range starts at "
			+ hiddenRangeStart.replace(/:/, " in chain ")
			+ " (</font><font face='sans-serif'>[</font><font color='red'>)"
			+ ".\n<br>Click on End of range, or "
			+ "<a href='javascript: cancelHiddenRange()'>Cancel</a>"
			+ "\n</b></center></font><hr noshade size=5 align='center' width=150>\n";

	hh +=
"<span style='float: right; display: inline;'> \
<input type='button' value='Exit Hiding' onClick='cancelHiding()'> \
</span> ";

if (!invertHidden)
{
		hh +=
"<b>Hide:</a></b> Click on any \
<br clear='right'><center> " +
makeHideRadios(cck, gck, ack, rck) +
"<br>to <b>hide<\/b> it, or hide "
+ makeHideCheckboxes() +
"<\/center> \
Currently hidden:"
+ listHidden(hiddenTot);

//	hc + "<\/b>&nbsp;Chains, <b>" +
//	hg + "<\/b>&dagger;&nbsp;Residues/Groups, <b>" +
//	ha + "<\/b>&Dagger;&nbsp;Atoms.\

	hh += "<br>These will remain hidden in <b>all views</b>, \
until re-displayed: \
";

	if (hidden > 0) hh +=
"<a href='javascript: top.unHideLast()'><b>Re-Display</b><\/a> \
the most recently hidden <b>" + toHide + "<\/b>. \
";

	else hh +=
"<font color='#808080'>(No " + toHide + " hidden to re-display.)<\/font>";

	if (hiddenTot > 0)
		hh +=
"<br> \
<a href='javascript: top.unHideAll()'><b>Re-Display Everything.</b><\/a> ";

	hh +=
"<br><br> \
<a href='javascript: top.centerVisible()'><b>Center Visible Chains</b><\/a> \
&nbsp; &nbsp; &nbsp; \
<a href='javascript: top.doViewLink(top.centerIndex)'><b>Center by Clicking</b><\/a> \
<center><input type='checkbox' name='invert' " + ick + 
" onClick='invertHiding(" + hiddenTot + ")'><b>Invert Hiding</b> \
</center> \
To see only one (or a few) small parts of a molecule, first hide them, \
and then check <i>Invert Hiding</i> (immediately above). ";

} // END of !invertHidden

else // BEGIN INVERTED
{
		hh +=
"<b>Hiding Is Inverted:</a></b> \
<br clear='right'> \
<table><tr><td>&nbsp; &nbsp;</td><td> \
Previously hidden moieties are displayed, and vice versa. \
</td></tr></table> \
<b>Currently displayed:</b>"
+ listHidden(hiddenTot);

//	hc + "<\/b>&nbsp;Chains, <b>" +
//	hg + "<\/b>&dagger;&nbsp;Residues/Groups, <b>" +
//	ha + "<\/b>&Dagger;&nbsp;Atoms.\

	hh += "<br>Everything else will remain hidden in <b>all views</b>, \
until re-displayed. <b>To change</b> what is displayed (and hidden), \
you must first <b>uncheck</b> <i>Invert Hiding</i> (below). \
";

	hh +=
"<br><br> \
<a href='javascript: top.centerVisible()'><b>Center Visible Chains</b><\/a> \
&nbsp; &nbsp; &nbsp; \
<a href='javascript: top.doViewLink(top.centerIndex)'><b>Center by Clicking</b><\/a> \
<center><input type='checkbox' name='invert' " + ick + 
" onClick='invertHiding(" + hiddenTot + ")'><b>Invert Hiding</b> \
</center>";

}

	if (!invertHidden)
		hh +=

"<\/form> \
<small> \
<b>&dagger; Ligands+</b> are not hidden when you hide a chain, even if they \
belong to that chain. Use the <i>Residue/Group</i> option, or the \
<i>Ligands+</i> button to hide them. \
<br> \
<b>Nonstandard residues</b> are not always hidden with the chain, \
but can be hidden as <i>Residues</i>. \
<br> \
<b>*</b> &quot;Protein&quot;, &quot;DNA&quot;, or &quot;RNA&quot;, \
as the terms are used here, exclude amino acids or nucleotides that are <b>not \
part of a polymer chain</b>. \
<\/small>";

//&dagger; Count of hidden Residues/Groups excludes those in entire hidden chains. \
//<br> \
//&Dagger; Count of hidden Atoms excludes those in entire hidden residues/groups/chains. \

//&#167; squiggle

	return hh;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeHideCheckboxes()
{
	var hp = hd = hr = hc = hh = "";
	if (hideProtein) hp = " checked";
	if (hideDNA) hd = " checked";
	if (hideRNA) hr = " checked";
	if (hideCarbohydrate) hc = " checked";
	if (hideHydrogen) hh = " checked";

	var cbs = 
"<table border=0><tr> \
<td><input type='checkbox' onClick='hideChecked(\"p\")' name='p'" + hp + ">Protein* \
</td><td> \
<input type='checkbox' onClick='hideChecked(\"d\")' name='d'" + hd + ">DNA* \
</td><td rowspan=2> \
&nbsp;&nbsp;<input type='checkbox' onClick='hideChecked(\"h\")' name='h'" + hh + ">Hydrogen \
</td></tr><tr><td> \
<input type='checkbox' onClick='hideChecked(\"c\")' name='c'" + hc + ">"
	+ makeNotesLink("Carbohydrate", "predef") +
" &nbsp; \
</td><td> \
<input type='checkbox' onClick='hideChecked(\"r\")' name='r'" + hr + ">RNA* \
</td></tr><\/table> \
";

	return cbs;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function listHidden(hiddenTot)
{
	var is;
	var curhid = "";
	if (hiddenTot > 0)
		curhid += "<font color='red'><b>";
	else
		return("<br>&nbsp;&nbsp; Nothing");

	var allhid = "";
	if (hideProtein) allhid += "Protein*\n";
	if (hideDNA)
	{
		if (allhid.length > 0) allhid += ", \n";
		allhid += "DNA*\n";
	}
	if (hideRNA)
	{
		if (allhid.length > 0) allhid += ", \n";
		allhid += "RNA*\n";
	}
	if (hideCarbohydrate)
	{
		if (allhid.length > 0) allhid += ", \n";
		allhid += "Carbohydrate "
	+ makeNotesLink("[?]", "predef");
	}
	if (hideHydrogen)
	{
		if (allhid.length > 0) allhid += ", \n";
		allhid += "Hydrogen\n";
	}
	
	if (allhid.length > 0)
		allhid = "<br>&nbsp;&nbsp; All " + allhid;
	curhid += allhid;

	for (is = 0; is < hiddenChains.length; is++)
	{
		if (is == 0) // @@
		{
			if (hiddenChains[0].length > 1) // unnamed Protein or Nucleic chain
			{
				curhid += "<br>&nbsp;&nbsp; The Unnamed ";
			}
			else
			{
				curhid += "<br>&nbsp;&nbsp; Chain"
				if (hiddenChains.length > 1)
					curhid += "s"
				curhid += " ";
			}
		}
		else
			curhid += ", "

		curhid += hiddenChains[is];

		if (is == 0 && hiddenChains[0].length > 1) // unnamed Protein or Nucleic chain
		{
			if (hiddenChains[0].charAt(0) == "N")
				curhid += " Acid";
			curhid += " Chain";
		}
	}
	for (is = 0; is < hiddenGroups.length; is++)
	{
		if (is == 0)
		{
			curhid += "<br>&nbsp;&nbsp; "
			if (hiddenGroups.length == 1)
				curhid += "Residue/Group ";
			else
				curhid += "Residues/Groups ";
		}
		else
			curhid += ", "

		curhid += hiddenGroups[is];
	}

	for (is = 0; is < hiddenAtoms.length; is++)
	{
		curhid += "<br>&nbsp;&nbsp;" + hiddenAtoms[is].substring(
			hiddenAtoms[is].indexOf(" "));

// This made a one-line list, before the element name was included
//		if (is == 0)
//		{
//			curhid += "<br>&nbsp;&nbsp; Atom Serial"
//			if (hiddenAtoms.length > 1)
//				curhid += "s"
//			curhid += " ";
//		}
//		else
//			curhid += ", "
//
//		curhid += "#" + hiddenAtoms[is];
	}

	for (is = 0; is < hiddenRanges.length; is++)
	{
		if (curhid.length > 0)
			curhid += "<br>";
		curhid += "&nbsp; " +
			"Range: " + hiddenRanges[is];
	}

	if (hiddenTot > 0)
		curhid += "<\/b><\/font>";

	return curhid;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeHideNoMoreHelp()
{
	// Prior to call, lastHideMode is set to hideMode, then hideMode is blanked.
	// In this implementation, lastHideMode is not used.
	// (See abandoned unnecessarly complicated idea in 0.98/obsolete/unhideh.js)

	var uhh =
"<form name='hideForm'><b>Hiding Exited:</b> \
Clicked atoms will be identified. \
<br> ";

	if (getHiddenTot() > 0)
		uhh +=
"To re-display hidden moieties, at any time, click <b>Re-Display..</b> above. \
";

	else uhh +=
"(Nothing is hidden.)";

	return uhh;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeSelectRadios(cck, gck, ack, rck, fck)
{
	var hr =
"<center> \
<input type='radio' name='selectwhat' value='c'" + cck +
	" onClick='changeSelectRadio()'>Chains &nbsp; &nbsp; \
<input type='radio' name='selectwhat' value='g'" + gck +
	" onClick='changeSelectRadio()'>Residues/Groups &nbsp; &nbsp; \
<input type='radio' name='selectwhat' value='a'" + ack +
	" onClick='changeSelectRadio()'>Atoms \
<br> \
<input type='radio' name='selectwhat' value='r'" + rck +
	" onClick='changeSelectRadio()'>Range of residues in one chain (2 clicks) \
<br> \
or check \
<input type='checkbox' onClick='changePreContactsView()' name='selectFound'" +
fck + ">Atoms with Halos</a>. "
	+ makeNotesLink("<b>FAQ</b>", "contactsFAQ", "",
	"Target Selection: Frequently Asked Questions") +
"<\/center> ";

	return hr;
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makePreContactsHelp()
{

	if (selectMode == "")
	{
		clearSelectedArrays();
		selectMode = "c";
	}

	// SET CHECKBOXES
	var cck = gck = ack = rck = fck = "";
	if (selectMode == "c")
		cck = " checked ";
	else if (selectMode == "g")
		gck = " checked ";
	else if (selectMode == "a")
		ack = " checked ";
	else if (selectMode == "r")
		rck = " checked ";

	if (selectedFound != "")
		fck = " checked";

	var sfck = ctck = wtck = "";
	if (preContactsView == "sf")
		sfck = " checked";
	else
		ctck = " checked";

	if (selectedWater)
		wtck = " checked";

	var swck = "";
	if (preContactsWater)
		swck = " checked";
	
	var hh = "<form name='contactsForm'><center>";

	if (selectedRangeStart != "")
		hh += "<font color='red'><b>Range starts at "
			+ selectedRangeStart.replace(/:/, " in chain ")
			+ ".<br>Click on End of range, or "
			+ "<a href='javascript: cancelSelectedRange()'>Cancel</a>"
			+ "</b></font><hr noshade size=5 align='center' width=150>";

	hh +=
"View: \
<input type='radio' name='pCView' value='sf'" + sfck +
	" onClick='changePreContactsView()'>Spacefill &nbsp; or &nbsp; \
<input type='radio' name='pCView' value='ct'" + ctck +
	" onClick='changePreContactsView()'>Cartoon \
<br> \
<img src='bar.gif' align='center'> \
<b>Select Targets for Contacts:</a></b> \
<img src='bar.gif' align='center'> \
</center> \
Whose contacts do you want to see? \
Click on the molecule to select, as the <b>target</b>, one or more:<br> "

	+ makeSelectRadios(cck, gck, ack, rck, fck) +

"then  <br><center>\
<a href='javascript: showContacts()'><b><big>Show \
Atoms Contacting Target</big></b></a>. \
</center> \
<br><b>Click again to deselect.</b> \
<br><b><i>Hide..</i></b> or <b><i>Find..</i></b> (above) \
can be used to make target selection easier. \
<br><input type='checkbox' name='preContactsWater' onClick=\
'changePreContactsWater(\"\")'" + swck + ">Show <b>Water</b>. \
&nbsp; &nbsp; \
<input type='checkbox' name='preContactsWaterTarget' onClick=\
'changePreContactsWaterTarget()'" + wtck + ">Target All Water.";

//What you select will be decorated with only the atoms within \
//<br> \
//&nbsp; <input type='radio' name='within' value='3.5' checked> \
//3.5 &Aring; (out to weak hydrogen bonds) \
//<br> \
//&nbsp; <input type='radio' name='within' value='4.0'> \
//4.0 &Aring; (out to weak salt bridges) \
//<br> \
//&nbsp; <input type='radio' name='within' value='4.5'> \
//4.5 &Aring; (out to weak van der Waals interactions) \
//<br> \
//&nbsp; <input type='radio' name='within' value='7.0'> \
//7 &Aring; (out to weak cation-pi interactions) \

	hh +=
"<br><br> \
Currently selected: \
<br><b> "

	+ listSelected() +

"<br><a href='javascript: top.clearSelected()'><b>Start Over (Deselect All)</b></a> \
</b> \
<\/form>";

	if (preContactsView == "sf")
		hh += "In this view, all atoms are spacefilling.";

	hh +=
"Protein and nucleic acid \
chains are each given a distinct pastel color, while \
<font color='#" + colorLigand + "'><b>Ligands+</b></font> \
and \
<font color='#" + colorSolvent + "'><b>Water</b></font> are colored \
as in <i>Composition</i>. \
";

	if (preContactsView != "sf")
		hh +=
"For further description of this cartoon view, click on \
<i>Cartoon</i> (top panel above).";

	return hh;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeContactsShownHelp()
{
	var ck;

	// STOP SELECTING
	selectMode = "";
	// STOP HIDING
	hideMode = "";

	var hh =
"<form name='contactsForm'> ";

	hh += "<center><b>Contacts Shown:</b></center> ";

	hh +=
"The target you selected, \
<br> "

	+ listSelected() +

"<br>is decorated with all&Dagger; contacting atoms \
("
	+ makeNotesLink("Definitions", "contacts", ".)");


	// CHECKBOXES, CENTERING
//	hh += "<br> &nbsp; &nbsp; ";
	hh += "<center><table border=0><tr><td>";

	var marktarg = "Mark target with *";

	if (!labelContacts)
	{
		ck = "";
		if (markContactsTargets)
			ck = " checked";
			hh +=
"<div title='Marks target atoms with * * * * ' \
><input type='checkbox' name='markContactsTargets' \
	onClick='changeContactsTargetsMarks()'" + ck + "> " + marktarg + "</div> ";
	}
	else
		hh +=
"<div title='Not available when Labels are on.' \
onClick='alert(\"Not available when Labels are on.\")'>\
<img src='unchecked.gif'><font color='#808080'> " +
marktarg + "</font></div> ";

	ck = "";
	if (backboneContacts)
		ck = " checked";
	hh +=
//"<br> &nbsp; &nbsp; \
"<input type='checkbox' name='contactsBackbones' \
	onClick='changeContactsBackbones()'" + ck +
" title='Shows Thin Backbones for All Chains'> Backbones";

	hh += "</td><td> &nbsp; &nbsp; </td><td>";

	ck = "";
	if (labelContacts)
		ck = " checked";
	hh +=
//"<br> &nbsp; &nbsp; \
"<div><input type='checkbox' name='labelContacts' \
	onClick='changeContactsView()'" + ck +
" title='Labels Currently Visible Contacts'> Label Contacts ("
	+ makeNotesLink("?", "contactsLabels", ")",
	"Explanation of Labeling") +
"</div> ";

	hh +=
//"<br> &nbsp; &nbsp; \
"<a href='javascript: centerContacting()' \
title='Centers the Currently Visible Contacts' \
><b>Center Contacts</b></a> \
";

	ck = "";
	if (colorContactsTargetGray)
		ck = " checked";

	if (telAvivMode)
		hh +=
"</td></tr><tr><td colspan=3><input type='checkbox' name='targetGray' \
	onClick='changeContactsView()'" + ck +
" title='Improves Visibility of " + serverName + " Colors'> Color Target Gray \
(for <font color='red'>" + serverName + "</font>)&Dagger;";

	hh +=
"</td></tr></table></center><br>";

	// VIEW RADIO BUTTONS
	var cktSF, cktBS, cktCHN, cktCPK;
	var ckcSF, ckcBS, ckcCHN, ckcCPK;
	cktSF = cktBS = cktCHN = cktCPK = "";
	ckcSF = ckcBS = ckcCHN = ckcCPK = "";
	ck = " checked";
	if (targetSF) cktSF = ck; else cktBS = ck;
	if (targetCPK) cktCPK = ck; else cktCHN = ck;
	if (contactingSF) ckcSF = ck; else ckcBS = ck;
	if (contactingCPK) ckcCPK = ck; else ckcCHN = ck;

	var dag, Dag;
	dag = Dag = "";
//	if (targetCPK || contactingCPK)
//		Dag = "&Dagger;";
//	if (!targetCPK || !contactingCPK) // CHAIN
//		dag = "&dagger;";

	var starstar = "";
//	if (!targetSF || !contactingSF)
//		starstar = "**";

// BEGIN SNAPSHOTS TABLE
	if (!contactsRadioViews)
		hh +=
"<center><table border=0><tr><td>\
<div align='center'>Contacts Views&dagger; -- <i>Click Snapshots:</div> \
<hr noshade> \
<a href='javascript: setContactsView(1)'>\
	<img src='contact1.gif' \
		title='Overview: Target & Contacts Spacefilled, Colored by Chain'></a> &nbsp; \
<a href='javascript: setContactsView(2)'>\
	<img src='contact2.gif' \
		title='Target Spacefilled, Contacts Balls and Sticks, Colored by Chain'></a> &nbsp; \
<a href='javascript: setContactsView(3)'>\
	<img src='contact3.gif' \
		title='Target Spacefilled, Contacts Balls and Sticks, Colored by Element'></a> &nbsp; \
<a href='javascript: setContactsView(4)'>\
	<img src='contact4.gif' \
		title='Maximum Detail: Target & Contacts Balls and Sticks, Colored by Element'></a>\
</td></tr></table></center>";
// END SNAPSHOTS TABLE

// BEGIN RADIO BUTTONS TABLE

	else
		hh +=
"<center><table border=0>\
	<tr><td colspan=7 bgcolor='#808080'></tr>\
	<tr>\
		<td rowspan=5>\
<a href='javascript: setContactsView(1)'>View 1</a><sup>&#167;</sup> \
<br> \
<a href='javascript: setContactsView(2)'>View 2</a> \
<br> \
<a href='javascript: setContactsView(3)'>View 3</a> \
<br> \
<a href='javascript: setContactsView(4)'>View 4</a> \
		</td> \
 \
		<td rowspan=5>&nbsp;</td>\
		<td rowspan=5 bgcolor='#808080'></td>\
		<td rowspan=5>&nbsp;</td> \
 \
		<td>Target &nbsp;</td><td>Contacts &nbsp;</td><td>View&dagger;</td>\
	</tr><tr>\
		<td><center>\
<input type='radio' name='targetRendering' value='tsf'" + cktSF +
			" onClick='changeContactsView()'>\
		</center></td><td><center>\
<input type='radio' name='contactsRendering' value='csf'" + ckcSF +
			" onClick='changeContactsView()'>\
		</center></td>\
<td>Spacefilled</td>\
	</tr><tr>\
		<td><center>\
<input type='radio' name='targetRendering' value='tbs'" + cktBS +
			" onClick='changeContactsView()'>\
		</center></td><td><center>\
<input type='radio' name='contactsRendering' value='cbs'" + ckcBS +
			" onClick='changeContactsView()'>\
		</center></td>\
<td>Balls" + starstar + " & Sticks</td>\
	</tr><tr>\
		<td><center>\
<input type='radio' name='targetColoring' value='tcc'" + cktCHN +
			" onClick='changeContactsView()'>\
		</center></td><td><center>\
<input type='radio' name='contactsColoring' value='ccc'" + ckcCHN +
			" onClick='changeContactsView()'>\
		</center></td>\
<td>Colored by Chain" + dag + "</td>\
	</tr><tr>\
		<td><center>\
<input type='radio' name='targetColoring' value='tce'" + cktCPK +
			" onClick='changeContactsView()'>\
		</center></td><td><center>\
<input type='radio' name='contactsColoring' value='cce'" + ckcCPK +
			" onClick='changeContactsView()'>\
		</center></td>\
<td>Colored by Element" + Dag + "</td>\
	</tr>\
	<tr><td colspan=7 bgcolor='#808080'></tr>\
</table></center>";
// END RADIO BUTTONS TABLE

	ck = "";
	if (contactsRadioViews)
		ck = " checked";
	hh +=
"<div align='center'>\
Distances: "

	+ makeNotesLink("How?", "distances", "",
	"How to Measure Distances and Angles") +

"&nbsp; \
<a href='javascript: hideMonitors()' title='Hide Fixed Distances and Angles')'>Hide</a>. \
&nbsp; &nbsp; \
<input type='checkbox' onClick='toggleContactsRadioButtons()'\
name='contactsRadioButtons'" + ck + "><small>More views.</small> \
</div> \
&nbsp;<img src='down_arrow.gif' align='center'> \
<a href='javascript: checkAll(false)'>Uncheck</a> / \
<a href='javascript: checkAll(true)'>Check</a> \
all.</br>\
";

	// SHOW WATER BRIDGES
	var watcol = "#" + colorSolvent;
	if (contactingCPK)
		watcol = "magenta";

	ck = "";
	if (showWaterBridges)
		ck = " checked";

	hh +=
"<input type='checkbox' name='waterBridges' \
	onClick='changeContactsView()'" + ck + "> Show putative "

	+ makeNotesLink("<font color='" + watcol + 
			"'><b>water</b></font> bridges", "waterbridges", "") +

" (target to non-target).<br>";

	// SHOW WATER
	ck = "";
	if (showContactsWater)
		ck = " checked";
	hh +=
"<input type='checkbox' name='contactsWater' \
	onClick='changeContactsView()'" + ck + "> Show \
	<font color='" + watcol + "'><b>water</b></font> \
putatively "

	+ makeNotesLink("hydrogen bonded", "hbonds", "") +

" to target.<br>\
";

	// SHOW HBONDS
	ck = "";
	if (showContactsHBonds)
		ck = " checked";
	hh +=
"<input type='checkbox' name='contactsHBonds' \
	onClick='changeContactsView()'" + ck + "> Show putatively "

	+ makeNotesLink("hydrogen bonded", "hbonds", "") +

" non-water.<br>\
";

	// SHOW HYDROPHOBIC
	ck = "";
	if (showContactsHphob)
		ck = " checked";
	hh +=
"<input type='checkbox' name='contactsHphob' \
	onClick='changeContactsView()'" + ck + "> Show "

	+ makeNotesLink("hydrophobic (apolar van der Waals)", "hphob") +

" interactions.<br>\
";

	// SHOW SALT BRIDGES
	ck = "";
	if (showContactsSB)
		ck = " checked";
	hh +=
"<input type='checkbox' name='contactsSB' \
	onClick='changeContactsView()'" + ck + "> Show putative "

	+ makeNotesLink("salt bridges", "saltbr", ".") +

"<br>\
";

	// SHOW CATION PI
	ck = "";
	if (showContactsCatPi)
		ck = " checked";
	hh +=
"<input type='checkbox' name='contactsCatPi' \
	onClick='changeContactsView()'" + ck + "> Show possible "

	+ makeNotesLink("cation-pi", "catpi", "") +

" interactions.<br>\
";

	// SHOW METALS & MISC
	ck = "";
	if (showContactsMeMi)
		ck = " checked";
	hh +=
"<input type='checkbox' name='contactsMeMi' \
	onClick='changeContactsView()'" + ck + "> Show possible "

	+ makeNotesLink("metal and misc", "memi", ".") +

" bonds.<br>\
";

//-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  

	// SHOW STICKS?
	if (!contactingSF) // need to make form reading, or use hidden input?
	{
		ck = "";
		if (showContactsSticks)
			ck = " checked";
		hh +=
"&nbsp; &nbsp; <input type='checkbox' name='contactsSticks' \
	onClick='changeContactsView()'" + ck + "> Show sticks.<br>\
";
	}

	// HYDROGENS
	ck = "";
	if (hydrogensContacts)
		ck = " checked";
	hh +=
"&nbsp; &nbsp; <input type='checkbox' name='contactsHydrogens' \
	onClick='changeContactsView()'" + ck + "> Show "

	+ makeNotesLink("hydrogens (if present in model)", "hydrogen", ".");

	if (consurfMode)
		hh += "<br><center><img src='consurf/consurf_key.gif'></center>";
	if (selectonMode)
		hh += "<br><center><font color='red'>NEED SELECTON KEY HERE</font></center>"; //@STON
	if (epitopiaMode)
		hh += "<br><center><font color='red'>NEED EPITOPIA KEY HERE</font></center>"; //@EPIT

	// NOTES
	hh +=
"<ul> \
<li><b><i>Find..</i></b> or <b><i>Hide..</i></b> \
(above) can be used on the Contacts display. \
<li>Any other view <b>clears the contacts</b> display. \
</ul> \
";

	// "ALL" CONTACTING ATOMS
	hh +=
"&Dagger;<small><b>All</b> contacting atoms in the model are <b>shown</b>, regardless of whether they were \
hidden during target selection. NOT SHOWN, however, are \
<a href='http://molvis.sdsc.edu/protexpl/igloss.htm#crystalcontacts' \
target=_blank><font color='#00b000'><b>crystal contacts</b>\
</font></a>.";

	// PRESET VIEWS
	if (contactsRadioViews)
		hh +=
"<br>&#167; Views 1-4 are the most useful of the 16 possible \
settings of the radio buttons."

	hh += "<br><br>&dagger;";

	// BALLS
	if (!targetSF || !contactingSF)
	{
		hh +=
"<b>Small balls</b> signify atoms likely noncovalently-bonded \
to the target ("

	+ makeNotesLink("Definitions", "contacts", ").") +

" Slightly larger and darker balls are target atoms likely \
non-covalently bonded to the target-contacting atoms.\n";

		if (showContactsSticks)
			hh += 
"Optionally, residues containing balls are shown as <b>sticks</b>, \
solely for context.\n";

		hh +=
"<br>Use <b><i>Center Atom..</i></b>, <b><i>Zoom</i></b> and \
<b><i>Slab</i></b> (above) to see details with less clutter. ";
	}

	// CHAIN COLORS
	if (!targetCPK || !contactingCPK)
		hh +=
"<b>Colors:</b> \
Protein and nucleic acid chains are each given a distinct \
pastel color. \
<font color='#" + colorLigand + "'><b>Ligands+</b></font> \
and \
<font color='#" + colorSolvent + "'><b>Water</b></font> are colored \
as in <i>Composition</i>.";

	// ELEMENT COLORS
	if (targetCPK || contactingCPK)
		hh +=
"<br><b>Colors:</b>\
Atoms are colored by element, except that \
<font color='magenta'><b>water oxygens</b></font> are colored magenta. \
Target atom colors are <b>darker</b>. "
	+ colorByElement;

	if (telAvivMode)
		hh +=
"<br><br>&Dagger; <b>Color Target Gray</b> does <b>not apply</b> when \
" + serverName + "\
colors are applied to the target."

	hh += "</small><\/form>";

	return hh;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function listSelected()
{
	var is;
	var cursel = "";

	for (is = 0; is < selectedChains.length; is++)
	{
		if (cursel.length > 0)
			cursel += "<br>"
		if (selectedChains[is].length > 1)
		{
			if (selectedChains[is] == "Protein")
				cursel += "&nbsp; The Unnamed Protein Chain";
			else
				cursel += "&nbsp; The Unnamed Nucleic Acid Chain";
		}
		else
			cursel += "&nbsp; Chain " + selectedChains[is];
	}
	for (is = 0; is < selectedGroups.length; is++)
	{
		if (cursel.length > 0)
			cursel += "<br>"
		cursel += "&nbsp; Residue/Group " + selectedGroups[is];
	}
	for (is = 0; is < selectedAtoms.length; is++)
	{
		if (cursel.length > 0)
			cursel += "<br>"
		cursel += "&nbsp; " +
			selectedAtoms[is].substring(selectedAtoms[is].indexOf(" "));
	}

	if (selectedFound != "")
	{
		if (cursel.length > 0)
			cursel += "<br>"
		cursel += "&nbsp; Halos: " + selectedFound;
	}

	for (is = 0; is < selectedRanges.length; is++)
	{
		if (cursel.length > 0)
			cursel += "<br>";
		cursel += "&nbsp; " +
			"Range: " + selectedRanges[is];
	}

	if (selectedWater)
	{
		if (cursel.length > 0)
			cursel += "<br>"
		cursel += "&nbsp; All Water";
	}

	if (cursel.length == 0)
		cursel = "&nbsp; Nothing";
	else cursel = "<font color='red'>" + cursel + "</font>";

	return cursel;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeFindHelp() // mfh
{
	var pfh =
"<form name='findForm' onSubmit='doFind(); return false;'> \
<b>Find:</b> \
<input type='text' size='30' name='toFind' \
value='" + toFind + "'> \
<a href='javascript: clearFindForm()'><b>Clear Halos</b></a> \
<br> \
<div align='center'> \
<img src='halos1.gif' align='right' \
title='Halos on Invisible Atoms Look Like This'> \
<img src='halos2.gif' align='left' hspace=8 \
title='Halos on Spacefilled Atoms Look Like This'> \
<a href='javascript: seeHalosEasily()'><b>See All Halos Easily</b></a> \
&nbsp; &nbsp; \
<a href='javascript: reDisplay(\"\", \"\")' \
title='Restore the Previous View'><b>Undo</b></a> \
</div><br clear='both'> \
In the slot above, enter one or more (separated by <b>commas</b>): \
<ul> \
<li> "

	+ makeNotesLink("<b>Sequence</b>", "seq", "") +

" number(s) (such as <b>10,51</b>). \
<li> Range of "

	+ makeNotesLink("sequence", "seq", "") +

" numbers (such as <b>18-23</b>). \
<li> Amino acid "

	+ makeNotesLink("3-letter names", "aanames", "") +

" (such as <b>PRO,HIS</b>). \
<li> Nucleotide 1-letter names (<b>A,C,G,T,U</b>). \
<a href='notes.htm#moreFind' \
target='_blank'>More..</a> \
<li> Name-sequence combinations (<b>SER41, C9</b>). \
<li> To restrict one of the above to a specific \
chain, add colon plus the chain letter \
(such as <b>41<b>:</b>A, C9<b>:</b>D</b>). \
<li> Full name(s) of elements (<b>zinc, selenium</b>). \
<li> "

	+ makeNotesLink("More..", "moreFind", ".") +

"</ul> \
After pressing <i>Enter</i>, <b>yellow dot-halos</b> will appear \
around the atoms in the residues listed in the slot above (even if \
the atoms themselves are not visible). \
If <b>no halos</b> appear, either the listed residues don't exist \
in this molecule, or your list is not formatted correctly \
following the above examples. \
<br><br> \
The halos will remain present in all views until you click <i>Clear Halos</i> \
or <i>Reset</i> above. \
</form> \
";

	return pfh;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeBePatientHelp()
{
	var bph =
"<form> \
<big><big><b>Please Be Patient!</b></big> It may take several minutes \
for the Jmol applet to arrive the first time you use \
<i>FirstGlance in Jmol</i>. Subsequent sessions will \
show the molecule much faster. \
";

	if (top.usingSignedApplet)
		bph +=
"<br>If you did <font color='red'>not trust</font> the signed Jmol applet, \
close this window because the molecule will never appear. \
";

//"<center><input type='button' value='OK -- I see the molecule!' \
//onClick='top.showHelp(\"makeIntroHelp()\")'></center> \
//Please click the button above to go to the <i>Introduction</i>. \

bph +=
"<br> \
</big>(Large molecules or multiple-model NMR data may need \
extra time to arrive.) \
<br><br> \
<big>Please <b>don't reload/refresh</b> until you see the molecule.</big> \
<br>Reloading/refreshing before you see the molecule sometimes prevents the \
molecule from ever appearing. To fix this, just close/quit \
your browser, and restart it. \
</form> \
";

	return bph;
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var noClick = "";
/*
" <small>(Currently, this does not work for nucleic acids with the \
Cartoon or Secondary Structure displays, but works with the \
N-&gt;C Rainbow display or on nucleotide bases as Vines. \
A future version will fix this.) <\/small>";
*/
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var macHover =

"<small>(On <b>Macintosh OS X</b>, click on blank background near the molecule \
first.)</small>";

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function identifySubhelp()
{
	var idsubh = 
"<b>Identify</b> any atom by clicking on it. Its identity will be \
displayed to the lower left of the molecule (and in the browser status bar). "

	+ makeNotesLink("More..", "ident", "")
	+ " " + makeIdentityCodeHelp();

	return idsubh;
}

//After about two seconds of touching an atom, a message will appear its
//identity will be displayed. This works best \
//with <i>spinning toggled off</i>. \
//" + macHover;

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var inspectSubhelp =
"<br><br>Click the <i>Slab</i> button (above) for instructions on how to \
zoom in and see a region of interest, without clutter.";
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var addHeteroSubhelp =
"Clicking the <b>Ligands+</b> or <b>Water</b> buttons adds \
these components to the display, if they are not already visible,\
or hides them if they are.";

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var hideHeteroSubhelp =
"<br><br>Clicking the <b>Ligands+</b> or <b>Water</b> buttons hides \
these components.";

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var drumsSubhelp =
"<br><br>This color scheme is adapted from the \
<a href='http://www.umass.edu/molvis/drums' target='drumswin'> \
Drums Standardized \
Color Schemes for Macromolecules</a>. \
";

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var colorByElement =
"<center><table border=0 cellpadding=5 bgcolor='black'><tr>\
<td><center><big><big><b> \
<font face='sans-serif'> \
" + coloredElements + " \
</font></b></big></big><br> \
(<a href='http://jmol.sourceforge.net/jscolors/' \
target='coewin'><font color='c8c8ff'>more elements..</font></a>) \
</center></td></tr></table></center> \
";

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeSlabHelp()
{
	var ck10 = ck6 = ck3 = "";

	if (slabThickness == "10")
		ck10 = " checked";
	else if (slabThickness == "6")
		ck6 = " checked";
	else if (slabThickness == "3")
		ck3 = " checked";

	var slh =

"<form name='slabForm'> " +

//<center><table border=0 cellpadding=4 bgcolor='#ff80ff'> \
//<tr><td><b><b>Molecule disappeared? &nbsp; \
//<a href='javascript: doMolViewSpt(\"zoom 300;\")'>&nbsp;Fix!&nbsp;</a> " +
//&nbsp; (" +
//	+ makeNotesLink("More..", "zoombugs", ")") +
//</b></td></tr></table></center> \

"<big><b>Slab</b></big> \ mode hides the front and rear of the \
molecule, leaving visible only a thin central slab, \
parallel to the screen. \
This is best appreciated when <i>spinning is toggled off</i>. \
<center> \
Slab thickness: \
	<input type='radio' name='slabThickness' value='10'" + ck10 +
		" onClick='changeSlabThickness()'>10% \
		&nbsp; \
	<input type='radio' name='slabThickness' value='6'" + ck6 +
		" onClick='changeSlabThickness()'>6% \
		&nbsp; \
	<input type='radio' name='slabThickness' value='3'" + ck3 +
		" onClick='changeSlabThickness()'>3% \
</center> \
 \
<br> \
With slab mode off (so you can see the entire molecule), \
use <i><b>Center Atom..</b></i> (above) to center a region \
of interest. "

+ noClick +

"Centering ensures that the region \
of interest will be visible after you <b>turn slab mode on</b>. Next, <b>Zooming \
in</b> may help see details, and also pushes more of the front and back \
out of the visible slab zone, producing a less obstructed view of the \
centered moiety. \
 \
<br><br>Click <i>Center Atom..</i> (above) to re-center the entire molecule, and \
click <i>Slab</i> again to toggle slab mode off. <br><br>\
"

 + identifySubhelp(); // in makeSlabHelp()

	return slh;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeWaterHelp()
{
	var wath =
"<big><b>Water</b></big> \
oxygens are displayed as \
<img src='waterox.gif' align='left' hspace='3'> \
<font color='red'><b>red</b></font> spheres of van der Waals radii, \
as shown at left. \
 \
(If the <i>Water</i> button does not show any red \
spheres, no water was included in the model.) \
 \
" + makeSmallWaterCheckbox() + " \
 \
Typically, only 10-20% of the water in protein crystals is tightly-enough \
bound to be resolved, so 80-90% of the water present is invisible \
(due to disorder). \
 \
<br><br> \
<img src='hoh.gif' align='left' hspace='3'> \
<b>Hydrogen</b> atoms are not resolved in most \
protein crystallographic results, \
so often the water oxygens lack hydrogens. When hydrogen atoms are \
modeled, they appear as two white atoms \
attached to the red water oxygens, as shown at left. \
";

	return wath;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeLigandsHelp()
{
	var ligh =
	
"<big><b>Ligands+</b></big> \
displays the &quot;ligands+&quot; subset of atoms as spheres of van der Waals \
radii, colored by element: "

+ colorByElement +

"&quot;Ligands+&quot; includes all components of the model that are not \
water, and not "

	+ makeNotesLink("chains", "lig", "") +	

" of protein, DNA, or RNA. \
Thus, it includes substrate or inhibitors, prosthetic groups such as \
heme, cofactors such as NAD, \
carbohydrate, metal ions, \
and so forth, \
regardless of whether these are covalently \
or non-covalently bound to the protein or nucleic acid chains. \
It also includes isolated standard amino acids or nucleotides \
that are not members of a "

	+ makeNotesLink("standard protein or nucleic acid chain", "lig", "") +	

" (<b>Caution</b>: Rare ligands may fail to be displayed, but will be displayed \
when you check non-standard residues below. "

	+ makeNotesLink("More..", "lig", ")") +

"<br><br> \
Clicking <i>Ligands+</i> a second time hides the ligands+. "
 + makeSmallLigandCheckbox() 
 + makeNonStandardCheckbox()
 + identifySubhelp(); // in makeLigandsHelp()

	return ligh;
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var centerAtomHelp =
"<form> \
<span style='float: right; display: inline;'> \
<input type='button' value='Exit Centering' onClick='cancelCentering()'> \
</span> <big><b>Center Atom</b></big> (or Entire Molecule) \
 \
</form> \
<b><big><big><font color='red'>Click on any atom </font></big> \
to center it.</big></b> \
<br> \
Mac OS X Firefox: two (or four) clicks may be needed. Safari works better! See "

	+ makeNotesLink("Notes", "macff", ".") +

"<br><br>" +

//<b> \
//2. Centering mode remains on until you \
//<center> \
//<big> \
//<a href='javascript: top.cancelCentering()'>Turn Off or Cancel Centering</a>. \
//</big> \
//</center> \
//</b><br> \

"At any time, you may <center>\
<a href='javascript: top.centerAll()'><b>Re-Center the \
Entire Molecule</b></a></center>. \
" + inspectSubhelp;

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var centeringCancelledHelp =
"<big><b>Centering Exited.</b></big> \
 \
<br><br> \
At any time, you may \
<a href='javascript: top.centerAll()'><b>Re-Center the Entire Molecule</b></a>. \
";
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var centerAllHelp =
"<big><b>Center All</b></big> \
centers the entire molecule. This is useful after you have clicked \
on the molecule, which centers the clicked atom. \
 \
<br><br> \
<big>To inspect details in a region of interest,</big> click on an atom \
in the region to center that region, Then zoom in. Turning on \
<b>Slab</b> will hide portions of the molecule distant from the \
centered region, simplifying the view. \
 \
<br><br> \
When finished, click <b>Center All</b> and zoom out if you wish to restore \
an overview of the entire molecule. \
 \
<br><br> \
 \
Protein Explorer (see link above) can be used to capture any view of a \
molecule in a slide with a rotating molecular view, called a MolSlide. \
Please see <a href='http://www.molslides.org' \
target='molslidewin'>MolSlides.Org</a> for \
examples and details. \
";


//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeAllModelsHelp()
{

	var allmh =

"<big><b>All Models</b></big> \
enables you to see whether there is more than one model. \
It displays a very thin backbone trace for each model. \
In most cases, you will see the chain(s) for a single model. \
Sometimes, however, you will see multiple models -- \
and in these cases, clicking on the molecule will report \
<b>Model=<i>n</i></b>, where <i>n</i> is the model number. \
<br><br> \
Access Proteopedia (or PDB or OCA, via the above link to \
<i>Key Resources</i>) to find out \
the experimental method. \
About 85% of \
3D macromolecular structure data files (PDB files) result from \
<b>X-ray crystallography</b>, which produces a <b>single model</b>. \
<img src='multmods.gif' align='left' hspace='5'> \
Most of the remaining data files come from \
<a href='http://proteopedia.org/wiki/index.php/NMR' \
target='_blank'>solution nuclear magnetic \
resonance spectroscopy (<b>NMR</b>)</a>, which typically yields \
<b>multiple models</b>. \
An example \
(<a href='fg.htm?mol=2BBN' target=_blank>2BBN</a>) \
is shown at left. \
In such cases, all the other views in <i>FirstGlance</i> \
show only the first model. \
<br><br> \
In NMR results, the discrepancies between models can result either from \
thermal motion in solution, or from regionally insufficient data. \
Nothing in the published data file distinguishes these two sources \
of the discrepancies. Also, in contrast to \
<a href='http://proteopedia.org/wiki/index.php/R_value' \
target='_blank'>R</a> \
and \
<a href='http://proteopedia.org/wiki/index.php/Free_R' \
target='_blank'>R<sub>free</sub></a> \
for crystallographic models, nothing in published NMR data files gives an \
overall measure of \
<a href='http://proteopedia.org/wiki/index.php/Quality_assessment_for_molecular_models' \
target='_blank'>quality</a>. \
<br><br> \
In general, NMR results are \
<a href='http://proteopedia.org/wiki/index.php/Quality_assessment_for_molecular_models#NMR_Models' \
target='_blank'>more likely to contain major errors</a> \
than are good-quality crystallographic results. \
";

	return allmh;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeVinesHelp()
{
	vh =	

"<big><b>Vines:</b></big> All atoms ";

	var closeparen = "";
	if (!toggleIsDown[waterIndex] || !sidechainsVisible || !hydrogensVisible)
	{
		vh += "(except ";
		closeparen = ")";
	}

	var except = "";
	if (!toggleIsDown[waterIndex])
		except += "water";

	if (!sidechainsVisible)
	{
		if (except.length > 0)
			except += " and ";
		except += "sidechains";
	}

	if (!hydrogensVisible)
	{
		if (except.length > 0)
			except += " and ";
		except += "hydrogen";
	}

	if (!allWireframe)
	{
		if (except.length > 0)
			except += " and ";
		except += "backbone";
	}

	vh += except;

	vh += closeparen +
" are displayed as sticks (or tiny balls, if not \
covalently bonded) colored by element: " +
colorByElement;

	if (!allWireframe)
		vh +=
"<br> \
<b>Backbone</b> atoms are hidden, except for traces connecting protein alpha carbon \
atoms or nucleic acid phosphorus atoms. The backbone for each chain is given a distinct \
pastel color. ";

	vh +=
makeWireframeAllCheckbox() +
addHeteroSubhelp + "<br><br>"
	+ identifySubhelp(); // in makeVinesHelp

	vh += inspectSubhelp;

	return vh;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var zoomHelp =
"<big><b>Zoom</b></big> \
<br><br>\
In addition to using the zoom-arrow buttons above, \
here are other ways to zoom: \
<ul> \
<li>Click on the background of the molecular rectangle; then use \
the wheel on your mouse. \
<br><li>Hold down the Shift key, then drag up or down on the molecule. \
</ul><center> \
<a href='javascript: scriptToJmol(\"zoom 100;\")'>Fit molecule to window</a>. \
&nbsp; &nbsp; \
<a href='javascript: scriptToJmol(\"center all;\")'>Center entire molecule</a>. \
</center> \
";

//Zooming <b>too large</b> (close to the maximum) may distort the \
//molecule. " +
//(<a href='notes.htm#zoombugs' target='_blank'>More..</a>). \
//"Zoom a bit smaller to correct these distortions. \


//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeChargeHelp()
{

	var ckcps = "";
	if (showPolar)
		ckcps = " checked";

	var ckincs = "";
	if (showChargeIncompleteSidechains)
		ckincs = " checked";

	var ckcoa = "";
	if (colorChargeOnlyAtoms)
		ckcoa = " checked";

	var charh =
	
"<form name='chargeForm'><big><b>Charge:</b></big> \
Amino acids are colored  \
";

	var eside = "</big> (charged atoms* only)<big>";
	if (showPolar)
		eside = "</big> (entire sidechains)<big>";
	if (!showPolar && !colorChargeOnlyAtoms)
		eside = "</big> (entire residues)<big>";

	charh +=
"<ul><font face='sans-serif'><big> \
<li><font color='#" + colorBasic + "'><b>Cationic +</b></font> " + eside +
"<li><font color='#" + colorAcidic + "'><b>Anionic -</b></font> " + eside;

	if (showPolar)
		charh +=
"<li><font color='#" + colorPolarText + "'><b>Polar, uncharged</b></font> \
<li><font color='#" + colorBackbone + "'><b>Backbone atoms</b></font> \
</big> (charged or uncharged)<big> \
<li><font color='#" + colorHydrophobicText + "'><b>Hydrophobic</b></font> \
";

	charh += "<\/big><\/font>";

	if (!showPolar)
	{
		charh +=
"<br><input type='checkbox' onClick='top.toggleChargeOnlyAtoms()'" +
ckcoa + "> \
Color only charged atoms.\n";

		if (colorChargeOnlyAtoms)
			charh +=
"<br><input type='checkbox' onClick='top.toggleChargeIncompleteSidechains()'" +
ckincs + "> \
Color <a href='notes.htm#icsc' target=_blank>incomplete sidechains</a>&dagger;. \
(<font face='sans-serif'><b>S-</b></font>)";
	}

	charh +=
"<br><input type='checkbox' onClick='top.togglePolarColor()' name='colorPolar'" +
ckcps + "> \
Color polar (uncharged) sidechains. \
<\/ul> \
";

	if (!showPolar)
	{
		charh +=
"<table bgcolor='white'><tr><td>\
*Charged atoms at neutral pH: sidechain \
<font color='#" + colorAcidic + "'><b>oxygens</b></font> \
in Asp and Glu, sidechain \
<font color='#" + colorBasic + "'><b>nitrogens</b></font> \
in Lys, Arg, and His. \
His N-epsilon is \
<font color='#" + colorHisBasic + "'><b>medium blue</b></font> \
because it is only partially charged (pKa 6.0). \
";

	if (colorChargeOnlyAtoms)
	{
		if (showChargeIncompleteSidechains)		
		charh +=
"<br>&dagger; Charged residues with incomplete sidechains, \
when present, are shown in \
<font color='#" + colorLightBasic + "'><b>light blue</b></font> \
or \
<font color='#" + colorLightAcidic + "'><b>light red (pink)</b></font>. \
Examples with incomplete sidechains include \
<a href='fg.htm?mol=1apm' target=_blank>1APM</a> and \
<a href='fg.htm?mol=1bl8' target=_blank>1BL8</a>.";
		else charh +=
"<br>&dagger; <b>Warning:</b> Charged atoms are <b>not colored</b> \
for any residues with incomplete sidechains. \
";
	}

	charh +=
"</td></tr></table><br> \
";

	} // end if !showPolar
//	else charh += "<br>\n";

	charh +=
"Nucleic acid is shown as \
<a href=\"javascript: top.showHelp('cartoonHelp')\">Cartoons</a> \
with each chain given a different color. \
Ligand and solvent are initially hidden. \
</form>" +

addHeteroSubhelp + "<br><br>"
	+ identifySubhelp(); // in makeChargeHelp()

	charh += drumsSubhelp;

return charh;

}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makePolarityHelp()
{
	var polh =

"<big><b>Hydrophobic/Polar:</b></big> \
Amino acids are colored either \
<ul><big><big><font face='sans-serif'> \
<li><font color='#" + colorHydrophobicText + "'><b>Hydrophobic</b></font> or \
<li><font color='#" + colorPolarText + "'><b>Polar</b></font> \
</font><\/big><\/big> (charged or uncharged) <\/ul> \
Nucleic acid is shown as \
<a href=\"javascript: top.showHelp('cartoonHelp')\">Cartoons</a> \
with each chain given a different color. \
Ligand and solvent are initially hidden. \
<br><br>" +

addHeteroSubhelp + "<br><br>"
	+ identifySubhelp(); // in makePolarityHelp()

	polh += drumsSubhelp;

	return polh;
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Before the black table,
//<ul><big><font face='sans-serif'> \
//<li><font color='#" + colorProtein + "'><b>Protein</b></font> \
//<li><font color='#" + colorDNA + "'><b>DNA</b></font> \
//<li><font color='#" + colorRNA + "'><b>RNA</b></font> \
//<li><font color='#" + colorLigand + "'><b>&quot;Ligand&quot;*</b></font> \
//<li><font color='#" + colorSolvent + "'><b>Solvent**</b></font> \
//</font><\/big><\/ul> \

// Black table with white for zombies.
// <table cellpadding='10' bgcolor='black'><tr><td> \
// <font face='sans-serif'><big> \
// <font color='#" + colorProtein + "'><b>Protein</b></font> \
// <br><font color='#" + colorDNA + "'><b>DNA</b></font> \
// <br><font color='#" + colorRNA + "'><b>RNA</b></font> \
// <br><font color='#" + colorLigand + "'><b>&quot;Ligand&quot;*</b></font> \
// <br><font color='#" + colorSolvent + "'><b>Solvent**</b></font> \
// </big><small> \
// <br><font color='white'><b>?***</b></font> \
// </small> \
// </font> \
// </td></tr></table> \
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


function makeCompositionHelp()
{
	var comph =

"<big><b>Composition:</b></big> \
All atoms are shown as spacefilling spheres of van der Waals radii, colored \
as follows: \
<ul><big><font face='sans-serif'> \
<li><font color='#" + colorProtein + "'><b>Protein</b></font> \
<li><font color='#" + colorDNA + "'><b>DNA</b></font> \
<li><font color='#" + colorRNA + "'><b>RNA</b></font> \
<li><font color='#" + colorLigand + "'><b>&quot;Ligand&quot;*</b></font> \
<li><font color='#" + colorSolvent + "'><b>Solvent**</b></font> \
</font><\/big><\/ul> \
 \
<b><font color='#" + colorLigand + "'>* Here, \
<i>&quot;Ligand&quot;</i> includes everything that is not protein, \
DNA, RNA, or solvent. \
</font><font color='#" + colorSolvent + "'> \
<br> \
**<i>Solvent</i> is water plus inorganic sulfate or phosphate ions. \
</font></b> \
" +

hideHeteroSubhelp + "<br><br>"
	+ identifySubhelp(); // in makeCompositionHelp()

	comph += drumsSubhelp;

	return comph;
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeRainbowHelp()
{

	var bowh =

"<big><b>N<img src='arrow.gif'>C Rainbow</b></big> \
<br><br> \
Protein and nucleic acid chains are shown as smooth backbone traces, \
with nucleic acids thicker. \
<font color='#" + colorAminoTerm + "'><b>Amino (N) termini</b></font> \
of proteins and  \
<font color='#" + colorAminoTerm + "'><b>5' termini</b></font> \
of nucleic acids are \
<font color='#" + colorAminoTerm + "'><b>blue</b></font>. \
<font color='#" + colorCarboxyTerm + "'><b>Carboxy (C) termini</b></font> \
of proteins and  \
<font color='#" + colorCarboxyTerm + "'><b>3' termini</b></font> \
of nucleic acids are \
<font color='#" + colorCarboxyTerm + "'><b>red</b></font>. \
Between termini, colors follow a spectral rainbow sequence. \
<br><center><table cellpadding=5 cellspacing=0><tr> \
<td bgcolor='#0000ff'><font color='#ffffff' face='sans-serif'><b>N, 5'</b></font></td> \
<td bgcolor='#00c0ff'>&nbsp;</td> \
<td bgcolor='#00e0b0'>&nbsp;</td> \
<td bgcolor='#50e000'>&nbsp;</td> \
<td bgcolor='#a0e000'>&nbsp;</td> \
<td bgcolor='#e0e000'>&nbsp;</td> \
<td bgcolor='#ffa000'>&nbsp;</td> \
<td bgcolor='#ff0000'><font color='#ffffff' face='sans-serif'><b>C, 3'</b></font></td> \
</tr></table></center> \
<br>" +

addHeteroSubhelp;

	return bowh;
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeRocketHelp()
{
	var rockh =
"<big><b>Secondary Structure</b></big> \
<br><br> \
This display affects <b>only protein</b> chains; the previous display of non-protein \
moieties remains unchanged. \
<font color='#" + colorAlphaHelix + "'><b>Alpha helices</b></font> \
are shown as \
&quot;<font color='#" + colorAlphaHelix + "'><b>rockets</b></font>&quot;. \
<font color='#" + colorBetaStrand + "'><b>Beta strands</b></font> \
are shown as \
<font color='#" + colorBetaStrand + "'><b>planks</b></font>. \
 \
<br><br> \
Arroheads point towards the carboxy termini. \
 \
<br><br> \
The entire protein chain is shown as a smoothed backbone trace. \
Random coils are white. \
Make the <b>background black</b> \
with the <i>Background</i> button to make the backbone trace \
easier to see. \
<font color='#" + colorTurn + "'><b>Turns</b></font> may (or may not) be colored \
<font color='#" + colorTurn + "'><b>blue</b></font>. \
 \
<br><br> \
If secondary structure was specified by the authors of the published \
model (PDB file), secondary structure is shown accordingly. \
Otherwise, Jmol determines secondary \
structure objectively using a modified Kabsch-Sander algorithm. \
Authors who specify helices and strands often do not specify turns, \
which is why turns are often not colored blue. \
<br><br>" +

addHeteroSubhelp + drumsSubhelp;

	return rockh;

}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeCartoonHelp()
{
	var carth =

"<big><b>Cartoon</b></big> \
<br><br> \
Each chain is a different pastel color. \
<b>Protein</b> alpha helices and beta strands are shown as ribbons, with arrowheads \
pointing towards the carboxy termini. \
Random coil is shown as smoothed backbone traces. \
<b>Nucleic acids</b> are shown as schematic bases extending from smoothed \
backbone traces. \
This display affects only protein and nucleic acid; the previous display \
of other moieties remains unchanged.<br><br>" +

addHeteroSubhelp;

	return carth;
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeCheckAtRCSB()
{
	var ckrcsb = "You can check this by ";

	if (top.validPDBId.length > 0)
		ckrcsb +=
"<a href='" + rcsbPDBURLHead + top.validPDBId +
"' target='_blank'>searching for " + top.validPDBId +
" at RCSB</a>. ";

	else ckrcsb +=
"searching for the PDB code at <a href='http://www.pdb.org' \
target='rcsbwin'>RCSB</a>.";

	ckrcsb += 
"<ul><li>&quot;Status HPUB&quot; means the entry is supposed to be released \
upon publication of the journal article describing it. \
If it was not, contact info@rcsb.org citing the publication.\
</li> \
<li>&quot;No results were found matching your query&quot; usually means \
that the PDB code above is incorrect. \
</li></ul> \
";

	return (ckrcsb);
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeTroubleHelp()
{

	var trh =
"<big><b>Troubleshooting</b></big> \
<br><br> \
<b>Please be patient!</b> \
The first time you use <i>FirstGlance</i>, it might take up to several \
minutes before the molecule appears. This time is required to transfer \
and initialize the Jmol java applet. After the first use, loading \
will be faster. \
 \
<br><br> \
Please <b>don't reload/refresh</b> until after you see the molecule. \
Reloading prematurely may prevent the molecule from ever appearing! \
To fix this, just close (quit) your browser, and restart it. \
 \
<br><br> \
If the white rectangle at right turns <b>completely blank</b> \
(&quot;Jmol&quot; disappears \
from the lower right corner), this means that the PDB file was not \
available. Often, this means that the Protein Data Bank has not released \
the data file yet. ";

	trh += makeCheckAtRCSB();

	trh +=
"<br><br> \
FirstGlance <b>requires "

	+ makeNotesLink("java</b>", "java", ".") +

" Some installations of Windows or \
linux may have \
no java. You can install or update free java by going to \
<a href='http://www.java.com' target='javacomwin'>java.com</a>. Updating java is always \
a good idea, especially if FirstGlance does not seem to be working \
properly. "

	+ makeNotesLink("More..", "java", "") +

"<br><br> \
<b>Not all browsers work well with FirstGlance.</b> \
<font color='green'><b>Recommended browsers</b></font> \
(see <a href='http://en.wikipedia.org/wiki/Usage_share_of_web_browsers' \
target='_blank'>browser popularity</a>) \
are the <i>current versions</i> of: \
<ul> \
<li><b>Windows</b> \
(get/update java from  \
<a href='http://www.java.com' target='javacomwin'>java.com</a>) \
<font color='green'><b> \
	<ul> \
	<li>Internet Explorer 6 or later\
	</li><li>Firefox 1.5 or later\
	</li><li>Chrome 3 or later\
	</li><li>Opera 10.10 (Windows only!) or later\
	</li><li>Safari-Windows 4.0 or later \
	</li></ul></b></font> \
 \
<li><b>Mac OS X</b> \
(Apple <i>Software Upgrades</i> include java. Keeping your \
software upgrades up to date is recommended.) \
	<ul> \
<b><font color='green'><li>Safari</font></b> (see important "

	+ makeNotesLink("Notes", "safari", ")") +

"<b><font color='green'><li>Firefox 1.5 or later</font></b> (imperfect; see "

	+ makeNotesLink("Notes", "macff", ")") +

"	</ul> \
 \
<li><b>linux</b><font color='green'><b> \
	<ul><li>Mozilla Firefox</ul></b></font> \
</ul> \
 \
<i>FirstGlance in Jmol</i> may not work properly in any browser \
not listed above. It  \
<font color='red'>does not work</font> in these browsers: \
<font color='red'> \
<ul></li><li>Opera 10.10 for Mac OS X \
</font>(OK on Windows)<font color='red'> \
<li>Netscape Communicator 4.x \
</li><li>Konqueror \
</li><li>Mac PPC OS9 <q>Classic</q> (any browser: current java is unavailable for OS9)\
</li></ul></font> \
";

	// Invisible unless blocked, for those in the know.
	trh += "<font color='#f4f4f4'>" + pdbURL + "</font>";

	return trh;

}


//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeIntroHelp()
{
//"<center>Introduction<\/center> \
	
	var introHelp =
"<center><table border='0' width='100%'><tr><td width='32%'>&nbsp;</td>\
<td width='32%' align='center'>Introduction</td>\
<td width='32%' align='right'><a href='languages/es/fg.htm"
	+ document.location.search +
"' target='_blank'>espa&ntilde;ol</td>\
</tr></table></center>\
<a href='javascript: top.showHelp(\"licenseHelp\")'> \
<img src='nsf4c_50bt.gif' align='right' border='0' \
title='Supported by the Division of Undergraduate Education of the \
US National Science Foundation'></a> \
<big><b>FirstGlance in Jmol</b></big> \
is a simple, free tool for macromolecular visualization. \
The initial display is \
<a href=\"javascript: top.showHelp('cartoonHelp')\"><b>Cartoon</b></a> \
plus \
<a href=\"javascript: top.showHelp('makeLigandsHelp()')\"><b>Ligands+</b></a>. "

+

"<span title='X=NonStandard, S-=Sidechain Incomplete, ?=Anomalous'>\
(Unusual moieties, when present, are labeled "
	+ makeNotesLink("<b>X, S-,</b> or <b>?</b>", "labels") + ".)</span> " +

"Click on the links and buttons above to see different \
aspects of the molecular structure. \
 \
<ul> \
<li> <b>Rotate</b> the molecule by dragging near it with the mouse. \
<li>"
	+ identifySubhelp(); // in makeIntroHelp()

	introHelp +=
"<li><b>Center</b> a region of interest using <i>Center Atom</i> above. "

	+ noClick +

"You can then inspect details by <b>zooming</b> in. \
Regions distant from the centered moiety can be <b>hidden</b> by \
toggling <i>Slab</i> on. (When finished, \
<i>Center Atom</i> offers the option to re-center the entire molecule.) \
 \
<br><br> \
 \
<li><b>Specific oligomers</b> or single molecules can be visualized using \
<a href='javascript: showHelp(\"makeKeyExternalResourcesHelp()\")'>Key \
External Resources</a>. \
 \
<li>See <b>Salt Bridges, Cation-Pi Interactions</b>, evaluate model \
quality (e.g. color by <b>Temperature</b>), etc. by clicking on \
<b>More Views..</b> above. \
 \
<li>For <b>more information</b> about the molecule (name, species, \
sequence, etc.), use the \
<a href='javascript: showHelp(\"makeKeyExternalResourcesHelp()\")'>Key \
External Resources</a>. \
 \
<br><br> \
 \
<li><b>Snapshots of your work</b> can easily be \
<a href='slides.htm' target=_blank><b>pasted \
into a Powerpoint presentation</b></a>. \
 \
<li>For a <b>quick tour</b> of what <i>FirstGlance</i> can do, \
visit the <b><a href='snaps/index.htm' target=_blank>Snapshot Gallery</a></b> \
and see \
<b><a href='whatis.htm' target=_blank>What Is FirstGlance?</a></b>. \
\
<li><a href='about.htm' target='aboutwin'><b>About FirstGlance in Jmol</b></a> \
has instructions on setting up links to display molecules, \
troubleshooting, copyright/license, acknowledgements, version history, and \
extensive technical information. \
</ul> \
";

	return introHelp;
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeMoreViewsHelp()
{

	var ack = ucck = bbck = aack = aadots = aass = "";
	if (axesOn) ack = "checked ";
	if (unitcellOn) ucck = "checked ";
	if (boundboxOn) bbck = "checked ";
	if (showAnomalous) aack = " checked";
	if (anomalousDots) aadots = " checked";
	else aass = " checked";
	
	var moreHelp =
"<center><b>More Views<\/b><\/center> \
 \
<ul> \
</li><li><b><a href='javascript: doCatPiSB()'>Show</a> \
All Protein \
<a href='http://proteopedia.org/wiki/index.php/Cation-pi_interactions' \
target='_blank'>Cation-Pi Interactions</a> \
and Salt Bridges</b> throughout the molecule. " +

"</li><li><b>" + makeNotesLink("Sequences", "seq") +
"</b> are available. \
</li><li>To evaluate the <b>Quality of the Molecular Model</b> \
	(<a href='http://proteopedia.org/wiki/index.php/Quality_assessment_for_molecular_models' \
			target='_blank'><b>More..</b></a>): \
	<ul> \
	<li><a href='javascript: top.colorTemperature()'><b>Color \
		by Uncertainty</b></a> \
		(&quot;temperature&quot;, &quot;disorder&quot;, &quot;B factor&quot;). \
		<a href='http://proteopedia.org/wiki/index.php/Temperature_value' \
			target='_blank'><b>More..</b></a> \
 \
	</li><li><a href='http://molprobity.biochem.duke.edu/' \
	target='aacwin'><b>All-Atom Contact Analysis</b></a> \
with the MolProbity Server \
	(<a href='http://www.umass.edu/microbio/chime/pe_alpha/protexpl/favlit.htm#aac' \
	target='favlitwin'><b>More..</b></a>) corrects \
	ASN, GLN and HIS rotamers, detects atomic clashes and compares the overall \
	&quot;clash score&quot; with those for similar-resolution models, \
	performs Ramachandran analysis, and more. \
 \
	</li><\/ul> \
<li>" + makeNonStandardCheckbox() +

"</li><li><form name='anomalousForm'>\
<input type='checkbox' name='showAA' onClick='doAnomalousAtoms()'" +
aack + ">Show "

	+ makeNotesLink("<b>Anomalous atoms</b>", "anomalous") +

" as<br>\
<input type='radio' name='renderAA' value='d' onClick='doAnomalousAtoms()'" +
aadots + ">dots, or<br>\
<input type='radio' name='renderAA' value='s' onClick='doAnomalousAtoms()'" +
aass + ">dots with spacefilled atoms. \
</form>" +

"</li><li>You can "

	+ makeNotesLink("<b>measure distances or angles</b>", "distances", "") +

" between atoms. " +

//click \
//&quot;Jmol&quot; \
//(to lower right of molecule) \
//and on the menu that pops up, select About Jmol, Mouse Manual. \

"<br> \
<a href='javascript: hideMonitors()'><b>Hide distances and angles.</b></a> \
<br><br> \
 \
</li><form name='setForm' id='setForm'> \
<li><input type='checkbox' name='axes' onClick='toggleAxes()' \
" + ack + ">Show Atomic Coordinate Axes. \
</li><li><input type='checkbox' name='unitcell' onClick='toggleUnitcell()' \
" + ucck + ">Show Crystallographic Unit Cell. \
&nbsp; <small>(Shows nothing for NMR models.)</small> \
</li><li><input type='checkbox' name='boundbox' onClick='toggleBoundbox()' \
" + bbck + ">Show Bound Box. \
</li></form> \
 \
<li>Jmol's extensive <b>menu</b> \
(click &quot;Jmol&quot; to the lower right of the molecule) \
enables you to select subsets of atoms, then apply custom \
displays or colors, and much more. \
 \
</li><li>Jmol has a \
<a href='http://www.stolaf.edu/people/hansonr/jmol/docs' \
target='jmolscriptmanualwin'><b>powerful \
command language</b></a>. To type commands and send them to the Jmol applet, \
click Jmol (to lower right of molecule), \
then on the menu that pops up, select <b>Console, Open</b>. \
 \
</li></ul>";

	moreHelp +=
"Click <a href='about.htm' target='aboutwin'><b>About \
FirstGlance in Jmol</b><\/a> \
for full documentation, including troubleshooting, \
linking to or installing, license and copyright, \
contributors, and versions. \
<hr noshade width=100> \
For more depth than <i>FirstGlance</i> offers, use the \
<a href='javascript: showHelp(\"makeKeyExternalResourcesHelp()\")'>Key \
External Resources</a>, \
or try out the resources linked below. \
 \
<ul> \
";

var hpdbid = getPDBId();

//------DIPOLES--------
moreHelp +=
"<li>Visualize dipole moments ";

if (hpdbid.length > 0)
	moreHelp +=
"of " + hpdbid.toUpperCase() + " with the \
<a href='http://bioportal.weizmann.ac.il/dipol-bin/dipol2j.cgi?pdb_id=" +
hpdbid + "' target='dipolewin'>Dipole Moment Server<\/a>.";

else
	moreHelp +=
" with the <a href='http://bioportal.weizmann.ac.il/dipol' \
target='dipolewin'>Dipole Moment Server<\/a>.";

//------MOLVISINDEX--------
moreHelp +=
"<li>World Index of Molecular Visualization Resources: \
<a href='http://www.molvisindex.org' target='molvisindexwin'>MolVisIndex.Org</a>. \
";

//------MOLVIZ--------
moreHelp +=
"<li><a href='http://www.molviz.org' target='molvizwin'>MolviZ.Org</a> \
(tutorials on DNA, \
hemoglobin, lipid bilayers, etc.; links to many molecular visualization \
resources) \
 \
</ul> \
";

// <li><a href=\"\"></a> \

//	showSptInWindow(moreHelp.replace(/\</g, "&lt;").replace(/\>/g, "&gt;"));

	return moreHelp;

}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeKeyExternalResourcesHelp()
{
	var pdbid = getPDBId();
	var upid = "";
	var upidFull = "";

	if (pdbid.length > 0)
	{
		upid = pdbid.toUpperCase();
		upidFull = " for " + upid;
	}

	var keyHelp =
"<center><b>Key External Resources " + upidFull + "<\/b><\/center><br>";

var ppl = "";

	if (pdbid.length == 0) // can't get PDB ID
	{
		ppl +=
"<a href='http://proteopedia.org' ";
	}
	else
	{
		ppl +=
"<a href='http://proteopedia.org/wiki/index.php/" +
	pdbid.toLowerCase() +
"' target='_blank'> ";

	keyHelp += ppl +
"<img src='proteopedia_w30.png' align='left' border='0'> \
<b>Proteopedia" +
	upidFull +
":</b></a> \
Full <b>name of molecule</b> and publication abstract; full names of ligands, sites, non-standard residues; \
evolutionary conservation; custom scenes immediately online to share, \
<a href='http://proteopedia.org/wiki/index.php/About_Macromolecular_Structure' \
target='_blank'>structural terminology</a>. \
Proteopedia is the <b>best place to start</b> exploring a PDB code; \
then use its \
link to <i>FirstGlance in Jmol</i>. \
 \
<br><br> " +

makeNotesLink(
"<img src='pqs.gif' border='1'> \
<b>Probable Quaternary Structure"
+ upidFull, "pqs", "")

+ ':</b> Visualize specific oligomers, the \
<a href="http://proteopedia.org/wiki/index.php/Biological_Unit" \
target="_blank">functional biological unit</a>, or monomers, \
regardless of the contents of the \
<a href="http://proteopedia.org/wiki/index.php/Asymmetric_Unit" \
target="_blank">crystallographic asymmetric unit</a> \
in the published PDB file. \
<a href="http://proteinexplorer.org/pqs.htm" \
target="_blank">More..</a> \
 \
<br><br> ';

	keyHelp += ppl +
"<img src='4enl_consurf_icon.png' border='0' align='left'> \
<b>Evolutionary Conservation " + upidFull +
'</b></a> is available at Proteopedia. Consider doing a ConSurf run that \
<a href="http://proteopedia.org/wiki/index.php/Conservation%2C_Evolutionary#Limiting_ConSurf_Analysis_to_Proteins_of_a_Single_Function" \
target="_blank">limits the analysis to proteins of a single function</a>. \
 \
<br><br> ';


	keyHelp +=
makeNotesLink(
"<img src='gaps2.gif' border='1'> \
<b>Missing pieces"
+ upidFull, "seq", "")

+ ':</b> Often, parts of the protein or nucleic acid chains are disordered \
in the crystal, and are missing from the model. Find out what parts \
are missing! \
 \
<br><br> ';

	keyHelp +=
'<img src="1bef_clash.png" align="left" border="0" \
title="Clash in 1bef, a retracted structure."> \
<b>See atomic clashes' + upidFull +
'</b>, get the overall clash score, and <b>flip sidechains</b> \
into energetically more favorable positions using \
<a href="http://molprobity.biochem.duke.edu/" \
target="_blank"><b>MolProbity</b></a>, \
a key tool for assessing \
<a href="http://proteopedia.org/wiki/index.php/Quality_assessment_for_molecular_models" \
target="_blank">model quality</a>. \
 \
<br><br> ';

	keyHelp +=

"<a href='http:\/\/www.pdb.org\/pdb\/search\/structidSearch.do?structureId=" +
	pdbid + "' target='rcsbwin' \/>" +
"<img src='pdb.gif' border='1'> \
<b>Protein Data Bank" + upidFull +
':</b></a> Get \
<a href="http://proteopedia.org/wiki/index.php/R_value" \
target="_blank">R</a> \
and \
<a href="http://proteopedia.org/wiki/index.php/Free_R" \
target="_blank">R<sub>free</sub></a> \
to assess \
<a href="http://proteopedia.org/wiki/index.php/Quality_assessment_for_molecular_models" \
target="_blank">model quality</a>. \
Get details on biology & chemistry; etc. etc. \
<a href="http://proteopedia.org/wiki/index.php/Protein_Data_Bank" \
target="_blank">About the PDB</a>. \
 \
<br><br> ' +
'<a href="http:\/\/bip.weizmann.ac.il\/oca-bin\/ocashort?id=' +
	pdbid + '" target="_blank" \/>' +
"<img src='oca.gif' border='1'> \
<b>OCA Browser" + upidFull + ":</b></a> \
Key information conveniently summarized on one page, with links to unique \
resources. \
";

	}

	return keyHelp;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var helpFooter =
"<br><br> \
<hr noshade> \
Copy this view and paste it into a <b>presentation</b>. \
<a href='slides.htm' target=_blank> \
How?</a> \
<br><br> \
Return to \
<a href=\"javascript: top.returnToIntro()\">Introduction</a> \
(atom identification, centering, related resources, \
troubleshooting, license, etc.). \
To <b>reset</b> to the default view, click <i>Reset</i> (above). \
";

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var nohelp = "To Be Written ...";

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var licenseHelp =
"<big><b>Copyright & License</b></big> \
<br><br> \
<img src='nsf4c_50bt.gif' align='right'> \
FirstGlance in Jmol is copyright &copy; 2005-2010 by \
<a href='http://www.umass.edu/molvis/martz' target='emwin'>Eric \
Martz</a>. FirstGlance in Jmol is freely available, \
including its source code*. \
It may be used and redistributed for non-commercial purposes. \
Use in a commercial context, such as a link to FirstGlance in Jmol \
from the website of a for-profit scientific journal, is permitted \
provided that no payment is required for the use of FirstGlance in Jmol. \
All modified derivitives or copies must obey the same license. \
 \
<br><br><center><table bgcolor='#e0e0e0' \
cellpadding='6'><tr><td><font face='sans-serif'> \
 \
<!-- Creative Commons License --> \
<a rel='license' \
href='http://creativecommons.org/licenses/by-nc-sa/3.0/us/'><img \
alt='Creative Commons License' style='border-width:0' \
src='http://creativecommons.org/images/public/somerights20.png' \
/></a> Version " +
fgijVersion +
" of <span \
xmlns:dc='http://purl.org/dc/elements/1.1/' \
property='dc:title'>FirstGlance in Jmol</span> by  \
<a xmlns:cc='http://creativecommons.org/ns#' \
href='http://bioinformatics.org/firstglance' \
property='cc:attributionName' \
rel='cc:attributionURL'>Eric Martz</a> is licensed under a \
<br /><a rel='license' \
href='http://creativecommons.org/licenses/by-nc-sa/3.0/us/'>Creative \
Commons Attribution-Noncommercial-Share Alike 3.0 United States License</a>. \
<!-- /Creative Commons License --> \
 \
<br> \
(Versions 1.42 and earlier used a less restrictive license.) \
</font></td></tr></table></center> \
<br> \
*<b>Source Code</b> is available from the project home website, \
<a href='http://bioinformatics.org/firstglance' \
target='fghomewin'>bioinformatics.org/firstglance</a>. \
 \
<br><br> \
<big><b>Acknowledgements and Credits</b></big> \
<br><br> \
FirstGlance in Jmol would not be possible without the \
free, open-source java applet \
<a href='http://www.jmol.org' target='jmolwin'>Jmol</a>. Thanks \
are due many people who have selflessly contributed their time \
and expertise to creating Jmol. Special thanks are due <b>Miguel \
Howard</b> for the quality and quantity of his programming contributions \
to the Jmol project, and to <b><a href='http://www.stolaf.edu/people/hansonr/'>\
Robert Hanson</a></b> for his contributions \
to Jmol, and for creating and maintaining \
the indispensible Jmol reference manual. \
<a href='http://sourceforge.net/projects/jmol' target='jmolwin'><b>Jmol \
is licensed</b></a> under the \
<a href='http://www.gnu.org/copyleft/lesser.html' target='gnuwin'>GNU \
&quot;Library&quot; or Lesser General Public License</a>. \
Briefly, this means that Jmol is free, that its source code is openly \
available, and that all derivatives of Jmol itself (the &quot;library&quot;) \
must also be free and have open source code. However, proprietary \
commercial products may utilize Jmol, so long as Jmol itself is unmodified, \
and is redistributed in accord with the terms of the license. \
 \
<br><br> \
Thanks to Evelyn Jabri for her encouragement while at <i>Nature Publishing \
Group</i>. \
Special thanks to Frieda Reichsman \
(<a href='http://moleculesinmotion.com'>moleculesinmotion.com</a>) \
for a large number of insightful suggestions that improved FirstGlance \
substantially. \
 \
<br><br> \
Thanks to Jeff Bizzaro and <a href='http://bioinformatics.org'> \
bioinformatics.org</a> for providing a home for this project. \
Thanks to <a href='http://www.sdsc.edu/~bourne/'>Phil Bourne</a> \
and the <a href='http://www.sdsc.edu'>San \
Diego Supercomputer Center</a> for providing a very fast \
server, and to Andy Sanderson for configuring it. \
 \
<br><br> \
Thanks to <a href='http://bip.weizmann.ac.il/about/people.html'> \
Jaime Prilusky</a> for contributing the "

	+ makeNotesLink("CGI program", "uploads", "") +

" and server that accepts an uploaded \
PDB file, and displays it in FirstGlance. Also for determining most of \
the carbohydrates present in the Protein Data Bank. Also for developing \
and maintaining the OCA browser, which provides mirror sites for \
FirstGlance in Jmol. \
 \
<br><br> \
Thanks to Guoli Wang and Roland L. Dunbrack for their \
<a href='http://dunbrack.fccc.edu/Guoli/s2c/' target=_blank>S2C</a> \
server, linked to "
	+ makeNotesLink("Sequence Notes", "seq") +
". Thanks to Jaime Prilusky for providing an installation of S2C \
that responds quickly, and is updated routinely. \
 \
<br><br> \
Thanks, for good ideas, inspiration, or technical help, \
to Miguel Howard, Bob Hanson, \
Cris Necocea, Jaime Prilusky, \
Frieda Reichsman, Tim Driscoll, Michael Maroney, Andreas Bohne, Thomas \
Luetteke, Joel Sussman, Evelyn Jabri, and Boyana Konforti. \
Thanks to Miguel Howard for enhancements \
to Jmol requested for the FirstGlance project. \
 \
<br><br> \
Development of FirstGlance in Jmol was supported by a grant from the \
Division of Undergraduate Education of the \
<a href='https://www.fastlane.nsf.gov/servlet/showaward?award=9980909' \
target=_blank>\
US National Science Foundation</a> \
(Award 9980909), and by the <a href='http://www.umass.edu'> \
University of Massachusetts</a>. \
";

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function checkAll(result)
{
	document.contactsForm.contactsWater.checked = result;
	document.contactsForm.waterBridges.checked = result;
	document.contactsForm.contactsHBonds.checked = result;
	document.contactsForm.contactsHphob.checked = result;
	document.contactsForm.contactsSB.checked = result;
	document.contactsForm.contactsCatPi.checked = result;
	document.contactsForm.contactsMeMi.checked = result;

//	if (!contactingSF)
//		document.contactsForm.contactsSticks.checked = result;

//	document.contactsForm.contactsHydrogens.checked = result;

	changeContactsView();
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeCatPiSBHelp()
{
	// STOP SELECTING
	selectMode = "";
	// STOP HIDING
	hideMode = "";

	var ckcp, cksb, ckcoe, ckcoc, ckbb;
	ckcp = cksb = ckcoe = ckcoc = ckbb = "";
	var cpsb;
	if (showCatPi)
	{
		ckcp = " checked ";
		cpsb = "Cation-Pi Interactions"
	}
	else
	{
		cksb = " checked ";
		cpsb = "Salt Bridges"
	}

	if (colorCatPiSBChain)
		ckcoc = " checked";
	else
		ckcoe = " checked";

	if (showCatPiSBBackbones)
		ckbb = " checked";

	var hh =
"<form name='catPiSBForm'> ";

	hh += "<center><b>Salt Bridges / Cation-Pi Orbital Interactions</b></center> \
<br> \
<input type='radio' name='catPiSB' value='s' \
onClick='showCatPiSB(\"\")'" + cksb + "> \
Show Protein "

	+ makeNotesLink("Salt Bridges", "saltbr", "") +

"<br> \
<input type='radio' name='catPiSB' value='c' \
onClick='showCatPiSB(\"\")'" + ckcp + "> Show Protein "

	+ makeNotesLink("Cation-Pi Interactions", "catpi", "*") +

"<br>Color Protein " + cpsb +
"<br> &nbsp; <input type='radio' name='colorCatPiSB' value='e' \
onClick='showCatPiSB(\"\")'" + ckcoe + "> by Element \
\
<br> &nbsp; <input type='radio' name='colorCatPiSB' value='c' \
onClick='showCatPiSB(\"\")'" + ckcoc + "> by Chain \
";

	if (telAvivMode)
		hh +=
"<br> &nbsp; &nbsp; by " + serverName + " (use checkbox above) ";

	hh +=
"<br><input type='checkbox' name='backbonesCatPiSB'" + ckbb +

" onClick='showCatPiSB(\"\")'> Show Backbones \
";

	if (!colorCatPiSBChain)
		hh +=
"<br><br> \
<font color='#" + colorNitrogen + "'><b>Cations (+)</b></font> \
are \
<font color='#" + colorNitrogen + "'><b>nitrogen atoms</b></font> \
(Arg or Lys sidechains). \
<br> \
<font color='#" + colorOxygen + "'><b>Anions (-)</b></font> \
are \
<font color='#" + colorOxygen + "'><b>oxygen atoms</b></font> \
(Asp or Glu sidechains), or the pi-orbital faces of \
<font color='#" + colorCarbon + "'><b><big>six-carbon</big></b></font> \
aromatic rings (Phe, Tyr or Trp). \
";

	hh +=
"<br><br> \
These interactions are shown for <b>protein chains only</b>. <i>FirstGlance</i> \
does not show interactions involving ligands or nucleic acids. \
<br><br> \
*<b>Caution:</b> Some cation-pi interactions shown may not be \
energetically significant, while some energetically signficant \
interactions may fail to be shown. Consult \
<a href='http://capture.caltech.edu/' target=_blank><b>CaPTURE</b></a> \
for a definitive list. "

	+ makeNotesLink("More..", "catpi", ".");


	hh += "</form>";

	return hh;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeBadPDBFileHelp()
{
	var bfh = '<big>We are sorry, but <font color="red"><big><b>';

	if (usePDBId)
		bfh += validPDBId;
	else
		bfh += pdbToLoad;

	bfh += ' is not available</b></big></font>';

	if (usePDBId)
	{
		bfh += ' from the Protein Data Bank.\n\
If the PDB identification code above is <i>correct</i>, then most likely \n\
the atomic coordinates (PDB file) have not yet been released \n\
to the public. Sometimes there is a delay of a week or more between journal publication \n\
and release of the coordinates. ';

		bfh += makeCheckAtRCSB();
	}
	else
	{
		bfh += '. There may be an error in the filename or URL.';
	}

		bfh += ' FirstGlance in Jmol is unable to display the molecule\n\
as specified. (You may close this window/tab.)</big>';

		return (bfh);
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

