﻿var target_flash_Ver = 8;

//plugin check
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {

	//plugin version check
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i){
		if (isNaN(parseInt(words[i])))
		continue;
		var PluginVersion = words[i]; 
	}

	var FlashCanPlay = PluginVersion >= target_flash_Ver;

}else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {

	//for windows Internet explorer
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & target_flash_Ver)))\n');
	document.write('</SCR' + 'IPT\> \n');
}



function dispContent (flashDataObj, NO_flashSrc) {
	if ( FlashCanPlay ) {
		swfName = flashDataObj.swfName;
		swfWidth = flashDataObj.swfWidth;
		swfHeight = flashDataObj.swfHeight;
		swfBgColor = flashDataObj.swfBgColor;
		swfVars = flashDataObj.FlashVars;
		
		custom_embed(swfName, swfWidth, swfHeight, swfBgColor, swfVars);
	} else {
		if ( NO_flashSrc.indexOf("img src") >= 0 ) {
			dispImage(NO_flashSrc);
		} else {
			location.replace(NO_flashSrc);
		}
	}
}

function custom_embed(swfName, swfWidth, swfHeight, swfBgColor, swfVars){
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width=" + swfWidth + " height=" + swfHeight + ">");
	document.write("<param name=movie value=" + swfName + ">");
	document.write("<param name=bgcolor value=" + swfBgColor + ">");
	document.write("<param name=quality value=high>");
	document.write("<param name=menu value=false>");
	document.write("<param name=FlashVars value=" + swfVars + ">");
	document.write("<embed src=" + swfName + " FlashVars=" + swfVars + " menu=false quality=high pluginspage='https://www.macromedia.com/jp/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' bgcolor=" + swfBgColor +" width=" + swfWidth + "  height=" + swfHeight + "></embed>"); 
	document.write("</object>");
}

function dispImage(NO_flashDataObj) {
	document.write(NO_flashDataObj);
}