function trapPlayerErrors() {
player=document.getElementById("MediaPlayer");
player.attachEvent("error",handlePlayerErrors);
player.attachEvent("playstatechange",handlePlayerStateChange);
player.attachEvent("statuschange",handleStatusChange);
player.attachEvent("scriptcommand",handleScriptCommand);
}

function handlePlayerErrors(error_object) {
alert("An error occurred");
}
function handlePlayerStateChange(playstate_value) {
alert("The playstate changed to "+playstate_value);
}
function handleStatusChange(new_status_value) {
alert("The status changed to "+new_status_value):
}
function handleScriptCommand(commandType, commandText) {
alert("Script command sent of type "+commandType+" with value
"+commandText);
}