
	var _select_color1 = "#000000";
	var _select_color2 = "#999999";
	var _holiday_color = "#FF0000";

	// Очистить календарь
	function _clearCalendar()
	{
		p_cl_names = new Array();
		p_cl_urls = new Array();
		p_cl_months = new Array();
		p_cl_items_cnt = 0;
	}

	// Внешний вид календаря
	function _ReloadCalendar()
	{
		var _out = "";

		for(i=0;i<12;i++)
		{
			_col = "";
			if(p_cl_months[i] > 0) _col = _select_color1;
			else _col = _select_color2;
			document.getElementById("cl_sel_month").options[i].style.color = _col;
		}

		for(i=0;i<p_cl_items_cnt;i++)
		{
			for(j=0;j<7;j++)
			{
				_out = "";
				if(p_cl_urls[i][j] != "undefined")
				{
					_out = '<a href="index.php?'+p_cl_urls[i][j]+'" style="color:#0000cc">';
					if( (j==5) || (j==6) ) _out += '<font color="'+_holiday_color+'">';
					_out += p_cl_names[i][j];
					if( (j==5) || (j==6) ) _out += '</font>';
					_out += '</a>';
				}else 
				{
					if( (j==5) || (j==6) ) _out += '<font color="'+_holiday_color+'">';
					_out += p_cl_names[i][j];
					if( (j==5) || (j==6) ) _out += '</font>';
				}

				document.getElementById("div_cl_content"+i+j).innerHTML = _out;
			}
		}
	}

	// Обновление календаря
	function _addCalendar(_cl_name, _cl_url, _cl_months, _cl_items_cnt)
	{
		_clearCalendar();
		
		p_cl_items_cnt = _cl_items_cnt;

		z = _cl_name.split(":");
		z1 = _cl_url.split(":");
		z2 = _cl_months.split(":");

		for(i=0;i<12;i++) { p_cl_months[i] = z2[i]; }

		for(i=0;i<_cl_items_cnt;i++)
		{
			tmp = z[i].split(",");
			tmp1 = z1[i].split(",");
			p_cl_names[i] = new Array( tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], tmp[5], tmp[6] );
			p_cl_urls[i] = new Array( tmp1[0], tmp1[1], tmp1[2], tmp1[3], tmp1[4], tmp1[5], tmp1[6] );
		}

		_ReloadCalendar();
	}

