function outputFlash(flash, filename, width, height, alt, scale, salign, quality, bgColor, wmode, allowScriptAccess, flashVars) {
  if (flash == 1) {
    var result = '';
    var embedOptions = '';
    var params = [];

    params.scale = (scale !== undefined) ? scale : 'showall';
    params.salign = (salign !== undefined) ? salign : '';
    params.quality = (quality !== undefined) ? quality : 'high';
    params.allowFullScreen = 'true';

    if (bgColor !== undefined) {
      params.bgcolor = bgColor;
    }
    if (wmode !== undefined && wmode != null) {
      params.wmode = wmode;
    }
    if (allowScriptAccess !== undefined && allowScriptAccess != null) {
      params.allowScriptAccess = allowScriptAccess;
    }
    if (flashVars !== undefined) {
      params.flashVars = flashVars;
    }

	  result += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" type="application/x-shockwave-flash" data="' + filename + '" width="' + width + '" height="' + height + '">';
    result += '<param name="movie" value="' + filename + '" />';
    result += '<param name="play" value="true" />';
    result += '<param name="loop" value="true" />';

    embedOptions = '';
    for (var paramName in params) {
      result += '<param name="' + paramName + '" value="' + params[paramName] + '" />';
      embedOptions += ' ' + paramName + '="' + params[paramName] + '" ';
    }

    result += '<embed src="'+filename+'" play="true" loop="true" ' +
      'width="'+ width +'" height="' + height + '"'+ embedOptions +
      ' type="application/x-shockwave-flash" ' + 'pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>';
    result += '</object>';
    document.write(result);
	} else {
    if (alt !== null) {
      document.write(alt);
      return true;
    }
	  document.write('Sorry, you don`t have a recent flash plugin installed. Therefore part of the content on this page cannot be displayed. If you want <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">to install the flash plugin, click here.</a>');
	}
  return true;
}

function hasFlash(version) {
  var flashVersion = swfobject.getFlashPlayerVersion();
  var matches = version.toString().match(/(\d+)(\.(\d+)(\.(\d+))?)?/);
  if (matches) {
    var cmpVersion = parseInt(matches[1], 10);
    var cmpSubVersion = parseInt(matches[3], 10);
    var cmpPatchVersion = parseInt(matches[5], 10);
    if (flashVersion.major >= cmpVersion) {
      if (isNaN(cmpSubVersion) || flashVersion.minor >= cmpSubVersion) {
        if (isNaN(cmpPatchVersion) || flashVersion.release >= cmpPatchVersion) {
          return true;
        }
      }
    }
  }

  return false;
}
