Use goog.global instead of this or window.
Convert cumbersome conditionals into calls to goog.getObjectByName.
Fix onchange handler handler.
Remove some DOM creation from headless fields.