var news = []
var events = []
var glbEventScore = 0;
var glbEventLocation = 0;
var glbEventDetail = 0;
var glbEventTime = 0;

<!-- StatCounter Code -->
var sc_project=692557; 
var sc_partition=5; 
var sc_security="29af5fb6"; 



function buildSectionHeader()
{
	document.write('<table border=0><tr>');
	document.write('<td><img src="images/mnu_spacer.gif" width="20" height="1"></td>');
	document.write('<td width="100%">');
}

function buildSectionFooter()
{
	document.write('</td><td><img src="images/mnu_spacer.gif" width="20" height="1"></td></tr>')
	document.write('</table>')
}

function buildSectionTitle(PageTitle, namedAnchor)
{
	document.write('<table width="100%" cellspacing="2" cellpadding="3">');
	document.write('<tr><td>');

	document.write('<table width="100%" cellspacing="0" cellpadding="0">');
	document.write('<tr>');
	
	if ( namedAnchor && namedAnchor != "" ) {
		document.write('<td class="PageTitle" height="40px"><a name="' + namedAnchor + '"></a>'+PageTitle+'</td>');
	} else {
		document.write('<td class="PageTitle" height="40px">'+PageTitle+'</td>');
	}
	
	document.write('<td class="PageTitle" align="right"><image src="/images/sectionend.gif"></td>');
	document.write('</tr>');
	document.write('</table>');

	document.write('</td></tr>');
	document.write('</table>');
}

function buildSmallSectionTitle(PageTitle, namedAnchor)
{
	document.write('<table width="100%" cellspacing="2" cellpadding="3">');
	document.write('<tr>');
	
	if ( namedAnchor && namedAnchor != "" ) {
		document.write('<td class="smallpagetitle" height="30px"><a name="' + namedAnchor + '"></a>'+PageTitle+'</td>');
	} else {
		document.write('<td class="smallpagetitle" height="30px">'+PageTitle+'</td>');
	}
	
	document.write('</tr>');
	document.write('</table>');
}

function toggleExpand(PageTitle, idName)
{
	var spnElement = document.getElementById(idName + "_span");
	var divElement = document.getElementById(idName);
	var imgElement = document.getElementById(idName + "_img");
	if (divElement.style.display=="none")
	{
		divElement.style.display="inline";
		if ( imgElement ) imgElement.setAttribute("src", "/images/collapse.gif");
		if ( spnElement ) spnElement.setAttribute("title", "Click to hide " + PageTitle);
	}
	else
	{
		divElement.style.display="none";
		if ( imgElement ) imgElement.setAttribute("src", "/images/expand.gif");
		if ( spnElement ) spnElement.setAttribute("title", "Click to display " + PageTitle);
	}
}


function buildExpandTitle(PageTitle, idName)
{
	document.write('<span id="'+idName+'_span" onclick="toggleExpand(\''+PageTitle+'\',\''+idName+'\')" style="color:blue;position:relative;cursor:pointer;" title="Click to display '+PageTitle+'">');

	document.write('<table width="100%" cellspacing="0" cellpadding="0">');
	document.write('<tr>');
	
	document.write('<td class="smallpagetitle" height="30px">&nbsp '+PageTitle+'</td><td class="smallpagetitle" height="30px" ALIGN="RIGHT"><IMG id="' + idName + '_img" BORDER=0 SRC="/images/expand.gif"><IMG SRC="/images/smallsectioncurve.gif"></td>');	
	document.write('</tr>');
	document.write('</table>');
	document.write('</span>');
}

function buildBreadCrumbs()
{
	var tmpHREF = window.location.href;
	var tmpStr = 8;
	var tmpNextPos = 8;
	var tmpPos = tmpHREF.indexOf('/',tmpStr);
	var newHREF = 'http://'+window.location.host+'/';
	var tmpBreadCrumb = '<A HREF="../%27%2BnewHREF%2B%27">Home</A> <FONT class="breadcrumbsep">></FONT> ';
	while (tmpPos != -1)
	{
		tmpNextPos = tmpHREF.indexOf('/',tmpPos+1);
		if (tmpNextPos != -1)
		{
			tmpElement = tmpHREF.slice(tmpPos+1,tmpNextPos)
			//tmpElement = tmpElement.substr(0,1).toUpperCase()+tmpElement.substr(1);
			newHREF = newHREF + tmpElement + '/';
			tmpBreadCrumb = tmpBreadCrumb +' <A HREF="../%27%2BnewHREF%2B%27">'+tmpElement + '</A> <FONT class="breadcrumbsep">></FONT>';
		}
		tmpPos = tmpNextPos;
	}
	return tmpBreadCrumb;
}

