﻿SPECIAL_DAYS;

function dateIsSpecial(year, month, day) {
    
    var i=0;
    for (i = 0; i < SPECIAL_DAYS.length; i++) 
    { 
    
    f = SPECIAL_DAYS[i].split(",");


    if ((f[0] == year) && ((f[1] -1)== month) && f[2] == 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:
      var y = calendar.date.getFullYear();
      var m = calendar.date.getMonth();     // integer, 0..11
      var d = calendar.date.getDate();      // integer, 1..31
      // redirect...
    
    
    
    if (calendar.dateClicked) {


        currentyear = "/" + y + "/" + m + "/" + d;

        m = m + 1;

        ShowDateDetails(y,m,d);
      
    }

    currentyear = "/" + y + "/" + m + "/" + d;
    
  };

  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,
      
    }
  );


