/*###########################################################################
	flash object write function
	Example :
	writeFlashObject ("top.swf","middle", 730, 305, "window", "#E7E7E7", "");
#############################################################################*/

function writeFlashObject(src, align, width, height, wmode, bgcolor, props)
{
				
	var str = '<object ';
	str += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
	str += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"';
	str += 'align="' + align + '"';
	str += 'width="' + width + '"';
	str += 'height="' + height + '">';
	str += '<param name="Src" value="' + src + props + '" />';
	str += '<param name="WMode" value="' + wmode + '" />';
	str += '<param name="Play" value="true" />';
	str += '<param name="Loop" value="true" />';
	str += '<param name="Quality" value="best" />';
	str += '<param name="Menu" value="false" />';
	str += '<param name="Scale" value="ShowAll" />';
	str += '<param name="DeviceFont" value="false" />';
	str += '<param name="EmbedMovie" value="false" />';
	str += '<param name="BGColor" value="' + bgcolor + '" />';
	str += '<embed ';
	str += 'src="' + src + props + '" ';
	str += 'quality="best" ';
	str += 'wmode="' + wmode + '" ';
	str += 'bgcolor="' + bgcolor + '" ';
	str += 'align="' + align + '" ';
	str += 'width="' + width + '" ';
	str += 'height="' + height + '" ';
	str += 'type="application/x-shockwave-flash" ';
	str += 'pluginspage="http://www.macromedia.com/go/getflashplayer" ';
	str += '/>';
	str += '</object>';

	document.write (str);

}

/*############################################
	Full Screen resize Function
	Example : resizeFull();
#############################################*/

function resizeFull()
{
	window.moveTo(0, 0);
	window.resizeTo(screen.availWidth, screen.availHeight);
	window.focus();
}
/*############################################
	Browser Check Function
	Example : BrowserCheck();
#############################################*/
function BrowserCheck(){
		var bwr = navigator.appName;
		if (bwr == "Netscape") this.bwr = "NN";
		else if (bwr == "Microsoft Internet Explorer") this.bwr = "IE";
		else this.bwr = bwr;
		this.version = navigator.appVersion;
		this.vSub = navigator.vendorSub;
		this.userAgent = navigator.userAgent;
		this.appVersion = navigator.appVersion;
		this.v = parseInt(this.version);
		this.vs = parseFloat(this.vSub);
		
		this.NN = (this.bwr == "NN");
		this.NN3 = (this.bwr == "NN" && this.v == 3);
		this.NN4 = (this.bwr == "NN" && this.v == 4);
		this.NN6x = (this.bwr == "NN" && this.v == 5 && this.vs >= 6.01);
		this.NN6 = (this.bwr == "NN" && this.v == 5);
		this.NN7 = (this.bwr == "NN" && this.v == 5 && this.vs >= 7);
		
		this.IE = (this.bwr == "IE");
		this.IE3 = (this.userAgent.indexOf('MSIE 3')>0);
		this.IE45 = (this.userAgent.indexOf('MSIE 4.5')>0);
		this.IE401 = (this.userAgent.indexOf('MSIE 4.01')>0);
		this.IE4 = (this.userAgent.indexOf('MSIE 4')>0);
		this.IE51 = (this.userAgent.indexOf('MSIE 5.1')>0);
		this.IE512 = (this.userAgent.indexOf('MSIE 5.12')>0);
		this.IE514 = (this.userAgent.indexOf('MSIE 5.14')>0);
		this.IE52 = (this.userAgent.indexOf('MSIE 5.2')>0);
		this.IE5 = (this.userAgent.indexOf('MSIE 5')>0);		
		this.IE6 = (this.userAgent.indexOf('MSIE 6')>0);
		
		this.GEK = (this.userAgent.indexOf("Gecko") != -1);
		this.SAF = (this.userAgent.indexOf("Safari",0) != -1);
		this.FF = (this.userAgent.indexOf("Firefox") != -1);
		this.CAB = (this.userAgent.indexOf("iCab",0) != -1);
		this.OPE = (this.userAgent.indexOf("Opera",0) != -1);
		
		this.Win = (this.userAgent.indexOf('Win',0) != -1);
		this.Mac = (this.userAgent.indexOf('Mac',0) != -1);
		this.MacOSX = (this.userAgent.indexOf('Mac OS X',0) != -1);
		if(this.IE512 || this.IE52){
			this.MacOSX=true;
		}
		else if(this.IE514){
			if (navigator.plugins) {
				for (i=0; i < navigator.plugins.length; i++ ) {
					if (navigator.plugins[i].name.indexOf('QuickTime') >= 0 && navigator.plugins[i].filename.indexOf('.plugin')!=-1){
						this.MacOSX=true;
					}
				}
			}
		}
		this.Unix = (this.appVersion.indexOf('X11',0) != -1);
}

var checkBwr = new BrowserCheck();
//window.alert(checkBwr.IE);



/*############################################
	Flash version Check section
#############################################*/
var flash_version = 8;
var FlashInstalled = false;
var pv = 6;

if (checkBwr.OPE) {
	var sp = navigator.plugins["Shockwave Flash"].description.indexOf("Flash");
	var ep = navigator.plugins["Shockwave Flash"].description.lastIndexOf(" ");
	var aver = parseFloat(navigator.plugins["Shockwave Flash"].description.substring(sp+pv,ep));
	if(aver >= flash_version){
		FlashInstalled = true;
	}
} else if(checkBwr.Win && checkBwr.IE){
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('contentVersion = 6 \n');
	document.write('FlashInstalled = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & contentVersion))) \n');
	document.write('</SCR' + 'IPT\> \n');
	if(checkBwr.IE4){
		FlashInstalled = false;
	}
}else if(checkBwr.Mac && checkBwr.IE){
	if(!checkBwr.IE4 && navigator.plugins["Shockwave Flash"]){
		var sp = navigator.plugins["Shockwave Flash"].description.indexOf("Flash");
		var ep = navigator.plugins["Shockwave Flash"].description.lastIndexOf(" ");
		var aver = parseFloat(navigator.plugins["Shockwave Flash"].description.substring(sp+pv,ep));
		if(aver >= flash_version){
			FlashInstalled = true;
		}
	}
}else if(checkBwr.NN && navigator.plugins["Shockwave Flash"]){
	if(checkBwr.NN7 || checkBwr.NN6 || checkBwr.NN6x || checkBwr.NN4){
		var sp = navigator.plugins["Shockwave Flash"].description.indexOf("Flash");
		var ep = navigator.plugins["Shockwave Flash"].description.lastIndexOf(" ");
		var aver = parseFloat(navigator.plugins["Shockwave Flash"].description.substring(sp+pv,ep));
		if(aver >= flash_version){
			FlashInstalled = true;
		}
	}
}
/*############################################
	Check and Write Function
	Example : CheckAndWrite();
#############################################*/
function CheckAndWrite()
{
	if(FlashInstalled){
		writeFlashObject ("topsample.swf","middle", 800, 515, "window", "#FFFFFF", "");
	}else{
		document.write('<div id="noflash"><div id="noflash-con">');
		document.write('<a href="http://www.adobe.com/go/getflashplayer_jp"><img src="images/get_flash_player.gif" alt="Flash Playerのダウンロード"  /></a>');
		document.write('<p>最新のFlashPlayerをインストールしてください</p></div></div>');
	}
}