 function getMp3Filename(htmlCode) {
    var mp3Filename = String(htmlCode.match(/mp3.+?mp3/));
    mp3Filename = mp3Filename.slice(4, mp3Filename.length);
    return mp3Filename;
  }

function playMp3(elementId, mp3Filename) {
	document.getElementById(elementId).innerHTML =
	
	
	'<embed src="audio_player.swf" FlashVars="mp3=' + mp3Filename + '&play_button=pix/stop.gif&stop_button=pix/play.gif" quality="high" wmode="transparent" width="30" height="15" align="top" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'

	for (var i = 0; i < 13; i++) {
	  var currentId = 'mp3_' + i;
	  if (currentId != elementId) {
	  var htmlCode = document.getElementById(currentId).innerHTML;
        if (isFlash(htmlCode)) {
        	currentMp3Filename = getMp3Filename(htmlCode);
		document.getElementById(currentId).innerHTML =
	  	'<a href="javascript:playMp3(\'' + currentId + '\', \'' + currentMp3Filename + '\')"><img src="pix/stop.gif" width="30" height="15" style="border: 0px" /></a>';
		}
		}
	  }
	}


function isFlash(htmlCode) {
	return ((htmlCode.slice(0, 6).toLowerCase() == '<embed'));
}