var errtrap = new Array(
	"cannot open",
	"disabled",
	"error",
	"exception",
	"expected",
	"incomplete",
	"incorrect",
	"invalid",
	"missing",
	"molecule database loaded",
	"no atom",
	"no colour specified",
	"not enough",
	"not supported",
	"out of range",
	"oversubscribed",
	"too deep",
	"too large",
	"too long",
	"unable",
	"unrecognised",
	"warning",
	"" // this is crucial to signal the end of the array
)

function alert_error(msg)
{
	var i = 0;
	lmsg = msg.toLowerCase();
	while	(errtrap[i].length)
	{
		if (lmsg.indexOf(errtrap[i]) != -1)
		{
			var toyell = "Presence of \"" + errtrap[i] + "\" in Chime message\n" +
				"\"" + msg + "\"\n" +
				"suggests Chime-script error.";
			if (getCookie("debugc") != "ON")
				toyell = toyell + " Use debug mode.";
			alert(toyell);
			return;
		}
		i++;
	}
}
