if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0)) {
	var VBtext = "";
	VBtext += '<script language="VBScript">\n';
	VBtext += 'VB_Enabled = "true" \n';
	VBtext += 'Function VB_FlashDetect(version) \n';
		VBtext += 'Dim VB_flash_version \n';
		VBtext += 'VB_flash_version = 0 \n';
		VBtext += 'on error resume next \n';
		VBtext += 'For i = 3 to version \n';
			VBtext += 'If Not(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then \n';
			VBtext += 'Else \n';
				VBtext += 'VB_flash_version = i \n';
			VBtext += 'End If \n';
		VBtext += 'Next \n';
		VBtext += 'If VB_flash_version = 0 Then \n';
			VBtext += 'VB_FlashDetect = -2 \n';
		VBtext += 'Else \n';
			VBtext += 'If VB_flash_version < version Then \n';
				VBtext += 'VB_FlashDetect = -1 \n';
			VBtext += 'Else \n';
				VBtext += 'VB_FlashDetect = 2 \n';
			VBtext += 'End If \n';
		VBtext += 'End If \n';
	VBtext += 'End Function \n';
	VBtext += '</script>';

	document.write(VBtext);
}
function FlashDetect(version)
{
	if(typeof version != "undefined" && version != null && version != "")
	{
		version = parseInt(version);
		if(typeof version == "number")
		{
			var status = 0;
			if(typeof navigator.plugins != "undefined" && typeof navigator.plugins != "unknown" && navigator.plugins.length > 0)
			{
				if(typeof navigator.plugins["Shockwave Flash"] != "undefined")
				{
					var plugins_version = navigator.plugins["Shockwave Flash"].description.charAt(navigator.plugins["Shockwave Flash"].description.indexOf('.')-1);
					status = (plugins_version < version)? -1:2;
				}
				else status = -2;
			}
			else if(typeof navigator.mimeTypes != "undefined" && typeof navigator.mimeTypes != "unknown" && navigator.mimeTypes.length > 0)
			{
				if(typeof navigator.mimeTypes["application/x-shockwave-flash"] != "undefined" && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)
				{
					status = 1;
				}
				else status = -2
			}
			else
			{
				if(typeof VB_Enabled != "undefined" && navigator.userAgent.indexOf("MSIE") >= 0 && navigator.userAgent.toLowerCase().indexOf("win") >= 0)
				{
					status = VB_FlashDetect(version);
				}
				else status = 0;
			}
			return status;
		}
	}
	return -3;
}
function writeContent(
	url,		// url: String
	width,		// width: Number
	height,		// height: Number
	nghtml,		// nghtml: String(HTML)
	quality,	// quality: String or null
	flashvars,	// flashvars: String(xxx=xxx&xxx=xxx...) or null
	bgcolor,	// bgcolor: String(#xxxxxx) or null
	version,	// version: String(x,x,x,x) or null
	versionCheck	// versionCheck: Boolean or null (versionは指定するけれども、それでチェックをかけたくはない場合に明示的に使ってください)
) {
	var str = "";

	// init optionals
	if(typeof quality == "undefined" || quality == null) {
		var quality = "high";
	}
	if(typeof flashvars == "undefined") {
		var flashvars = null
	}
	if(typeof bgcolor == "undefined") {
		var bgcolor = null
	}
	if(typeof version == "undefined" || version == null) {
		var version = "6,0,0,0";
	}
	if(typeof versionCheck == "undefined") {
		var versionCheck = null;
	}

	if( versionCheck == false || FlashDetect(version.charAt(0)) == 2 ) {
		str += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version+'" width="'+width+'" height="'+height+'">\n';
		str += '<param name="movie" value="'+url+'">\n';
		str += '<param name="quality" value="high">\n';
		if(bgcolor != null) {
			str += '<param name="bgcolor" value="'+bgcolor+'">\n';
		}
		if(flashvars != null) {
			str += '<param name="flashvars" value="'+flashvars+'">\n';
		}
		str += '<embed src="'+url+'" quality="'+quality+'"';
		if(bgcolor != null) {
			str += ' bgcolor="'+bgcolor+'"';
		}
		if(flashvars != null) {
			str += ' flashvars="'+flashvars+'"';
		}
		str += 'width="'+width+'" height="'+height+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>\n';
		str += '</object>';
	}
	else {
		str += nghtml;
	}

	document.open();
	document.write(str);
	document.close();
}
