
function checkFlash() {
  //var hasFlash = false;

  if (ie4) {
    document.write('<scr' + 'ipt language="VBScript"\> \n');
    document.write('on error resume next \n');
    document.write('dim obFlash \n');
    document.write('set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.5") \n');
    document.write('if IsObject(obFlash) then \n');
    document.write('hasFlash = true \n');
    document.write('end if');
    document.write('</scr' + 'ipt\> \n');

    if (!this.hasFlash) {
      hasFlash = false;
      //alert("navigator=" + navigator + " navigator.plugins=" + navigator.plugins + " navigator.plugins.length=" + navigator.plugins.length);
      if (navigator != null && navigator.plugins != null && navigator.plugins.length > 0) {
        var flashPlugin = navigator.plugins['Shockwave Flash'];
        if (typeof flashPlugin == 'object') {
          hasFlash = true;
        }
      }
    }
  }
  else if (ns6) {
    hasFlash = false;
    if (navigator.plugins != null && navigator.plugins.length > 0) {
      var flashPlugin = navigator.plugins['Shockwave Flash'];
      if (typeof flashPlugin == 'object') {
        hasFlash = true;
      }
    }
  }
  else hasFlash = false;

  return hasFlash;
}

function outputFlash(imgSrc, swfSrc, width, height) {
  if (checkFlash()) {
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="' + width + '" height="' + height + '"><param name=movie value="' + swfSrc + '"><param name=quality value="high"><embed src="' + swfSrc + '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed></object>');
  }
  else if (imgSrc.length > 0) {
    document.write('<img src="' + imgSrc + '" width="' + width + '" height="' + height + '">');
  }
}