//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// alerts through # 2

var fgijMode = "";
var employSignedApplet = false;
var employCIF = false;
var employDebugging = false;

var a2 = false;

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function initGallery()
{
	var qs = document.location.search;
	var ieq;

	if ((ieq = qs.indexOf("mode=")) != -1)
		fgijMode = qs.substring(ieq + 5, ieq + 6);

//	alert("gallery.js #1: fgijMode=" + fgijMode);

	if (qs.indexOf("appl=s") != -1)
		employSignedApplet = true;

	if (qs.indexOf("cif=1") != -1)
		employCIF = true;

	if (qs.indexOf("db=1") != -1)
		employDebugging = true;

}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function writeGalleryItem(mode, pdbid, label, hide)
{
	var gi = "<li><a href=\"fg" + mode + ".htm";
	gi += "?mol=" + pdbid;

	if (employSignedApplet)
		gi += "&appl=s";

	if (employCIF)
		gi += "&cif=1";

	if (employDebugging)
		gi += "&db=1";

	var file2show = pdbid.toUpperCase();
	if (typeof(hide) != "undefined")
	{
		var isl = file2show.lastIndexOf("/");
		if (isl != -1)
			file2show = file2show.substring(isl + 1);
	}

	gi += "\"";
	gi += " target=_blank><tt><b>" + file2show + "</b></tt></a>:";

//	if (!a2)
//	{
//		alert("gallery.js #2 GalleryItem:\n" + gi);
//		a2 = true;
//	}

	document.writeln(gi + " " + label);
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showAdvancedOptions(verbose)
{
	var sspre = "<br>Advanced options active: <font color='red'>";
	var sspost = "<\/font>";
	var sstail = "<br><small>(To change, close this window and click " +
				"<i>Advanced Options</i> at the bottom of the main page.)<\/small>";

	var noaoa = "<br>Advanced options active: <b>None</b>";

	var sscore = "";

	if (fgijMode == "f")
		sscore += "<big><b> Frames </b></big>";

	if (fgijMode == "e")
		sscore += "<big><b> Embedded </b></big>";

	if (employSignedApplet)
		sscore += "<big><b>&nbsp; Signed Applet </b></big>";

	if (employCIF)
		sscore += "<big><b>&nbsp; CIF </b></big>";

	if (employDebugging)
		sscore += "<big><b>&nbsp; Debugging </b></big>";

	if (sscore.length > 0)
		document.writeln(sspre + sscore + sspost + sstail);
	else if (verbose)
		document.writeln(noaoa + sstail);
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function writeTechGalleryLink(linkLabel)
{
	var qp = document.location.search;

	var linkHtml = "<a href=\"techgall.htm" + qp + "\">" +
		linkLabel + "</a>";

	document.writeln(linkHtml);
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
