//枠作成クラス
function BoxMaker(){
	//コンストラクタ
	this.constructor = function(){
		this.Data = [];
	}
	
	//枠データ取得
	this.GetInitBox = function(){
		var ResData = {
			Name:null,
			Type:"box",
			x:0,
			y:0,
			width:0,
			height:0,
			linecolor:null,
			bgcolor:null,
			txtcolor:null,
			display:"none",
			opacity:0.8,
		}
		
		return ResData;
	}
	
	//枠データ追加
	this.AddBoxData = function(Data){
		this.AddData(Data,"box");
	}
	
	//枠データ取得
	this.GetBoxData = function(Key){
		return this.GetData(Key,"box");
	}
	
	//枠表示
	this.ViewBox = function(Key){
		var tmp = this.Elm("."+Key);
		tmp.style.display = "";
	}
	
	//枠非表示
	this.HiddenBox = function(Key){
		var tmp = this.Elm("."+Key);
		tmp.style.display = "none";
	}
	
	//表示状態
	this.GetBoxStatus = function(Key){
		return this.Elm("."+Key).style.display==""?true:false;
	}
	
	//コマンド追加
	this.AddCommand = function(addElmId,Key,str,display=null){
		var selm = this.CreateElm("p",Key);
		selm.innerText = str;
		selm.style.textAlign = "center";
		selm.style.display = display;
		var IdKey = "."+addElmId;
		var elm = this.Elm(IdKey);
		elm.appendChild(selm);
	}
	
	//コマンドタッチイベント追加
	this.AddEventForId = function(Key,func){
		Key = "."+Key;
		var elm = this.Elm(Key);
		elm.onmousedown = func;
		elm.ontouchstart = func;
	}
	
	//枠データ設置
	this.SettingBox = function(parent,Key,display=null){
		var selm = this.CreateElm("div",Key);
		var elm = this.GetBoxData(Key);
		if(display!=null)elm.display = display;
		selm.style.top = elm.y;
		selm.style.left = elm.x;
		selm.style.width = elm.width;
		selm.style.height = elm.height;
		selm.style.display = elm.display;
		selm.style.backgroundColor = elm.bgcolor;
		selm.style.color = elm.txtcolor;
		selm.style.border = elm.linecolor;
		selm.style.position = "absolute";
		selm.style.opacity = elm.opacity;
		parent.appendChild(selm);
	}

	//パラメータセット
	this.SetBoxParam = function(data,Name,width,height,option=null){
		data.Name = Name;
		data.width = width;
		data.height = height;
		data.bgcolor = "#303030";
		data.txtcolor = "#F0F0F0";
		data.linecolor = "solid 1px #0F0F0F";
		data.opacity = 0.8;
		if(option!=null){
			if(option.bgcolor)data.bgcolor = option.bgcolor;
			if(option.txtcolor)data.txtcolor = option.txtcolor;
			if(option.linecolor)data.linecolor = option.linecolor;
			if(option.opacity)data.opacity = option.opacity;
		}
		return data;
	}	
	
	//枠データ設置
	this.ChangeBox = function(Key){
		var selm = this.Elm("."+Key);
		var elm = this.GetBoxData(Key);
		selm.style.top = elm.y;
		selm.style.left = elm.x;
		selm.style.width = elm.width;
		selm.style.height = elm.height;
		selm.style.backgroundColor = elm.bgcolor;
		selm.style.color = elm.txtcolor;
		selm.style.border = elm.linecolor;
		selm.style.position = "absolute";
		selm.style.opacity = elm.opacity;
	}	
	
}