Bring brooklyn-utils.js in line with other javascript modules

define() it, rather than creating several global functions. Removed
references to it from a few modules where it went unused and moved the
setVisibility function to application-add-wizard, the only place it is
used.

Also: Remove several trailing commas from arrays and objects. Add 'var'
to variable declarations that were missing it.