winIEpass = ((navigator.appName.indexOf("Microsoft") != -1) && 
  (navigator.appVersion.indexOf("Windows") != -1)) && 
  (parseFloat(navigator.appVersion) >= 4) ? true : false;

NNpass = ((navigator.appName == "Netscape") && 
  (navigator.userAgent.indexOf("Mozilla") != -1) && 
  (parseFloat(navigator.appVersion) >= 4) && 
  (navigator.javaEnabled())) ? true : false;

  supportedBrowser = (winIEpass || NNpass) ? true : false;

// check for Flash Plug-in in Mac or Win Navigator. Get plug-in version.


minPlayer = 4;
var mySwf;

function Flash_checkForPlugIn() {
  var plugin = (navigator.mimeTypes &&
  navigator.mimeTypes["application/x-shockwave-flash"]) ?
  navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
  if (plugin) {
    var pluginversion = parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) 
    if(pluginversion >= minPlayer) {return true;}
  }
  return false;
}

// vbscript check for Flash ActiveX control in windows IE
if(supportedBrowser && winIEpass) {
  document.write(
    '<script language=VBScript>' + '\n' +
    'Function Flash_checkForActiveX()' + '\n' +
    'Dim hasPlayer, playerversion' + '\n' +
    'hasPlayer = false' + '\n' +
    'playerversion = 10' + '\n' +
    'Do While playerversion >= minPlayer' + '\n' +
    'On Error Resume Next' + '\n' +
    'hasPlayer = (IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" & playerversion & \"\")))' + '\n' +
    'If hasPlayer = true Then Exit Do' + '\n' +
    'playerversion = playerversion - 1' + '\n' +
    'Loop' + '\n' +
    'Flash_checkForActiveX = hasPlayer' + '\n' +
    'End Function' + '\n' +
    '<\/script>'
  );
}

function Flash_checkForMinPlayer() {
  if(!supportedBrowser) return false;
  if(NNpass) return (Flash_checkForPlugIn());
  if(winIEpass) return (Flash_checkForActiveX());
}

function Flash_embedSWF(srcURL, id, swfbgColor, wd, ht) {

  if (!Flash_checkForMinPlayer()) return;

  var defaultColor = (document.bgColor != null) ? document.bgColor : "#ffffff";
  var bgcolor = (swfbgColor != null) ? swfbgColor : defaultColor;
  document.writeln( '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
'codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"' +
    'ID="' + id + '" width="' + wd + '" height="' + ht + '">' +
    '<PARAM NAME="movie" value="' + srcURL + '">' + 
    '<PARAM NAME="quality" value="high">' +
    '<PARAM NAME="wmode" value="transparent">'+
    '<PARAM NAME="autostart" value="0">'+
    '<PARAM NAME="autoplay" value="false">'+
    '<PARAM NAME="controller" value="false">'+
    '<PARAM NAME="bgcolor" value=' + bgcolor + '>' +
    
    '<embed src="' + srcURL + '" quality="high"' + ' bgcolor="' + 
    bgcolor + '"' + 'width="' + wd + '" height="' + ht + '' +
    'type="application/x-shockwave-flash" wmode="transparent" autostart="0" controller="1" NAME="' + id + '"' +
 'pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></OBJECT>');

  //eval('window.document.'+ id + '.Rewind()');
  return (eval('window.document.'+ id));
}

function sonified_flash(id, myFrame){
  if(!Flash_checkForMinPlayer()) {return;}
  mySwf = eval('window.document.' + id);
  if (mySwf.PercentLoaded()<100) return

  mySwf.GotoFrame(myFrame);
  //mySwf.GotoFrame(0);
}
function sonified_flash2(myFrame){
  mySwf.GotoFrame(myFrame);
  //mySwf.GotoFrame(0);
}
