// ****************************************************************************
// 初期設定・グローバル変数宣言
// ****************************************************************************

var timerID = ""; // 遅延消去用のタイマー宣言;
var xpos = 0;     // ポップアップメニューの X座標;
var ypos = 0;     // ポップアップメニューの Y座標;
var tObj;         // ポップアップメニューのオブジェクト;
var xObj;         // 元メニューのオブジェクト;


// ****************************************************************************
// ポップアップメニュー表示スクリプト
// ****************************************************************************

function mn(n,m){
	if(timerID!=""){
		clearTimeout(timerID);
	}
	dlt2();
	tObj = "";
	xObj = "";
	xpos = 0;
	ypos = 0;
	tObj = document.getElementById(n);
	xObj = document.getElementById(m);
	tObj.style.visibility="visible";
	getXpos(xObj);
	getYpos(xObj);
	ypos += xObj.offsetHeight;
	tObj.style.left = xpos + "px";
	tObj.style.top = ypos + "px";
	tObj.style.zIndex = "1";
}


// ****************************************************************************
// ポップアップメニュー表示スクリプト（一番後ろの部分）
// ****************************************************************************

function last(n,m){
	if(timerID!=""){
		clearTimeout(timerID);
	}
	dlt2();
	tObj = "";
	xObj = "";
	xpos = 0;
	ypos = 0;
	tObj = document.getElementById(n);
	xObj = document.getElementById(m);
	tObj.style.visibility="visible";
	getXpos(xObj);
	getYpos(xObj);
	ypos += xObj.offsetHeight;
	xpos = xpos - 0;
	tObj.style.left = xpos + "px";
	tObj.style.top = ypos + "px";
	tObj.style.zIndex = "1";
}
//上記の xpos = xpos - ●● の部分に第一階層ボタンと第二階層目のボタンのワイドの差を挿入


// ****************************************************************************
// 消去用遅延スクリプト（タイマー）
// ****************************************************************************

function dlt(){
	if(timerID!=""){clearTimeout(timerID);}
	timerID = setTimeout("dlt2()",500);
}
// 上記の右端の数値(500)は、マウスが離れてからメニュー表示が消えるまでの時間(0.5秒)を示す
// （1000で1秒）


// ****************************************************************************
// 消去用スクリプト本体
// ****************************************************************************

function dlt2(){
	var dval;
	var tval;
	for (i=1;i<5;i++){
	// 上記の中央の数値(7)は、元メニューの数に「1」を加えた数を記入する

		dval = "dv" + i;
		tval = "td" + i;
		document.getElementById(dval).style.visibility = "hidden";
		document.getElementById(dval).style.zIndex = "0";
	}
}


// ****************************************************************************
// 元メニュー位置検出（X座標）
// ****************************************************************************

function getXpos(obj){
	xpos = obj.offsetLeft;
	if(obj.offsetParent != null){
		xpos += getXpos(obj.offsetParent);
	}
	return xpos;
}


// ****************************************************************************
// 元メニュー位置検出（Y座標）
// ****************************************************************************

function getYpos(obj){
	ypos = obj.offsetTop;
	if(obj.offsetParent != null){
		ypos += getYpos(obj.offsetParent);
	}
	return ypos;
}


// ****************************************************************************
// ロールオーバー等の処理
// ****************************************************************************

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//ポップアップウィンドウの表示

function WO(window_open,x,y,win_name,tool,loca,stat,menu,scroll)

	 {

	var open_win;

	open_win=window.open(window_open,win_name,"width="+x+",height="+y+",toolbar="+tool+",location="+loca+",directories=no,status="+stat+",menubar="+menu+",scrollbars="+scroll);

	open_win.focus();

	}
	
	function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->