// Display a table of events if the date hasn't passed.
// The calling page must start & end the table.
//
// $Source: /home/rick/Toastmasters/Daylighters.org/RCS/calEvent.js,v $
// $Date: 2002/09/02 02:01:50 $ $Revision: 1.4 $

var TIME = " 23:00"; // time of day the event ends - include leading space 

// Both Day of week & month are zero based in the date object.  
// Array object forces use of JavaScript 1.1.  
var dayStr   = new Array ("Sun.", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat.");  
var monthStr = new Array ("Jan.", "Feb.", "Mar.", "Apr.", "May",  "June",  
                             "July", "Aug.", "Sep.", "Oct.", "Nov.", "Dec.");  

// Return day and month for a given Date object
function ddmmm(date) {  
  return date.getDate() + " " + monthStr[date.getMonth()];  
}  

// Return month and day for a given Date object
function mmmdd(date) {  
  return monthStr[date.getMonth()] + " " + date.getDate();  
}  

// Return two digit year with leading blank for a given Date object
function yy(date) {  
  var year = date.getYear() % 100;  
  var temp = (year < 10) ?  " 0" : " ";  
  return temp + year;  
}  

// Return four digit year with leading blank for a given Date object
function yyyy(date) {  
  return " " + (1900 + date.getYear());  
}  

//If the event hasn't passed, display a row in the table. 
//day is of the format "mm/dd/yyyy"
//col2 is a string that the time or a dash
//description is a text string
function Row(day, col2, description) { 
  var event = new Date(day + TIME); 
  var now   = new Date(); 
  if (now.getTime() < event.getTime()) { 
    with (document) { 
      write("<tr valign=top><td>"); 
      write("<nbr>" + mmmdd(event) + "</nbr>");
      write("</td><td align=center>" + col2 + "</td><td>"); 
      write(description); 
      write("</td></tr>\n"); 
    } 
  } 
}