function display_flash(filename, width, height) {
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" width="' + width + '" height="' + height + '">');
  document.write('  <param name="movie" value="' + filename + '" />');
  document.write('  <param name="quality" value="high" />');
  document.write('  <param name="scale" value="noscale" />');
  document.write('  <embed src="' + filename + '" quality="high" scale="noscale" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>');
  document.write('</object>');
}


function LoadFlash(divID, movieURL, width, height) {
  var getFlash = "You need to have the latest Adobe Flash Player to view this content.<br /><a href=\"http://get.adobe.com/flashplayer/\" style=\"margin-left: 5px;\"><img src=\"http://www.adobe.com/images/shared/download_buttons/get_adobe_flash_player.png\" alt=\"Acrobat Document - Get Adobe Acrobat Reader\" title=\"Get Adobe Flash Player\" /></a>";
  var div = document.getElementById(divID);
  if (div == null) { alert("Could not find element " + divID + "\nLoadFlash() Failed"); return; }

  div.style.height = height + 'px';
  div.style.width = width + 'px';

  div.innerHTML = "<p>Loading <img src=\"/PleaseWait.gif\"/></p>";

  var check = new flensed.checkplayer("9",
    function(checkObj) {

      if (checkObj.checkPassed) {
        var flashvars = {};
        var params = { wmode: "window", allowScriptAccess: "sameDomain", menu: "true", allowFullScreen: "true", scale: "noscale" };
        var attributes = { id: divID, name: divID };

        checkObj.DoSWF(movieURL, divID, width, height, flashvars, params, attributes, DoSWFCB);

      } else {
      div.innerHTML = getFlash
      }
    },
    true,
    function(checkObj) {
      if (checkObj.updateStatus == flensed.checkplayer.UPDATE_CANCELED) {
        div.innerHTML = getFlash;
      }
      else if (checkObj.updateStatus == flensed.checkplayer.UPDATE_FAILED) {
        div.innerHTML = getFlash;
      }

    }
  );


}


function DoSWFCB(loadStatus) {

  if (loadStatus.status == flensed.checkplayer.SWF_LOADING) {
    loadStatus.srcElem.style.visibility = "visible";
  }

}
