/* メニュー作成支援ツール２号 */

var garyMenu = new Array();
var garyMenuObj = new Array(20);
var gidTimer;

function mbSetMenu
( pidMbtn, pidMenu, pflgButton, pstrDirect, pflgTimer, plngSecond
	, pstrMFFlg, pstrMFClr1, pstrMFClr2, pstrMBFlg, pstrMBClr1, pstrMBClr2
	, pstrIFFlg, pstrIFClr1, pstrIFClr2, pstrIBFlg, pstrIBClr1, pstrIBClr2 ){
	var wflgFound;
	var wflgTimer;

	wflgFound = false;
	wflgTimer = false;
	for( var wCnt=0 ; wCnt<garyMenuObj.length ; wCnt++ ){
		if( garyMenuObj[wCnt] == null ){
			if( wflgFound == false ){
				garyMenuObj[wCnt] = new MenuButton(pidMbtn,pidMenu);
				with( garyMenuObj[wCnt] ){
					setButton( pflgButton );
					setDirect( pstrDirect );
					setTimer( pflgTimer, plngSecond );
					setMbtnForeColor( pstrMFFlg, pstrMFClr1, pstrMFClr2 );
					setMbtnBackColor( pstrMBFlg, pstrMBClr1, pstrMBClr2 );
					setItemForeColor( pstrIFFlg, pstrIFClr1, pstrIFClr2 );
					setItemBackColor( pstrIBFlg, pstrIBClr1, pstrIBClr2 );
				}
				garyMenu[pidMbtn] = garyMenuObj[wCnt];
			}
			break;
		}else{
			if( garyMenuObj[wCnt].getMbtnID() == pidMbtn ){
				wflgFound = true;
			}else{
				garyMenuObj[wCnt].Close();
			}
			if( garyMenuObj[wCnt].getTimerEnable == true ){
				wflgTimer = true;
			}
		}
	}

	if( wflgTimer == true || pflgTimer == true ){
		if( gidTimer == null ){
			gidTimer = setInterval("mbMenuTimer();", 1000)
		}
	}else if( wflgTimer == false && pflgTimer == false ){
		if( gidTimer != null ){
			clearInterval(gidTimer);
			gidTimer = null;
		}
	}
}
function mbAutoMenu( pidMbtn ){
	garyMenu[pidMbtn].Auto();
}
function mbOpenMenu( pidMbtn ){
	garyMenu[pidMbtn].Open();
}
function mbCloseMenu( pidMbtn ){
	garyMenu[pidMbtn].Close();
}
function mbSetClose( pidMbtn ){
	try{
		garyMenu[pidMbtn].setClose();
	}catch( e ){}
}
function mbMenuTimer(){
	var wlngCnt;

	for( var wCnt=0 ; wCnt<garyMenuObj.length ; wCnt++ ){
		if( garyMenuObj[wCnt] == null ){
			break;
		}else{
			garyMenuObj[wCnt].Wait();
		}
	}
}

