﻿/*<!-------------------------------------------------------------------------------------------------
JSクラス
-------------------------------------------------------------------------------------------------->*/
if(typeof(unit_doc_head) != "object"){
	var unit_doc_head = new Object();
}

/*<!-------------------------------------------------------------------------------------------------
表示切替
	name="id" type="string" required="yes" displayname="表示切替を行う要素のID属性名" hint=""
-------------------------------------------------------------------------------------------------->*/
unit_doc_head.dspChange = function (arguments){
	<!--- local変数 --->
	var local = new Object();
	<!--- result変数 --->
	var result = "";
	<!--- 表示切替 --->
	if(unit_doc_head.getById({id:arguments.id}).style.display == "none"){
		unit_doc_head.getById({id:arguments.id}).style.display = "block";
		result = "block";
	} else {
		unit_doc_head.getById({id:arguments.id}).style.display = "none";
		result = "none";
	}
	return result;
}

/*<!-------------------------------------------------------------------------------------------------
ドキュメント要素の特定のIDを持つオブジェクトを取得
	name="id" type="string" required="yes" displayname="ドキュメント要素のID属性値" hint=""
-------------------------------------------------------------------------------------------------->*/
unit_doc_head.getById = function (arguments){
	<!--- local変数 --->
	var local = new Object();
	/*<!---------------------------------------------
	オブジェクト取得
	---------------------------------------------->*/
	<!--- IE5+, Mozilla, Opera --->
	if(document.getElementById){
		return document.getElementById(arguments.id);
	<!--- IE4 --->
	}else if(document.all){
		return document.all(arguments.id);
	<!--- NN4 --->
	}else if(document.layers){
    return document.layers[arguments.id];
	}
  return null;
}

/*<!-------------------------------------------------------------------------------------------------
ログアウト
	name="name" type="string" required="yes" displayname="フォームのNAME属性値" hint=""
	name="event" type="string" required="yes" displayname="イベント値" hint=""
-------------------------------------------------------------------------------------------------->*/
unit_doc_head.logout = function (arguments){
	<!--- local変数 --->
	var local = new Object();
	<!--- result変数 --->
	var result = true;
	<!--- ロケーション --->
	if(confirm("ログアウトします\nよろしいですか？")){
		unit_doc_head.setFValLocate(arguments);
	}
}

