Strict js

Used jslint and weened out all the errors ( _apart from three circular references and one incorrect 'not used' error_ ).

Was worthwhile, caught a fair few silly errors which have all been taken care of.