Modularized functions into separate files

Moved all TVDB-related functions into tvdb.js, and moved all utility
functions into utilities.js. Also added database.js, which will contain
all the MongoDB related functions.