Dynamically generate div structure of survey pages

Instead of copying HTML, produce the page skeleton with JS
This would look better as ```function handleError() {```

The way it is now looks like it's going to be passed as a callback to a function, but it's called directly instead.