<!-- Begin
//  Set availability
var available = new Array(9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
//  declare variables
var Calendar = new Date();//date automatically set to today

var year = Calendar.getFullYear(); // Returns year
var month = Calendar.getMonth();    // Returns month (0-11)
var today = Calendar.getDate();    // Returns day (1-31)


var firstOfMonth = new Date(year, month, 1);

var weekday = firstOfMonth.getDay();    // Returns day (0-6)

var days_in_month = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if(year % 4 == 0) //hopefully no one is using this script in the year 2100
{
	days_in_month[1] =29;
}

var month_of_year = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

var DAYS_OF_WEEK = 7;    // "constant" for number of days in a week
var DAYS_OF_MONTH = days_in_month[month];    //sets the number of days in the current month

var cal;    // the html that is written on to the document

cal =  '<table summary="' + month_of_year[month] + '"><caption>' + month_of_year[month] + ' ' + year + '</caption>';
cal += '<thead><tr><th abbr="Sunday" scope="col" title="Sunday">S</th><th abbr="Monday" scope="col" title="Monday">M</th><th abbr="Tuesday" scope="col" title="Tuesday">T</th><th abbr="Wednesday" scope="col" title="Wednesday">W</th><th abbr="Thursday" scope="col" title="Thursday">T</th><th abbr="Friday" scope="col" title="Friday">F</th><th abbr="Saturday" scope="col" title="Saturday">S</th></tr></thead>';
cal += '<tfoot><tr><td>&nbsp;</td></tr><tr><td colspan="3" class="r">Reserved</td><td class="pad">&nbsp;</td><td colspan="3"class="pad">Available</td></tr></tfoot><tbody>';

if(weekday != 0)
{	
	cal += '<tr>';
}

for(i=0; i<weekday; i++)//set appropriate amount of empty days at beginning
{
	
	cal += '<td>&nbsp;</td>';

}


for(i=1; i <= DAYS_OF_MONTH; i++)
{
	if(weekday == 0)//start a new row on sundays
	{
		cal += '<tr>'
	}
	
	//start the day, test for today, then determine availability

	cal += '<td ';
	
	if( i == today )
		cal += 'id="today" ';
	if(available[i]==0)    
		cal += 'class="r">' + i + '</td>';
	else
	cal += 'class="a">' + i + '</td>';
	
	
	weekday++;
	if(weekday == 7)//if you've reached the end of the week, end the row (unless the month ends on a saturday.. too many /trs
	{
		weekday = 0;
		
		if(i < DAYS_OF_MONTH)
		{	cal += '</tr>';
		}
	}
}

cal += '</tr></tbody></table>';

//  print calendar
document.write(cal);


//  End -->


