Delay survey submissions

For issue #37. This queues survey submissions and tries resending them if there's a problem with Internet connectivity. @christhompson had landed some starter code; this goes the last mile and gets it working.
Yeah, looks about right then. Since open is async, I guess the event handlers get called only after the whole block exits. Or magic.