// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// This is a placeholder file into which special controls for molecular
// views, such as checkboxes, can be inserted. For an explanation, see
// the Authoring Instructions section on Checkboxes.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

// Create a chapter-specific writeJmolControls() function here.
// It must generate the control HTML and place it in the appropriate
// division(s), e.g. divisions named jcontrol1 (and optionally
// jcontrol2, jcontrol3, etc.).

function writeJmolControls()
{
	var chtml = "";


// Here is an example that creates a single checkbox to hide/show
// labels. Additional checkboxes can be added in the same way,
// to this jcontrol1 division, or to other jcontrol divisions.
// Please see the working example in jtat/jtatdemo/ch_drums.
//

// the script should be labelm1.spt, but this freezes jmol at the first
// select atomno command. ???
// so does view01.spt, so I give up! (Jmol 11.6.RC12)

	chtml += " &nbsp; " + setupJmolCheckbox("!script labelm1.spt;",
		"!select all; set labels off;",
		"Labels", true);

	document.getElementById("jcontrol1").innerHTML = chtml;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Here is the service function that actually generates the checkbox
// HTML.

function setupJmolCheckbox(whenChecked, whenUnchecked,
	labelHtml, startsChecked)
{
	// Save the current document.
	var cdoc = _jmol.currentDocument;

	// Tell Jmol.js functions not to write into the current document, but merely
	// to return the relevant HTML.
	_jmol.currentDocument = false;

	// Use the checkbox-generating function in Jmol.js to make HTML
	// for a checkbox.
	var chtml = jmolCheckbox(whenChecked, whenUnchecked, labelHtml,
		startsChecked);

	// Restore current document to its default.
	_jmol.currentDocument = cdoc;

	// Return the checkbox HTML.
	return chtml;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
