Tree related code is getting huge; refactor it into a separate .js file and javascript-prototype-class form, and delete it from index.html.  Change around index.html to use the new setup.  Leave a bunch of TODOs for bits that aren't finished yet.