function calendar_calc(calendar)
{
	this.calendar = calendar;
	
	this.nextmonth = function(year, month)
	{
		return new Date(new Date(year, month, 1).setMonth(++month));
	}
	
	this.prevmonth = function(year, month)
	{
		return new Date(new Date(year, month, 1).setMonth(--month));
	}
	
	this.curdate = function()
	{
		value = new Date();
		value = new Date(value.getFullYear(), value.getMonth(), value.getDate(),0, 0, 0);
		
		return value;
	}
	
	this.days = function(year, month)
	{
		return 32 - new Date(year, month, 32).getDate();
	}
	
	this.lastdayinmonth = function(year, month)
	{
		value = new Date(year, month, this.countDays(year, month),0, 0, 0);
		
		return value;
	}
	
	this.firstdate = function(year, month)
	{
		return new Date(year,month, 1, 0, 0, 0);
	}
	
	this.lastdate = function(year, month)
	{
		return new Date(year, month, this.days(year, month),0, 0, 0);
	}
	
	this.addday = function(year, month, day,value)
	{
		return new Date(year, month, day+value,0, 0, 0);
	}
	
	this.addmonth = function(year, month, day, value)
	{
		return new Date(year, month + value, day, 0, 0, 0);
	}

}