//Author: Jeremy McAllister
//Thank you for the start Chris Blum @ http://devblog.xing.com/frontend/how-to-log-javascript-errors/
//Undying gratitude to John Resig & company for jQuery.
window.onerror = function(errorMessage, url, line){
	$.ajax({
		type: "POST",
		url : "/components/saveError.cfc?method=emailError",
		data : ({
			errorMsg 	: escape(errorMessage),
			currentURL	: escape(url),
			lineNum		: escape(line),
			parentURL	: escape(document.location.href),
			userAgent	: escape(navigator.userAgent),
			browserName	: escape( $("html").attr("class") )
		}),
		dataType: "json"
	});
}
