//指定方法（<script type="text/javascript">flash('swfファイルパス','幅','高さ');</script>）
//プラグインバージョン設定
var xContentVer = 8.0;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

//プラグインとバージョン判定
if(plugin){
  var pluginName = navigator.plugins["Shockwave Flash"].description.split(" ");
    for (var i = 0; i< pluginName.length; ++i){
      if(isNaN(parseInt(pluginName[i])))continue;
        var xPluginVer = pluginName[i];
    }
  var xFlashCanPlay = xPluginVer >= xContentVer;
}else if(navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0&& (navigator.appVersion.indexOf("Win") != -1)) {
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('xFlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & xContentVer)))\n');
  document.write('</SCR' + 'IPT\> \n');
}

//プラグインとバージョンがOKの場合
function flash(swfPath,w,h){
  if( xFlashCanPlay ) {
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://www.macromedia.com/jp/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="'+w+'" height="'+h+'" align="top" scale="noscale">');
    document.write('<param name="movie" value="'+swfPath+'">');
    document.write('<param name="quality" value="high">');
    document.write('<param name="scale" value="noscale">');
    document.write('<embed src="'+swfPath+'" width="'+w+'" height="'+h+'" align="top" scale="noscale" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>');
    document.write('</object>');
  }else{
    //条件に合わない場合の代替表示
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="760" height="340"><param name="movie" value="img/flash_829_es2.swf"><param name="quality" value="high"><embed src="img/flash_829_es2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="760" height="340"></embed></object>');
  }
}
