function CalendarMonth (Month, Year, ShortForm) {
	this.EmptyCell = "";
	if (ShortForm)
	{
		this.Weekdays = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
	}
	else
	{
		this.Weekdays = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	};
	this.Months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	
	this.RenderWeekName = function (weekday) {  return this.Weekdays[weekday]; };
	this.RenderDay = function (year,month,day) { return day; };
	this.RenderHeader = function (year,month) { return this.Months[month-1] + " " + year; };
	this.DayStyle = function (year,month,day) { return 'day'; };

	this.Initialize = function (Month, Year)
	{
		this.cMonth = Month;
		this.cYear = Year;
		this.CurrentMonth = new Date(Year,Month-1,1);
		this.CurrentMonthLastDay = new Date(Year,Month-1,1);
		this.CurrentMonthLastDay.setMonth(this.CurrentMonthLastDay.getMonth()+1);
		this.CurrentMonthLastDay.setDate(this.CurrentMonthLastDay.getDate()-1);
		this.NextMonth = new Date(Year,Month-1,1);
		this.NextMonth.setMonth(this.NextMonth.getMonth()+1);
		this.LastMonth = new Date(Year,Month-1,1);
		this.LastMonth.setMonth(this.LastMonth.getMonth()-1);
	};
	
	this.RenderHtml = function () {
		var iMonth = this.CurrentMonth.getMonth()+1;
		var iYear = this.CurrentMonth.getFullYear();
		var wDay = this.CurrentMonth.getDay();
		var lastDate = this.CurrentMonthLastDay.getDate();
		var html = "<tr>";
		
		// render the week name heading
		for (var i = 0; i < 7; i++)
		{
			html += "<td class='weekname'>" + this.RenderWeekName(i) + "</td>";
		}
		html += "</tr><tr>";
		// Fill in empty cells
		for (var i = 0; i < wDay; i++)
		{
			html += "<td class='empty'>"+ this.EmptyCell +"</td>";
		}
		
		// render the calendar day
		for (var i = 1; i <= lastDate; i++)
		{
			if (wDay > 6)
			{
				html += "</tr><tr>";
				wDay = 0;
			}
			html += "<td class='"+this.DayStyle(iYear,iMonth,i)+"'>" + this.RenderDay(iYear,iMonth,i) + "</td>";
			wDay ++;
		}
		
		// Fill in empty cells
		while (wDay > 0 && wDay < 7)
		{
			html += "<td class='empty'>"+ this.EmptyCell +"</td>";
			wDay++;
		}
		html += "</tr>"
		return "<table><tr><td colspan='7'>" + this.RenderHeader(iYear,iMonth)+ html + "</td></tr></table>"
	};
	
	this.RenderDropDownMonthYear = function (month,year)
	{
		var html = "<select id='idCalJumpMonth' name='calMonth'>";
		var i;
		for (i = 1; i <= 12; i++)
		{
			html += "<option value='"+ (i) +"'"+ (month==i ? " selected=true " : "") +">"+ this.Months[i-1] +"</option>";
		}
		html += "</select><select id='idCalJumpYear' name='calYear'>";
		i = year + 10;
		if (this.MaxDate)
		{
			i = this.MaxDate.getFullYear();
			if (i < year) i = year;
		}
		while (i > year)
		{
			html += "<option value='"+ i +"'"+ (year==i ? " selected=true " : "") +">"+ i +"</option>";
			i--;
		}
		html += "<option value='"+ (i) +"' selected=true>"+ i +"</option>";
		i--;
		if (this.MinDate)
		{
			if (this.MinDate.getFullYear() < year)
			{
				year = this.MinDate.getFullYear();
			}
		}
		else 
		{
			year -= 10;
		}
		while (i >= year)
		{
			html += "<option value='"+ i +"'"+ i +">"+ i +"</option>";
			i--;
		}
		
		html += "</select><input type='button' onclick='"+ (this.GoEventName ? this.GoEventName : "CalJump();") +"' value='Go'>";
		
		return html;
	};
	
	this.Render = function (id,month,year) {
		var obj = document.getElementById(id);
		if (obj) {
			if (year && month)
			{
				this.Initialize(month,year);
			}
			obj.innerHTML = this.RenderHtml();
		}
	};
	
	this.Initialize(Month,Year);
	
}
