<!--

function ampCalendar_setFebDays()
{
  if ( this.month == 1 ) 
  {
    if ( this.year % 4 == 0 )
    {
      if ( this.year % 100 == 0)
      {
        if ( this.year % 400 == 0) 
          this.m_rgDays[1] = 29;
      }
      else
        this.m_rgDays[1] = 29;
    }
  }
}

function ampCalendar_Display()
{
  var strDeadCell;
	var strHdrCell;
	var strCellContents;
	var nColor;
	var strDateNum;
	var strCellText;
	
  strDeadCell = "<td width=\"14%\" height=\"70\" bgcolor=\"#" + 
	              this.colorDead + "\">&nbsp;</td>";

  strHdrCell  = "<td align=\"center\" width=\"14%\" bgcolor=\"#304860\">" +
	              "<font color=\"#FFFFFF\" face=\"";

	document.writeln("<table align=\"" + this.align + "\" border=\"0\" width=\"650\">");
	document.writeln("<tr><td align=\"center\" valign=\"bottom\" bgcolor=\"#183048\">");
	document.writeln("<font face=\"Arial, Helvetica, Verdana\" size=5 color=\"#FFFFFF\"><b>" + this.title + "</b></font>");
	document.writeln("</td></tr>");
	document.writeln("<tr><td bgcolor=\"#FFFFFF\">");
	document.writeln("<table border=\"0\" width=\"650\" cellpadding=\"2\" bordercolor=\"#FFFFFF\" bordercolordark=\"#FFFFFF\" bordercolorlight=\"#FFFFFF\">");
	document.writeln("<tr>");
	
	document.writeln(strHdrCell + this.font + "\" size=\"" + this.headSize + "\"><strong>Monday</strong></font></td>");
	document.writeln(strHdrCell + this.font + "\" size=\"" + this.headSize + "\"><strong>Tuesday</strong></font></td>");
	document.writeln(strHdrCell + this.font + "\" size=\"" + this.headSize + "\"><strong>Wednesday</strong></font></td>");
	document.writeln(strHdrCell + this.font + "\" size=\"" + this.headSize + "\"><strong>Thursday</strong></font></td>");
	document.writeln(strHdrCell + this.font + "\" size=\"" + this.headSize + "\"><strong>Friday</strong></font></td>");
	document.writeln(strHdrCell + this.font + "\" size=\"" + this.headSize + "\"><strong>Saturday</strong></font></td>");
	document.writeln(strHdrCell + this.font + "\" size=\"" + this.headSize + "\"><strong>Sunday</strong></font></td>");
	document.writeln("</tr>");
	
	// now create each row
	for (j = 0; j < 6; j++)
	{
	  if( 5 == j && this.m_myDate.getDate() < 30 )
		{
			// Check to see if we've already printed all
			// the days.  If so, get out without doing another row.
			break;
		}
		x = 1;
		document.writeln("<tr>");
		for( i = 0; i < 7; i++)
		{
			// Is this a "dead" cell?
			if ( this.m_myDate.getDay() > (i + x) || 
					 this.m_myDate.getMonth() != this.month - 1 )
				document.writeln( strDeadCell );
			else
			{
				if ( this.m_myDate.getYear() < this.m_now.getYear())
				  nColor = this.colorPast;
				else if (this.m_myDate.getYear() > this.m_now.getYear())
					nColor = this.colorFuture;
				else
				{
					// Same year...
					if (this.m_myDate.getMonth() < this.m_now.getMonth() )
						nColor = this.colorPast;
					else if (this.m_myDate.getMonth() > this.m_now.getMonth() )
						nColor = this.colorFuture;
					else
					{
						// Same month...
						if (this.m_myDate.getDate() < this.m_now.getDate())
							nColor = this.colorPast;
						else if (this.m_myDate.getDate() > this.m_now.getDate())
							nColor = this.colorFuture;
						else
							nColor = this.colorNow;
					}
				}
				strDateNum  = this.m_myDate.getDate();
				strCellText = this.getText( this.m_myDate.getDate() );
				strCellContents = "<td valign=\"top\" width=\"14%\" height=\"70\" " +
				                  "bgcolor=\"#" + nColor + "\"><b><font face=\"" + 
													this.font + "\" size=\"" + this.fontSize + "\">" + 
													strDateNum + "</b><br><font face=\"" + 
													this.font + "\" size=" + this.fontSize + ">" + 
													strCellText + "</font></td>";
				document.writeln( strCellContents );
				this.m_myDate.setDate( this.m_myDate.getDate() + 1 );
      }
    }
    document.writeln("</tr>");
    x += 7;
  }

  document.writeln("</table>");
}

function ampCalendar_setItem( nDay, strText )
{
  x = this.m_rgDay.length;
  this.m_rgDay[x + 1] = nDay;
	this.m_rgTxt[x + 1] = strText;
}

function ampCalendar_getText( n )
{
  var x = 0;
	while( x < this.m_rgDay.length ) 
	{
		if ( n == this.m_rgDay[x] ) 
			return this.m_rgTxt[x] ;

		x++;
	}
  return "";
}

//
// ampCalendar() - Constructor
//
function ampCalendar( m, y )
{
	// properties
	this.m_rgDay = new Array();
	this.m_rgTxt = new Array();

	// Static stuff

	// Colors
	this.colorDead = "c4c6c7";
	this.colorFuture = "7890D8";
  this.colorPast = "90A8D8";
  this.colorNow  = "4878C0";

	this.m_rgDays = new Array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ); 
	this.m_rgMths = new Array( "January", "February", "March", "April", 
														 "May", "June", "July", "August", 
														 "September", "October", "November", "December" );

	this.font      = "Verdana, Arial, Helvetica";
  this.fontSize  = "2";
  this.headSize  = "2";
	this.align     = "center";

  this.month = m;
  this.year  = (y < 1900? y+1900: y);
	this.m_now = new Date(); 
	this.m_myDate  = new Date(this.year, m - 1, 1);

	this.monthName = this.m_rgMths[ this.m_myDate.getMonth() ];
  this.title = this.monthName + " " + this.year;

	// Methods
	this.setFebDays = ampCalendar_setFebDays;
	this.display = ampCalendar_Display;
	this.setItem = ampCalendar_setItem;
	this.getText = ampCalendar_getText;

  this.setFebDays();
}

//-->
