$(document).ready(function () {
	var res = cur_date.split("-");
	$('#calFront').jCal({
		day:		new Date(res[0], res[1]-1, res[2]),
		ml:			['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'],
		// dow:		['Нд', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'],
		dow:		['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Нд'],
		dCheck:		function (day) {
				res = cur_date.split("-");
				if (day.getFullYear() == res[0] && (day.getMonth()+1) == res[1] && day.getDate() == res[2]) return false;
				return true;
			},
		//days:		1,
		//showMonths:	1,
		//sDate:		new Date(),
		//eDate:		new Date(),
/*		dCheck:		function (day) {
				return (day.getDay() != 6);
			},*/
		callback:	function (day, days) {
				t_day = day.getDate();
				t_month = (day.getMonth()+1);
				if (t_month < 10) t_month = '0' + t_month;
				if (t_day < 10) t_day = '0' + t_day;
				location.href = calendar_front_url + '/date/' + day.getFullYear() + '-' + t_month + '-' + t_day;
				return true;
			}
		});
	$('#calAdmin').jCal({
		day:		new Date( (new Date()).setMonth( (new Date()).getMonth() ) ),
		ml:			['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'],
		dow:		['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Нд'],
		dCheck:		function (day) {
				res = cur_date.split("-");
				if (day.getFullYear() == res[0] && (day.getMonth()+1) == res[1] && day.getDate() == res[2]) return false;
				return true;
			},
		callback:	function (day, days) {
				t_day = day.getDate();
				t_month = (day.getMonth()+1);
				if (t_month < 10) t_month = '0' + t_month;
				if (t_day < 10) t_day = '0' + t_day;
				location.href = calendar_admin_url + '/type/news/date/' + day.getFullYear() + '-' + t_month + '-' + t_day;
				return true;
			}
		});	
	$('#calNewsext').jCal({
		day:		new Date( (new Date()).setMonth( (new Date()).getMonth() ) ),
		ml:			['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'],
		dow:		['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Нд'],
		dCheck:		function (day) {
				res = cur_date.split("-");
				if (day.getFullYear() == res[0] && (day.getMonth()+1) == res[1] && day.getDate() == res[2]) return false;
				return true;
			},
		callback:	function (day, days) {
				t_day = day.getDate();
				t_month = (day.getMonth()+1);
				if (t_month < 10) t_month = '0' + t_month;
				if (t_day < 10) t_day = '0' + t_day;
				location.href = calendar_newsext_url + '/date/' + day.getFullYear() + '-' + t_month + '-' + t_day;
				return true;
			}
		});	
	$('.dellink').click(function(){
		return confirm('Точно удалить?');
	});
});
