<!DOCTYPE html>
<html>
<head>
<title>SoundManager 2: HTML 5 DTD test</title>
<meta name="description" content="A test page using SoundManager 2 under an HTML 5 DOCTYPE." />
<script>

// -- Movie size/positioning test case, Firefox/Win32 --

// SM2 normally works at 6x6px SWF size, position:fixed bottom/left:0px.
// Was failing with this case using HTML 5 doctype? ..
// Started working when 8x8px SWF size was used.

// Previous notes, courtesy Jacob Seidelin ...

// This fails to load in Firefox 3.6 (Win7) but will load after one of the following changes:
// 1. Remove the doctype or set it to eg. 
//    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
// 2. Set soundManager.useHighPerformance = false
// 3. Set soundManager.debugFlash = true

function loadScript(sURL,onLoad) {
  try {
  var loadScriptHandler = function() {
    var rs = this.readyState;
    if (rs == 'loaded' || rs == 'complete') {
      this.onreadystatechange = null;
      this.onload = null;
      if (onLoad) {
        onLoad();
      }
    }
  }
  function scriptOnload() {
    this.onreadystatechange = null;
    this.onload = null;
    window.setTimeout(onLoad,20);
  }
  var oS = document.createElement('script');
  oS.type = 'text/javascript';
  if (onLoad) {
    oS.onreadystatechange = loadScriptHandler;
    oS.onload = scriptOnload;
  }
  oS.src = sURL;
  document.getElementsByTagName('head')[0].appendChild(oS);
  } catch(e) {
    // oh well
  }
}

window.onload = function() {

  loadScript('../../script/soundmanager2.js', function() {

    soundManager.setup({
      // path to directory containing SoundManager2 .SWF file
      url: '../../swf/',
      flashVersion = 9,
      flash9Options: {
        useEQData = true,
        useWaveformData = true
      },
      onready: function() {
        alert('Loaded!');
      }),
      debugMode: true,
      useHighPerformance: true,
      debugFlash: false,
    });

    // ensure things start, in case document.readyState / domReady are missed (eg. Firefox 3.5.5/win32 with HTML5 DTD, no document.readyState??)
    soundManager.beginDelayedInit();

  }

}

</script>

</head>

<body>

</body>
</html>