// JavaScript Document
var SPECIAL_DATES = {
	20060 : [16,24,30],//january 2006
	20061 : [4,10,25],//february 2006
	20062 : [7,18,22],//...
	20063 : [2,15,16,17,28],
	20064 :	[2,15,16,17,28]
}
function dateIsSpecial(year, month, day) {
	var idx=year + "" + month;
	var y = SPECIAL_DATES[idx];
	if (!y) return false;
	for (var i in y) if (y[i] == day) return true;
	return false;
}
function dateChanged(calendar) {
	// Beware that this function is called even if the end-user only
	// changed the month/year. In order to determine if a date was
	// clicked you can use the dateClicked property of the calendar:
	if (cal.dateClicked) {
		// OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
		var y = cal.date.getFullYear();
		var m = cal.date.getMonth(); // integer, 0..11
		var d = cal.date.getDate(); // integer, 1..31
		if ( !dateIsSpecial(y,m,d)){
			return;
		}
		// redirect...
		m=m+1;
		if(m<10){m="0"+m}
		//window.location = "/unsingers/en/calendar/" + y + m + ".htm";
		window.location = y + ".htm#m"+ m;
	}
}
function disallowDate(date) {
	// date is a JS Date object
	var thisdate=new Date();
	var y=thisdate.getFullYear();
	var m=thisdate.getMonth();
	var d=thisdate.getDate();
	if ((date.getFullYear()==y) && (date.getMonth()==m) && (date.getDate()==d)){
		return false;
	}
	if ( !dateIsSpecial(date.getFullYear(),date.getMonth(),date.getDate())) {
		return true; // disable 
	}else {
		return "special"
	}
	// return false; enable other dates
};
var parent_id="calendar-container";
var cal = new Calendar();
cal.weekNumbers = false;
cal.setDisabledHandler(disallowDate);
cal.callHandler=dateChanged;