//指定方法（<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 id="movie" 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">');
    document.write('<param name="movie" value="'+swfPath+'">');
    document.write('<param name="quality" value="high">');
    document.write('<param name="wmode" value="transparent">');
    document.write('<param name="scale" value="noscale">');
    document.write('<embed src="magic/'+swfPath+'" width="'+w+'" height="'+h+'" align="top" wmode="transparent" scale="noscale" name="movie" id="movie" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>');
    document.write('</object>');
  }else{
    //条件に合わない場合の代替表示
    document.write('<p>本サイトは、JavaScriptの機能、及びMacromedia Flash 8.0 以上のプラグインの機能を使用しています。<br />ご使用になられているブラウザでは、これらの機能がサポートされていない可能性があります。<br />大変お手数ですが、JavaScriptの機能に対応した最新のブラウザ、新しいバージョンのMacromedia Flash Playerをインストールしてご覧ください。<br /><a href="http://www.macromedia.com/jp/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash&Lang=Japanese" target="_blank">Macromedia Flash Player ダウンロードセンター</a></p>');
  }
}
