// JavaScript Document
// events.js
// July 4, 2009
// spry events filtering

<!-- 
// today is today's date with a 12:00am timestamp; used in filters
today = new Date();
today.setHours(0,0,0,0);

// Usage: [JSON Data Set].filter(upcomingFilter);
// row should contain the columns, "Year", "Month", and "Day"
var upcomingFilter = function(dataSet, row, rowNumber)
{
	tDate = new Date(parseInt(row["Year"],10),parseInt(row["Month"],10)-1,parseInt(row["Day"],10));
	if (tDate >= today) {
		return row;  // Return the row to keep it in the Nested JSON Data Set.
	}
	return null;   // Return null to remove the row from the Nested JSON Data Set.
}

// Usage: [JSON Data Set].filter(upcomingFilter);
// row should contain the columns, "Year", "Month", and "Day"
var pastFilter = function(dataSet, row, rowNumber)
{
	tDate = new Date(parseInt(row["Year"],10),parseInt(row["Month"],10)-1,parseInt(row["Day"],10));
	if (tDate < today) {
		return row;  // Return the row to keep it in the Nested JSON Data Set.
	}
	return null;   // Return null to remove the row from the Nested JSON Data Set.
}

// -->
