var offsetx = 20;
var offsety = -20;

ns = (document.layers)? true:false
ie = (document.all)? true:false

var x = 0;
var y = 0;
var popped = 0;
var sw = 0;
var count = 0;

if ( (ns) || (ie) )
{
	if (ns)
	{
		over = document.overDiv;
	}
	else if (ie)
	{
		over = overDiv.style;
	}
	document.onmousemove = moveLayer;
	if (ns)
	{
		document.captureEvents(Event.MOUSEMOVE);
	}
}

// Clears popups as needed
function unpop()
{
	if ( count >= 1 ) { sw = 0 };
	if ( (ns) || (ie) )
	{
		if ( sw == 0 )
		{
			popped = 0;
			if (ns)
			{
				over.visibility = "hide";
			}
			else if (ie)
			{
				over.visibility = "hidden";
			}		}
		else
		{
			count++;
		}
	}
}

// Popup
function popup (text, width)
{
	contents = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\"#CC3300\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=3 CELLSPACING=0 BGCOLOR=\"#006699\"><TR><TD><FONT FACE=\"Arial,Helvetica\" COLOR=\"#FFFFFF\" style=\"font-size:100%\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
	if (ns)
	{
		var lyr = document.overDiv.document
		lyr.write(contents)
		lyr.close()
	}
	else if (ie)
	{
		document.all["overDiv"].innerHTML = contents
	}
	if ( (ns) || (ie) )
	{
		if (popped == 0)
		{
			over.left = x + offsetx;
			over.top = y + offsety;
			if (ns)
			{
				over.visibility = "show";
			}
			else if (ie)
			{
				over.visibility = "visible";
			}
			popped = 1;
		}
	}
}

// Moves the layer
function moveLayer(e)
{
	if (ns)
	{
		x=e.pageX; y=e.pageY;
	}
	//if (ie) {x=event.x; y=event.y;}
	if (ie)
	{
		x=event.x+document.body.scrollLeft;
		y=event.y+document.body.scrollTop;
	}

	if (popped)
	{
		over.left = x + offsetx;
		over.top = y + offsety;
	}
}