/*<!-------------------------------------------------------------------------------------------------
SWFファイルをロード
	name="id" type="string" required="yes" displayname="OBJECTタグのID属性値" hint=""
	name="name" type="string" required="yes" displayname="OBJECTタグのNAME属性値" hint=""
	name="movie" type="string" required="yes" displayname="SWFの相対パス" hint=""
	name="width" type="string" required="yes" displayname="SWFの幅" hint=""
	name="height" type="string" required="yes" displayname="SWFの高さ" hint=""
	name="alt" type="string" required="no" default="" displayname="ALT属性値" hint=""
	name="title" type="string" required="no" default="" displayname="TITLE属性値" hint=""
	name="base" type="string" required="no" default="" displayname="SWF内の相対パス指定の基準になるディレクトリやURL" hint=""
	name="flashvars" type="string" required="no" default="" displayname="SWFへの引数値" hint=""
-------------------------------------------------------------------------------------------------->*/
unit_doc_head.loadSWF = function (arguments){
	<!--- local変数 --->
	var local = new Object();
	<!--- result変数 --->
	var result = true;
	/*<!---------------------------------------------
	引数初期設定
	---------------------------------------------->*/
	if(typeof(arguments.alt) != "string"){
		arguments.alt = "";
	}
	if(typeof(arguments.title) != "string"){
		arguments.title = "";
	}
	if(typeof(arguments.base) != "string"){
		arguments.base = "";
	}
	if(typeof(arguments.flashvars) != "string"){
		arguments.flashvars = "";
	}
	/*<!---------------------------------------------
	ロード
		codebase
			基底URI
		classid
			実行ファイル識別値
		pluginspage
			Flash Playerプラグインがインストールされていない場合のDLサイト
		allowscriptaccess
			HTMLとのデータ通信( always(never)=JavaScriptの実行を常に許可, sameDomain=同一のドメイン上のJavaScriptの実行を許可 )
		bgcolor
			SWFの背景色
		play
			ロード再生( false:ロード後に再生を行わない, true=ロード後に再生を行う )
		loop
			ループ再生( false=ループ再生を行わない, true=ループ再生を行う )
		menu
			右クリックメニュー表示( false=右クリックメニューを対応しない, true=右クリックメニューを対応 )
		devicefont
			デバイスフォント( false=デバイスフォントを使用しない, true=デバイスフォントを使用 )
		quality
			SWFの画質( low=低, autolow=自動/低, autohigh=自動/高, medium=中, high=高, best=品質優先 )
		wmode
			ウィンドウモード( opaque=不透明表示, transparent=透明表示 )
		align
			HTMLの位置( top=上揃え, middle=中央揃え, bottom=下揃え, left=左揃え, right=右揃え )
		scale
			伸縮( noborder=枠なし, exactfit=フィット, noscale=拡大縮小なし )
		salign
			Flashの位置( l=左, r=右, t=上段, b=下段 )
	---------------------------------------------->*/
	local.topDepth = "";
	for(local.i=0; local.i<eventURL_maxDepth-1; local.i++){
		if(local.i > 0){
			local.topDepth += "/";
		}
		local.topDepth += "..";
	}
	document.write('<object id="'+arguments.id+'" name="'+arguments.name+'" width="'+arguments.width+'" height="'+arguments.height+'" alt="'+arguments.alt+'" title="'+arguments.title+'" codebase="'+document.location.protocol+'://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" align="middle">');
	document.write('	<param name="movie" value="'+local.topDepth+arguments.movie+'" />');
	document.write('	<param name="base" value="'+arguments.base+'" />');
	document.write('	<param name="flashvars" value="'+arguments.flashvars+'" />');
	document.write('	<param name="allowscriptaccess" value="sameDomain" />');
	document.write('	<param name="bgcolor" value="#ffffff" />');
	<!--- document.write('	<param name="play" value="" />'); --->
	<!--- document.write('	<param name="loop" value="" />'); --->
	<!--- document.write('	<param name="menu" value="" />'); --->
	<!--- document.write('	<param name="devicefont" value="" /> />'); --->
	document.write('	<param name="quality" value="high" />');
	document.write('	<param name="wmode" value="transparent" />');
	document.write('	<param name="scale" value="noscale" />');
	<!--- document.write('	<param name="salign" value="" />'); --->
	document.write('	<embed src="'+local.topDepth+arguments.movie+'" name="'+arguments.movie.split("/").pop().split(".swf").join("")+'" width="'+arguments.width+'" height="'+arguments.height+'" base="'+arguments.base+'" flashvars="'+arguments.flashvars+'" allowscriptaccess="sameDomain" bgcolor="#ffffff" quality="high" wmode="transparent" scale="noscale" align="middle" pluginspage="'+document.location.protocol+'://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" />');
	document.write('</object>');
	return result;
}

