function SetFlash(v,s,q,w,h,c){
	var FlashPluginURL = 'http://www.adobe.com/shockwave/download/index.cgi?Lang=Japanese&P1_Prod_Version=ShockwaveFlash';
	var InsertHtml;

	if(GetFlashVersion() >= v){
		InsertHtml = GetFlashHtml(s,q,w,h,c);
	} else {
		if(GetFlashVersion() == 0){
			InsertHtml = GetNoFlashHtml(FlashPluginURL);
		} else {
			InsertHtml = GetOldFlashHtml(v,FlashPluginURL);
		}
	}
	document.write(InsertHtml);
}

function CreateUserAgent(){
	this.isWin = (navigator.userAgent.indexOf("Win",0) != -1);
	this.isMac = (navigator.userAgent.indexOf("Mac",0) != -1);
	this.isNs		= navigator.appName.indexOf("Netscape") != -1 ? true : false;
	this.isNs4		= (document.layers) ? true : false;
	this.isMoz		= navigator.userAgent.indexOf("Gecko") != -1 ? true : false;
	this.isIe		= navigator.userAgent.indexOf("MSIE") != -1 ? true : false;
	this.isIe4		= navigator.userAgent.indexOf("MSIE 4") != -1 ? true : false;
	this.isIe5		= navigator.userAgent.indexOf("MSIE 5") != -1 ? true : false;
	this.isIe6		= navigator.userAgent.indexOf("MSIE 6") != -1 ? true : false;
	this.isOp		= navigator.userAgent.indexOf("Opera") != -1 ? true : false;
	return this;
}

function GetFlashVersion(){
	var UA = new CreateUserAgent();
	var FV = 0;
	var s = "application/x-shockwave-flash";
	if (UA.isIe && UA.isWin && !UA.isOp) {
		try{
			FV= new ActiveXObject("ShockwaveFlash.ShockwaveFlash").FlashVersion();
		}catch(e){
			FV=0;
		};
		FV = Math.floor (FV / 0x10000);
	} else {
		if (UA.isNs && !navigator.plugins) {
			FV = 0;
		} else {
			if (navigator.mimeTypes && navigator.mimeTypes[s] && navigator.mimeTypes[s].enabledPlugin){
				FV=navigator.plugins["Shockwave Flash"].description.match (/\d+/);
			} else {
				FV = 0;
			}
		}
	}
	return FV;
}

function GetFlashHtml(Swf,Quality,W,H,BGColor){
	var text;
	text = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + W + '" height="' + H + '">';
	text += '<param name="movie" value="' + Swf + '" />';
	text += '<param name="quality" value="' + Quality + '" />';
	text += '<param name="bgcolor" value="' + BGColor + '" />';
	text += '<param name="menu" value="false" />';
	text += '<embed menu="false" src="' + Swf + '" quality="' + Quality + '" bgcolor="' + BGColor + '" width="' + W + '" height="' + H + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
	text += '</object>';
	return text;
}

function GetNoFlashHtml(Url){
	var text;
	text = '<p>このコンテンツをご利用になるにはFlash Playerが必要になります。<br /><a href="' + Url + '" target="_blank">Flash Playerのインストールはこちらから行って下さい。</a></p>';
	return text;
}

function GetOldFlashHtml(fVersion,Url){
	var text;
	text = '<p>お使いのFlash Playerのバージョンが古いようです。このコンテンツをご利用になるにはバージョン' + fVersion + '以上のFlash Playerが必要になります。</p><p><a href="' + Url + '" target="_blank">最新のFlash Playerのインストールはこちらから行って下さい。</a></p>';
	return text;
}

