Fix several issues with scoping and XML output from upload forms.
Fix several issues with scoping and XML output from upload forms.

JavaScript scoping bit us, causing the expected 'options' variable to
end up being overridden when used with the new ready() functions. We now
limit the scope using apply(this, arguments).

We also were receiving XML output from any forms during uploads. The
reason is that we relied upon the browser to perform the request, but
it requests HTML/XML output, whereas we needed JSON. We now hard-code
"api_format=json" in the POST data in this case.

atagar/ReviewBoard,bkochendorfer/reviewboard,reviewboard/reviewboard,chazy/reviewboard,custode/reviewboard,1tush/reviewboard,KnowNo/reviewboard,Khan/reviewboard,brennie/reviewboard,chazy/reviewboard,1tush/reviewboard,davidt/reviewboard,davidt/reviewboard,bkochendorfer/reviewboard,1tush/reviewboard,sgallagher/reviewboard,atagar/ReviewBoard,chazy/reviewboard,davidt/reviewboard,custode/reviewboard,atagar/ReviewBoard,bkochendorfer/reviewboard,sgallagher/reviewboard,sgallagher/reviewboard,beol/reviewboard,1tush/reviewboard,chipx86/reviewboard,KnowNo/reviewboard,atagar/ReviewBoard,Khan/reviewboard,brennie/reviewboard,atagar/ReviewBoard,chazy/reviewboard,atagar/ReviewBoard,chazy/reviewboard,chazy/reviewboard,custode/reviewboard,1tush/reviewboard,Khan/reviewboard,KnowNo/reviewboard,sgallagher/reviewboard,beol/reviewboard,1tush/reviewboard,chipx86/reviewboard,Khan/reviewboard,atagar/ReviewBoard,davidt/reviewboard,1tush/reviewboard,chazy/reviewboard,Khan/reviewboard,reviewboard/reviewboard,Khan/reviewboard,Khan/reviewboard,beol/reviewboard,chazy/reviewboard,1tush/reviewboard,bkochendorfer/reviewboard,chipx86/reviewboard,beol/reviewboard,reviewboard/reviewboard,custode/reviewboard,Khan/reviewboard,atagar/ReviewBoard,chazy/reviewboard,Khan/reviewboard,atagar/ReviewBoard,chipx86/reviewboard,KnowNo/reviewboard,brennie/reviewboard,reviewboard/reviewboard,brennie/reviewboard,1tush/reviewboard