Add Docco documentation

I've added build scripts that generate documentation for the demo using
Docco, greatly extended the code comments and added the generated
documentation.