<!--
// RJS Creations entries
/*
 ==================================================
 DBList is the list of database-like entries enclosed in quotes and separated by  (alt-249)
 ** Table Columns are:
 EventID = Internal ID number for this record (currently the same as the index #) [long]
 EventName = the name of the event or holiday [varchar(50)]
 InCommunity = "Y"es in the community, or "N"o not in the community [boolean]
 EventDayStart = calendar day on which the event will occur [date]
 TimeStart = starting time for the event [datetime]
 TimeEnd = expected ending time for the event [datetime]
 AdmissionFeeAdult = cost of admission for adults [money]
 AdmissionFeeChild = cost of admission for children [money]
 BroadcastFromDate = when should this event for be broadcast (default=immediately) [date]
 BroadcastThruDate = when should the event stop being broadcast (default=day after event) [date]
 ContactName = name and title of person to be contacted about this event? [varchar(100)]
 ContactAddress = mailing address contact for this event, if any [varchar(250)]
 ContactPhone = contact phone number for this event, if any [varchar(20)]
 ContactEMail = e-mail contact for this event, if any [varchar(50)]
 WebSite = full web site address (blank means none) [varchar(250)]
 Description = description of the event [varchar(*)]

? Image_Code = the code name used to uniquely identify the Entity [varchar(25)]
? Community_Region = subcommunity area such as "Northern", "Central", "Lower" [varchar(50)]
? Last_Updated = date entry was last updated

 ** Sample entries (copy/paste as needed):
 "LV Planning CommitteeY28aug200019:0021:0000Doug Beckham, Chair858-576-6308Linda Vista's monthly Community Planning Committee meeting, see <A HREF="groups/lvcpc.htm">http://www.lindavistasd.com/groups/lvcpc.htm</A>"
 "Labor DayY4sep20000:0023:5900Parade of Flags along Linda Vista Road"
 "123456789101112131415"
 "xyzYmmddt1t200nameph@http"

 For each event, show the event name and add (*) if outside of community (with note later),
 show the day of the event (needs multiple entries of it spans multiple days), and starting and ending times
 If available, show fees, contact info, related website, description
 ==================================================
*/

function ShowEvents()
{
	var iListCntr;
	var strEventName;
	var bInCommunity;
	var strEventDate;
	var strEventStartTime;
	var strEventEndTime;
	var strEventDisplayStartDate;
	var strEventDisplayEndDate;
	var datEventDisplayStartDate;
	var datEventDisplayEndDate;
	var datTodaysDate = new Date();
	var strDescription;

	document.write("<P>Your system is currently set at ", datTodaysDate, "</P>");
	document.write("<FONT SIZE=+1>List of events in Linda Vista and neighboring communities:<BR></FONT>");
	document.write("<TABLE BORDER=1 CELLPADDING=1 CELLSPACING=0>");
	document.write("<TR><TH>Date</TH> <TH>Times</TH> <TH>Event</TH> <TH>Other Info</TH></TR>");
	for (iListCntr=0; iListCntr < DBList.length; iListCntr++)
	{
		strEventName = GetField(iListCntr, 1);
		bInCommunity = GetField(iListCntr, 2);
		strEventDate = GetField(iListCntr, 3);
		strEventStartTime = GetField(iListCntr, 4);
		strEventEndTime = GetField(iListCntr, 5);
		strEventDisplayStartDate = GetField(iListCntr, 8);
		strEventDisplayEndDate = GetField(iListCntr, 9);
		strDescription = GetField(iListCntr, 15);
		datEventDisplayStartDate = GetDate(strEventDisplayStartDate);
		datEventDisplayStartDate.setTime(datEventDisplayStartDate.getTime() - 100000);

		datEventDisplayEndDate = GetDate(strEventDisplayEndDate);
		datEventDisplayEndDate.setTime(datEventDisplayEndDate.getTime() + 100000) ;

		if (datTodaysDate >= datEventDisplayStartDate && datTodaysDate <= datEventDisplayEndDate)
		{
			document.write("<TD>", strEventDate, "</TD><TD>", strEventStartTime, "-", strEventEndTime, "</TD>");
			document.write("<TD><B>", strEventName, "</B>");
			if (bInCommunity != "Y")
				document.write(" (*)");
			document.write("</TD>");
			document.write("<TD>" + strDescription + "&nbsp;</TD>");
			document.write("</TR>");
		}
	}
	document.write("</TABLE>");
	document.write("<small>(*) denotes events occurring outside of the Linda Vista boundaries.</small>");
}

function GetDate(strDate)
{
	var datDate;

	if (strDate == "")
	{	datDate = new Date();	}
	else
	{
		var datMonth = strDate.substring(2, 5);
		var datDay = strDate.substring(0, 2);
		var datYear = strDate.substring(5, 9);
		datDate = new Date(datMonth + ' ' + datDay + ', ' + datYear);
	}

	return(datDate);
}
//-->

