Since the original calendar script had links added to allow the month displayed to be changed I decided to add this functionality to the calendar but rather than build it into the toCalendar method, I have created it as a separate option where the links are attached to the page separately so as to give maximum flexibility.
Since an array of holiday dates could get quite large depending on how many years you wanted to cover, I slightly modified the toCalendar method so that it will accept a functiona> as an alternative to the array of holiday dates. As long as the function accepts a year as its one parameter and returns an array of dates in the correct format it allows you to dynamically generate the array of holiday dates provided that you can work out appropriate formulae for calculating which dates in a year would normally be holidays.
The complete script is demonstrated below and so you can get a better idea of what it looks like by itself it can also be viewed separately.
If you want to be able to display calendars easily on your own site you are welcome to download the calendar script and to either use the toCalendar function separately or to use that and the main script that adds the buttons either with a fixed array of dates to be highlighted or with a modified version of the holidays function that generates the holiday dates for your location.
This article written by Stephen Chapman, Felgall Pty Ltd.