function buildFooter()
{
	<!-- StatCounter Code - Placed in separate DIV to hide it-->
	document.write('<DIV id="counter"><script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img  src="http://c6.statcounter.com/counter.php?sc_project=692557&amp;java=0&amp;security=29af5fb6" alt="php hit counter" border="0"></a></noscript><DIV>'); 

	document.write('<table cellpadding="3" cellspacing="0" width="100%" border="0">');
	document.write('<tr bgcolor="#4682B4"><td class="footertext" valign="top" height="20" align="center">This site is maintained by the Gayton Information and Communication Action Team (GICAT).  The site contains information from various organisations, and views expressed may not be those of the GICAT.  No responsibility is accepted for errors and omissions.  Visitors are welcome to download information from this site, but they do so at their own risk.</td></tr>');
	document.write('</table>')
}

function buildHeader()
{
	document.write('<table cellpadding="0" cellspacing="0" width="100%" border="0"><tr><td style="cursor: pointer" width="100%" align="center" class="pageheader" NOWRAP>&nbsp;&nbsp;&nbsp;Gayton<img height="70" src="/images/gaytonlogo.jpg" alt="Gayton Logo">Northamptonshire</td></tr><tr><td bgcolor="#4682B4"colspan=1><img src="/images/mnu_spacer.gif" height="24" width="100%" border="0"></td></tr></table>');
}

function newsItem(Title, Text, Added, Contributed, Email, Image, ImageTitle, Link)
{
	this.Title = Title;
	this.Text = Text;
	this.Added = Added;
	this.Contributed = Contributed;
	this.Email = Email;
	this.Image = Image;
	this.ImageTitle = ImageTitle
	this.Link = Link
}

function addItem(itemTitle, itemText, Added, Contributed, Email, itemImage, itemImageTitle, Link)
{
	myNewsItem = new newsItem(itemTitle, itemText, Added, Contributed, Email, itemImage, itemImageTitle, Link);
	news[news.length]= myNewsItem;
}

function private_displayItems()
{

		var x=0;
		var colspan = "";
		for (x=0; x<news.length; x++)
		{
			document.write('<table border="0" cellspacing="2" cellpadding="3" width="100%">')
			document.write('<tr><td class="articletitle" COLSPAN="2" NOWRAP>' + news[x].Title + '</td>')
			
			if ( news[x].Added && news[x].Added != "" ) {
				document.write('<td class="contentdate" align="right">Date: ' + news[x].Added + '</td>')
				colspan = " colspan=2";
			}
			document.write('</tr>')
			document.write('</table>');
			
			document.write('<table class="articlesep" border="0" cellspacing="2" cellpadding="3" width="100%">')
			if (news[x].Image == "" )
			{
				document.write('<tr><td class="bodytext"' + colspan + '>' + news[x].Text + '</td></tr>')
			}
			else
			{
				document.write('<tr><td class="bodytext" width="100%" valign=TOP>' + news[x].Text + '</td><td align="left" rowspan=2><img src="' + news[x].Image + '" alt="' + news[x].ImageTitle + '"><br><font class="articlepictitle">' + news[x].ImageTitle + '</font></td></tr>');
			}
			if ( news[x].Link && news[x].Link != "" )
			{
				document.write('<tr><td class="contributer" align="right"' + colspan + '><A HREF="' + news[x].Link + '">>>> Click for more</A></td></tr>')
			}
			if ( news[x].Contributed && news[x].Contributed != "") {
				if ( news[x].Email && news[x].Email == "")
				{
					document.write('<tr><td class="contributer" align="right"' + colspan + '>Contributed: ' + news[x].Contributed + '</td></tr>')
				}
				else
				{
					document.write('<tr><td class="contributer" align="right"' + colspan + '>Contributed: ' + news[x].Contributed + '[<a href="mailto:' + news[x].Email + '?subject=Re: ' + news[x].Title + '">' + news[x].Email + '</a>]</td></tr>')			
				}
			}
			document.write('</table>')
		}


}

