/*=================================================================
      D-HTML TIP HELP  ==== CopyRight (C) 2001 HP-DESIGN.NET
===                    ==== URL : http://hp-design.net/
===                    === 
===                    === 
===                    ===
====  No reproduction, No republication without written permission.
====  無断転載・配付は禁止です。この著作権表示を消さない事！
========================================================*/

// Browser Checker
bsDOM=document.getElementById?1:0;
IE=(document.all)?1:0;
IE5=(IE&&bsDOM)?1:0;
NN4=(document.layers)?1:0;
NN6=(bsDOM&&!IE)?1:0;

mx=0;my=0;n=0;scrspeed=0;spd=80;timeID=setTimeout("",80);tiphelpstyle=0;

if (NN4 || NN6) { document.captureEvents(Event.MOUSEMOVE) }
function GetM(e){
	if (NN4 || NN6) { mx=e.pageX;my=e.pageY; }
	if (IE) { mx=event.clientX+document.body.scrollLeft;my=event.clientY+document.body.scrollTop; }
}
document.onmousemove = GetM;

function GetScreenWH() {
	if (IE) { WinWidth=document.body.clientWidth;WinHeight=document.body.clientHeight; }
	if (NN4 || NN6) { WinWidth=innerWidth;WinHeight=innerHeight;}
}

function tiphelp(n,style){
	if (IE || NN6) {tiphelpdiv=IE?document.all("LINKMSG"):NN6?document.getElementById("LINKMSG"):0;}
	if (NN4) {tiphelplayer=document.layers["LINKMSG-NN4"]}
	ex=mx+tx;ey=my+ty;GetScreenWH();
	if(style==6){x=ex;y=ey;TipShow(n);MoverTIP();}
	if(style==5){var randomn=Math.ceil(Math.random()*4);tiphelpstyle=randomn;TipStyle(n);}
	if((style!=5)&&(style!=6)){tiphelpstyle=style;TipStyle(n);}	
}

function TipShow(n) {
	if (IE || NN6) {
		tiphelpdiv.style.top=x;tiphelpdiv.style.left=y;
		tiphelpdiv.innerHTML=msg[n];
		tiphelpdiv.style.color=ftcolor;tiphelpdiv.style.fontSize=fontsize;
		tiphelpdiv.style.backgroundColor=bgcolor;
		tiphelpdiv.style.width=tipwidth;tiphelpdiv.style.visibility="visible";
	}
	if (NN4) {
		tiphelplayer.moveTo(x,y);
		tiphelplayer.document.open();
		tiphelplayer.document.write("<FONT STYLE='color:"+ftcolor+";font-size:"+fontsize+";'>");
		tiphelplayer.document.write( msg[n] );
		tiphelplayer.document.write("</FONT>");
		tiphelplayer.document.close();
		tiphelplayer.bgColor=bgcolor;
		tiphelplayer.width=tipwidth;
		tiphelplayer.visibility = "show";
	}
}

function TipStyle(n) {
	if(tiphelpstyle==1){ x=ex;y=ey+WinHeight;TipShow(n);MoveUP() }
	if(tiphelpstyle==2){ x=ex;y=ey-WinHeight;TipShow(n);MoveDOWN() }
	if(tiphelpstyle==3){ x=ex-WinWidth;y=ey;TipShow(n);MoveRIGHT() }
	if(tiphelpstyle==4){ x=ex+WinWidth;y=ey;TipShow(n);MoveLEFT() }
}

function MoveUP() {
	yd=Math.abs(y-ey);yp=yd*0.2;scrspeed=yp;
	y-=scrspeed;if(y<=ey){EndMove()}
	MoverTIP();timeID=setTimeout("MoveUP()",spd)
}
function MoveDOWN() {
	yd=Math.abs(y-ey);yp=yd*0.2;scrspeed=yp;
	y+=scrspeed;if(y>=ey){EndMove()}
	MoverTIP();timeID=setTimeout("MoveDOWN()",spd)
}
function MoveRIGHT() {
	xd=Math.abs(x-ex);xp=xd*0.2;scrspeed=xp;
	x+=scrspeed;if(x>=ex){EndMove()}
	MoverTIP();timeID=setTimeout("MoveRIGHT()",spd)
}
function MoveLEFT() {
	xd=Math.abs(x-ex);xp=xd*0.2;scrspeed=xp;
	x-=scrspeed;if(x<=ex){EndMove()}
	MoverTIP();timeID=setTimeout("MoveLEFT()",spd)
}

function EndMove() {
	e=ex;y=ey;
	clearTimeout(timeID)
}

function MoverTIP() {
	if(IE || NN6){tiphelpdiv.style.top=y;tiphelpdiv.style.left=x}
	if(NN4){ tiphelplayer.moveTo(x,y)}
}

function tipclose(n){
	if (IE || NN6) {
		tiphelpdiv=IE?document.all("LINKMSG"):NN6?document.getElementById("LINKMSG"):0;
		tiphelpdiv.style.visibility="hidden";tiphelpdiv.style.top=-500;tiphelpdiv.style.left=-500;
	}
	if (NN4) { document.layers["LINKMSG-NN4"].visibility = "hide"; }
	clearTimeout(timeID);
}
