
var pluginspages = new Array(); // プラグインダウンロードリンク先
pluginspages[0] = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"; // English
pluginspages[1] = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=Japanese"; // Japanese
var pluginVer = 0;

function pfAltAction(Obj) {
	if (Obj.nonflashSW == 1) location.href = Obj.nonFlashSRC;
	return Obj.nonFlashSRC;
}

function pfAltContent(Obj) {
	if (Obj.nonflashSW == 1) return "";
	return Obj.nonFlashSRC;
}

function pfFlashPlayerObject() {
	if(navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]){
		return navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
	}
}
function putflash (Obj) {
	if (!Obj.dir) Obj.dir = '';
	if (!Obj.id) Obj.id = 'putflash';
	if (!Obj.requiredVer) Obj.requiredVer = 6;
	if (!Obj.bgcolor) Obj.bgcolor = "#ffffff";
	if (!Obj.quality) Obj.quality = "high";
	if (!Obj.language) Obj.language = 0;
	if (!Obj.macie4exec && Obj.macie4exec != "0") Obj.macie4exec = 0;
	if (!Obj.moz_exec && Obj.moz_exec != "0") Obj.moz_exec = 1;
	if (!Obj.opera_exec && Obj.opera_exec != "0") Obj.opera_exec = 1;
	if (!Obj.nonflashSW && Obj.nonflashSW != "0") Obj.nonflashSW = 0;
	if (!Obj.nonFlashSRC) Obj.nonFlashSRC = "";
	if (!Obj.swLiveConnect) Obj.swLiveConnect = "false";
	if (!Obj.menu) Obj.menu = "false";
	if (!Obj.disableCodebase) Obj.disableCodebase = 0;
	var plugin = pfFlashPlayerObject();
	if (plugin) {
		var tmp = navigator.plugins["Shockwave Flash"].description.split(" ");
		for (var i=0; i<tmp.length; i++) {
			if (!isNaN(parseInt(tmp[i]))){	pluginVer = parseInt(tmp[i]);}
		}
		//pluginVer = parseInt(plugin.description.substring(plugin.description.indexOf(".") -1));
	} else {
		document.writeln('<script type="text/vbscript">');
		document.writeln('On Error Resume Next');
		document.writeln('Private swfEnableFlag');
		document.writeln('swfEnableFlag = false');
		document.writeln('swfEnableFlag = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.' + Obj.requiredVer + '"))');
		document.writeln('If swfEnableFlag Then');
		document.writeln('pluginVer = ' + Obj.requiredVer);
		document.writeln('End If');
		document.writeln('</script>');
	}

	document.open();
	if (Obj.hedSRC) document.write(Obj.hedSRC);
	if (pluginVer < Obj.requiredVer){
		document.write(pfAltAction(Obj));
	} else {
 		document.write(pfGetObjectElement(Obj));
	}
	if (Obj.fotSRC) document.write(Obj.fotSRC);
	document.close();
}
function pfGetObjectElement(Obj){

	if (window.opera && Obj.opera_exec != 1) {
		return pfAltAction(Obj);
	}

	if (!Obj.file || !Obj.width || !Obj.height || !Obj.id) {
		return "";
	}

	var result = "";
	result += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	if(!Obj.disableCodebase){
		result += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"';
	}
	//result += ' id="' + Obj.id + '" width="' + Obj.width + '" height="' + Obj.height + '" name="' + Obj.id + '">';
	result += ' id="' + Obj.id + '" width="' + Obj.width + '" height="' + Obj.height + '">';
	result += '<param name="movie" value="' + Obj.dir + Obj.file + '">';
	result += '<param name="quality" value="' + Obj.quality + '">';
	result += '<param name="bgcolor" value="' + Obj.bgcolor + '">';
	result += '<param name="menu" value="' + Obj.menu + '"' + '>';
	result += '<param name="wmode" value="opaque">';
	if (Obj.salign)    result += '<param name="salign" value="' + Obj.salign + '"' + '>';
	if (Obj.scale)     result += '<param name="scale" value="' + Obj.scale + '"' + '>';
	if (Obj.FlashVars) result += '<param name="FlashVars" value="' + Obj.FlashVars + '"' + '>';

	if ((navigator.appVersion.indexOf('Win',0) != -1 && navigator.appName.indexOf("Microsoft Internet Explorer",0) != -1) && !window.opera){
		result += pfAltContent(Obj);
	} else {
		result += pfGetEmbedElement(Obj);
	}
	result += '</object>';
	return result;
}
function pfGetEmbedElement(Obj){

	if (Obj.moz_exec != 1 && (navigator.userAgent.indexOf("Gecko/") != -1)) return pfAltAction(Obj);

	if (Obj.macie4exec != 1 && (navigator.appVersion.indexOf('Mac',0) != -1)){
		if (navigator.appVersion.indexOf('MSIE 4.',0) != -1) return pfAltAction(Obj);
		if (navigator.appVersion.indexOf('MSIE 3.',0) != -1) return pfAltAction(Obj);
	}
	var ua = navigator.userAgent;
	var reviseFlag = false;
	if (ua.match(/Gecko\//)) {
		var key = 'rv:';
		var sRv = ua.substr(ua.indexOf(key) + key.length, 4);
		var fRv = parseFloat(sRv);
		reviseFlag = (fRv > 1.4 && (fRv < 1.7 || sRv == '1.7a'));
	}
	var result = "";
	//result += '<embed src="' + Obj.dir + Obj.file + '"';
	result += '<embed name="' + Obj.id + '" src="' + Obj.dir + Obj.file + '"';
	result += ' menu="' + Obj.menu + '"';
	result += ' quality="' + Obj.quality + '"';
	result += ' swLiveConnect="' + Obj.swLiveConnect + '"';
	result += ' bgcolor="' + Obj.bgcolor + '"';
	result += ' width="' + Obj.width + '"';
	result += ' height="' + Obj.height + '"';
	if (Obj.scale && !reviseFlag) result += ' scale="' + Obj.scale + '"';
	if (Obj.salign)               result += ' salign="' + Obj.salign + '"';
	if (Obj.scale && reviseFlag)  result += ' scale="' + Obj.scale + '"';
	if (Obj.FlashVars)            result += ' FlashVars="' + Obj.FlashVars + '"';
	result += ' type="application/x-shockwave-flash"';
	result += ' pluginspage="' + pluginspages[Obj.language] + '"';
	result += ' name="' + Obj.id + '-embed"';
	result += ' id="' + Obj.id + '-embed"';
	result += ' wmode="opaque"';
	result += '></embed><br>';
	return result;
}






	function setSWFDimensions (objID,width,height) {
		if (objID && width && height) {
			
			var fObj = document.getElementById(objID);
			var fEmb = document.getElementById(objID+'-embed');
			
			if (fObj && fObj.style) {
				fObj.setAttribute('width',width);
				fObj.setAttribute('height',height);
				fObj.style.width = width+'px';
				fObj.style.height = height+'px';
			}
			
			if (fEmb != null) { 
				fEmb.width = width;
				fEmb.height = height;
				
				if (fEmb.style) { 
					fEmb.style.width = width+'px';
					fEmb.style.height = height+'px';
				}
			}
		}
	}