// Javascript for Projects.html

// -- GetAddress --------------------------------------------------------------

// Dhtml which revises an area of text as you click.

function getAddress(value)
{
	var txt = value;

	if (document.getElementById)
	{
		 document.getElementById('myLayer').innerHTML = txt;
		 document.getElementById('myLayer').style.visibility = 'visible';
	}
	else if (document.all)
	{
		document.all.myLayer.innerHTML = txt;
		document.all['myLayer'].style.visibility = 'visible';
	}
	else if (document.layers)
	{
		 document.layers['myLayer'].document.open();
		 document.layers['myLayer'].document.write(txt);
		 document.layers['myLayer'].document.close();
		 document.layers['myLayer'].visibility = 'show';
	}
}


//-- ProjectRow ---------------------------------------------------------------

// Used to include a row containing; <Title> <Laboratory> in a table of projects.
// The anchor identifies that the row has been selected.

function projectRow(title,laboratory,anchor,country) {
	returnAnchor = anchor.substring(1,anchor.length);
	document.write('<tr>');
	
	// Use a different layout for France.
	if (country == 'fr')
	{
		document.write('<td width="42%" class=\"projectTitle\"><a name=' + returnAnchor + '></a>' + title +'</td>');
		document.write('<td width="42%" class=\"projectTitle address\">'+ laboratory +'</td>');
		document.write('<td width="6%" class=\"projectTitle\"><a href=return.php' + anchor + '&' + country +'>more</a></td>');
	}
	else
	{
		document.write('<td width="64%" class=\"projectTitle\"><a name=' + returnAnchor + '></a>' + title +'</td>');
		document.write('<td width="30%" class=\"projectTitle address\">'+ laboratory +'</td>');
		document.write('<td width="6%" class=\"projectTitle\"><a href=return.php' + anchor + '&' + country +'>more</a></td>');
	}
	document.write('</tr>');
}


//-- AllProjectText -----------------------------------------------------------

// Note activityNews is not being used!

function allProjectText(anchor,returnAnchor,country,projectTitle,principalInvestigators,principalInvestigatorsEmailName,principalInvestigatorsEmailAddress,laboratoryAddress,locationOfProject,scientificObjectives,fundingSource,projectDates,programmeName,projectWebsite,activityNews)
{
	if (document.URL.search(anchor) != -1)
	{
		amp = '@';
		if (principalInvestigatorsEmailName == '') amp ='';
		document.write('<tr>');

		includeActivityNews = '';
		if (activityNews != '') includeActivityNews = '<br><br><span class="projectHeader">Activity News:</span> &nbsp;&nbsp;' + activityNews;
		
		document.write('<td class="meeting" colspan=\"3\">' + 
						'<span class="projectHeader">Project Title :</span> &nbsp;&nbsp;' + projectTitle +
		'<br><br><span class="projectHeader">Principal Investigators :</span> &nbsp;&nbsp;' + principalInvestigators +
		'<br><br><span class="projectHeader">Principal Investigator\'s Email <small><i>(spam safe)</i></small> :</span>&nbsp;&nbsp;<a href=mailto:'+ principalInvestigatorsEmailName + '@' + principalInvestigatorsEmailAddress + '>' + principalInvestigatorsEmailName + amp + principalInvestigatorsEmailAddress + '</a>' +
		'<br><br><span class="projectHeader">Laboratory Address :</span> &nbsp;&nbsp;' + laboratoryAddress +
		'<br><br><span class="projectHeader">Location of Project :</span> &nbsp;&nbsp;' + locationOfProject + 
		'<br><br><span class="projectHeader">Scientific Objectives :</span> &nbsp;&nbsp;' + scientificObjectives + 
		'<br><br><span class="projectHeader">Funding Source :</span> &nbsp;&nbsp;' + fundingSource + 
		'<br><br><span class="projectHeader">Dates :</span> &nbsp;&nbsp;' + projectDates + 
		'<br><br><span class="projectHeader">Programme Name :</span> &nbsp;&nbsp;' + programmeName + 
		'<br><br><span class="projectHeader">Project Website :</span> &nbsp;&nbsp;' + projectWebsite + 
		includeActivityNews +
		'<div align="right"><a href=return.php' + returnAnchor + '&' + country + '><img src="../images/less.gif"></a></div></td>');
		document.write('</tr>');
	}
}


//-- InternationalProjectRow --------------------------------------------------

// Used to include a row containing; <Title> <Description> <Laboratory> in a table of international projects.
// The anchor identifies that the row has been selected.

function internationalProjectRow(title,description,laboratory,anchor,country) {
	more = '';
	if (country != '') more ='more';
	returnAnchor = anchor.substring(1,anchor.length);
	document.write('<tr>');
	document.write('<td class=\"projectTitle address\" ><a name=' + returnAnchor + '></a>' + title +'</td>');
	document.write('<td class=\"projectTitle">'+ description +'</td>');
	document.write('<td class=\"projectTitle address\">'+ laboratory +'</td>');
	document.write('<td class=\"projectTitle\"><a href=return.php' + anchor + '&' + country +'>' + more + '</a></td>');
	//document.write('<td class=\"projectTitle\"><a href=return.php' + anchor + '&' + country +'>more</a></td>');
	document.write('</tr>');
}


// -- InternationalProjectText ------------------------------------------------

