//Exe
writeFlash("movie0001.swf",400,300,"");



//Function

function writeFlash(filename,width,height,noflash){
	var htm = "";
	
	if (getIsFlash()){
		htm+="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'";
		htm+=" codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab'";
		htm+=" width='" + width + "'";
		htm+=" height='" + height + "'>";
		htm+="<param name='movie' value='" + filename + "'>";
		htm+="<param name='quality' value='high'>";
		htm+="<param name='menu' value='false'>";
		htm+="<embed src='" + filename + "'";
		htm+=" quality='high'";
		htm+=" width='" + width + "'";
		htm+=" height='" + height + "'";
		htm+=" menu='false'";
		htm+=" type = 'application/x-shockwave-flash'";
		htm+=" pluginspage='http://www.macromedia.com/go/getflashplayer'>";
		htm+="</object>";
	}else{
		htm = noflash;
	}
	
	document.write(htm);
	
	return;
}


/* Flash存在チェック
isExist = getIsFlash();

[ Relation ]

*/

function getIsFlash() {
	var flashinstalled = 0;
	var flashversion = 0;
	var obj_flash;
	
	if (navigator.plugins && navigator.plugins.length){
		obj_flash = navigator.plugins["Shockwave Flash"];
		if (obj_flash){
			flashinstalled = 2;
			if (obj_flash.description){
				var y = obj_flash.description;
				flashversion = y.charAt(y.indexOf('.')-1);
			}
		}else{
			flashinstalled = 1;
		}
		
		if (navigator.plugins["Shockwave Flash 2.0"])
		{
			flashinstalled = 1;
		}
	}else if (navigator.mimeTypes && navigator.mimeTypes.length){
		obj_flash = navigator.mimeTypes['application/x-shockwave-flash'];
	
		if (obj_flash && obj_flash.enabledPlugin)
			flashinstalled = 1;
		else
			flashinstalled = 0;
			
	}else{
		
		try{
			obj_flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
		}catch(e){
			for (var i=3;i<20;i++){
				try{
					obj_flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
					break;
				}catch(e){
					
				}
			}
		}
		
		flashinstalled = (obj_flash)?1:0;
	}
	
	return flashinstalled;
}
