<!--//

// THIS FILE REQUIRES helper.js

var contentArray = [];

// Resource array to hold resource items read into the page
var resourcesArray = [];

function parseResources(respXML, resIndex)
{
	if(respXML != null)
	{
		var htmlOutput = "";
		
		var resources = respXML.getElementsByTagName("resource");
		if (!resources) return "<p>There are no resources available at the current time.</p>";
		if (resources.length > 0)
		{
			htmlOutput += "<ul>";
			
			for(var i = 0; i < resources.length; i++)
			{
				// Parse out the current resource item from the XML <resource> ... </resource>
				var r = parseResourceItem(resources[i]);
				
				// Add each resource to global array for all archived and active
				if ((resIndex == 0) || (resIndex == 1))	{ resourcesArray.push( r );	}
				
				if (r.title && r.type && r.id)
				{
					htmlOutput += "<li>" + r.title;
					htmlOutput += " <a href=\"#\" onclick=\"javascript:showResource('" + r.id + "');\">more</a>";
					htmlOutput += "</li>";
				}
			}
			htmlOutput += "</ul>";
		}
		else
		{
			htmlOutput = "<p>There are no resources available at the current time.</p>";
		}
		// Update the page
		return htmlOutput;
	}
	else
	{
		return "<p>There are no resources available at the current time.</p>";
	}
}

function parseResourcesByIndex(respXML, resIndex)
{
	var xmlBlock = respXML.getElementsByTagName('Resources')[resIndex];
	
	if (xmlBlock)
	{
		 return parseResources(xmlBlock, resIndex);
	}
	else
	{
		return "<p>There are no resources available at the current time.</p>";
	}
}

// Global resources index
var resourcesIncIndex = 0;

function parseResourcesIncrement(respXML)
{
	return parseResourcesByIndex(respXML,resourcesIncIndex++);
}

function parseAllEvents(respXML)
{
	var MAX_NUM_EVENTS = 1000;
	calendarXML = respXML.getElementsByTagName('AllEvents');
	
	if(calendarXML[0] != null)
	{
		var htmlOutput = "";
		var lastEventDate = "";
		var events = calendarXML[0].getElementsByTagName("Event");
		var title = calendarXML[0].getElementsByTagName("title");
		if (title)
		{
			bothDates = title[0].firstChild.data;
			if (bothDates)
			{
				if (bothDates.length > 22)				
				{
					indexDash = bothDates.indexOf(" - ");
					startOnly = bothDates.substr(0, indexDash);
					endOnly = bothDates.substr((indexDash + 3), (bothDates.length - (indexDash + 2)));
					htmlOutput += "<h2>" + fixInternationalDate(startOnly) + " - " + fixInternationalDate(endOnly) + "</h2><br />\n";
				}
			}
		}
		if (events)
		{
			// Limit the number of events
			var eventLimit = 0;
			if (events.length < MAX_NUM_EVENTS)
			{
				eventLimit = events.length;
			}
			else
			{
				eventLimit = MAX_NUM_EVENTS;
			}
			htmlOutput += '<div style="height: 300px; padding-top: 5px; overflow: auto;">';
			for(var i = 0; i < eventLimit; i++)
			{
				var evtName = events[i].getElementsByTagName('name')[0].firstChild.data;
				var evtID = events[i].getElementsByTagName('id')[0].firstChild.data;
				var evtDate = events[i].getElementsByTagName('startDate')[0].firstChild.data;
				var startTime = "";
				if (events[i].getElementsByTagName('startTime').length > 0)
				{
					startTime = events[i].getElementsByTagName('startTime')[0].firstChild;
					(startTime != null) ?  (startTime = startTime.data) : (startTime = "");
				}
				var endTime = "";
				if (events[i].getElementsByTagName('endTime').length > 0)
				{
					endTime = events[i].getElementsByTagName('endTime')[0].firstChild;
					(endTime != null) ?  (endTime = endTime.data) : (endTime = "");
				}
				var evtWhere = "";
				if (events[i].getElementsByTagName('where').length > 0)
				{
					evtWhere = events[i].getElementsByTagName('where')[0].firstChild;
					(evtWhere != null) ?  (evtWhere = evtWhere.data) : (evtWhere = "");
				}
				
				evtDate = fixEventDate(evtDate);
				
				if (evtDate && evtName)
				{
					if (evtDate != lastEventDate)
					{
						htmlOutput+="<h3>" + evtDate + "</h3>";
					}
					htmlOutput += "<p><strong>" + evtName + ":</strong><br/>";
					if (startTime.length > 0)
					{
						htmlOutput += startTime;
					}
					if (endTime.length > 0)
					{
						htmlOutput += " - " + endTime;
					}
					if ((endTime == 0) && (startTime == 0))
					{
						//htmlOutput += "All Day Event";
					}
					htmlOutput += "</p>";
					lastEventDate = evtDate;
				}
			}
			htmlOutput += "</div>\n";
			if (!eventLimit)
			{
				htmlOutput = "<p>There are currently no events.</p>";
			}
		}
		else
		{
			htmlOutput = "<p>There are currently no events.</p>";
		}
		
		return htmlOutput;
	}
	else
	{
		return "<p>There are currently no events.</p>";
	}
}

