Made JS code complient to Plone's JS style requirements
Fixed several large bugs introduced from jslint-ing all the JS