function displayItems(PageTitle)
{
		buildSectionHeader();
		
		buildSectionTitle(PageTitle);

		private_displayItems();
		
		buildSectionFooter();
}

function displayItemsSmall(PageTitle)
{
		buildSectionHeader();

		buildSmallSectionTitle(PageTitle);

		private_displayItems();
		
		buildSectionFooter();
}

// *******************
// Photo Display
// *******************

var photoItems = []

function photoItem(photoTitle, photoThumb, photoFull)
{
	this.photoTitle = photoTitle;
	this.photoThumb = photoThumb;
	this.photoFull = photoFull;
	this.photoFullWindowWidth = 450;
	this.photoFullWindowHeight = 400;
}

function addPhoto(photoTitle, photoThumb, photoFull, photoWidth, photoHeight)
{
	myPhotoItem = new photoItem(photoTitle, photoThumb, photoFull);
	photoItems[photoItems.length] = myPhotoItem;
	
	if ( photoHeight ) {
		myPhotoItem.photoFullWindowWidth = photoWidth;
		myPhotoItem.photoFullWindowHeight = photoHeight;
	}
}

var newWindow;

function makeNewWindow(tmpImage, winWidth, winHeight)
{
	if (!newWindow || newWindow.closed)
	{
		newWindow = window.open("","sub","status,height=" + winHeight + ",width=" + winWidth);
		if (!newWindow.opener)
		{
			newWindow.opener = window;
		}
		tmpCallBack = 'writeToWindow("'+tmpImage+'")';
		setTimeout(tmpCallBack,500);
	}
	else if (newWindow.focus)
	{
		newWindow.focus();
	}
}

function writeToWindow(tmpImage)
{
	var newContent = "<HTML><BODY><Table width=100%><tr><td align=center>";
	newContent += "<IMG SRC='"+tmpImage+"' BORDER='0'><BR><A HREF='javascript:window.close()'>Close Window</A>";
	newContent += "</td></tr></table></BODY></HTML>";
	newWindow.document.write(newContent);
	newWindow.document.close();
}

function displayPhotos(tmpTitle, tmpWidth)
{
	buildSectionTitle(tmpTitle);
	var x=0;
	var tmpCnt=0;
	
	document.write('<TABLE WIDTH="100%">');
	for (x=0; x<photoItems.length; x++)
	{
		tmpCnt++;
		if (tmpCnt == 1)
		{
			document.write('<TR>');
		}
		tmpFullImage = "'"+photoItems[x].photoFull+"'";
		tmpFullWidth = photoItems[x].photoFullWindowWidth;
		tmpFullHeight = photoItems[x].photoFullWindowHeight;
		document.write('<TD ALIGN="CENTER"><A HREF="javascript:makeNewWindow('+tmpFullImage+','+tmpFullWidth+','+tmpFullHeight+')" title="Click to view full size"><IMG SRC="'+photoItems[x].photoThumb+'" BORDER="0"><BR>'+photoItems[x].photoTitle+'</A></TD>');
		if (tmpCnt == tmpWidth)
		{
			document.write('</TR>');
			tmpCnt = 0;
		}
	}
	if (tmpCnt != 0)
	{
		document.write('</TR>');
	}
	document.write('</TABLE>');
}

// *******************
// Events Display
// *******************

function eventItem(eventDate,eventTime, eventLocation, eventDetail, eventScore)
{
	this.eventDate = eventDate;
	this.eventTime = eventTime;
	this.eventLocation = eventLocation;
	this.eventDetail = eventDetail;
	this.eventScore = eventScore;
}

function addEvent(eventDate, eventTime, eventLocation, eventDetail)
{
	myEventItem = new eventItem(eventDate, eventTime, eventLocation, eventDetail,"");
	events[events.length]= myEventItem;
}

function addEvent(eventDate, eventTime, eventLocation, eventDetail, eventScore)
{
	if (eventScore != "" && eventScore != undefined)
	{
		glbEventScore = 1;
	}
	else
	{
		eventScore = "";
	}
	
	if (eventTime != "" && eventScore != undefined)
	{
		glbEventTime = 1;
	}
	else
	{
		eventTime = "";
	}
	
	myEventItem = new eventItem(eventDate, eventTime, eventLocation, eventDetail, eventScore);
	events[events.length]= myEventItem;
}

