// JavaScript Document

var SPECIAL_DAYS = {         //  special days in 0=Jan 1=feb 2=mar 3=apr 4=may 5=jun 6=jul 7=aug 8=sep 9=oct 10=nov  11=dec

0 : [ ],				
    1 : [ 26, 28 ],		        	
    2 : [ 1, 7, 12, 14, 19, 26, 28 ],			
    3 : [ 3, 4, 5, 17, 23 ],		        
    4 : [ 27 ],		        
    5 : [  ],		        
    6 : [ 13, 25, 30 ],		        
    7 : [ 8 ],		        
    8 : [  ],		        
    9 : [ 8, 14, 28 ],		        
   10 : [ 5 ],
   11 : [ ]
	   
};


function dateIsSpecial(year, month, day) {
    var m = SPECIAL_DAYS[month];
    if (!m) return false;
    for (var i in m) if (m[i] == day) return true;
    return false;
};

function dateChanged(calendar) {
    if (calendar.dateClicked) {
      var y = calendar.date.getFullYear();
      var m = calendar.date.getMonth();     // integer, 0..11
      var d = calendar.date.getDate();      // integer, 1..31
    // window.location = "/" + y + "/" + m + "/" + d + "/index.html";
	  if (dateIsSpecial(y,m,d)) {  window.location.href="page_events.html#"+m ; }
   }
};

function ourDateStatusFunc(date, y, m, d) {
    if (dateIsSpecial(y, m, d))  return "special";
    else  return false;                                   // other dates are enabled, return true if you want to disable other dates
};

Calendar.setup( 
    {
      flat         : "calendar-container", // ID of the parent element
      flatCallback : dateChanged,          // our callback function
      dateStatusFunc : ourDateStatusFunc
    }
);

