
ie4 = (document.all) ? true:false
ns4 = (document.layers) ? true:false

if (ie4)
{
	if (navigator.userAgent.indexOf('MSIE 5')>0) ie5 = true;
	else ie5 = false;
}
else ie5 = false;

var x = 0;
var y = 0;
var flag = 0;

if ( (ns4) || (ie4))
{
	if (ns4) over = document.overDiv
	if (ie4) over = overDiv.style
	document.onmousemove = MouseMove
	document.onmousedown = BodyClick
	if (ns4) document.captureEvents(Event.MOUSEMOVE);
	if (ns4) document.captureEvents(Event.MOUSEDOWN);
}

function HideTip()
{
	if (ns4) over.visibility = "hide"
	else if (ie4) over.visibility = "hidden"
	flag=0;
}

function ShowTip(text)
{
	txt = "<TABLE WIDTH=256 BORDER=0 CELLPADDING=4 CELLSPACING=0 BGCOLOR=#339933><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=#CCFFCC><TR><TD><FONT FACE=\"Arial,Helvetica\" COLOR=#000000 SIZE=\"-2\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"
	if (ns4)
	{
		if( x > (document.width-256) ) over.left = document.width-256;
		else over.left = x;

		if( y > (document.height-256) ) over.top = document.height-256;
		else over.top = y;

		over.visibility = "show"

		document.overDiv.document.write(txt)
		document.overDiv.document.close()
	}
	else if (ie4)
	{
		document.all["overDiv"].innerHTML = txt;

		if( x > (document.body.scrollWidth-256) ) over.left = document.body.scrollWidth-256;
		else over.left = x;

		if( y > (document.body.scrollHeight-256) ) over.top = document.body.scrollHeight-256;
		else over.top = y;

		over.visibility = "visible"
	}
	flag=1;
}

function MouseMove(e)
{
	if (ns4) {x=e.pageX; y=e.pageY; document.routeEvent(e);}
	if (ie4) {x=event.x; y=event.y;}
	if (ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}
}

function BodyClick(e)
{

		if(flag && Outside()) { HideTip(); }
		else if (ns4){ document.routeEvent(e); }
}


function Outside()
{
	if (ns4)
	{
		if (x < over.left || x > (over.left + over.clip.width) || y < over.top || y > over.top + over.clip.height) return 1; else return 0;
	}
	else if (ie5)
	{
		rects = overDiv.getClientRects();
		if (x < (rects[0].left+document.body.scrollLeft)
			|| x > (rects[0].right+document.body.scrollLeft)
			|| y < (rects[0].top+document.body.scrollTop)
			|| y > (rects[0].bottom+document.body.scrollTop)) return 1; else return 0;
	}
	else if(ie4)
	{
		rects = overDiv.getClientRects();
		if (x < (rects[0].left) || x > (rects[0].right) || x < (rects[0].left) || x > (rects[0].right)) return 1; else return 0;
	}

}

function Nothing()
{
}