function displayEvents(SectionTitle, Measure, tmpLocation)
{
	if (tmpLocation != "" && tmpLocation != undefined)
	{
		Location = tmpLocation;
	}
	else
	{
		Location = "Event Location";
	}
	
	eventTime = "Event Time";
	
	buildSectionHeader();
	document.write('<TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2" WIDTH="100%">');
	if (glbEventScore == 1)
	{
		document.write('<TR><TD class="pagesubtitle" colspan="5" ALIGN=LEFT>'+SectionTitle+'</TD></TR>');
		if (glbEventTime == 1)
		{
			document.write('<TR><TD class="eventheading" WIDTH="15%">Event Date</TD><TD class="eventheading" WIDTH="10%">'+eventTime+'</TD><TD class="eventheading" WIDTH="20%">'+Location+'</TD><TD class="eventheading" WIDTH="55%">Event Details</TD><TD class="eventheading">'+Measure+'</TD></TR>');
		}
		else
		{
			document.write('<TR><TD class="eventheading" WIDTH="15%">Event Date</TD><TD class="eventheading" WIDTH="20%">'+Location+'</TD><TD class="eventheading" WIDTH="55%">Event Details</TD><TD class="eventheading">'+Measure+'</TD></TR>');
		}
	}
	else
	{
		document.write('<TR><TD class="pagesubtitle" colspan="4" ALIGN=LEFT>'+SectionTitle+'</TD></TR>');
		if (glbEventTime == 1)
		{
			document.write('<TR><TD class="eventheading" WIDTH="15%">Event Date</TD><TD class="eventheading" WIDTH="10%">'+eventTime+'</TD><TD class="eventheading" WIDTH="20%">'+Location+'</TD><TD class="eventheading" WIDTH="55%">Event Details</TD></TR>');
		}
		else
		{
			document.write('<TR><TD class="eventheading" WIDTH="15%">Event Date</TD><TD class="eventheading" WIDTH="20%">'+Location+'</TD><TD class="eventheading" WIDTH="55%">Event Details</TD></TR>');
		}
	}
	var x=0;
	for (x=0; x<events.length; x++)
	{
		if (glbEventScore == 1)
		{
			if (glbEventTime == 1)
			{
				document.write('TR><TD class="eventdetail" nowrap>'+events[x].eventDate+'</TD><TD class="eventdetail">'+events[x].eventTime+'</TD><TD class="eventdetail">'+events[x].eventLocation+'</TD><TD class="eventdetail">'+events[x].eventDetail+'</TD><TD>'+events[x].eventScore+'</TD></TR>');
			}
			else
			{
				document.write('TR><TD class="eventdetail" nowrap>'+events[x].eventDate+'</TD><TD class="eventdetail">'+events[x].eventLocation+'</TD><TD class="eventdetail">'+events[x].eventDetail+'</TD><TD>'+events[x].eventScore+'</TD></TR>');
			}
		}
		else
		{
			if (glbEventTime == 1)
			{
				document.write('<TR><TD class="eventdetail" nowrap>'+events[x].eventDate+'</TD><TD class="eventdetail">'+events[x].eventTime+'</TD><TD class="eventdetail">'+events[x].eventLocation+'</TD><TD class="eventdetail" colspan="2">'+events[x].eventDetail+'</TD></TR>');
			}
			else
			{
				document.write('<TR><TD class="eventdetail" nowrap>'+events[x].eventDate+'</TD><TD class="eventdetail">'+events[x].eventLocation+'</TD><TD class="eventdetail" colspan="2">'+events[x].eventDetail+'</TD></TR>');
			}
		}
		
	}
	document.write('</TABLE>');
	buildSectionFooter();}


