Rewrote JavaScript and altered HTML

As per #1, generic.js has been completely rewritten in a more sensible
way. A couple of HTML elements have been removed as these can be
dynamically added when necessary. CSS still needs reworking.