Bugs fixed, code clean up, and comments added

Fixed a bug that would cause chatted text to not clear out of the text
window.  Cleaned up some unnecessary functions and added some
documentation to the javascript in index.html  .