/*<!-------------------------------------------------------------------------------------------------
指定のフォーム値を代入してからのロケーション設定
	※旧イベント可変型サブミットアクション( unit_doc_head.submitEventAct() )
	name="name" type="string" required="yes" displayname="フォームのNAME属性値" hint=""
	name="item" type="struct" required="yes" displayname="フォーム用要素代入値" hint=""
	name="event" type="string" required="false" displayname="イベント値" hint="action値が無い場合は必須( event, action値両方の指定も可能 )"
	name="action" type="string" required="false" displayname="サブミットアクション" hint="event値が無い場合は必須( event, action値両方の指定も可能 )"
	name="mc" type="any" required="false" displayname="メソッドコール要素のオブジェクト" hint=""
	name="target" type="string" required="false" displayname="サブミットターゲット" hint=""
-------------------------------------------------------------------------------------------------->*/
unit_doc_head.setFValLocate = function (arguments){
	<!--- local変数 --->
	var local = new Object();
	<!--- result変数 --->
	var result = true;
	<!--- 代入 --->
	for(local.key in arguments.item){
		document[arguments.name][local.key].value = arguments.item[local.key];
	}
	<!--- ロケーション --->
	if(typeof(arguments.event) == "string"){
		document[arguments.name][eventParameter].value = arguments.event;
	}
	if(typeof(arguments.action) == "string"){
		document[arguments.name].action = arguments.action;
	}
	if(typeof(arguments.mc) == "object"){
		if(typeof(arguments.mc.href) == "string"){
			arguments.mc.removeAttribute("href");
		}
		if(typeof(arguments.mc.onclick) == "function"){
			arguments.mc.removeAttribute("onclick");
		}
		if(typeof(arguments.mc.disabled) == "string"){
			arguments.mc.disabled = false;
		}
	}
	if(typeof(arguments.target) == "string"){
		document[arguments.name].target = arguments.target;
	} else {
		document[arguments.name].target = "_self";
	}
	document[arguments.name].submit();
	return result;
}

/*<!-------------------------------------------------------------------------------------------------
リストに文字列を追加
	name="list" type="string" required="yes" displayname="付加するリスト" hint=""
	name="value" type="string" required="yes" displayname="付加する文字列" hint=""
	name="delimiters" type="string" required="yes" displayname="リストの区切り文字列" hint="初期値=,"
-------------------------------------------------------------------------------------------------->*/
unit_doc_head.ListAppend = function (arguments){
	<!--- local変数 --->
	var local = new Object();
	<!--- result変数 --->
	var result = arguments.list;
	<!--- 追加 --->
	if(typeof(arguments.delimiters) != "string"){
		arguments.delimiters = ",";
	}
	if(result != ""){
		result += arguments.delimiters;
	}
	result += arguments.value;
	return result;
}

/*<!-------------------------------------------------------------------------------------------------
指定された値が出現する最初のリスト要素のインデックスを検索
	name="list" type="string" required="yes" displayname="検索するリスト" hint=""
	name="value" type="string" required="yes" displayname="検索する文字列" hint=""
	name="delimiters" type="string" required="yes" displayname="リストの区切り文字列" hint="初期値=,"
-------------------------------------------------------------------------------------------------->*/
unit_doc_head.ListFindNoCase = function (arguments){
	<!--- local変数 --->
	var local = new Object();
	<!--- result変数 --->
	var result = -1;
	<!--- 検索 --->
	if(typeof(arguments.delimiters) != "string"){
		arguments.delimiters = ",";
	}
	local.arr = arguments.list.split(arguments.delimiters);
	for(local.i=0; local.i<local.arr.length; local.i++){
		if(local.arr[local.i].search(new RegExp(arguments.value, "i")) > -1){
			result = local.i;
			break;
		}
	}
	return result;
}

/*<!-------------------------------------------------------------------------------------------------
リストから要素を削除
	name="list" type="string" required="yes" displayname="削除するリスト" hint=""
	name="position" type="numeric" required="yes" displayname="削除するリストポジション" hint=""
	name="delimiters" type="string" required="yes" displayname="リストの区切り文字列" hint="初期値=,"
-------------------------------------------------------------------------------------------------->*/
unit_doc_head.ListDeleteAt = function (arguments){
	<!--- local変数 --->
	var local = new Object();
	<!--- result変数 --->
	var result = "";
	<!--- 削除 --->
	if(typeof(arguments.delimiters) != "string"){
		arguments.delimiters = ",";
	}
	local.arr = arguments.list.split(arguments.delimiters);
	if(arguments.position > -1){
		local.arr.splice(arguments.position, 1, "");
	}
	for(local.i=0; local.i<local.arr.length; local.i++){
		if(result != ""){
			result += arguments.delimiters;
		}
		result += local.arr[local.i];
	}
	return result;
}