try 
{
	var test = (NETJOHNHENRY.name == 'NETJOHNHENRY');
} 
catch (e) 
{
	NETJOHNHENRY = {};
}

/*
 * Note that eval(something_other_than_a_string) returns the parameter unchanged.
 * This means these functions can accept a string of code that evaluates to an object
 * reference, or the object reference itself, and still work.
 */
NETJOHNHENRY.XY = new function()
{
	this.name = 'XY';
	this.description = 'This function is used to get the x and y coordinates of a node in a page. Usage: <code>NETJOHNHENRY.XY.getCoordinateX(node)</code> returns the X coordinate of the node object. <code>NETJOHNHENRY.XY.getCoordinateY(node)</code> returns the Y coordinate of the node value. <code>NETJOHNHENRY.XY.getMouseX(event)</code> gets the X coordinate of the mouse. <code>NETJOHNHENRY.XY.getMouseY(event)</code> gets the Y coordinate of the mouse.';
};

NETJOHNHENRY.XY.getCoordinateX = function(obj)
{
	if (eval(obj).x) 
	{
		return eval(obj).x;
	}
	else 
	{
		return NETJOHNHENRY.XY._getCoordinateX(obj);
	}
};

NETJOHNHENRY.XY.getCoordinateY = function(obj)
{
	if (eval(obj).y) 
	{
		return eval(obj).y;
	}
	else 
	{
		return NETJOHNHENRY.XY._getCoordinateY(obj);
	}
};

NETJOHNHENRY.XY._getCoordinateX = function(obj)
{
	xPos = eval(obj).offsetLeft;
	tempEl = eval(obj).offsetParent;
	while (tempEl !== null) 
	{
		xPos += tempEl.offsetLeft;
		tempEl = tempEl.offsetParent;
	}
	return xPos;
};

NETJOHNHENRY.XY._getCoordinateY = function(obj)
{
	yPos = eval(obj).offsetTop;
	tempEl = eval(obj).offsetParent;
	while (tempEl !== null) 
	{
		yPos += tempEl.offsetTop;
		tempEl = tempEl.offsetParent;
	}
	return yPos;
};

NETJOHNHENRY.XY.getMouseX = function(e)
{
	var tempX;
	if (document.all) 
	{ // grab the x-y pos.s if browser is IE
		tempX = event.clientX + document.body.scrollLeft;
	}
	else 
	{ // grab the x-y pos.s if browser is NS
		tempX = e.pageX;
	}
	// catch possible negative values in NS4
	if (tempX < 0) 
	{
		tempX = 0;
	}
	return tempX;
};

NETJOHNHENRY.XY.getMouseY = function(e)
{
	var tempY;
	if (document.all) 
	{ // grab the x-y pos.s if browser is IE
		tempY = event.clientY + document.body.scrollTop;
	}
	else 
	{ // grab the x-y pos.s if browser is NS
		tempY = e.pageY;
	}
	// catch possible negative values in NS4
	if (tempY < 0) 
	{
		tempY = 0;
	}
	return tempY;
};
