// Javascript for workshop.php

// This script has two purposes
// 1. Prevents writing a new page for every meeting added.
// 2. Meetings which have expired are not displayed.

// The meeting page has a 'Meeting Table'
// Rows in the meeting table can be set to expire.
// Upon selecting 'more' the table opens out to include extra text.
// Occassionally the extra text will itself contain tables.


//-- ExpireMeetingRow ---------------------------------------------------------

// Used to include a row containing; <aDate> <title> <place> in the Meeting table.
// Row will not appear after variable date - (expires)
// The anchor identifies that the row has been selected.

function expireMeetingRow(expires,aDate,title,place,anchor) {

date = new Date(expires);
now  = new Date();

returnAnchor = anchor.substring(1,anchor.length);

if (date.getTime() < now.getTime())
	{
	}
	else
	{
		more = '';
		if (anchor != '') more ='more';
		returnAnchor = anchor.substring(1,anchor.length);
		document.write('<tr>');
		document.write('<td width="20%" class=\"projectTitle printDate\">'+ aDate +'</td>');
		document.write('<td width="50%" class=\"projectTitle smallT\"><a name=' + returnAnchor + '></a>'+ title +'</td>');
		document.write('<td width="24%" class=\"projectTitle address\">'+ place +'</td>');
		document.write('<td width="6%" class=\"projectTitle smallT\"><a href=return.php' + anchor + '>'+ more +'</a></td>');
		document.write('</tr>');
	}
}

//-- MeetingProposalRow ---------------------------------------------------------

// Used to include a row containing; <aDate> <title> <place> in the Meeting table.
// Row will not appear after variable date - (expires)
// The anchor identifies that the row has been selected.

function meetingProposalRow(expires,aDate,title,place,anchor) {


returnAnchor = anchor.substring(1,anchor.length);


		more = '';
		if (anchor != '') more ='more';
		returnAnchor = anchor.substring(1,anchor.length);
		document.write('<tr>');
		document.write('<td width="20%" class=\"projectTitle02 printDate\">'+ aDate +'</td>');
		document.write('<td width="50%" class=\"projectTitle02 smallT\"><a name=' + returnAnchor + '></a>'+ title +'</td>');
		document.write('<td width="24%" class=\"projectTitle02 address\">'+ place +'</td>');
		document.write('<td width="6%" class=\"projectTitle02 smallT\"><a href=return.php' + anchor + '>'+ more +'</a></td>');
		document.write('</tr>');
}


//-- moreMeetingText ----------------------------------------------------------

// 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 moreMeetingText(anchor,returnAnchor,text)
{
	if (document.URL.search(anchor) != -1)
	{
		document.write('<tr>');
		document.write('<td colspan=\"4\">' + text +'<p class=\"alignRight\"><a href=return.php' + returnAnchor + '><img src="../images/less.gif"></a></td>');		
		document.write('</tr>');
	}
}


// -- MoreTableThree ----------------------------------------------------------

// Used to include a three column table.

function moreTableThree(anchor,returnAnchor,header,openOrClose,odd,columnOne,columnTwo,columnThree)
{
	if (document.URL.search(anchor) != -1)
	{
		if (openOrClose == "open")
		{
			document.write('<tr><td colspan=\"4\">' + header + '<table class=\"mixedTable\">');
		}
	
		if (odd == "true")
		{
			document.write('<tr><td width=\"10%\" class=\"mixedTable5\">' + columnOne +
			'</td><td width=\"10%\" class=\"mixedTable1\">' + columnTwo +
			'</td><td width=\"80%\" colspan=\"2\" class=\"mixedTable2\">' + columnThree +
			'</td></tr>');
		}
		else
		{
			document.write('<tr><td width=\"10%\" class=\"mixedTable5\">' + columnOne +
			'</td><td width=\"10%\" class=\"mixedTable3\">' + columnTwo +
			'</td><td width=\"80%\" colspan=\"2\" class=\"mixedTable4\">' + columnThree +
			'</td></tr>');		
		}		
		if (openOrClose == "close")
		{
			document.write('<td colspan=\"4\"><p class=\"alignRight\"><a href=return.php' + returnAnchor + '><img src="../images/less.gif"></a></td>');		
			document.write('</tr></table></td></tr>');
		}
	}
}


//-- MoreTableTwo ---------------------------------------------------------

// Used to include a two column table.

function moreTableTwo(anchor,returnAnchor,header,openOrClose,odd,columnOne,columnTwo)
{
	if (document.URL.search(anchor) != -1)
	{
		if (openOrClose == "open")
		{
			document.write('<tr><td colspan=\"4\">' + header + '<table class=\"mixedTable\">');
		}
	
		if (odd == "true")
		{
			document.write('<tr><td width=\"10%\" class=\"mixedTable1\">' + columnOne +
			'</td><td width=\"10%\" class=\"mixedTable2\">' + columnTwo +
			'</td></tr>');
		}
		else
		{
			document.write('<tr><td width=\"10%\" class=\"mixedTable3\">' + columnOne +
			'</td><td width=\"90%\" class=\"mixedTable4\">' + columnTwo +
			'</td></tr>');		
		}		
		if (openOrClose == "close")
		{
			document.write('<td colspan=\"4\"><p class=\"alignRight\"><a href=return.php' + returnAnchor + '><img src="../images/less.gif"></a></td>');
			document.write('</tr></table></td></tr>');
		}
	}
}

//-- InterMARGINSRow ---------------------------------------------------------

// Used to include a row containing; <aDate> <title> <place> in the Meeting table.
// Row will not appear after variable date - (expires)
// The anchor identifies that the row has been selected.

function InterMARGINSRow(expires,aDate,title,place,anchor) 
{

returnAnchor = anchor.substring(1,anchor.length);


		more = '';
		if (anchor != '') more ='more';
		returnAnchor = anchor.substring(1,anchor.length);
		document.write('<tr>');
		document.write('<td width="20%" class=\"projectTitle03 printDate\">'+ aDate +'</td>');
		document.write('<td width="50%" class=\"projectTitle03 smallT\"><a name=' + returnAnchor + '></a>'+ title +'</td>');
		document.write('<td width="24%" class=\"projectTitle03 address\">'+ place +'</td>');
		document.write('<td width="6%" class=\"projectTitle03 smallT\"><a href=return.php' + anchor + '>'+ more +'</a></td>');
		document.write('</tr>');
}

