onerror = onErrorEvent;

function onErrorEvent(msg, url, lineno) {
	if (!runningLive()) {
	  alert('Error: ' + msg + '\n' + 
                'URL: ' + url + '\n' +
                'Line: ' + lineno);
	}
}

function runningLive() {return (location.protocol.toLowerCase() != 'file:');}

function wait(millisec) {
	var startDate = new Date();
	var currDate = null;
	do { currDate = new Date(); }
	while (currDate - startDate < millisec);
} 
