NanoUI Update

This is a major update to NanoUI:

* Clicking on object which already has an open NanoUI will force the UI to close and open again. This brings the UI to the front and fixes the delayed opening issue which some people were experiencing.
* The JSRender template library has been replaced with doT.js, which has been modified to bring it's syntax in line (mostly) with JSRender's. The differences are minor and will be covered in the NanoUI wiki entry. doT.js is a lot more stable than JSRender (a lot less error prone), making it easier to create UIs with. 
* The frontend Javascript code has been re-organised using a state machine. This is to allow for new "states" (Javascript classes/objects) which can be shared between UIs. States handle the receiving of data from the server, and rendering. States are an advanced coding feature and are completely optional. A 'default' state covers all standard logic.
* Multiple styling fixes throughout the templates.
Debug stuff left in?