//---------------------------------------------------------------------------//// File:    ampCal.js// Purpose: This is the source file for the ampCal JavaScript Calendar.// Author:  Andrew M. Pierce// Date:    08/21/1998//// Copyright (c) 1998-99, Andrew M. Pierce, Baja Web Designs//// Description://   This souce code is provided as is, without guarantee or warranty of//   any kind.  You are free to use and distribute this source without //   obtaining written permission from the author providing you do not//   remove or modify the copyright line which displays at the bottom //   of the calendar.////   See the readme.txt file which should accompany this file for complete//   instructions on how to use this calendar.//// -------------------------------------------------------------------------//// M O D I F I C A T I O N   H I S T O R Y// ---------------------------------------////    Date    By  Description// ----------	--- ----------------------------------------------------------// 09/21/1998 amp Initial revision.// 09/28/1998 amp Made the height of the day blocks a minimum of 70 and //                centered column headings.// 11/06/1998 amp Repeated the font specification on each day because //                Netscape had a problem with it.  Also placed the entire//                calendar in a table so I can control the background color//                so my header and copyright line show up.  // 11/25/1998 amp Add a row for days 30 and 31 if necessary.  Also made //                colors work correctly in past and future.                                     // 12/09/1998 amp Fixed the color problem permanently.// 02/16/1999 amp Forced the year to 4 digits.// 09/21/1999 amp Updated with baja information.  ////---------------------------------------------------------------------------<!--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=\"20\" height=\"20\" bgcolor=\"#" + 	              this.colorDead + "\">&nbsp;</td>";  strHdrCell  = "<td align=\"center\" width=\"20\" bgcolor=\"#000080\">" +	              "<font color=\"#FFFFFF\" face=\"";	document.writeln("<table align=\"" + this.align + "\" border=0 width=\"160\">");	document.writeln("<tr><td align=\"center\" valign=\"bottom\" bgcolor=\"#800000\">");	document.writeln("<font face=\"Arial, Helvetica, Verdana\" size=3 color=\"#FFFFFF\"><b>" + "Model Aviation Advertising <br>"+this.title + "</b></font>");	document.writeln("</td></tr>");	document.writeln("<tr><td bgcolor=\"#FFFFFF\">");	document.writeln("<table border=\"1\" cellpadding=\"0\" bordercolor=\"#FFFFFF\" bordercolordark=\"#FFFFFF\" bordercolorlight=\"#FFFFFF\">");	document.writeln("<tr>");	document.writeln(strHdrCell + this.font + "\" size=\"" + this.headSize + "\"><strong>Sun</strong></font></td>");	document.writeln(strHdrCell + this.font + "\" size=\"" + this.headSize + "\"><strong>Mon</strong></font></td>");	document.writeln(strHdrCell + this.font + "\" size=\"" + this.headSize + "\"><strong>Tue</strong></font></td>");	document.writeln(strHdrCell + this.font + "\" size=\"" + this.headSize + "\"><strong>Wed</strong></font></td>");	document.writeln(strHdrCell + this.font + "\" size=\"" + this.headSize + "\"><strong>Thu</strong></font></td>");	document.writeln(strHdrCell + this.font + "\" size=\"" + this.headSize + "\"><strong>Fri</strong></font></td>");	document.writeln(strHdrCell + this.font + "\" size=\"" + this.headSize + "\"><strong>Sat</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 = 0;		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=\"20\" height=\"20\" " +				                  "bgcolor=\"#" + nColor + "\"><font face=\"" + 													this.font + "\" size=\"" + this.fontSize + "\">" + 													strDateNum + "<br><b><font face=\"" + 													this.font + "\" size=" + this.fontSize + ">" + 													strCellText + "</font></b></td>";				document.writeln( strCellContents );				this.m_myDate.setDate( this.m_myDate.getDate() + 1 );      }    }    document.writeln("</tr>");    x += 7;  }	document.writeln("</table>");	document.writeln("</td></tr></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 = "a0a0a0";	this.colorFuture = "f5deb3";  this.colorPast = "E1E1D1";  this.colorNow  = "F08080";	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  = "1";  this.headSize  = "1";	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();}//-->