
// Array variable to hold a list of all player IDs on the page
var mediaPlayer = ['flash1', 'flash2', 'flash3','flash4', 'flash5', 'flash6','flash7', 'flash8', 'flash9','flash10'];

// Add a listener to trigger function stopOtherPlayers whenever an item is played
function playerReady(obj) {
document.getElementById(obj.id).addControllerListener('ITEM', 'stopOtherPlayers');
}

// Loop through all player IDs and, unless the player ID is the currently selected player ID, tell them to stop
function stopOtherPlayers(obj) {
for ( var id in mediaPlayer ) {
if ( obj.id != mediaPlayer[id] ) document.getElementById(mediaPlayer[id]).sendEvent('STOP');
}
}