function parseWorshipServices(respXML)
{
	worshipXML = respXML.getElementsByTagName('WorshipServices');
	
	if(worshipXML[0] != null)
	{	
		var htmlOutput = "<h2 class=\"home_heading\"><a href=\"worship.html\">Worship Opportunities</a></h2>";
		var lastEventDate = "";
		var events = worshipXML[0].getElementsByTagName("Event");
		if (events)
		{
			for(var i = 0; i < events.length; i++)
			{
				var evtName = events[i].getElementsByTagName('name')[0].firstChild.data;
				var evtID = events[i].getElementsByTagName('id')[0].firstChild.data;
				var evtDate = events[i].getElementsByTagName('startDate')[0].firstChild.data;
				var startTime = "";
				if (events[i].getElementsByTagName('startTime').length > 0)
				{
					startTime = events[i].getElementsByTagName('startTime')[0].firstChild;
					(startTime != null) ?  (startTime = startTime.data) : (startTime = "");
				}
				var endTime = "";
				if (events[i].getElementsByTagName('endTime').length > 0)
				{
					endTime = events[i].getElementsByTagName('endTime')[0].firstChild;
					(endTime != null) ?  (endTime = endTime.data) : (endTime = "");
				}
				var evtWhere = "";
				if (events[i].getElementsByTagName('where').length > 0)
				{
					evtWhere = events[i].getElementsByTagName('where')[0].firstChild;
					(evtWhere != null) ?  (evtWhere = evtWhere.data) : (evtWhere = "");
				}
				
				evtDate = fixEventDate(evtDate);
				
				if (evtDate && evtName)
				{
					if (evtDate != lastEventDate)
					{
						htmlOutput+="<h3>" + evtDate + "</h3>";
					}
					var timeFound = ((startTime.length > 0) || (endTime.length > 0));
					htmlOutput += "<p><strong>" + evtName + (timeFound ? ":" : "")  + "</strong><br/>";
					if (startTime.length > 0)
					{
						htmlOutput += startTime;
					}
					if (endTime.length > 0)
					{
						htmlOutput += " - " + endTime;
					}
					if ((endTime == 0) && (startTime == 0))
					{
						//htmlOutput += "All Day Event";
					}
					htmlOutput += "</p>";
					lastEventDate = evtDate;
				}
			}
		}
		else
		{
			htmlOutput += "<p>There are currently no Worship Opportunities found.</p>";
		}
		
		return htmlOutput;
	}
	else
	{
		return "<h2>Worship Opportunities</h2><p>There are currently no Worship Opportunities found.</p>";
	}
}

