/**
 *	common.js
 *	$Author MLEXP.
 */

var isMSIE = navigator.appName.indexOf("Microsoft") != -1;

//!	FutureSplash用コマンド発行。
//	@description Handle all the the FSCommand messages in a FutureSplash movie
function ff_DoFSCommand(command, args) {
	var ffObj = isMSIE ? ff : document.ff;
	// Place your code here...
}

//!	IE用VBScript。
//	@description  Hook for Internet Explorer 
function futureSplashForVBS(command, args) {
	if (navigator.userAgent 
		&& navigator.userAgent.indexOf("MSIE") >= 0 
		&& navigator.userAgent.indexOf("Windows") >= 0) {
		document.write('<script type="text/vbscript" language="VBScript"\> \n');
		document.write('on error resume next \n');
		document.write('Sub ff_FSCommand(ByVal command, ByVal args)\n');
		document.write('  call ff_DoFSCommand(command, args)\n');
		document.write('end sub\n');
		document.write('</script\> \n');
	}
}

//!	ShockWaveのチェック。
//
function checkForShockwave()
{
	navigator.plugins.refresh();
	if ( navigator.plugins["Shockwave Flash"] ){ 
		parent.location.reload();
	} else {
		setTimeout( "checkForShockwave()", 1000 );
	}
}

//!	Shockwave Flash の貼り付け。
//	@param	vWidth		横幅。
//	@param	vHeight		縦幅。
//	@param	vId			ID。
//	@param	vFileName	flash ファイル。
//	@param	vImageFileName	代替画像ファイル。
//	@param	vBGColor	背景色。
//	@param	vAlt		代替文字列。
//
function afterShock( vWidth, vHeight, vId, vFileName, vImageFileName, vBGColor, vAlt ) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
	document.write('codebase="http://active.macromedia.com/flash/cabs/swflash.cab#version=2,0,0,0" ');
	document.write(' id=' + vId + ' width=' + vWidth + ' height=' + vHeight + '>\n');
	document.writeln('<param name="movie" value=' + vFileName + '>');
	document.writeln('<param name="loop" value="false">');
	document.writeln('<param name="quality" value="autohigh">');
	document.writeln('<param name="bgcolor" value="' + vBGColor + '">');

	var ShockMode = 0;
	if (navigator.mimeTypes 
		&& navigator.mimeTypes["application/x-shockwave-flash"] 
		&& navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
		if (navigator.plugins && navigator.plugins["Shockwave Flash"])
			ShockMode = 1;
	}

	if (!ShockMode 
		&& navigator.appName && navigator.appName.indexOf("Netscape") != - 1 
		&& navigator.appVersion.indexOf("4.") != - 1 
		&& navigator.javaEnabled() 
		&& netscape.softupdate.Trigger.UpdateEnabled() 
		&& document.cookie.indexOf("StartedShockwaveInstall") == -1) {
			var jarPath = new String("");
			if (navigator.platform.indexOf("Win32") >= 0 )
				jarPath = "http://download.macromedia.com/pub/shockwave/jars/english/silentflash32.jar"
			else if (navigator.platform.indexOf("Win16") >= 0 )
				jarPath = "http://download.macromedia.com/pub/shockwave/jars/english/silentflash16.jar"
			else if (navigator.platform.indexOf("MacPPC") >= 0 )
				jarPath = "http://download.macromedia.com/pub/shockwave/jars/english/silentflashppc.jar"
			if (jarPath.length) {
				netscape.softupdate.Trigger.StartSoftwareUpdate (jarPath, netscape.softupdate.Trigger.FORCE_MODE);
				document.cookie='StartedShockwaveInstall;path=/;'
				setTimeout("checkForShockwave()", 1000);
		}
	}

	if ( ShockMode ) {
		document.write('<embed src="' + vFileName + '"');
		document.write(' swLiveConnect=FALSE');
		document.write(' width=' + vWidth + ' height=' + vHeight + '');
		document.write(' loop=false quality=autohigh bgcolor=' + vBGColor + '');
		document.write(' type="application/x-shockwave-flash"');
		document.write(' pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
		document.write('</embed>');
	} else if (!(navigator.appName 
		&& navigator.appName.indexOf("Netscape")>=0 
		&& navigator.appVersion.indexOf("2.")>=0)
		&& vImageFileName && vImageFileName.length) {
		document.write('<img src="' + vImageFileName + '"');
		document.write(' width="' + vWidth + '" height="' + vHeight + '" alt="' + vAlt + '">');
	}

	document.write('<noembed>');
	document.write('<img src="' + vImageFileName + '"');
	document.write(' width="' + vWidth + '" height="' + vHeight + '" alt="' + vAlt + '">');
	document.write('</noembed>\n');

	document.writeln('</object>');
}

function afterShockB( vWidth, vHeight, vId, vFileName, vImageFileName, vBGColor, vAlt ) {
	afterShock( vWidth, vHeight, vId, vFileName, vImageFileName, "#000000", vAlt );
}

function afterShockW( vWidth, vHeight, vId, vFileName, vImageFileName, vBGColor, vAlt ) {
	afterShock( vWidth, vHeight, vId, vFileName, vImageFileName, "#ffffff", vAlt );
}

//!	Flash ムービーの貼り付け。
//	@param	vId			識別子。
//	@param	vWidth		横幅。
//	@param	vHeight		縦幅。
//	@param	vFileName	flash ファイル。
//	@param	vBGColor	背景色。
//	@param	vFlashVars	flash の固有パラメータ。
//	
function showFlash( vWidth, vHeight, vId, vFileName, vBGColor, vFlashVars )
{
	document.write( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' );
	document.write( ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"' );
	document.write( ' width="' + vWidth + '" height="' + vHeight + '" align="" id="' + vId + '">' );
	document.write( '<param name=movie VALUE="' + vFileName + '">' );
	document.write( '<param name=quality VALUE=high>' );
	document.write( '<param name=bgcolor VALUE=' + vBGColor + '>' );
	document.write( '<param name=flashvars VALUE="' + vFlashVars + '">' );
	document.write( '<param name=loop VALUE=false>' );
	document.write( '<embed src="' + vFileName + '"' );
	document.write( ' quality=high bgcolor=' + vBGColor + '' );
	document.write( ' flashvars="' + vFlashVars + '"' );
	document.write( ' width="' + vWidth + '" height="' + vHeight + '" align="" loop=false' );
	document.write( ' name="' + vId + '"' );
	document.write( ' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">' );
	document.write( '</embed>' );
	document.write( '</object>' );
}

function showFlashB( vWidth, vHeight, vId, vFileName, vFlashVars ) {
	showFlash( vWidth, vHeight, vId, vFileName, "#000000", vFlashVars );
}

function showFlashW( vWidth, vHeight, vId, vFileName, vFlashVars ) {
	showFlash( vWidth, vHeight, vId, vFileName, "#ffffff", vFlashVars );
}

//!	別窓オープン
//
//
function openWindow(url) 
{
	window.open(url, '', 'width=600, height=700, menubar=no, toolbar=no, location=no, scrollbars=yes');
	return false;
}
