// groupdate.js  -  depends on the scrolldates.js gdate array, generated by perl script
//                   using csv file exported from Yahoo Calendar (dbsanova userid).
<!--

// Note: groupname must be setup prior to calling this

limit=4; // number of dates to display 

var group=new Array();  // short name and date fields from gdates array  - see scrolldates.js
var groupdate=new String();

// Loop thru gdate array identifying the group and
// writing the string for the groupname's next meeting dates.

i=0; // index for array from perl generated group/date array.
j=1; // for limit comparison - only display up to the limit #of dates.
while ( gdate[i] ) {
  group=gdate[i].split(":"); // group is a 4 element array with name and date fields.
  // document.write("group: ", group,"<br />");
	
  if ( groupname != group[0] ) {
		i++;
		continue;
	};

  month=group[1]-1;         // dates are numeric at this point -  2/20/2008 for example
	day=group[2];
	year=group[3];
	
	var dayname = new Array(
	  "Sunday",
		"Monday",
		"Tuesday",
		"Wednesday",
		"Thursday",
		"Friday",
		"Saturday"
	);
	var monthname = new Array(
		"January",
		"February",
		"March",
		"April",
		"May",
		"June",
		"July",
		"August",
		"September",
		"October",
		"November",
		"December"
	);
	
	//document.write("dayname  : ", dayname, "<br />");
	//document.write("monthname: ", monthname, "<br />");
		
	//document.write("month: ", month+1, "<br />");
	//document.write("day: ", day, "<br />");
	//document.write("year: ", year, "<br />");
			
	var d = new Date();       
  
	// set up the date in the format desired
  d.setDate(day);
  d.setMonth(month);
  d.setFullYear(year);
	
	weekday=d.getDay();
		  
  //document.write("d:       ", d, "<br />");
	//document.write("weekday: ", weekday, "<br />");
  	  	
	if ( j < limit )
 	  groupdate = groupdate + monthname[month] + " " + day + ", ";
	else 	
	  groupdate = groupdate + monthname[month] + " " + day;
		
	j++;
	if ( j > limit ) break;
	i++;
}

document.write(groupdate);
-->