// メニューボタンクラス
function MenuButton( pidMbtn, pidMenu ){
	this.midMbtn = pidMbtn;
	this.midMenu = pidMenu;
	this.mflgButton = false;
	this.mstrDirect = "bottom";
	this.mflgExtend = true;

// タイマー関連
	this.mmapTimer = new Array();
	this.mmapTimer["use"]	= false;
	this.mmapTimer["sec"]	= 10;
	this.mmapTimer["wait"]= 0;

// 色関連
	this.mmapColor = new Array();
	this.mmapColor["MbtnForeFlg"]	= false;
	this.mmapColor["MbtnForeOut"]	= "";
	this.mmapColor["MbtnForeOver"]= "";
	this.mmapColor["MbtnBackFlg"]	= false;
	this.mmapColor["MbtnBackOut"]	= "";
	this.mmapColor["MbtnBackOver"]= "";
	this.mmapColor["ItemForeFlg"]	= false;
	this.mmapColor["ItemForeOut"]	= "";
	this.mmapColor["ItemForeOver"]= "";
	this.mmapColor["ItemBackFlg"]	= false;
	this.mmapColor["ItemBackOut"]	= "";
	this.mmapColor["ItemBackOver"]= "";


// メニューボタン押下時スタイル設定メソッド
	this.setButton = function( pflgBtn ){
		var wflgRet = false;

		if( pflgBtn == true || pflgBtn == false ){
			this.mflgButton = pflgBtn;
			wflgRet = true;
		}

		return wflgRet;
	}
// 表示方向設定メソッド
	this.setDirect = function( pstrDirect ){
		var wstrDir = pstrDirect.toLowerCase();
		var wflgRet = false;

		if( wstrDir == "top" || wstrDir	== "right" || wstrDir	== "bottom" || wstrDir	== "left" ){
			this.mstrDirect = wstrDir;
			wflgRet = true;
		}else{
			wflgRet = false;
		}

		return wflgRet;
	}
// タイマー設定メソッド
	this.setTimer = function(){
		var wflgRet = false;

		if( 0 < arguments.length && arguments.length < 3 ){
			if( arguments[0] == true || arguments[0] == false &&	0 < arguments[1] && arguments[1] < 600 ){
				switch( arguments.length ){
					case 2:
						this.mmapTimer["sec"]	= arguments[1];
					case 1:
						this.mmapTimer["use"]	= arguments[0];
						wflgRet = true;
				}
			}
		}

		return wflgRet;
	}
// Mbtn文字色設定メソッド
	this.setMbtnForeColor = function(){
		var wflgRet = false;

		if( 0 < arguments.length && arguments.length < 4 ){
			if( arguments[0] == true || arguments[0] == false ){
				switch( arguments.length ){
					case 3:
						this.mmapColor["MbtnForeOver"]	= arguments[2];
					case 2:
						this.mmapColor["MbtnForeOut"]	= arguments[1];
					case 1:
						this.mmapColor["MbtnForeFlg"]	= arguments[0];
						wflgRet = true;
				}
			}
		}

		return wflgRet;
	}
// Mbtn背景色設定メソッド
	this.setMbtnBackColor = function(){
		var wflgRet = false;

		if( 0 < arguments.length && arguments.length < 4 ){
			if( arguments[0] == true || arguments[0] == false ){
				switch( arguments.length ){
					case 3:
						this.mmapColor["MbtnBackOver"]	= arguments[2];
					case 2:
						this.mmapColor["MbtnBackOut"]	= arguments[1];
					case 1:
						this.mmapColor["MbtnBackFlg"]	= arguments[0];
						wflgRet = true;
				}
			}
		}

		return wflgRet;
	}
// Item文字色設定メソッド
	this.setItemForeColor = function(){
		var wflgRet = false;

		if( 0 < arguments.length && arguments.length < 4 ){
			if( arguments[0] == true || arguments[0] == false ){
				switch( arguments.length ){
					case 3:
						this.mmapColor["ItemForeOver"]	= arguments[2];
					case 2:
						this.mmapColor["ItemForeOut"]	= arguments[1];
					case 1:
						this.mmapColor["ItemForeFlg"]	= arguments[0];
						wflgRet = true;
				}
			}
		}

		return wflgRet;
	}
// Item背景色設定メソッド
	this.setItemBackColor = function(){
		var wflgRet = false;

		if( 0 < arguments.length && arguments.length < 4 ){
			if( arguments[0] == true || arguments[0] == false ){
				switch( arguments.length ){
					case 3:
						this.mmapColor["ItemBackOver"]	= arguments[2];
					case 2:
						this.mmapColor["ItemBackOut"]	= arguments[1];
					case 1:
						this.mmapColor["ItemBackFlg"]	= arguments[0];
						wflgRet = true;
				}
			}
		}

		return wflgRet;
	}
// 取得系メソッド
	this.getMbtnID	= function(){return this.midMbtn;}
	this.getMenuID	= function(){return this.midMenu;}
	this.getButton	= function(){return this.mflgButton;}
	this.getDirect	= function(){return this.mstrDirect;}
	this.getExtend	= function(){return this.mflgExtend;}
	this.getTimerEnable	= function(){return this.mmapTimer["use"];}
	this.getTimerSecond	= function(){return this.mmapTimer["sec"];}
	this.getTimerRemain	= function(){return this.mmapTimer["wait"];}
	this.getMbtnForeEnable= function(){return this.mmapColor["MbtnForeFlg"];}
	this.getMbtnForeMOut	= function(){return this.mmapColor["MbtnForeOut"];}
	this.getMbtnForeMOver	= function(){return this.mmapColor["MbtnForeOver"];}
	this.getMbtnBackEnable= function(){return this.mmapColor["MbtnBackFlg"];}
	this.getMbtnBackMOut	= function(){return this.mmapColor["MbtnBackOut"];}
	this.getMbtnBackMOver	= function(){return this.mmapColor["MbtnBackOver"];}
	this.getItemForeEnable= function(){return this.mmapColor["ItemForeFlg"];}
	this.getItemForeMOut	= function(){return this.mmapColor["ItemForeOut"];}
	this.getItemForeMOver	= function(){return this.mmapColor["ItemForeOver"];}
	this.getItemBackEnable= function(){return this.mmapColor["ItemBackFlg"];}
	this.getItemBackMOut	= function(){return this.mmapColor["ItemBackOut"];}
	this.getItemBackMOver	= function(){return this.mmapColor["ItemBackOver"];}
// タイマー
	this.Wait = function(){
		if( this.mmapTimer["use"] == true ){
			if( this.mflgExtend == true ){
				if( this.mmapTimer["wait"] > 0 ){
					this.mmapTimer["wait"] -= 1;
				}else{
					this.Close();
				}
			}
		}
	}
// メニュー開
	this.Open = function(){
		var welmMbtn
		var welmMenu;
		var welmTmp, wlngTop, wlngLeft;

		welmMbtn = document.getElementById(this.midMbtn);
		welmMenu = document.getElementById(this.midMenu);

		if( !welmMenu.hasChildNodes() ){
			return;
		}

		welmTmp	= welmMbtn;
		wlngTop	= 0;
		wlngLeft = 0;
		while( welmTmp != document.body ){
			wlngTop	+= welmTmp.offsetTop;
			wlngLeft += welmTmp.offsetLeft;
			welmTmp	=	welmTmp.offsetParent;
		}

		this.fncHide(welmMenu);
		with( welmMenu.style ){
			display	= "block";
			switch( this.mstrDirect ){
				case "top":
//					top	= welmMbtn.offsetTop - welmMenu.offsetHeight - 1;
//					left = welmMbtn.offsetLeft;
					top	= wlngTop - welmMenu.offsetHeight - 1;
					left = wlngLeft;
					break;
				case "right":
//					top	= welmMbtn.offsetTop;
//					left = welmMbtn.offsetLeft + welmMbtn.offsetWidth + 1;
					top	= wlngTop;
					left = wlngLeft + welmMbtn.offsetWidth + 1;
					break;
				case "bottom":
//					top	= welmMbtn.offsetTop + welmMbtn.offsetHeight + 1;
//					left = welmMbtn.offsetLeft;
					top	= wlngTop + welmMbtn.offsetHeight + 1;
					left = wlngLeft;
					break;
				case "left":
//					top	= welmMbtn.offsetTop;
//					left = welmMbtn.offsetLeft - welmMenu.offsetWidth - 1;
					top	= wlngTop;
					left = wlngLeft - welmMenu.offsetWidth - 1;
					break;
			}
		}
//		if( this.mflgButton == true ){
			welmMbtn.style.borderStyle = "";
//	}else{
		if( this.mflgButton != true ){
			welmMbtn.focus();
		}
		if( this.mmapColor["MbtnForeFlg"] == true ){
			welmMbtn.style.color = this.mmapColor["MbtnForeOver"];
		}
		if( this.mmapColor["MbtnBackFlg"] == true ){
			welmMbtn.style.backgroundColor = this.mmapColor["MbtnBackOver"];
		}
		if( this.mmapTimer["use"] == true ){
			this.mmapTimer["wait"] = this.mmapTimer["sec"];
		}
		this.mflgExtend = true;
	}
// メニュー閉
	this.Close = function(){
		var welmMbtn
		var welmMenu;

		welmMbtn = document.getElementById(this.midMbtn);
		welmMenu = document.getElementById(this.midMenu);

		this.fncHide(welmMenu);
		welmMenu.style.display = "none";
//		if( this.mflgButton == true ){
			welmMbtn.style.borderStyle = "";
//		}
		if( this.mmapColor["MbtnForeFlg"] == true ){
			welmMbtn.style.color = this.mmapColor["MbtnForeOut"];
		}
		if( this.mmapColor["MbtnBackFlg"] == true ){
			welmMbtn.style.backgroundColor = this.mmapColor["MbtnBackOut"];
		}
		if( this.mmapTimer["use"] == true ){
			this.mmapTimer["wait"] = 0;
		}
		this.mflgExtend = false;
	}
// メニュー開閉動作
	this.Auto = function(){
		var welmMenu;

		welmMenu = document.getElementById(this.midMenu);

		if( welmMenu.style.display != "block" ){
			this.Open();
		}else{
			this.Close();
		}
	}
// フォーカス解除時にメニューを閉める
	this.setClose = function(){
		setTimeout("garyMenu['" + this.midMbtn + "'].Close();",200);
	}
// リスト要素選択時の動作
	this.actList = function( pidList, pelmThis ){
		this.fncHide(pelmThis.parentNode);
		with( pelmThis.style ){
			if( this.mmapColor["ItemForeFlg"] == true ){
				color		= this.mmapColor["ItemForeOver"];
			}
			if( this.mmapColor["ItemBackFlg"] == true ){
				backgroundColor	= this.mmapColor["ItemBackOver"];
			}
		}

		with( document.getElementById(pidList).style ){
			display	= "block";
			switch( this.mstrDirect ){
				case "top":
					top	= pelmThis.offsetTop + pelmThis.offsetHeight - document.getElementById(pidList).offsetHeight;
					left = pelmThis.offsetLeft + pelmThis.offsetWidth;
					break;
				case "right":
					top	= pelmThis.offsetTop;
					left = pelmThis.offsetLeft + pelmThis.offsetWidth;
					break;
				case "bottom":
					top	= pelmThis.offsetTop;
					left = pelmThis.offsetLeft + pelmThis.offsetWidth;
					break;
				case "left":
					top	= pelmThis.offsetTop;
					left = pelmThis.offsetLeft - pelmThis.offsetWidth;
					break;
			}
		}

		if( this.mmapTimer["use"] == true ){
			this.mmapTimer["wait"] = this.mmapTimer["sec"];
		}
	}
	this.actLink = function( pelmThis ){
		this.fncHide(pelmThis.parentNode);
		with( pelmThis.style ){
			if( this.mmapColor["ItemForeFlg"] == true ){
				color		= this.mmapColor["ItemForeOver"];
			}
			if( this.mmapColor["ItemBackFlg"] == true ){
				backgroundColor	= this.mmapColor["ItemBackOver"];
			}
		}

		if( this.mmapTimer["use"] == true ){
			this.mmapTimer["wait"] = this.mmapTimer["sec"];
		}
	}
// リストを隠す
	this.fncHide = function( pelmThis ){
		var wlngCnt;
		var wndlElm;

		wndlElm = pelmThis.childNodes;
		for( wlngCnt = wndlElm.length-1 ; wlngCnt>=0 ; wlngCnt-- ){
			switch( wndlElm.item(wlngCnt).nodeName.toLowerCase() ){
				case "div":
					this.fncHide( wndlElm.item(wlngCnt) );
					wndlElm.item(wlngCnt).style.display = "none";
					break;
				case "a":
					with( wndlElm.item(wlngCnt).style ){
						if( this.mmapColor["ItemForeFlg"] == true ){
							color		= this.mmapColor["ItemForeOut"];
						}
						if( this.mmapColor["ItemBackFlg"] == true ){
							backgroundColor	= this.mmapColor["ItemBackOut"];
						}
					}
					break;
			}
		}
	}
}

