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.
JavaScript looks so weird to me with the spacing.