Date.prototype.getDayName = function() {
  var dayList = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
  return ( dayList[this.getDay()]);
}//end getDayName

Date.prototype.getMonthName = function() {
  var monthList = [ "Jan.", "Feb.", "Mar.", "Apr.", "May", "Jun.", "Jul.", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."];
  return ( monthList[this.getMonth()]);
}//end getMonthName

Date.prototype.getBihfTime = function() {
  var strOut = "";

  if( this.getHours() > 12)
    strOut = (this.getHours() - 12) + ":" + formatNumber( this.getMinutes()) + " p.m.";
  else if ( this.getHours() == 12 && this.getMinutes() > 0)
    strOut = "12:" + formatNumber( this.getMinutes()) + " p.m.";
  else if ( this.getHours() == 12)
    strOut = "Noon";
  else
    strOut = this.getHours() + ":" + formatNumber( this.getMinutes()) + " a.m.";

  return ( strOut);
}//end getMonthName

function formatNumber( nIn) {
  var strOut = nIn.toString();

  if (strOut.length < 2) strOut = "0" + strOut;

  return( strOut);
}//end padNumber

///////////////////////////////////////////////////////////////
// Happening object
///////////////////////////////////////////////////////////////
function Happening( nameIn, dtIn, whereIn) {
  this.what = nameIn;
  this.when = dtIn;
  this.where = whereIn;
  this.desc = "";
}//end constructor

//This forces the prototype object to be created in Navigator 3.
new Happening();

Happening.prototype.setDesc = function( descIn) { this.desc = descIn;}
Happening.prototype.getDesc = function() { return (this.desc);}

Happening.prototype.toString = function() {
  var strOut = "";

  strOut += "<p class='eventDate'>";
  strOut += this.when.getDayName() + ", ";
  strOut += this.when.getMonthName() + " ";
  strOut += this.when.getDate() + ", " + this.when.getFullYear();
  strOut += "</p>";
  strOut += "<span class='eventTitle'>";
  strOut += this.what;
  strOut += "</span>";
  strOut += "&nbsp;&nbsp;";
  strOut += "<span class='eventTime'>";
  strOut += this.when.getBihfTime();
  strOut += "</span>";
  strOut += "<p>";
  strOut += this.where;
  strOut += "<br /><br />";
  strOut += this.desc;
  strOut += "</p>";

  return (strOut);
}//end toString

///////////////////////////////////////////////////////////////
// Schedule object
///////////////////////////////////////////////////////////////
function Schedule() {
  this.items = new Array();
}//end constructor

//This forces the prototype object to be created in Navigator 3.
new Schedule();

Schedule.prototype.addEvent = function( e) {
  this.items[ this.items.length] = e;
}//end addEvent

Schedule.prototype.toString = function() {
  var dtToday = new Date();
  var bNothing = new Boolean( true);
  var hapTemp = new Happening();

  for ( var x = 0; x < this.items.length; x++) {
    hapTemp =
    this.items[x];

    if( hapTemp.when >= new Date( dtToday.getFullYear(), dtToday.getMonth(), dtToday.getDate())) {
      document.writeln( hapTemp.toString());
      bNothing = false;
    }
  }//end for loop

  if (bNothing == true) {
    document.writeln( "<p>No upcoming events to display.  Check back again, or let us know if there is an event you want listed.</p>");
  }
}//end addEvent

///////////////////////////////////////////////////////////////
// functions called by the page
///////////////////////////////////////////////////////////////
function listSched() {
  var s = new Schedule();
  var descr = "";

  var hap1 = new Happening("&quot;Celtic Cats&apos;&quot; Post-St. Patrick's Day Ceili/Showcase", new Date( 2010, 02, 28, 16), "Billings North Lounge, University of Vermont, Burlington, VT");

  descr = "<p>Join the newest Irish dance club in town, UVM's &quot;Celtic Cats,&quot; from 4PM to 6PM for an afternoon of music and dance.  No dance experience is required, just a willingness to have a good time.  Musicians are invited to bring their instruments to participate in the session.</p>";
  descr += "<p>Tickets are $7 ($5 for UVM students) and will be available at the door</p>";

  hap1.setDesc(descr);
  s.addEvent( hap1);

  //list out schedule
  s.toString();
}//end listSched