/**
*	Dates that have agendas or minutes.  Use Y=>m=>d=>'className' format.
*
*	Valid classNames are: has_agenda, has_minutes, has_both.
*
*	@global Object $motor_dates
*/
var $motor_dates =
{
	2007:
	{
		1:
		{
			15:	'motor_has_minutes'
		},
		2:
		{
			15:	'motor_has_both'
		},
		3:
		{
			15:	'motor_has_both'
		},
		4:
		{
			19:	'motor_has_both'
		},
		5:
		{
			17:	'motor_has_both'
		},
		6:
		{
			21:	'motor_has_both'
		},
		7:
		{
			26:	'motor_has_both'
		},
		8:
		{
			16:	'motor_has_both'
		},
		9:
		{
			7:	'motor_has_both'
		}
	}
};

/**
*	List of TAC meetings with agendas or minutes uploaded.
*
*	@global Object $tac_dates
*/
$tac_dates =
{
	2007:
	{
		9:
		{
			7:	'tac_has_both'
		},
		10:
		{
			5:	'tac_has_agenda'
		}
	}
};

/**
*	Checks to see what kind of a day we're looking at.
*
*	@param Date $date
*	@param Number $year
*	@param Number $month
*	@param Number $day
*
*	@return String|Boolean Class name associated with the calendar date, or false if the date is not special.
*
*	@uses $motor_dates, $tac_dates
*
*	@author Josh Zerin <josh@teneodesign.com>
*	@copyright © 2007 Life Blue Media.  All rights reserved.
*
*	@since Thursday, September 20, 2007
*/
function dateIsSpecial( $date, $year, $month, $day )
{
	/***************
	*
	*	Make dates (starting index: 0) match up with human months (starting index: 1).
	*/
	++$month;

	/***************
	*
	*	Check for dates with agendas or minutes (currently hard-coded).
	*/
	var $className;
	if( $motor_dates[$year] && $motor_dates[$year][$month] && ($className = $motor_dates[$year][$month][$day]) )
	{
		return $className;
	}
	
	if( $tac_dates[$year] && $tac_dates[$year][$month] && ($className = $tac_dates[$year][$month][$day]) )
	{
		return $className;
	}

	/***************
	*
	*	Policy meetings are on the third Thursday of each month.
	*/
	if( $date.getDay() == 1 && $day > 14 && $day < 22 )
	{
		return 'policy_meeting';
	}
	
	/***************
	*
	*	TAC meetings are on the first Friday of each month.
	*/
	if( $date.getDay() == 4 && $day > 0 && $day < 8 )
	{
		return 'tac_meeting';
	}
	
	return false;
}

/**
*	Initialize the calendar.
*
*	@global Calendar $cal
*/
var $cal =
	Calendar.setup
	(
		{
			'flat'			: 'calendar_item',
			'dateStatusFunc': dateIsSpecial
		}
	);