function parseCalendarEvents(respXML)
{
	calendarXML = respXML.getElementsByTagName('CalendarEvents');
	MAX_NUM_EVENTS = 20;
	if(calendarXML[0] != null)
	{
		var htmlOutput = "<h2 class=\"home_heading\"><a href=\"events.html\">Upcoming Events</a></h2>";
		var lastEventDate = "";
		var events = calendarXML[0].getElementsByTagName("Event");
		if (events)
		{
			// Limit the number of events
			var eventLimit = 0;
			if (events.length < MAX_NUM_EVENTS)
			{
				eventLimit = events.length;
			}
			else
			{
				eventLimit = MAX_NUM_EVENTS;
			}
			
			for(var i = 0; i < eventLimit; i++)
			{
				var evtName = events[i].getElementsByTagName('name')[0].firstChild.data;
				var evtID = events[i].getElementsByTagName('id')[0].firstChild.data;
				var evtDate = events[i].getElementsByTagName('startDate')[0].firstChild.data;
				var startTime = "";
				if (events[i].getElementsByTagName('startTime').length > 0)
				{
					startTime = events[i].getElementsByTagName('startTime')[0].firstChild;
					(startTime != null) ?  (startTime = startTime.data) : (startTime = "");
				}
				var endTime = "";
				if (events[i].getElementsByTagName('endTime').length > 0)
				{
					endTime = events[i].getElementsByTagName('endTime')[0].firstChild;
					(endTime != null) ?  (endTime = endTime.data) : (endTime = "");
				}
				var evtWhere = "";
				if (events[i].getElementsByTagName('where').length > 0)
				{
					evtWhere = events[i].getElementsByTagName('where')[0].firstChild;
					(evtWhere != null) ?  (evtWhere = evtWhere.data) : (evtWhere = "");
				}
				
				evtDate = fixEventDate(evtDate);
				
				if (evtDate && evtName)
				{
					if (evtDate != lastEventDate)
					{
						htmlOutput+="<h3>" + evtDate + "</h3>";
					}
					var allDayEvent = (((endTime == 0) && (startTime == 0))?true:false);
					htmlOutput += "<p><strong>" + evtName + "" + (allDayEvent ? "" : ":") + "</strong><br/>";
					if (startTime.length > 0)
					{
						htmlOutput += startTime;
					}
					if (endTime.length > 0 && startTime != endTime)
					{
						htmlOutput += " - " + endTime;
					}
					if ((endTime == 0) && (startTime == 0))
					{
						//htmlOutput += "All Day Event";
					}
					htmlOutput += "</p>";
					lastEventDate = evtDate;
				}
			}
			if (!eventLimit)
			{
				htmlOutput += "<p>There are currently no upcoming events.</p>";
			}
		}
		else
		{
			htmlOutput += "<p>There are currently no upcoming events.</p>";
		}
		
		return htmlOutput;
	}
	else
	{
		return "<h2>Upcoming Events</h2><p>There are currently no upcoming events.</p>";
	}
}

function parseAnnouncements(respXML)
{
	announcementsXML = respXML.getElementsByTagName('Announcements');
	if(announcementsXML[0] != null)
	{
		var htmlOutput = "<h2 class=\"home_heading\"><a href=\"resources.html\">Announcements</a></h2>";
		
		var announcements = announcementsXML[0].getElementsByTagName("resource");
		if (announcements)
		{
			if (announcements.length > 0)
			{
				for(var i = 0; i < announcements.length; i++)
				{
					var a = parseResourceItem(announcements[i]);
		
					if (a.title && a.type && a.date)
					{
						if (a.type == "announcement")
						{
							htmlOutput += "<h3>" + a.title + "</h3>";
							
							var summaryCondensed = condenseSummary(a.summary,45);
							htmlOutput += "<p><strong>" + a.date + "</strong> - " + summaryCondensed + " ... <a href='resource_view.php?id=" + a.id + "'>More</a></p>";
						}
					}
				}
			}
			else
			{
				htmlOutput = "";//"<p>There are no announcements available at the current time.</p>";
			}
		}
		else
		{
			htmlOutput = "";//"<p>There are no announcements available at the current time.</p>";
		}
		return htmlOutput;
	}
	else
	{
		return "";//"<p>There are no announcements available at the current time.</p>";
	}
}

