/****************/
/*** 基本設定 ***/
/****************/

//SWFファイルのパス
swfPath	=	"./video.swf";

//FLVファイルのパス
flvPath	=	"http://www.ggj.jp/flv/20000000touka/01.flv";

//FLVの横サイズ
width		=	250;

//FLVの縦サイズ
height		=	350;

//FLVの総再生時間(mm:ss形式)
totalTime	=	"00:51";

/******************/
/*** 再生前設定 ***/
/******************/

//自動読み込み(0：無効、1：有効)
//無効にした場合、画像がクリックされてからFLVの読み込みを開始します。
autoLoad	=	1;

//読み込み前の画像ファイルのパス(画像形式はJPGまたはPNG)
imgPath	=	"./image.jpg";

/********************/
/*** 再生開始設定 ***/
/********************/

//自動再生(0：再生しない、1：再生する)
autoStart	=	1;

//プレ再生秒数(秒単位　自動再生有効時のみ)
//初回のみ自動で設定した秒数のみ再生し停止します。0なら停止しません。
preView	=	0;

//初期音量(0：消音、1：通常)
volume	=	1;

/**********************/
/*** 再生終了後設定 ***/
/**********************/

//再生終了後の動作(0：停止する、1：非表示にする)
autoClose	=	1;

//再生終了後に別ページに遷移(0：使用しない、1：使用する)
closeJamp	=	0;

//再生終了後の遷移URL(再生終了後に別ページに遷移を使用時のみ有効)
closeURL	=	"http://www.yahoo.co.jp";

//再生終了後のターゲット設定(0：同ウィンドウ、1：別ウィンドウ)
//再生終了後に別ページに遷移を使用時のみ有効
closeTarget	=	0;

/********************/
/*** 停止状態設定 ***/
/********************/

//停止中の映像に重ねる画像(0：使用しない、1：使用する)
//使用するにした場合、停止中に映像をクリックすると再生を再開します。
playImg	=	1;

//停止中の映像に重ねる画像のパス(画像形式はJPGまたはPNG)
playImgPath	=	"./image.jpg";

//停止中の映像に重ねる画像の透明度(%単位)
playImgAlpha	=	30;

//停止中にプログレスバーを操作した場合の自動再生動作(0：停止のまま、1：再生する)
progressStart	=	0;

/******************/
/*** リンク設定 ***/
/******************/

//動画をクリックした時の遷移URL
jampURL	=	"";

//動画をクリックした時のターゲット設定(0：同ウィンドウ、1：別ウィンドウ)
targetWin	=	0;

/****************/
/*** 表示設定 ***/
/****************/

//プレイヤーの透明度(%単位)
controlAlpha	=	70;

//プレイヤーの常時表示(0：非表示、1：表示)
visibility	=	0;

//表示開始までの時間(秒単位)
//ページ全体の読み込みが完了後、指定秒後にswfファイルを表示します。
//-1を設定すればswfファイルを読み込み次第表示します。
waitTime	=	-1;

//配置基準点(1：左上、2：右上、3：右下、4：左下、5：中央)
positionMode	=	5;

//表示位置調整(横・縦)
//配置基準点からの位置調整、マイナスの数値も指定出来ます。
positionX	=	0;
positionY	=	0;

/********************/
/*** 設定ここまで ***/
/********************/

