// details.js was added by Eric Martz to support inclusion of
// in-line details that can be displayed or hidden. This mechanism
// is similar to the "pop-up details" mechanism in Presentations
// in Protein Explorer (PiPEs).

var topContentsDetailsTitle = '';
var topContentsDetailsText = '';
var bottomContentsDetailsTitle = '';
var bottomContentsDetailsText = '';

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeButtonDetailsControl(num)
{
	if (typeof(buttons[num][iDetailsText]) == "undefined")
		return "";
	var bdet = buttons[num][iDetailsText];
	if (bdet.length == 0)
		return "";

	var divName = buttonDetailsDivisionNamePrefix + num;

	var bdldiv =
		"<div id='" + divName + "'>\n" +
		makeButtonDetailsLink(num) +
		"</div>\n";

	return(bdldiv);
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showButtonDetailsText(num)
{
	var bdet = "";

//	bdet += "<table border='1' cellpadding='6' noshade><tr><td>\n";

	bdet += "<div class='details'>\n";

	bdet += buttons[num][iDetailsText];

	bdet += "\n<center>(<a href='javascript: dismissButtonDetailsText(" +
		num + ")'>hide details</a>)</center>"

//	bdet += "\n</td></tr></table>\n";
	bdet += "\n</div>\n";

	var divName = buttonDetailsDivisionNamePrefix + num;

	document.getElementById(divName).innerHTML = bdet;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function dismissButtonDetailsText(num)
{
	var divName = buttonDetailsDivisionNamePrefix + num;

	var bdl = makeButtonDetailsLink(num);

	document.getElementById(divName).innerHTML = bdl;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeButtonDetailsLink(num)
{
	var dtitle = "Details..";
	if (buttons[num][iDetailsTitle] != "")
		dtitle = "Details: " + buttons[num][iDetailsTitle];

	var bdl =
		"<center><a href='javascript: showButtonDetailsText(" + num +
		")'>" + dtitle + "</a></center>\n";

	return bdl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// BEGIN CONTENTS DETAILS top or bottom
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeContentsDetails(position)
{
	var dtext = topContentsDetailsText;
	if (position != "top")
		dtext = bottomContentsDetailsText;

	// support legacy tutorials, bottom details only
	if (typeof(dtext) == "undefined" && position == "bottom" &&
		typeof(contentsDetailsText) != "undefined")
		dtext = contentsDetailsText;

	if (typeof(dtext) == "undefined")
		return "";

	if (dtext.length == 0)
		return "";

	var bdldiv =
		"<div id='" + position + "ContentsDetails'>\n" +
		makeContentsDetailsLink(position) +
		"</div>\n";

	return(bdldiv);
	
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function makeContentsDetailsLink(position)
{
	var dtitle = topContentsDetailsTitle;
	if (position != "top")
		dtitle = bottomContentsDetailsTitle;

	// support legacy tutorials, bottom details only
	if (position == "bottom" &&
		typeof(dtitle) == "undefined" &&
		typeof(contentsDetailsTitle) != "undefined")
		dtitle = contentsDetailsTitle;

	if (dtitle.length != 0)
		dtitle = "Details: " + dtitle;
	else
		dtitle = "Details..";

	var bdl =
		"<center><a " +
		"href='javascript: showContentsDetailsText(\"" + position + "\")'>" +
		dtitle +
		"</a></center>\n";

	return bdl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showContentsDetailsText(position)
{
	var bdet = "";

	bdet += "<div class='details'>\n";

	if (position == "top")
		bdet += topContentsDetailsText;
	else
	{
		bdet += bottomContentsDetailsText;

		// support legacy tutorials, bottom details only
		if (typeof(bdet) == "undefined" &&
			typeof(contentsDetailsText) != "undefined")
			bdet = contentsDetailsText;
	}

	bdet +=
		"\n<center>(<a " +
		"href='javascript: dismissContentsDetailsText(\"" + position + "\")'>" +
		"hide details</a>)</center>"

	bdet += "\n</div>\n";

	document.getElementById(position + "ContentsDetails").innerHTML = bdet;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function dismissContentsDetailsText(position)
{
	var bdl = makeContentsDetailsLink(position);

	document.getElementById(position + "ContentsDetails").innerHTML = bdl;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
