 function error(s) {
   while (document.body.hasChildNodes())
     document.body.removeChild(document.body.firstChild);
   var p1 = document.createElement('p');
   p1.className = 'error';
   p1.textContent = s;
   document.body.appendChild(p1);
   var p2 = document.createElement('p');
   var button = document.createElement('button');
   button.onclick = function () { document.location.reload(); };
   button.textContent = 'Reload';
   p2.appendChild(button);
   document.body.appendChild(p2);
 }
 window.onerror = function (s, f, l) { error('Scripting error: ' + s + ' in ' + f + ' line ' + l); };

