/*
 * JavaScript by Jeffrey Ouma.
 * Copyright© 2008 artkenya.net Ltd.
 * All rights reserved.
 */

/**
 * Purpose: Catches JavaScript errors and attempts to store them in the database
 * and send them to errors@artkenya.net
 */
function errorHandler(e) {
	
	var response = {
		success: function(x) {},
		failure: function(x) {}
	}
	var postvars = "message="+e.name+": "+e.message;
	postvars += "&file="+e.fileName;
	postvars += "&line="+e.lineNumber;
	postvars += "&context="+e.stack;
	
	switch(location.hostname){
		case "localhost":
			Connect.asyncRequest("POST", "http://localhost/swedishschool/Includes/js_error.php", response, postvars);
			break;
		default:
			Connect.asyncRequest("POST", "http://www.ssn.or.ke/Includes/js_error.php", response, postvars);
	}
	
}

