  var calendar = {
	url_click:	false,

	events:		false,
	monthes:	false,

	obj_cal:	false,
	obj_calm:	false,

	current:	false,

	today:		false,

	init:		function (y,m,d) {
				this.today = {"y":y,"m":m-1,"d":d};
				this.current = {"y":y,"m":m-1};

				this.obj_cal 	= DOM.obj("cal_container");
				this.obj_calm 	= DOM.obj("cal_month");

				this.draw();
			},

	draw:		function () {
				var d = new Date(this.current.y,this.current.m+1,0,0,0,0);
				m_count = d.getDate();

				var d = new Date(this.current.y,this.current.m,1,0,0,0);
				this.current = {"y":d.getFullYear(),"m":d.getMonth(),"st":d.getDay(),"cnt":m_count};

				this.obj_cal.innerHTML = "";
				this.obj_calm.innerHTML = (this.monthes[this.current.m]) + ' ' + this.current.y;

				this.draw_dates();
			},

	draw_dates:	function () {
				this.current.st = (this.current.st == 0 ? 7 : this.current.st);

				for (q=1; q<this.current.st; q++)
					this.draw_date("");

				for (q=1; q<=this.current.cnt; q++)
					this.draw_date(q, ((q + this.current.st - 1) % 7));
			},

	draw_date:	function (z, day) {
				div1 = document.createElement("div");

				var clsnm = "date_just";
				if (z == 0) clsnm = "date_empty";

				if (this.if_today(z)) clsnm = "date_current";

				if (this.if_event(z)) {
					clsnm = "date_event" + (this.if_today(z) ? " date_current" : "");

					me = this;

					div1.onclick = function() {
						//me.obj_calt.innerHTML = me.events[me.current.y][me.current.m+1][z].t;
						me.clicked(z);
					}

				} else {
					if (day in this.events.def) {
						clsnm = "date_event" + (this.if_today(z) ? " date_current" : "");

						me = this;

						div1.onclick = function() {
							//me.obj_calt.innerHTML = me.events.def[day].t;
							me.clicked(z);
						}
					}
				}

				div1.className = "date " + clsnm;
				div1.innerHTML = (z > 0 ? z : "");

				this.obj_cal.appendChild(div1);
			},

	clicked:	function (z) {
				z = z + '';			z = (z.length<2?"0"+z:z);
				m = (me.current.m+1) + '';	m = (m.length<2?"0"+m:m);
				document.location.href = this.events.url + z + "-" + m + "-" + this.current.y + ".html";
			},

	next:		function () {
				this.current.m += 1;
				this.draw();
			},

	prev:		function () {
				this.current.m -= 1;
				this.draw();
			},

	if_event:	function (z) {
				if (typeof this.events[this.current.y] == 'undefined') return false;
				if (typeof this.events[this.current.y][this.current.m+1] == 'undefined') return false;
				if (typeof this.events[this.current.y][this.current.m+1][z] == 'undefined') return false;

				return true;
			},

	if_today:	function (z) {
				if (z == this.today.d && this.current.m == this.today.m && this.current.y == this.today.y) return true;
				return false;
			}
  }