// Set to true if a JavaScript error occurs during the execution of statement.
// Reset to false at each call to safecall.
var safecall_has_error = false;

/*
* This function is called to suppress javascript error messages when it is
* known that the errors are not real problems.
*/
function safecall_suppress_errors ()
{
	safecall_has_error = true;
	return true;
}

/*
* This function executes the input statement while suppressing any JavaScript
* errors that might occur. The global variable safecall_has_error is set to 
* true if an error does occur
*/
function safecall (stmt)
{
	var old_error = window.onerror;
	safecall_has_error = false;
	window.onerror = safecall_suppress_errors;
	eval (stmt);
	window.onerror = old_error;
}
