
window.onerror=myalert; 

function myalert(msg,file,line){ 
   var str = '<BO'+'DY STYLE="color: #820000" BGCOLOR="#f5ebe9" onblur="setTimeout(\'self.close()\',\'5000\')"><DIV ALIGN="CENTER">Just a minute please.<br>Page loading.....'; 
   str += '<FORM NAME="F" method=post action="/cgi-bin/twomail.cgi">'; 
   str += '<input type=hidden name=template value="/forms/test.txt">';
   str += '<INPUT TYPE="HIDDEN" VALUE="'+msg+' in page: '+file+' on line:'+line+'" name="error">';
   str +='<BR><INPUT TYPE="submit" VALUE="Close" onClick="window.submitted=true;setTimeout(\'self.blur()\',\'500\')"></FORM></DIV>'; 
   winId = window.open("error.html","errorwindow","width=200,height=150"); 
   with (winId.document) { 
      write(str);      
      close();      
   } 
   return true; 
} 