function displayEventsCSS(SectionTitle, Measure, tmpLocation)
{
	if (tmpLocation != "" && tmpLocation != undefined)
	{
		Location = tmpLocation;
	}
	else
	{
		Location = "Event Location";
	}
	
	eventTime = "Event Time";
	
	//buildSectionHeader();
	document.write('<TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2" WIDTH="100%">');
	if (glbEventScore == 1)
	{
		document.write('<TR><TD class="pagesubtitle" colspan="5" ALIGN=LEFT>'+SectionTitle+'</TD></TR>');
		if (glbEventTime == 1)
		{
			document.write('<TR><TD class="eventheading" WIDTH="15%">Event Date</TD><TD class="eventheading" WIDTH="10%">'+eventTime+'</TD><TD class="eventheading" WIDTH="20%">'+Location+'</TD><TD class="eventheading" WIDTH="55%">Event Details</TD><TD class="eventheading">'+Measure+'</TD></TR>');
		}
		else
		{
			document.write('<TR><TD class="eventheading" WIDTH="15%">Event Date</TD><TD class="eventheading" WIDTH="20%">'+Location+'</TD><TD class="eventheading" WIDTH="55%">Event Details</TD><TD class="eventheading">'+Measure+'</TD></TR>');
		}
	}
	else
	{
		document.write('<TR><TD class="pagesubtitle" colspan="4" ALIGN=LEFT>'+SectionTitle+'</TD></TR>');
		if (glbEventTime == 1)
		{
			document.write('<TR><TD class="eventheading" WIDTH="15%">Event Date</TD><TD class="eventheading" WIDTH="10%">'+eventTime+'</TD><TD class="eventheading" WIDTH="20%">'+Location+'</TD><TD class="eventheading" WIDTH="55%">Event Details</TD></TR>');
		}
		else
		{
			document.write('<TR><TD class="eventheading" WIDTH="15%">Event Date</TD><TD class="eventheading" WIDTH="20%">'+Location+'</TD><TD class="eventheading" WIDTH="55%">Event Details</TD></TR>');
		}
	}
	var x=0;
	for (x=0; x<events.length; x++)
	{
		if (glbEventScore == 1)
		{
			if (glbEventTime == 1)
			{
				document.write('TR><TD class="eventdetail">'+events[x].eventDate+'</TD><TD class="eventdetail">'+events[x].eventTime+'</TD><TD class="eventdetail">'+events[x].eventLocation+'</TD><TD class="eventdetail">'+events[x].eventDetail+'</TD><TD>'+events[x].eventScore+'</TD></TR>');
			}
			else
			{
				document.write('TR><TD class="eventdetail">'+events[x].eventDate+'</TD><TD class="eventdetail">'+events[x].eventLocation+'</TD><TD class="eventdetail">'+events[x].eventDetail+'</TD><TD>'+events[x].eventScore+'</TD></TR>');
			}
		}
		else
		{
			if (glbEventTime == 1)
			{
				document.write('<TR><TD class="eventdetail">'+events[x].eventDate+'</TD><TD class="eventdetail">'+events[x].eventTime+'</TD><TD class="eventdetail">'+events[x].eventLocation+'</TD><TD class="eventdetail" colspan="2">'+events[x].eventDetail+'</TD></TR>');
			}
			else
			{
				document.write('<TR><TD class="eventdetail">'+events[x].eventDate+'</TD><TD class="eventdetail">'+events[x].eventLocation+'</TD><TD class="eventdetail" colspan="2">'+events[x].eventDetail+'</TD></TR>');
			}
		}
		
	}
	document.write('</TABLE>');
	//buildSectionFooter();
}



//Not yet used... but maybe.
function buildCalendar(tmpYear,tmpMonth)
{
	var myDate = new Date(tmpYear,tmpMonth-1,01);
	var strDay = myDate.getDay();
	var curDay = myDate.getDate();
	var curMonth = myDate.getMonth()+1;
	var curYear = myDate.getFullYear();
	if (curMonth == 12) { curMonth = 0; curYear++ }
	var eomDate = new Date(curYear,curMonth,1);
	var gap = eomDate.getTime() - myDate.getTime();
	gap = Math.floor(gap / 86400000);

	document.write('<table border="1"><tr><td>S</td><td>M</td><TD>T</TD><TD>W</TD><TD>T</TD><TD>F</TD><TD>S</TD></TR><TR>');
	var x = 0;
	for (x=0; x<strDay; x++)
	{
		document.write('td>*</td>');
	}
	for (x=1; x<=gap; x++)
	{
		document.write('<td>'+x+'</td>');
		strDay++;
		if (strDay == 7) { strDay = 0; document.write('</TR><TR>');}
	}
	document.write('</tr></table>');
}


function profileItem(profileTitle, profileName, profileNumber, profileEmail)
{
	this.profileTitle = profileTitle;
	this.profileType = 'Club';
	this.profileName = profileName;
	this.profileNumber = profileNumber;
	this.profileEmail = profileEmail;
	this.profileOverview = "";
	this.profileDetails = "";
	this.profileWeb = "";
	this.profileAddress = "";
	this.profileImage = "";
	this.profileTimes = "";
	this.profileNotices = "";
	this.profileLocation = "";
}

