/* Error Handling Script for CAS 113 - Ron Bekey

   To use this script, include it at the top of your page before any
   of your own JavaScript code, like this:

   <script type="text/javascript" src="showerrors.js">
   </script>

   Be sure this file is in the same folder as your main JavaScript file.
   
   You cannot combine this code with any other script block. Be sure the
   </script> tag is included immediately after the opening tag as shown above.

   Note: The onerror variable is case-sensitive. It cannot be mixed case.
*/

var onerror = handleErrors
var msg = null

function handleErrors(errorMessage, url, line)
{
msg = "There was an error on this page.\n\n";
msg += "Error message: " + errorMessage + "\n";
msg += "Line #: " + line;
alert(msg);
var msg2 = "<p>&nbsp;<p>&nbsp;<p>&nbsp;<p>&nbsp;<p>&nbsp;<p>&nbsp;<p>&nbsp;"
+ "<center><a href='javascript:'>" + "Show Errors in Console</a>"
+ "<br>(newest error is at the bottom)<p></center>"
document.write(msg2)
}
