Improve toolbar.js and add state storage via cookie. Add state aware main_template to avoid visual gadgets.