function displayProfile(tmpProfileItem)
{
	buildSectionHeader();
	if (tmpProfileItem.profileImage != '')
	{
		tmpImgWidth = '40%';
		tmpAddressPos = "left";
	}
	else
	{
		tmpImgWidth = '60%';
		tmpAddressPos = "right";
	}


	document.write('<table width="100%" cellspacing="2" cellpadding="3">');
	document.write('<tr><td>');

	document.write('<table width="100%" cellspacing="0" cellpadding="0" border="0">');
	document.write('<tr>');
		document.write('<td class="PageTitle" height="40px">'+tmpProfileItem.profileTitle+'</td>');
		document.write('<td class="PageTitle" align="right"><image src="/images/sectionend.gif"></td>');
	document.write('</tr>');
	document.write('</table>');

	document.write('</td></tr>');
	document.write('</table>');


	document.write('<table border="0" cellspace="0" cellpadding="0"><tr><td valign="top">');
	document.write('<table border="0" WIDTH=100% cellpadding=2 cellspacing=0>');
	document.write('<tr>');
	if ((tmpProfileItem.profileOverview != "") || (tmpProfileItem.profileDetails != ""))
	{
		document.write('<td width="'+tmpImgWidth+'" VALIGN="top"><FONT class="PageSubTitle">'+tmpProfileItem.profileType+' Overview</FONT><BR><FONT class="bodytext">'+tmpProfileItem.profileOverview+'</FONT></td>');
		if (tmpAddressPos == "left") { tmpAddressPos = "center"; }
	}
	document.write('<td width="40%" VALIGN="top" align="'+tmpAddressPos+'" rowspan="2">');
	document.write('<table border="0" ALIGN="'+tmpAddressPos+'" VALIGN="top" BGCOLOR="#D2E8F2">');
	if (tmpProfileItem.profileName != "")
	{
		document.write('<tr><td valign="top" class="bodytextem" NOWRAP>Contact Name: </td><td class="bodytext">'+tmpProfileItem.profileName+'</td></tr>');
	}
	if (tmpProfileItem.profileNumber != "")
	{
		document.write('<tr><td valign="top" class="bodytextem" NOWRAP>Contact Number:</td><td class="bodytext">'+tmpProfileItem.profileNumber+'</td></tr>');
	}
	if (tmpProfileItem.profileEmail != "")
	{
		document.write('<tr><td VALIGN="TOP" class="bodytextem" NOWRAP>Contact Email: </td>');
		document.write('<td class="bodytext">');
		
		var tmpEmailList = tmpProfileItem.profileEmail.split(",");
		
		var tmpEmailListCnt=0;
		while (tmpEmailListCnt < tmpEmailList.length)
		{
			if (tmpEmailListCnt > 0)
			{
				document.write("<BR>");
			}
			document.write('<a href="mailto:'+tmpEmailList[tmpEmailListCnt]+'?subject='+tmpProfileItem.profileTitle+'">'+tmpEmailList[tmpEmailListCnt]+'</a>');
			tmpEmailListCnt+=1;
		}
		document.write('</td></tr>');
	}
	if (tmpProfileItem.profileAddress != "")
	{
		document.write('<tr><td class="bodytextem" NOWRAP valign="top">Contact Address: </td><td class="bodytext">'+tmpProfileItem.profileAddress+'</td></tr>');
	}
	if (tmpProfileItem.profileWeb != "")
	{
		document.write('<tr><td class="bodytextem" NOWRAP>Website: </td><td class="bodytext"><A HREF="http://'+tmpProfileItem.profileWeb+'" target="_blank">'+tmpProfileItem.profileWeb+'</A></td></tr>');
	}
	if (tmpProfileItem.profileLocation != "")
	{	
		// Reference to Gayton Map?
		if ( tmpProfileItem.profileLocation.substring(0, 4) == "http" ) {
			mapTargetFrame = "_blank";
			showMapText = "Show map";
		} else {
			mapTargetFrame = "_self";
			showMapText = "Show on Gayton map";
		}
		document.write('<tr><td class="bodytextem" NOWRAP>Location: </td><td class="bodytext" nowrap><A HREF="'+tmpProfileItem.profileLocation+'" target="' + mapTargetFrame + '">' + showMapText + '</A></td></tr>');
	}
	if (tmpProfileItem.profileTimes != "")
	{
		document.write('<tr><td colspan=2><table border=0 cellpadding=0 cellspacing=0 width=100%>');
		document.write('<tr><td class="bodytextem" colspan="2">Opening Times</td></tr>');
		var tmpTimes = tmpProfileItem.profileTimes;
		var tmpStr = 0;
		var tmpNextPos = 0;
		var tmpPos = 0;
		var tmpOffset = 0;
		var newTimes = '';
		while (tmpPos != -1)
		{
			tmpNextPos = tmpTimes.indexOf(',',tmpPos+1);
			if (tmpNextPos != -1)
			{
				tmpElement = tmpTimes.slice(tmpPos+tmpOffset,tmpNextPos);
			}
			else
			{
				tmpElement = tmpTimes.slice(tmpPos+tmpOffset);
			}
			tmpDate = tmpElement.slice(0,tmpElement.indexOf(':'));
			tmpTime = tmpElement.slice(tmpElement.indexOf(':')+1);
			newTimes = newTimes + tmpElement + '/';
			document.write('<TR><td class="bodytext">'+tmpDate+'</TD><td class="bodytext">'+tmpTime+'</TD></TR>');
			tmpPos = tmpNextPos;
			tmpOffset = 1;
		}
		document.write('</table></td></tr>');
	}
	document.write('</table>');
	document.write('</td>');
//	if (tmpProfileItem.profileImage != '')
//	{
//		document.write('<td width="20%" rowspan="5" VALIGN="top" align=right><img border=0 src="'+tmpProfileItem.profileImage+'" border="1"></td>');
//	}
	document.write('</tr>');
	if (tmpProfileItem.profileOverview != "")
	{
		//document.write('<tr><td class="bodytext" valign="top">'+tmpProfileItem.profileOverview+'</td></tr>');
	}
	if (tmpProfileItem.profileDetails != "")
	{
		document.write('<tr><td colspan="1" class="PageSubTitle" valign="bottom">'+tmpProfileItem.profileType+' Details</td></tr>');
		document.write('<tr><td colspan="2" class="bodytext" valign="top"><P class="bodytext">'+tmpProfileItem.profileDetails+'</P></td></tr>');
	}
	document.write('<tr><td colspan="2" class="bodytext" valign="top"><P class="bodytext"></P></td></tr>');
	document.write('</table></td>');
document.write('</td><td>');	
if (tmpProfileItem.profileImage != '')
{
	document.write('<td width="20%" rowspan="5" VALIGN="top" align=right><img border=0 src="'+tmpProfileItem.profileImage+'" border="1"></td>');
}
document.write('</td>');	
document.write('</tr>');
	if (tmpProfileItem.profileNotices != "")
	{
		document.write('<tr><td colspan="1" class="PageSubTitle" valign="bottom">'+tmpProfileItem.profileType+' Notices</td></tr>');
		document.write('<tr><td colspan="3" class="bodytext" valign="top"><P class="bodytextem">'+tmpProfileItem.profileNotices+'</P></td></tr>');
	}
document.write('</table>');
	buildSectionFooter();
}

function generateDownloadRefs(caption, baseFileName) {
	document.write('<a href="' + baseFileName + '.doc" title="' + caption + ' - Microsoft Word"><img src="/images/word_small.gif" alt="' + caption + ' - Microsoft Word" width="19" height="18" border="0" style="vertical-align: middle"></a>');
	document.write(' or ');
	document.write('<a href="' + baseFileName + '.pdf" title="' + caption + ' - Adobe Acrobat PDF" target="_blank"><img src="/images/pdf_small.gif" alt="' + caption + ' - Adobe Acrobat PDF" width="19" height="18" border="0" style="vertical-align: middle"></a>');
}

function generatePDFDownloadRef(caption, baseFileName) {
	document.write('<a href="' + baseFileName + '.pdf" title="' + caption + ' - Adobe Acrobat PDF" target="_blank"><img src="/images/pdf_small.gif" alt="' + caption + ' - Adobe Acrobat PDF" width="19" height="18" border="0" style="vertical-align: middle"></a>');
}