Cleaning up project view

This is a continuation of the efforts to clean up client-side code for the project list and project view which have ballooned in size since Hermes. I've started with some low-hanging fruit:

* Separate out static javascript code to a separate file. I felt that javascript within tornado template within javascript... made my head spin. Also vim had no idea which syntax to give this kind of code.
* Wrap DOM dependent code (which I think is most of it) in ```$(document).ready {}```
* Remove some repeating code (by no means all of it). 
* Re-indenting the js code. I found [this](http://www.vim.org/scripts/script.php?script_id=3081) vimscript to be quite helpful, event though it required a semicolon at the end of each statement - which probably the way it should be :sunglasses: 
OCD again, but would be nice to use `function(e)` instead of `function(event)` to maintain consistency with code below.