SwfParam = {
putArea :'header', //設置する場所のID名
file : 'index.swf', //swfの場所
width : '850',
height : '393',
requiredVer : 7 //プラグインの必要バージョン
};


/*----- 判別完了まで表示しないでおく[BEGIN]-----*/
document.write("<style type=\"text/css\">\n");
document.write("#"+SwfParam.putArea+"{visibility:hidden;}\n");
document.write("</style>");
/*----- 判別完了まで表示しないでおく[END]-----*/


/*----- Flash Player のバージョン判定[BEGIN]-----*/
// IE以外でFlash Player のバージョンを取得　変数pluginVerに入る。
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : null;
if (navigator.mimeTypes["application/x-shockwave-flash"]) {
	pluginVer = parseInt(plugin.description.substring(plugin.description.indexOf(".") -1));
}
// IEの場合、Flash Player のバージョンをvbscriptで取得(IEでnavigator.mimeTypesが使えないため)
else{
	document.write('<script type="text/vbscript">\n');
	document.write('on error resume next \n');
	document.write('Dim Flash \n');
	document.write('Dim pluginVer \n');
	document.write('Flash=IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash"))\n');
	document.write('pluginVer=Left(Hex(Int(CreateObject("ShockwaveFlash.ShockwaveFlash").FlashVersion)),1)\n');
	document.write('</script>\n');
}
/*----- Flash Player のバージョン判定[END]-----*/


/*----- Flash Player のバージョンが必要バージョン以上で埋め込み[BEGIN]-----*/
function replaceSWF(){
	if(pluginVer>=SwfParam.requiredVer){
			
		var putArea = document.getElementById(SwfParam.putArea);
		
		//remove defo elements
		var p = document.getElementsByTagName("p");
		for(i=0;i<p.length;i++){
			if(p[i].className=="visual"){
				putArea.removeChild(p[i]);
			}
		}
		
		var ul= document.getElementsByTagName("ul");
		for(i=0;i<ul.length;i++){
			if(ul[i].className=="global-navigation"){
				putArea.removeChild(ul[i]);
			}
		}
		
		//put swf
		var flash = document.createElement('div');   
		flash.id = "flash";   
		flash.innerHTML = ('<object data=\"'+SwfParam.file+'\" type=\"application/x-shockwave-flash\" width=\"'+SwfParam.width+'\" height=\"'+SwfParam.height+'\"><param name=\"movie\" value=\"'+SwfParam.file+'\" /></object>');
		putArea.appendChild(flash);  
	}
}
/*----- Flash Player のバージョンが必要バージョン以上で埋め込み[END]-----*/


/*----- 判別前に隠したエリアを表示[BEGIN]-----*/
function showFlashArea(){
	document.getElementById(SwfParam.putArea).style.visibility = "visible";
}
/*----- 判別前に隠したエリアを表示[END]-----*/


window.onload = function(){
	replaceSWF();
	showFlashArea();
}
