Saner management of calendar javascript