// Javascript scripts used in all projects

function ExceptionHandler(){
/* Catch JS errors in the browsers and tell the server about them.
	 Originally I took the error handler from the jQuery docs:
	 http://docs.jquery.com/Events/error#fn
	 However, this does not work, see:
	 http://www.nabble.com/mysterious-$(window).error-behavior-td21633537s27240.html
	 I followed that page's advice and switched to a window.onerror instead.
	 
	 Furthermore, is basically an IE-only feature at the moment:
	 - Firefox support is borked (http://blogs.cozi.com/tech/2008/04/javascript-error-tracking-why-windowonerror-is-not-enough.html)
	 - Safari and Opera don't support it at all.
	 So it's useful - after all, IE is still majority browser - but not failsafe.
	 	
*/
	window.onerror = function(msg, uri, line) {
		jQuery.post("/common/javascript_errors/", {msg: msg, uri: uri, line: line});
	}
};

