Calendar JS Cleanup

Cleaned up and commented the calendar.js file, changed it into a
portable function, and moved the init outside of the file.