Grouping the current js code into a function. Also adding code to visualization.js so that it can detect what page was just loaded and created the correct graphs.