function writeMenu(){
document.write('<table border="0" cellspacing=0 style="color:white;width:730px;border-top:solid 0px white;border-bottom:solid 2px lightgrey;"><tr><td style="width:110px;"><div id="mbbecskybca" class="mbMbtn" onmouseover="mbSetMenu(\'mbbecskybca\',\'mbtecskybck\',false,\'right\',false,10,true,\'#FFFFFF\',\'#FFFFFF\',true,\'transparent\',\'#4169E1\',true,\'#696969\',\'#FFFFFF\',true,\'#FFFFFF\',\'#4169E1\');mbOpenMenu(\'mbbecskybca\');"  onclick="window.open(\'http://www.hnrc.jp/index.html\',\'_self\');" onblur="mbSetClose(\'mbbecskybca\');">HOME</div></td><td>|</td><td><div id="mbbecsl2q4a" class="mbMbtn" onclick="mbSetMenu(\'mbbecsl2q4a\',\'mbtecsl2q4a\',true,\'bottom\',true,5,true,\'#FFFFFF\',\'#FFFFFF\',true,\'transparent\',\'#4169E1\',true,\'#696969\',\'#FFFFFF\',true,\'#FFFFFF\',\'#4169E1\');mbAutoMenu(\'mbbecsl2q4a\');" onblur="mbSetClose(\'mbbecsl2q4a\');">ロータリーとは</div></td><td>|</td><td><div id="mbbecsl5rsg" class="mbMbtn" onclick="mbSetMenu(\'mbbecsl5rsg\',\'mbtecsl5rsg\',true,\'bottom\',true,5,true,\'#FFFFFF\',\'#FFFFFF\',true,\'transparent\',\'#4169E1\',true,\'#696969\',\'#FFFFFF\',true,\'#FFFFFF\',\'#4169E1\');mbAutoMenu(\'mbbecsl5rsg\');" onblur="mbSetClose(\'mbbecsl5rsg\');">広島北RCの活動</div></td><td>|</td><td><div id="mbbecslaz8s" class="mbMbtn" onmouseover="mbSetMenu(\'mbbecslaz8s\',\'mbtecslaz8s\',false,\'bottom\',false,10,true,\'#FFFFFF\',\'#FFFFFF\',true,\'transparent\',\'#4169E1\',true,\'#696969\',\'#FFFFFF\',true,\'#FFFFFF\',\'#4169E1\');mbOpenMenu(\'mbbecslaz8s\');" onclick="window.open(\'http://www.hnrc.jp/w-report/\',\'_self\');" onblur="mbSetClose(\'mbbecslaz8s\');">例会報告</div></td><td>|</td><td><div id="mbbecslank6" class="mbMbtn" onmouseover="mbSetMenu(\'mbbecslank6\',\'mbtecslank6\',false,\'bottom\',false,10,true,\'#FFFFFF\',\'#FFFFFF\',true,\'transparent\',\'#4169E1\',true,\'#696969\',\'#FFFFFF\',true,\'#FFFFFF\',\'#4169E1\');mbOpenMenu(\'mbbecslank6\');" onclick="window.open(\'http://www.hnrc.jp/member.php\',\'_self\');" onblur="mbSetClose(\'mbbecslank6\');">会員ページ</div></td><td>|</td><td><div id="mbbecslaz8s" class="mbMbtn" onmouseover="mbSetMenu(\'mbbecslaz8s\',\'mbtecslaz8s\',false,\'bottom\',false,10,true,\'#FFFFFF\',\'#FFFFFF\',true,\'transparent\',\'#4169E1\',true,\'#696969\',\'#FFFFFF\',true,\'#FFFFFF\',\'#4169E1\');mbOpenMenu(\'mbbecslaz8s\');" onclick="window.open(\'http://www.hnrc.jp/mail/index.html\',\'_self\');" onblur="mbSetClose(\'mbbecslaz8s\');">メール</div></td><td>|</td><td><div id="mbbecslbx3h" class="mbMbtn" onmouseover="mbSetMenu(\'mbbecslbx3h\',\'mbtecslbx3h\',false,\'bottom\',false,10,true,\'#FFFFFF\',\'#FFFFFF\',true,\'transparent\',\'#4169E1\',true,\'#696969\',\'#FFFFFF\',true,\'#FFFFFF\',\'#4169E1\');mbOpenMenu(\'mbbecslbx3h\');" onclick="window.open(\'http://www.hnrc.jp/link.html\',\'_self\');" onblur="mbSetClose(\'mbbecslbx3h\');">リンク</div></td><td width=10px>　</td></tr></table><div id="mbtecskybck" class="mbList"></div><div id="mbtecsl2q4a" class="mbList"><a class="mbItem" href="http://www.hnrc.jp/rotary.html" onmouseover="garyMenu[\'mbbecsl2q4a\'].actLink(this);">ロータリークラブの沿革</a><a class="mbItem" onmouseover="garyMenu[\'mbbecsl2q4a\'].actList(\'history\',this);">ロータリークラブの歴史</a><div id="history" class="mbList"><a class="mbItem" href="http://www.hnrc.jp/history_world.html" onmouseover="garyMenu[\'mbbecsl2q4a\'].actLink(this);">ロータリー年表</a><a class="mbItem" href="http://www.hnrc.jp/history_rchn.html" onmouseover="garyMenu[\'mbbecsl2q4a\'].actLink(this);">広島北ＲＣの歴史</a></div><a class="mbItem" href="http://www.hnrc.jp/gaiyo.html" onmouseover="garyMenu[\'mbbecsl2q4a\'].actLink(this);">広島北RCの概要</a></div><div id="mbtecsl5rsg" class="mbList"><a class="mbItem" href="http://www.hnrc.jp/president.html" onmouseover="garyMenu[\'mbbecsl5rsg\'].actLink(this);">会長方針</a><a class="mbItem"  href="http://www.hnrc.jp/activity/activity.php" onmouseover="garyMenu[\'mbbecsl5rsg\'].actList(\'katudo\',this);">社会奉仕活動</a><a class="mbItem" href="http://www.hnrc.jp/committee.html" onmouseover="garyMenu[\'mbbecsl5rsg\'].actLink(this);">委員会組織</a><a class="mbItem" onmouseover="garyMenu[\'mbbecsl5rsg\'].actList(\'mblecsl6aaa\',this);">行事予定</a><div id="mblecsl6aaa" class="mbList"><a class="mbItem" href="http://www.hnrc.jp/schedule/year.php" onmouseover="garyMenu[\'mbbecsl5rsg\'].actLink(this);">年間行事予定</a><a class="mbItem" href="http://www.hnrc.jp/schedule/month.php" onmouseover="garyMenu[\'mbbecsl5rsg\'].actLink(this);">月間スケジュール</a><a class="mbItem" href="http://www.hnrc.jp/schedule/etc.php" onmouseover="garyMenu[\'mbbecsl5rsg\'].actLink(this);">他クラブ情報</a></div><a class="mbItem" href="http://www.hnrc.jp/circle/" onmouseover="garyMenu[\'mbbecsl5rsg\'].actLink(this);">同好会情報</a></div><div id="mbtecslank6" class="mbList"></div><div id="mbtecslaz8s" class="mbList"></div><div id="mbtecslbx3h" class="mbList"></div>');
}
function writeFooter(){
document.write('Copyright 2006-2009 The Rotary Club of Hiroshima North All Rights Reserved.');
}