function parseResourcesHome(respXML)
{
	var xmlBlock = respXML.getElementsByTagName('Resources');
	
	if(xmlBlock[0] != null)
	{
		var htmlOutput = "";
		
		var resources = xmlBlock[0].getElementsByTagName("resource");
		if (resources)
		{
			var lastType = "";
			if (resources.length > 0)
			{
				for(var i = 0; i < resources.length; i++)
				{
					var r = parseResourceItem(resources[i]);
					var media1 = getMediaInfo(r.media);
					var media2 = getMediaInfo(r.mediaAlt);
					if (lastType != r.type)
					{
						if (lastType.length > 0)
						{
							htmlOutput += "</ul>";
						}
						if (r.type == "opportunity")
						{
							htmlOutput += '<h3>Opportunities</h3>';
						}
						else if (r.type == "media")
						{
							htmlOutput += '<h3>Media</h3>';
						}
						else
						{
							htmlOutput += '<h3>' + cleanForDisplay(r.type) + 's</h3>';
						}
						htmlOutput += "<ul>";
					}
					lastType = r.type;
					if (r.title && r.type && r.id)
					{
						htmlOutput += "<li>" + /*cleanForDisplay(r.type) +  ": " +*/ r.title;
						var lengthOk = (r.summary.length > 1) ? 1 : 0;
						if (r.type == "sermon")
						{
							//htmlOutput += " - Weekly Sermon";
							if (media1.length > 0)
							{
								htmlOutput += "<p style=\"vertical-align: top;\">" + media1;
								if (lengthOk)
								{
									htmlOutput += " | <a href='resource_view.php?id=" + r.id + "'>More</a>";
								}
							}
							else if (lengthOk)
							{
								htmlOutput += " <a href='resource_view.php?id=" + r.id + "'>More</a>";
							}
							if (media2.length > 0 && media1.length > 0)
							{
								htmlOutput += "<br />" + media2;
							}
							else if (media2.length > 0)
							{
								htmlOutput += "<p style=\"vertical-align: top;\">" + media2;
							}
							htmlOutput += "</p>";
						}
						else
						{
							if (media1.length > 0)
							{
								htmlOutput += "<p style=\"vertical-align: top;\">" + media1;
								if (lengthOk)
								{
									htmlOutput += " | <a href='resource_view.php?id=" + r.id + "'>More</a>";
								}
								htmlOutput += ((media2.length > 0) ? "<br />" : "") + media2 + "</p>";
							}
							else if (lengthOk)
							{
								htmlOutput += " <a href='resource_view.php?id=" + r.id + "'>More</a>";
							}
						}
						
						htmlOutput += "</li>";
					}
				}
				htmlOutput += "</ul>";
			}
			else
			{
				htmlOutput = "<p>We apologize, there are no resources available at the current time.</p>";
			}
		}
		else
		{
			htmlOutput = "<p>We apologize, there are no resources available at the current time.</p>";
		}
		// Update the page
		return htmlOutput;
	}
	else
	{
		return "<p>Currently no resources are available for this category.</p>";
	}
}

