// ===================== Initialization ===============

function initMP()
{
	SetMoleculeBar();
	
	//flipInit(); not working properly.
	
}


// ===================== Listing of Molecules Available ===============

// 'MoleculeList is an array, in which element is also an array.
// Each entry in the primary array is a molecular presentation at the Molecular Playground
// Within each entry, the array sub-elements are:
//   Short Name
//   Popup/Banner Text
//   Detailed description
//   Author id number
//   (optional) inactive flag

// =====================================================================

// The following provides a brief listing of each molecule in the MoleculeList array
//  Called on the Molecular Playground's front page (index.html)

function SetMoleculeBar()
{
	var st = "";
	for ( var i=0, len=MoleculeList.length; i<len; ++i ){
	  if (MoleculeList[i][5]!="inactive") 
 		 st += "<BR><A HREF=\""+MoleculeList[i][1]+"\" class=\"moleculebarlinks\" TARGET=\"MoleculeFocus\" TITLE=\""+MoleculeList[i][2]+" ("+AuthorList[MoleculeList[i][4]][1]+")"+"\">"+MoleculeList[i][0]+"</A>";
	}
    st += "<P><A HREF=\"MoleculeList.html\" TITLE=\"Click here for a more detailed listing of the molecules on display at the Molecular Playground\">More detailed listing...</A>";
    
	browser("moleculebar").innerHTML += st;
}

// ==========================================================

//	<TR ALIGN="left" VALIGN="top">
//	<TD width="20%">
//	<A HREF="http://proteopedia.org/wiki/index.php/User:Eric_Martz/Molecular_Playground/HIVDrug">HIV Protease Inhibitor Drug</A></TD>
//	<TD>The Human Immuno-Deficiency Virus (HIV), responsible for AIDS, uses a protease (an enzyme) that is essential to its infection and reproduction. Scientists have designed an inhibitor of this enzyme that effectively stops viral growth. This structure shows an animation of the drug binding to, and inhibiting, the HIV protease.
//	<A HREF="http://proteopedia.org/wiki/index.php/User:Eric_Martz/Molecular_Playground/HIVDrug">See the interactive molecular animation!</a>.
//	<small>
//	&nbsp;
//	(Author of this animation: <a href="http://martz.molviz.org">Eric Martz</a>.)
//	</small></TD>
//</TR>


// The following provides a more complete listing of each molecule in the MoleculeList array
//  Called on the Molecular Playground's MoleculeList.html page)

function SetMoleculeTable()
{
	var st = "";
	for ( var i=0, len=MoleculeList.length; i<len; ++i ){
	  if (MoleculeList[i][5]!="inactive") 
		var li = "<TR ALIGN=\"left\" VALIGN=\"top\"><TD width=\"150px\">" +
		"<A HREF=\"" + MoleculeList[i][1] + "\">" + MoleculeList[i][0] + "</A></TD>" +
		"<TD>" + MoleculeList[i][2] + 
		"<br><A HREF=\"" + MoleculeList[i][1] + "\">See the interactive molecular animation!</a>." +
		"&nbsp;<small>(Author of this animation: <a href=\"" + AuthorList[MoleculeList[i][4]][2] + "\">" + AuthorList[MoleculeList[i][4]][1] + "</a>.)" + 
		"</small></TD></TR>";

 		 st += li;
	}	
	document.writeln(st);
}

// ==========================================================

// Figure out which browser is running
 var nn4 = (document.layers) ? true : false 
 var ie = (document.all) ? true : false 
 var dom = (document.getElementById && !document.all) ? true : false  

// Used to reference dHTML elements browser-specifically 
function browser(id) {
  if (nn4)	{ path = document.layers[id] }
  else if (ie)	{ path = document.all[id] }
  else		{ path = document.getElementById(id) } ;
  return path
}

function ETag(Name,EMailName,EMailDomain)
{
if (EMailDomain == "") EMailDomain = "chem.umass.edu";
if (EMailDomain == "MCB") EMailDomain = "mcb.umass.edu";
if (EMailDomain == "student") EMailDomain = "student.umass.edu";
if (EMailDomain == "Y") EMailDomain = "yahoo.com";
if (EMailDomain == "H") EMailDomain = "hotmail.com";
if (EMailDomain == "A") EMailDomain = "aol.com";
if (EMailDomain == "G") EMailDomain = "gmail.com";

var Addr = EMailName + "@" + EMailDomain;
var EMailTag = "<A HREF=\"mailto:" + Addr + "\">" + Addr + "</A>";
				
document.writeln(EMailTag);
}