function internationalProjectText(anchor,returnAnchor,country,projectTitle,principalInvestigators,principalInvestigatorsEmailName,principalInvestigatorsEmailAddress,laboratoryAddress,locationOfProject,scientificObjectives,fundingSource,projectDates,programmeName,projectWebsite,activityNews)
{
	if (document.URL.search(anchor) != -1)
	{
		amp = '@';
		if (principalInvestigatorsEmailName == '') amp ='';
		document.write('<tr>');
		document.write('<td class="meeting" colspan=\"4\">' +  		
						'<span class="projectHeader">Project Title :</span> &nbsp;&nbsp;' + projectTitle +
		'<br><br><span class="projectHeader">Principal Investigators :</span> &nbsp;&nbsp;' + principalInvestigators +
		'<br><br><span class="projectHeader">Principal Investigator\'s Email <small><i>(spam safe)</i></small> :</span>&nbsp;&nbsp;<a href=mailto:'+ principalInvestigatorsEmailName + '@' + principalInvestigatorsEmailAddress + '>' + principalInvestigatorsEmailName + amp + principalInvestigatorsEmailAddress + '</a>' +
		'<br><br><span class="projectHeader">Laboratory Address :</span> &nbsp;&nbsp;' + laboratoryAddress +
		'<br><br><span class="projectHeader">Location of Project :</span> &nbsp;&nbsp;' + locationOfProject + 
		'<br><br><span class="projectHeader">Scientific Objectives :</span> &nbsp;&nbsp;' + scientificObjectives + 
		'<br><br><span class="projectHeader">Funding Source :</span> &nbsp;&nbsp;' + fundingSource + 
		'<br><br><span class="projectHeader">Dates :</span> &nbsp;&nbsp;' + projectDates + 
		'<br><br><span class="projectHeader">Programme Name :</span> &nbsp;&nbsp;' + programmeName + 
		'<br><br><span class="projectHeader">Project Website :</span> &nbsp;&nbsp;' + projectWebsite + 
		'<p class=\"alignRight\"><a href=return.php' + returnAnchor + '&' + country + '><img src="../images/less.gif"></a></td>');
		document.write('</tr>');
	}
}

//-- GEBCO version 20061212 -------------------------------------------------------------------------------------

function internationalProjectText2(anchor,returnAnchor,country,projectTitle,principalInvestigators,principalInvestigatorsEmailName,principalInvestigatorsEmailAddress,laboratoryAddress,locationOfProject,scientificObjectives,ParentBodies,FundingBodies,projectDates,programmeName,projectWebsite,activityNews)
{
	if (document.URL.search(anchor) != -1)
	{
		amp = '@';
		if (principalInvestigatorsEmailName == '') amp ='';
		document.write('<tr>');
		document.write('<td class="meeting" colspan=\"4\">' +  		
						'<span class="projectHeader">Project Title :</span> &nbsp;&nbsp;' + projectTitle +
		'<br><br><span class="projectHeader">Principal Investigators :</span> &nbsp;&nbsp;' + principalInvestigators +
		'<br><br><span class="projectHeader">Principal Investigator\'s Email <small><i>(spam safe)</i></small> :</span>&nbsp;&nbsp;<a href=mailto:'+ principalInvestigatorsEmailName + '@' + principalInvestigatorsEmailAddress + '>' + principalInvestigatorsEmailName + amp + principalInvestigatorsEmailAddress + '</a>' +
		'<br><br><span class="projectHeader">Laboratory Address :</span> &nbsp;&nbsp;' + laboratoryAddress +
		'<br><br><span class="projectHeader">Location of Project :</span> &nbsp;&nbsp;' + locationOfProject + 
		'<br><br><span class="projectHeader">Scientific Objectives :</span> &nbsp;&nbsp;' + scientificObjectives + 
		'<br><br><span class="projectHeader">Parent Bodies :</span> &nbsp;&nbsp;' + ParentBodies + 
		'<br><br><span class="projectHeader">Funding Bodie :</span> &nbsp;&nbsp;' + FundingBodies +		
		'<br><br><span class="projectHeader">Dates :</span> &nbsp;&nbsp;' + projectDates + 
		'<br><br><span class="projectHeader">Programme Name :</span> &nbsp;&nbsp;' + programmeName + 
		'<br><br><span class="projectHeader">Project Website :</span> &nbsp;&nbsp;' + projectWebsite + 
		'<p class=\"alignRight\"><a href=return.php' + returnAnchor + '&' + country + '><img src="../images/less.gif"></a></td>');
		document.write('</tr>');
	}
}

//-- ActivityRow --------------------------------------------------------------

// Used to include a row containing; <Decription> in a table of Activites.
// The anchor identifies that the row has been selected.

function activityRow(date, description, anchor, country) {
	returnAnchor = anchor.substring(1,anchor.length);
	document.write('<tr>');
  document.write('<td class=\"projectTitle printDate\">' + date +'</td>');
	document.write('<td class=\"projectTitle\"><a name=' + returnAnchor + '></a>' + description +'</td>');
	document.write('<td class=\"projectTitle\"><a href=return.php' + anchor + '&' + country +'>more</a></td>');
	document.write('</tr>');
}


//-- MoreActivityText ---------------------------------------------------------

// Upon selecting 'more' the table opens out to include extra text
// Whether the extra information appears is determined by the # anchor
// on the Url.

function moreActivityText(anchor,returnAnchor,country,text)
{
	if (document.URL.search(anchor) != -1)
	{
		document.write('<tr>');
		document.write('<td class="meeting" colspan=\"3\">' + text +'<p class=\"alignRight\"><a href=return.php' + returnAnchor + '&' + country + '><img src="../images/less.gif"></a></td>');
		document.write('</tr>');
	}
}
