// scrollitems.js
<!--

limit=10; // number of scroll items to display 

var pausecontent=new Array();

var tname=new Array();  // short name and remainder from original name array - see scrollsetup.js
var gname=new Array();  // new array containing only short name from tname.
var group=new Array();  // short name and date fields from gdates array  - see scrolldates.js

// build array of short group names the setup script full name array name[]

ndx=0;
while ( name[ndx] ) {
  tname=name[ndx].split(" ");
	gname[ndx]=tname[0] + " " + tname[1] ;
  ndx++;
};

// Loop thru gdate array identifying the group and writing a scroll item accordingly

i=0; // index for array from perl generated group/date array.
j=0; // 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.
	
	// find the matching array index for the group (shortname) from the group array.
  gdx=0;
  while ( gname[gdx] ){
    if ( gname[gdx] == group[0] ) {
		  break;
		}
		gdx++;
	}
	
	if ( ! gname[gdx] ) { // record does not match a support group name
	  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 />");
	  
  pausecontent[j]='<a href="' + html[gdx] + '">' + name[gdx] + 
	                '</a><br>' + dayname[weekday] + ", " + monthname[month] + " " + day + '&nbsp;&nbsp;' + time[gdx] + '<br>' +
	               	 addr[gdx];

  //document.write("pausecontent[j]: ",j," ",pausecontent[j],"<br>");
	
  j++;
  if ( j >= limit ) break;
  i++;
}
//document.write(pausecontent + "<br>");
-->