This piece of code is pure evil:
Suppose you're always adding a
Drupal.settings.foo.bar = 1; setting in PHP, i.e. on the server side.
And on the client side, you're adding a
Drupal.settings.foo.baz = 2; setting.
Then you upload a file using filefield (or an image through imagefield, because imagefield uses filefield). Because you're actually including all settings again, all of them will be overwritten!
Drupal.settings.foo.baz will no longer exist.
You should only output the settings that you actually need to prevent problems in other modules, which is the
Drupal.settings.ahah part. Hierarchical Select suffered from this: http://drupal.org/node/354445.