﻿/*
更新履歴
-----------------------
2008/8/19 忠鉢
作成
-----------------------
*/

var miniWidth = 1000;	//Flash横サイズ
var miniHeight = 550;	//Flash縦サイズ
var marginWidth = 0;	//横マージン補正サイズ
var marginHieht = 0;	//縦マージン補正サイズ(ヘッダ:[28px + 10px(余白)] + フッタ:[10px(余白) + 30px])
var reWidth;
var reHeight;

/* Load Listener */
addListener(window,"load",boxResizeLoad);

/* Load Event */
function boxResizeLoad(){
	//ウィンドウリサイズ時のリスナーをセット
	addListener(window,"resize",goBoxResize);
	goBoxResize();
}

/* Resize Event */
function goBoxResize(){
	if(windowWidthSize() < miniWidth + marginWidth || windowHeightSize() < miniHeight + marginHieht){
		//ウィンドウサイズが最小値より小さい場合
		document.getElementById("flashBox").style.width = miniWidth + "px";
		document.getElementById("flashBox").style.height = miniHeight + "px";
		document.getElementById("flashBox").style.left = "0px";
		document.getElementById("flashBox").style.top = "0px";
		document.getElementById("flashBox").style.margin = "0 auto 0 auto";

		document.getElementsByTagName("HTML")[0].style.overflow = "auto";

		document.getElementById("flashOther").style.width = miniWidth + "px";
		document.getElementById("flashOther").style.height = miniHeight + "px";
	} else if (windowWidthSize() < windowHeightSize() * 2 - 150) {
		//ウィンドウサイズが最小値より大きい場合(横が長い場合)
		document.getElementById("flashBox").style.width = (windowWidthSize() - marginWidth) + "px";
		document.getElementById("flashBox").style.height = (windowHeightSize() - marginHieht) + "px";
		document.getElementById("flashBox").style.left = "50%";
		document.getElementById("flashBox").style.top = "50%";

		document.getElementsByTagName("HTML")[0].style.overflow = "hidden";

		var reWidth = windowWidthSize() - marginWidth;
		var reHeight = windowHeightSize() - marginHieht;

		document.getElementById("flashOther").style.width = reWidth + "px";
		document.getElementById("flashOther").style.height = 550 * (reWidth / 1000) + "px";
	} else {
		//ウィンドウサイズが最小値より大きい場合(縦が長い場合)
		document.getElementById("flashBox").style.width = (windowWidthSize() - marginWidth) + "px";
		document.getElementById("flashBox").style.height = (windowHeightSize() - marginHieht) + "px";
		document.getElementById("flashBox").style.left = "50%";
		document.getElementById("flashBox").style.top = "50%";
		
		document.getElementsByTagName("HTML")[0].style.overflow = "hidden";
		
		var reWidth = windowWidthSize() - marginWidth;
		var reHeight = windowHeightSize() - marginHieht;

		document.getElementById("flashOther").style.width = 1000 * (reHeight / 550) + "px";
		document.getElementById("flashOther").style.height = reHeight + "px";
	}
}

