//CK 2008-10-20
//For VOA Scripts
var ap_instances = new Array();

function ap_stopAll(playerID) {
	for(var i = 0;i<ap_instances.length;i++) {
		try {
			if(ap_instances[i] != playerID) document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 1);
			else document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 0);
		} catch( errorObject ) {
			// stop any errors
		}
	}
}

function ap_registerPlayers() {
	var objectID;
	var objectTags = document.getElementsByTagName("object");
	for(var i=0;i<objectTags.length;i++) {
		objectID = objectTags[i].id;
		if(objectID.indexOf("audioplayer") == 0) {
			ap_instances[i] = objectID.substring(11, objectID.length);
		}
	}
}

var ap_clearID = setInterval( ap_registerPlayers, 100 );

// CK 2008-10-20
function MP3Player(TheFile) {
document.write('<object align="middle" type="application/x-shockwave-flash" data="http://www.manythings.org/mp3/player.swf" id="audioplayer1" height="24" width="290">');
document.write('<param name="movie" value="http://www.manythings.org/mp3/player.swf">');
document.write('<param name="FlashVars" value="playerID=1&amp;soundFile=');
document.write(TheFile);
document.write('">');
document.write('<param name="quality" value="high">');
document.write('<param name="menu" value="false">');
document.write('<param name="wmode" value="transparent">');
document.write('</object>');
//document.write('<br /><small><a href="');
//document.write(TheFile);
//document.write('" target="_blank">Download MP3</a>');
//document.write(' (Right-click or option-click the link.)<br />');
//document.write(TheFile);
}
