function CTransSoundManager(a_oTransManager,a_szSoundClassName,a_szOptDHTMLID)
{ var m_oTransManager = a_oTransManager; this.m_oTransManager = m_oTransManager; var m_szSoundClassName = a_szSoundClassName; this.m_szSoundClassName = m_szSoundClassName; var m_szOptDHTMLID = a_szOptDHTMLID; this.m_szOptDHTMLID = m_szOptDHTMLID; var m_oSoundEvents = new Array(); var m_bInstalled = false; var m_oOptDHTML = ei(m_szOptDHTMLID); if(a_szSoundClassName)
{ var oSoundCollection = null; if(ie)
{ oSoundCollection = etc("bgsound", m_szSoundClassName);}
else
{ oSoundCollection = etc("embed", m_szSoundClassName);}
for(var i = 0; i < oSoundCollection.length; i++)
{ var szEventName = cleanName(oSoundCollection[i].getAttribute('event')); if(szEventName)
{ if(isExtensionInstalled(oSoundCollection[i]))
{ m_oSoundEvents[szEventName] = oSoundCollection[i];}
}
}
}
function isExtensionInstalled(a_oSoundItem)
{ if(!a_oSoundItem) return false; var szSource = a_oSoundItem.getAttribute('src'); if(!szSource)
{ szSource = a_oSoundItem.getAttribute('osrc');}
if(szSource.toLowerCase().search(/.wav/))
{ if (navigator.mimeTypes && navigator.mimeTypes.length)
{ for(var i = 0; i < navigator.mimeTypes.length; i++)
{ if(navigator.mimeTypes[i].type == 'audio/x-wav')
{ return true;}
else if(navigator.mimeTypes[i].type == 'audio/wav')
{ return true;}
}
}
else
{ if(g_bSoundRecorder)
{ return true;}
}
return false;}
}
function playEvent(a_szEventName,a_optbContinueSequence)
{  if(g_bSoundState) { var oSoundEvent = getSoundEvent(a_szEventName); if(oSoundEvent)
{ try
{ if(ie)
{ oSoundEvent.src = oSoundEvent.getAttribute('osrc');}
else
{ oSoundEvent.Play();}
} catch (error)
{ try
{ oSoundEvent.DoPlay();}
catch(error2)
{ if(m_oOptDHTML)
{ m_oOptDHTML.innerHTML = '<embed src="'+oSoundEvent.src+'" hidden="true" autostart="true" loop="false">';}
}}}}
if(m_oTransManager)
{ if(false == a_optbContinueSequence)
{ }
else
{ m_oTransManager.continueSequence();}
}
}
this.playEvent = playEvent; function stopEvent(a_szEventName,a_optbContinueSequence)
{ var oSoundEvent = getSoundEvent(a_szEventName); if(oSoundEvent)
{ try
{ oSoundEvent.Stop(); oSoundEvent.Rewind();} catch (e)
{ }
}
if(m_oTransManager)
{ if(false == a_optbContinueSequence)
{ }
else
{ m_oTransManager.continueSequence();}
}
}
this.stopEvent = stopEvent; function getSoundEvent(a_szEventName)
{ var szEventName = cleanName(a_szEventName); return m_oSoundEvents[szEventName];}
function cleanName(a_szName)
{ a_szName = a_szName.replace(/\s/g, ''); return a_szName.toLowerCase();}
}
