I thought that might happen, should've done it right the first time around. Now it first checks if the sound object is actually instantiated yet. I even tested it this time, this works fine for me.
I also changed it to alert a Netscape (or Mozilla) user that it will not work for his/her browser.
Code:
<script language="JavaScript">
<!--
//v3.0
function MM_controlSound(x, _sndObj, sndFile)
{
var i;
var method = "";
var sndObj = eval(_sndObj);
if (sndObj != null)
{
if (navigator.appName == 'Netscape')
{
alert("My appologies, this functionality is reserved for Internet Explorer users only");
method = "play";
}
else
{
if (window.MM_WMP == null)
{
window.MM_WMP = false;
for(i in sndObj)
{
if (i == "ActiveMovie")
{
window.MM_WMP = true;
break;
}
}
}
if (window.MM_WMP)
{
method = "play";
}
else if(sndObj.FileName)
{
method = "run";
}
}
}
if (method)
{
if (sndObj != null)
{
eval(_sndObj+".stop()");
}
eval(_sndObj+"."+method+"()");
}
else
{
window.location = sndFile;
}
}
//-->
</script>