function flashWrite()
{
	temp		=	totalTime.split(":");
	totalTime	=	(temp[0]*60)+(temp[1]-0);
	flashvars	=	'varWidth='+width+'&varHeight='+height+'&visibility='+visibility+'&autoStart='+autoStart+'&flvPath='+flvPath+'&imgPath='+imgPath+'&waitTime='+waitTime+'&jampURL='+jampURL+'&targetWin='+targetWin+'&totalTime='+totalTime+'&autoClose='+autoClose+'&controlAlpha='+controlAlpha+'&preView='+preView+'&volume='+volume+'&autoLoad='+autoLoad+'&playImgPath='+playImgPath+'&playImg='+playImg+'&progressStart='+progressStart+'&playImgAlpha='+playImgAlpha+'&closeJamp='+closeJamp+'&closeURL='+closeURL+'&closeTarget='+closeTarget;

	document.open();
	document.write('<span><object id="presenSWF"\n  classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+width+'" height="'+height+'"\n  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0">\n <PARAM NAME="FlashVars" VALUE="'+flashvars+'">\n <param name="allowScriptAccess" value="sameDomain" />\n<param name="movie" value="'+swfPath+'">\n <param name="quality" value="high">\n <param name="wmode" value="transparent">\n <embed src="'+swfPath+'" quality="high" name="presenSWF" id="presenSWF"  pluginspage="http://www.macromedia.com/jp/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"\n  type="application/x-shockwave-flash"\n FlashVars='+flashvars+'  width="'+width+'" height="'+height+'" allowScriptAccess="sameDomain" wmode="transparent">\n </embed> \n</object></span>');
	document.close();

	if(visibility == 0)
	{
		document.getElementById("presenSWF").onmouseover	=	controlOver;
		document.getElementById("presenSWF").onmouseout		=	controlOut;
	}

	if(waitTime >= 0)
	{
		document.getElementById("presenSWF").style.visibility	=	"hidden";
	}
}

function presenSWF_DoFSCommand(commond, args)
{
	if(commond == "license")
	{
		document.presenSWF.SetVariable("adjustCheck", args);
	}
	else if(commond == "hidden")
	{
		hiddenMovie();
	}
}

function presenPositioning()
{
	bodyWidth	=	(document.documentElement && document.documentElement.clientWidth)?	document.documentElement.clientWidth	:	window.innerWidth-18;
	bodyHeight	=	(document.documentElement && document.documentElement.clientHeight)?	document.documentElement.clientHeight	:	window.innerHeight-18;
	bodyLeft	=	(document.documentElement && !isNaN(document.documentElement.scrollLeft))?	document.documentElement.scrollLeft	:	window.scrollX;
	bodyTop		=	(document.documentElement && !isNaN(document.documentElement.scrollTop))?		document.documentElement.scrollTop		:	window.scrollY;

	if(positionMode == 1)
	{
		basePositionX	=	bodyLeft;
		basePositionY	=	bodyTop;
	}
	else if(positionMode == 2)
	{
		basePositionX	=	bodyWidth-document.getElementById("presenSWF").offsetWidth+bodyLeft;
		basePositionY	=	bodyTop;
	}
	else if(positionMode == 3)
	{
		basePositionX	=	bodyWidth-document.getElementById("presenSWF").offsetWidth+bodyLeft;
		basePositionY	=	bodyHeight-document.getElementById("presenSWF").offsetHeight+bodyTop;
	}
	else if(positionMode == 4)
	{
		basePositionX	=	bodyLeft;
		basePositionY	=	bodyHeight-document.getElementById("presenSWF").offsetHeight+bodyTop;
	}
	else if(positionMode == 5)
	{
		basePositionX	=	(bodyWidth/2)-(document.getElementById("presenSWF").offsetWidth/2)+bodyLeft;
		basePositionY	=	(bodyHeight/2)-(document.getElementById("presenSWF").offsetHeight/2)+bodyTop;
	}

	document.getElementById("presenSWF").style.position	=	"absolute";
	document.getElementById("presenSWF").style.left		=	basePositionX+positionX+'px';
	document.getElementById("presenSWF").style.top		=	basePositionY+positionY+'px';
}

function hiddenMovie()
{
	obj	=	document.getElementById("presenSWF");
	obj.parentNode.removeChild(obj);
	clearInterval(ids);
}

function waitStart()
{
	setTimeout('document.getElementById("presenSWF").style.visibility = "visible";', waitTime*1000-100);
	setTimeout('document.presenSWF.SetVariable("startCheck", 1);', waitTime*1000);
}

function controlOver()
{
	document.presenSWF.SetVariable("controlCheck", 1);
}

function controlOut()
{
	document.presenSWF.SetVariable("controlCheck", 2);
}

ids	=	setInterval("presenPositioning()", 200);

if(waitTime >= 0)
{
	onload	=	waitStart();
}

//IE用
if(navigator.appName.indexOf("Microsoft") != -1)
{
	document.write('<script language=\"VBScript\"\>\n');
	document.write('Sub presenSWF_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call presenSWF_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}