//----------------------------------------------------------------------------------
//	チップヘルプ　IE/NN対応
//	実装方法
//	<STYLE type=text/css>
//		#helplay {LEFT: -100px; POSITION: absolute; TOP: -100px}
//	</STYLE>
//	<SPAN id=helplay></SPAN>
//	javascriptで外部変数を定義し、IDとメッセージをセット
//	var	msgTbl = Array("id1","msg-1","id2","msg-2",....);
//	onloadでinitHELP()を呼び出す
//	あとは、自動的に出る
//
//	★このスクリプトでは､onmouseoverとonmouseoutをハンドルしている
//
//----------------------------------------------------------------------------------
	var	cMsg = new Array();
	var offsetx=10;	//ヘルプ位置をマウスポインタから左右へ何ピクセル離すか
	var offsety=2;	//ヘルプ位置をマウスポインタから上下へ何ピクセル離すか
//--------------------------------------------------------------------
//	メッセージ本文の読み込み
//--------------------------------------------------------------------
function initHELP(){
	var	i;
	for (i=0;i<msgTbl.length;i+=2)
		cMsg[msgTbl[i]] = msgTbl[i+1];
}
//--------------------------------------------------------------------
//	マウス位置の取得
//--------------------------------------------------------------------
function getMouseX(){
	if(document.layers) return event.pageX;	//NN
	if(document.all)    return document.body.scrollLeft+event.clientX;
}
function getMouseY(){
	if(document.layers) return event.pageY;	//NN
	if(document.all)    return document.body.scrollTop+event.clientY;
}
//--------------------------------------------------------------------
//	ヘルプ表示オブジェクトの移動
//--------------------------------------------------------------------
function moveLAYER(x, y){
	if(document.layers) document.layers["helplay"].moveTo(x,y);	//NN用
	if(document.all)document.all.helplay.style.pixelLeft=x;	//IE用
	if(document.all)document.all.helplay.style.pixelTop=y;	//IE用
}
//--------------------------------------------------------------------
//	メッセージのセット
//--------------------------------------------------------------------
function outputLAYER(){
	var msg = "<meta http-equiv='Content-Type' content='text/html;charset=Shift_JIS'>" +
		"<TABLE BGCOLOR=#aaaaaa BORDER=0><TR><TD>" +
		"<TABLE BGCOLOR=#ccffcc BORDER=0><TR><TD>" +
		"<SPAN STYLE='font:10pt Osaka,Arial'>" +
		cMsg[event.srcElement.id] +
		"</SPAN></TD></TR></TABLE></TD></TR></TABLE>";

	if(document.layers) {		//NN用
		with(document.layers["helplay"].document){
			open();
			write(msg);
			close();
		}
	}
	if(document.all){			//IE用
		document.all.helplay.innerHTML = msg;
	}
}
//--------------------------------------------------------------------
//	マウスイベント処理
//--------------------------------------------------------------------
function showHELP(){
	if (event.srcElement == null) return;		//srcElementが無ければやらない
	if (event.srcElement.id == "") return;		//idが無ければやらない
	if (!cMsg[event.srcElement.id]) return;		//idに対応したメッセージが無ければやらない
	outputLAYER();
	moveLAYER((getMouseX()+offsetx),(getMouseY()+offsety))
}
//--------------------------------------------------------------------
//	マウスイベント処理
//--------------------------------------------------------------------
function hideHELP(e){
	moveLAYER(-100,-100)
	if(document.layers) {		//NN用
		with(document.layers["helplay"].document){
			open();
			write("");
			close();
		}
	}
	if(document.all){			//IE用
		document.all.helplay.innerHTML = "";
	}
}
	document.onmouseover = showHELP;
	document.onmouseout  = hideHELP;
