Toggling between instances of NiftyPlayer on a page - won't stop playing when hidden on IE
<p>i've got a page with links to MP3s, when the link is clicked I use javascript to show a small Flash player (NiftyPlayer) under the link. When a different link is clicked, the old player is hidden and the new player is revealed.</p>

<p>The player auto-starts when the element is shown, and auto-stops when hidden - in Firefox.</p>

<p>In IE it will only auto-start and NOT auto-stop. This is what I would like to solve.</p>

<p>This is an example HTML with link and player</p>

<pre><code>&lt;a href="Beat The Radar - Misunderstood What You Said.mp3" onclick="toggle_visibility('player662431');return false;" class="mp3caption"&gt;Misunderstood What You Said&lt;/a&gt;

&lt;div id="player662431" class="playerhide"&gt;&lt;embed src="http://www.xxx.com/shop/flash/player.swf?file=/mp3/Beat The Radar - Misunderstood What You Said.mp3&amp;as=1" quality="high" bgcolor="#000000" width="161" height="13" name="niftyPlayer662431" align="" type="application/x-shockwave-flash" swLiveConnect="true" pluginspage="http://www.macromedia.com/go/getflashplayer"&gt;&lt;/embed&gt;
</code></pre>

<p>Here is the javascript (i've got jquery installed to let me hide all the open players on this page apart from the new one)</p>

<pre><code>function toggle_visibility(id) {
 $('.playerhide').hide();
 var e = document.getElementById(id);
 e.style.display = 'block';
}
</code></pre>

<p>I think what I need to do is start the player manually with javascript (rather than using the autostart as=1 function in the URL string)</p>

<p>There is some javascript that comes with NiftyPlayer to allow this EG</p>

<pre><code>niftyplayer('niftyPlayer1').play()
</code></pre>

<p>there is also a stop method.</p>

<p>I need some help with javascript - how do I add this call to play into my toggle_visibility function (it has the same unique ID number added to the name of the player as the ID of the div that's being shown, but I don't know how to pull this ID number out of one thing and put it in another)</p>

<p>I also would like to be able to do</p>

<pre><code>niftyplayer('niftyPlayer1').stop()
</code></pre>

<p>to stop the audio of the previously running player. Is it possible to store the current ID number somewhere and call it back when needed?</p>

<p>Thanks for the help, i'm a PHP programmer who needs some support with Javascript - I know what I want to achieve, just don't know the commands to do it!</p>

<p>Thanks</p>
