// Meetings page script

function checkTime(i)
{
if (i<10)
  {
  i="0" + i;
  }
return i;
}

function updateMeetingScheduleImage()
{

	var today=new Date();
	// Need to match the meetingDates variable array to the meeting.html information
	// Also, add the 1st of September to cover the end of the summer break
	// Date format needs year first or it screws up the year end transition.
	var meetingDates = new Array("2010-01-12",
				     "2010-02-09",
				     "2010-03-09",
				     "2010-04-13",
				     "2010-05-11",
				     "2010-09-01",
				     "2010-09-14",
				     "2010-10-12",
				     "2010-11-09",
				     "2010-12-14");
	var year           = today.getFullYear();
	var month          = today.getMonth() + 1;  //adding 1 because the returned value is base 0
	var todaysDate     = today.getDate();
	//var theCurrentDate = checkTime(month) + "-" + checkTime(todaysDate) + "-" + year;
	var theCurrentDate = year + "-" + checkTime(month) + "-" + checkTime(todaysDate);
	
	var numberOfMeetings = meetingDates.length;
	var i = 0;
	var dateRange = "0000-00-00";  //NOT USED
	
	while(i < numberOfMeetings)
	{
		//return theDate<=meetingDates[i];
		//return theDate + " " + meetingDates[i];
		if(theCurrentDate <= meetingDates[i])
		{
			// RETURN the value of i to select the appropriate 
			// meeting schedule image but remember it starts at 0
			return i;
		}
		
		i++;
		
	}
	
	return "10";
	
	//return theCurrentDate;

}