function parseSermons(respXML)
{
	sermonsXML = respXML.getElementsByTagName('Sermons');
	
	if(sermonsXML[0] != null)
	{
		var htmlOutput = "<h2 class=\"home_heading\"><a href=\"sermons.html\">Sermon Focus</a></h2>";
		
		var sermons = sermonsXML[0].getElementsByTagName("resource");
		if (sermons)
		{
			var lastSermonCategory = "";
			var lastSermonAuthor = "";
			for(var i = 0; i < sermons.length; i++)
			{
				var s = parseResourceItem(sermons[i]);
	
				// Check if we have a new category
				if ( lastSermonCategory != s.category || lastSermonAuthor != s.author )
				{
					// Close list from previous category
					if ( lastSermonCategory != "" || lastSermonAuthor != "" )
					{
						htmlOutput += "</ul>";
						htmlOutput += "</div>";
					}
					
					// Always create new category heading and unordered list
					htmlOutput += "<h3>" + s.category + " by " + s.author + "</h3>";
					htmlOutput += "<ul>";
					
					// Remember the current category as the last category
					lastSermonCategory = s.category;
					lastSermonAuthor = s.author;
				}
	
				if (s.title && s.category && s.type && s.status && s.date)
				{
					if (s.type == "sermon")
					{
						htmlOutput += "<li>" + s.date + " - " + s.title;
						
						// Check if there is additional content, active or archived
						if ((s.media.length > 0 || s.summary.length > 0 || s.mediaAlt.length > 0) && (s.status != "inactive"))
						{
							htmlOutput += "&nbsp;&nbsp;<a href='resource_view.php?id=" + s.id + "'>" + "More" + "</a>";
						}
						htmlOutput += "</li>";
					}
				}
			}
			htmlOutput += "</ul>";
			if (sermons.length == 0)
			{
				htmlOutput = "";//"<p>We apologize, no sermons are available at the current time.</p>";
			}
			
		}
		else
		{
			htmlOutput = "";//"<p>We apologize, no sermons are available at the current time.</p>";
		}
		return htmlOutput;
	}
	else
	{
		return "";//"<p>We apologize, no sermons are available at the current time.</p>";
	}
}
function parseSermonsGeneric(respXML,respTag)
{
	sermonsXML = respXML.getElementsByTagName(respTag);
	var sermonError = "";
	if (respTag == "SermonsArchived")
	{
		sermonError = "<p>There are no archived sermons at the current time.</p>";
	}
	else
	{
		sermonError = "<p>There are no sermons at the current time.</p>";
	}
	if(sermonsXML[0] != null)
	{
		var htmlOutput = "";
		
		var sermons = sermonsXML[0].getElementsByTagName("resource");
		if (sermons)
		{
			var lastSermonCategory = "";
			var lastSermonAuthor = "";
			for(var i = 0; i < sermons.length; i++)
			{
				var s = parseResourceItem(sermons[i]);
	
				// Check if we have a new category
				if ( lastSermonCategory != s.category || lastSermonAuthor != s.author )
				{
					// Close list from previous category
					if ( lastSermonCategory.length > 0 && lastSermonAuthor.length > 0 )
					{
						htmlOutput += "</ul>";
					}
					
					// Always create new category heading and unordered list
					htmlOutput += "<h3>" + s.category + " by " + s.author + "</h3>";
					htmlOutput += "<ul>";
					
					// Remember the current category as the last category
					lastSermonCategory = s.category;
					lastSermonAuthor = s.author;
				}
	
				if (s.title && s.category && s.author && s.type && s.status && s.date)
				{
					if (s.type == "sermon")
					{
						htmlOutput += "<li>" + s.date + " - " + s.title;
						
						// Check if there is additional content, active or archived
						if ((s.media.length > 0 || s.summary.length > 0 || s.mediaAlt.length > 0) && (s.status != "inactive"))
						{
							htmlOutput += "&nbsp;&nbsp;<a href='resource_view.php?id=" + s.id + "'>" + "More" + "</a>";
						}
						htmlOutput += "</li>";
					}
				}
			}
			htmlOutput += "</ul>";
			if (sermons.length == 0)
			{
				htmlOutput = sermonError;
			}
			
		}
		else
		{
			htmlOutput = sermonError;
		}
		return htmlOutput;
	}
	else
	{
		return sermonError;
	}
}
function parseSermonsActive(respXML)
{
	return parseSermonsGeneric(respXML,"SermonsActive");
}
function parseSermonsArchived(respXML)
{
	return parseSermonsGeneric(respXML,"SermonsArchived");
}
function parseAnnouncementsGeneric(respXML,respTag)
{
	var announcementsXML = respXML.getElementsByTagName(respTag);
	var announcementError = "";
	if (respTag == "AnnouncementsArchived")
	{
		announcementError = "<p>There are no archived announcements at the current time.</p>";
	}
	else
	{
		announcementError = "<p>There are no announcements at the current time.</p>";
	}
	
	if(announcementsXML[0] != null)
	{
		var htmlOutput = "";
		
		var announcements = announcementsXML[0].getElementsByTagName("resource");
		if (announcements)
		{
			for(var i = 0; i < announcements.length; i++)
			{
				var a = parseResourceItem(announcements[i]);
	
				if (a.title && a.type && a.date)
				{
					if (a.type == "announcement")
					{
						htmlOutput += "<h3>" + a.title + "</h3>";
						
						var summaryCondensed = condenseSummary(a.summary,45);
						htmlOutput += "<p><strong>" + a.date + "</strong> - " + summaryCondensed + " ... <a href='resource_view.php?id=" + a.id + "'>More</a></p>";
					}
				}
			}
			htmlOutput += "</ul>";
			if (announcements.length == 0)
			{
				htmlOutput = announcementError;
			}
			
		}
		else
		{
			htmlOutput = announcementError;
		}
		return htmlOutput;
	}
	else
	{
		return announcementError;
	}
}
function parseAnnouncementsActive(respXML)
{
	return parseAnnouncementsGeneric(respXML,"AnnouncementsActive");
}
function parseAnnouncementsArchived(respXML)
{
	return parseAnnouncementsGeneric(respXML,"AnnouncementsArchived");
}
function parseFeatures(respXML)
{
	xmlBlock = respXML.getElementsByTagName('Features');
	var tempContentArray = [];
	
	if(xmlBlock[0] != null)
	{		
		var resources = xmlBlock[0].getElementsByTagName("resource");
		if (resources)
		{
			for(var i = 0; i < resources.length; i++)
			{
				var r = parseResourceItem(resources[i]);
				
				if (r.title && r.type && r.summary && r.media)
				{
					tempContentArray.push(new Feature(r.title,r.summary,r.media));
				}
			}
			if (resources.length > 0)
			{
				FEATURE_CONTENT_INITIALIZED = true;
			}
		}
		// Set the contentArray to the global value
		contentArray = tempContentArray;
		return "";
	}
	else
	{
		return "";
	}
}
function parseOpportunities(respXML)
{
	opportunitiesXML = respXML.getElementsByTagName('Opportunities');
	if(opportunitiesXML[0] != null)
	{
		var htmlOutput = "<h2 class=\"home_heading\"><a href=\"get_involved.html\">Opportunities for Involvement</a></h2>";
		
		var opportunities = opportunitiesXML[0].getElementsByTagName("resource");
		if (opportunities)
		{
			if (opportunities.length > 0)
			{
				for(var i = 0; i < opportunities.length; i++)
				{
					var a = parseResourceItem(opportunities[i]);
		
					if (a.title && a.type && a.date)
					{
						if (a.type == "opportunity")
						{
							htmlOutput += "<h3>" + a.title + "</h3>";
							
							var summaryCondensed = condenseSummary(a.summary,45);
							htmlOutput += "<p><strong>" + a.date + "</strong> - " + summaryCondensed + " ... <a href='resource_view.php?id=" + a.id + "'>More</a></p>";
						}
					}
				}
			}
			else
			{
				htmlOutput = "";//"<p>There are no opportunities available at the current time.</p>";
			}
		}
		else
		{
			htmlOutput = "";//"<p>There are no opportunities available at the current time.</p>";
		}
		return htmlOutput;
	}
	else
	{
		return "";//"<p>There are no opportunities available at the current time.</p>";
	}
}
function parseVolunteerOpps(respXML)
{
	var volunteerOppsXML = respXML.getElementsByTagName("VolunteerOpps");
	if(volunteerOppsXML[0] != null)
	{
		var htmlOutput = "";
		
		var opportunities = volunteerOppsXML[0].getElementsByTagName("resource");
		if (opportunities)
		{
			if (opportunities.length > 0)
			{
				for(var i = 0; i < opportunities.length; i++)
				{
					var a = parseResourceItem(opportunities[i]);
		
					if (a.title && a.type && a.date && a.category)
					{
						if (a.type == "opportunity" && a.category == "Volunteering")
						{
							htmlOutput += "<h3>" + a.title + "</h3>";
							
							var summaryCondensed = condenseSummary(a.summary,45);
							htmlOutput += "<p><strong>" + a.date + "</strong> - " + summaryCondensed + " ... <a href='resource_view.php?id=" + a.id + "'>More</a></p>";
						}
					}
				}
			}
			else
			{
				htmlOutput = "<p>There are no volunteering opportunities available at the current time.</p>";
			}
		}
		else
		{
			htmlOutput = "<p>There are no volunteering opportunities available at the current time.</p>";
		}
		return htmlOutput;
	}
	else
	{
		return "<p>There are no volunteering opportunities available at the current time.</p>";
	}
}
function parseInvolvementOpps(respXML)
{
	var involvementOppsXML = respXML.getElementsByTagName("InvolvementOpps");
	if(involvementOppsXML[0] != null)
	{
		var htmlOutput = "";
		
		var opportunities = involvementOppsXML[0].getElementsByTagName("resource");
		if (opportunities)
		{
			if (opportunities.length > 0)
			{
				for(var i = 0; i < opportunities.length; i++)
				{
					var a = parseResourceItem(opportunities[i]);
		
					if (a.title && a.type && a.date && a.category)
					{
						if (a.type == "opportunity" && a.category == "Involvement")
						{
							htmlOutput += "<h3>" + a.title + "</h3>";
							
							var summaryCondensed = condenseSummary(a.summary,45);
							htmlOutput += "<p><strong>" + a.date + "</strong> - " + summaryCondensed + " ... <a href='resource_view.php?id=" + a.id + "'>More</a></p>";
						}
					}
				}
			}
			else
			{
				htmlOutput = "<p>There are no opportunities available at the current time.</p>";
			}
		}
		else
		{
			htmlOutput = "<p>There are no opportunities available at the current time.</p>";
		}
		return htmlOutput;
	}
	else
	{
		return "<p>There are no opportunities available at the current time.</p>";
	}
}
//-->