var flg=0;
var fs=2;    // font size

M = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

D = new Array("Sun", "Mon", "Tue ", "Wed", "Thu ", " Fri ", "Sat ");

// Events[] is a SPARSE array; Call DefineEvent( ) to populate it
var Events = new Array;

// Each event is defined by calling the DefineEvent( ) routine with the following parameters:
//
//  DefineEvent(EventDate, EventDescription)
//    EventDate is a numeric value in the format YYYYMMDD
//    EvenDescription is a string that can include 
//      embedded HTML tags (e.g., <BR>, <strong>, etc.)

function DefineEvent(EventDate, EventDescription) 
{

	// If an event already exists for this date, append the new event to it.
	if (Events[EventDate])
	{
		Events[EventDate] += "<br><br>" + EventDescription;
	}
	else
	{
		Events[EventDate] = EventDescription;
	}
}

function getBgn()
{
	today=new Date();
	month=today.getMonth();
	year=today.getYear();
	yr=(month == 0? year-1 :year);
	mo=(month == 0?11 :month-1);

	yr1 = (yr < 1000) ? yr + 1900 : yr;
	bgn=new Date(M[mo]+" 1,"+yr1);
	document.write('<TABLE BORDER=0><TR><TD VALIGN=TOP>');
	Calendar();
	document.write('<\/TD><TD VALIGN=TOP>');

	yr=year;
	yr1 = (yr < 1000) ? yr + 1900 : yr;
	mo=month;
	bgn=new Date(M[mo]+" 1,"+yr1);
	Calendar();
	document.write('<\/TD><TD VALIGN=TOP>');

	yr=(month==11?year+1:year);
	yr1 = (yr < 1000) ? yr + 1900 : yr;
	mo=(month==11?0:month+1);
	bgn=new Date(M[mo]+" 1,"+yr1);
	Calendar();
	document.write('<\/TD><\/TR><\/TABLE>');
}

function Calendar(){
	dy=bgn.getDay();
	yr=eval(yr1);
	d="312831303130313130313031";
	if (yr/4==Math.floor(yr/4))
	{
		d = d.substring(0,2)+"29"+d.substring(4,d.length);
	}
	pos=(mo*2);
	ld=eval(d.substring(pos,pos+2));

	document.write("<TABLE BORDER=1><TR><TD COLSPAN=7>"
	  +M[mo]+" "+yr
	  +"<\/TD><\/TR><TR><TR>");
	for (var i=0;i<7;i++)
	{
		document.write("<TD>"
		  +D[i]+"<\/TD>");
	}
	document.write("<\/TR><TR>");
	ctr=0;
	for (var i=0;i<7;i++)
	{
		if (i<dy)
		{
			document.write("<TD>"
			  +"&nbsp;"+"<\/TD>");
		}
		else
		{
			ctr++;
			var ind = (((yr * 100) + (mo + 1)) * 100) + ctr;
			if (Events[ind]) 
			{
				document.write("<TD><A HREF=\"javascript:void(0)\" onmouseover='ddrivetip(\"");
				document.write(Events[ind]);
				document.write("\")' onmouseout=hideddrivetip()>"+ctr+"<\/TD>");
			}
			else
			{
				document.write("<TD>"+ctr+"<\/TD>");

			}
		}
	}
	document.write("<\/TR><TR>");
	while (ctr<ld)
	{
		for (var i=0;i<7;i++)
		{
			ctr++;
			if (ctr>ld)
			{
				document.write("<TD>"
				  +"&nbsp;<\/TD>");
			}
			else
			{
				var ind = (((yr*100)+(mo+1))*100)+ctr;
				if (Events[ind])
				{
					document.write("<TD><A HREF=\"javascript:void(0)\" onmouseover='ddrivetip(\"");
					document.write(Events[ind]);
					document.write("\")' onmouseout=hideddrivetip()>"+ctr+"<\/TD>");
				}
				else
				{
					document.write("<TD>"
					  +ctr+""
					  +"<\/TD>");
				}
			}
		}
		document.write("<\/TR><TR>");
	}
	document.write("<\/TR><\/TABLE>");
}


