Update main.js

First draft of the main javascript page of the app.  Was still using fusion tables at this point (which were later scrapped).  Some functionality was tuned/added later on.