//
// C_ERROR
// An error handling class that supports the following types of error handling:
//
// 1) Displaying an alert with the error message
// //2) Setting the inner html of an element to the error message
// //3) Silently failing
//

function c_error( ) {
	var txt;
	var element_id_error;

	this.catch_errors_alert = catch_errors_alert;
    //this.catch_errors_innerhtml = catch_errors_innerhtml;
    this.handle_error_with_alert = handle_error_with_alert;
    //this.handle_error_with_innerhtml = handle_error_with_innerhtml;
    this.help_create_txt_error = help_create_txt_error;

    function catch_errors_alert( ) {
        window.onerror = handle_error_with_alert;
		return true;
	}
	//function catch_errors_innerhtml( ) {
	    //alert( "catch_errors_innerhtml called" );
		//window.onerror = handle_error_with_innerhtml;
	//}
	function handle_error_with_alert( message, uri, line ) {
        //alert( "handle_error_with_alert called" );
        help_create_txt_error( message, uri, line );
		alert( txt );
		return true;
	}
	//function handle_error_with_innerhtml( message, uri, line ) {
	    //alert( "handle_error_with_innerhtml called" );
        //help_create_txt_error( message, uri, line );
		//core.set_inner_html( element_id_error, txt );
		//return true;
	//}
	function help_create_txt_error( message, uri, line ) {
		//alert( "help_create_txt_error called" );
        txt  = "There was an error on this page.\n\n";
		txt += "Error: " + message + "\n";
		txt += "URI: " + uri + "\n";
		txt += "Line: " + line + "\n\n";
	}
}

