

function swfwrite(thisVersion,myURL,myWidth,myHeight){ 
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version='+thisVersion+',0,0,0" width="'+myWidth+'" height="'+myHeight+'">');
	document.write('<param name="movie" value="'+myURL+'.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="false" />');
	document.write('<embed src="'+myURL+'.swf" quality="high" menu="false" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+myWidth+'" height="'+myHeight+'"></embed>');
	document.write('</object>');
}


function testPlugin(thisVersion,thisURL,thisWidth,thisHeight,otherAdd) {
/*
	if(navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
		if(navigator.plugins && navigator.plugins["Shockwave Flash"]){
			plugin = navigator.plugins["Shockwave Flash"].description.substring(16,17)
		}
	} else if(navigator.userAgent && (navigator.userAgent.indexOf("MSIE") >= 0) && (navigator.userAgent.indexOf("Win") >= 0)){
				document.write('<s'+'cript language="VBS'+'cript"> \n');
				document.write('on error resume next \n');
				document.write('plugin=Left(Hex(Int(CreateObject("ShockwaveFlash.ShockwaveFlash").FlashVersion)),1)\n');
				document.write('</s'+'cript> \n');
		}
*/
	currentVersion = get_flash_version_s();

//		if(Number(plugin)>=thisVersion){
		if(Number(currentVersion)>=thisVersion) {
			swfwrite(thisVersion,thisURL,thisWidth,thisHeight);
		} else {
			document.write('<a href="http://www.adobe.com/shockwave/download/index.cgi?Lang=Japanese&P5_Language=Japanese&P1_Prod_Version=ShockwaveFlash&Lang=Japanese" target="_blank"><img src="'+thisURL+'_alert_fla.jpg" alt="" width="'+thisWidth+'" height="'+thisHeight+'" border="0" /></a>');
        }
}


function get_flash_version_s() {
	currentVersion = get_flash_version();
	tempArray         = currentVersion.split(".");
	tempString        = tempArray[0];
	return tempString;
}


function get_flash_version() {
 var version='0.0.0';
 if(navigator.plugins && navigator.mimeTypes['application/x-shockwave-flash']){
  var plugin=navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin;
  // the code below is used in SWFObject
  //var plugin=navigator.plugins['Shockwave Flash'];
  if (plugin && plugin.description) {
   // convert the description like 'Shockwave Flash 9.0 r28' into version string like '9.0.8';
   // regex is provided by SWFObject
   version=plugin.description.replace(/^[A-Za-z\s]+/, '').replace(/(\s+r|\s+b[0-9]+)/, ".");
  }
  
 } else { // in the case of Win IE
  var x='';
  try {
   // for ver.7 and later
   var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
   x=axo.GetVariable("$version");
  } catch(e) {
   try {
    // for ver.6
    axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
    x="WIN 6,0,21,0";
    /*
     * GetVariable() crashes player version 6.0.22-29, and
     * players which have those versions throws when access 
     * to AllowScriptAccess
     */
    axo.AllowScriptAccess="always";
    x=axo.GetVariable("$version");
   } catch(e) {
    if (!x.match(/^WIN/)) {
     try {
      // for 4.x,5.x
      axo=null;
      axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
      // version 3 player throws when you call GetVariale().
      x=axo.GetVariable("$version");
     } catch(e) {
      if (axo) {
       // for 3.x
       x="WIN 3,0,18,0";
      } else {
       try {
        // for 2.x
        axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
        x="WIN 2,0,0,11";
       } catch(e) {
        x="WIN 0,0,0,0";
       }
      }
     }
    }
   }
  }
  // convert ActiveX version string to our version string like '9.0.28'
  version=x.replace(/^WIN /,'').replace(/,[0-9]+$/,'').replace(/,/g,'.');
 }
 // check version string format
 // Quicktime enabled Safari returns a description in natural language
 if (version.match(/^[0-9]+\.[0-9]+\.[0-9]+$/)) {
  return version;
 } else {
  return '0.0.0';
 }
}
