String.prototype.trim = function()
{
	return( this.replace(/(^\s+)|(\s+$)/g, "") );
}

String.prototype.isEmail = function()
{
	return( /.*@.*\..+/.test(this) );
}

var isDOM = typeof document.addEventListener != "undefined";

function getCommonEvent(e)
{
	var obj = e;
	
	if ( !isDOM )
	{
		obj.layerX = e.offsetX;
		obj.layerY = e.offsetY;
		obj.target = e.srcElement;
		obj.stopPropagation = function() { event.cancelBubble = true; }
	}
	
	return( obj );
}

function getNodeInfo(node)
{
	var xPos = 0, yPos = 0, width = 0, height = 0, srcNode = node;
	while ( node.nodeType == 1 )
	{
		if (node.tagName != "TR")
		{
			xPos += node.offsetLeft;
			yPos += node.offsetTop;
		}
		
		if ( node.offsetParent )
			node = node.offsetParent;
		else break;
	}
	
	if (typeof srcNode.offsetWidth != "undefined")
	{
		width = srcNode.offsetWidth;
		height = srcNode.offsetHeight;
	} else if (typeof srcNode.width != "undefined") {
		width = srcNode.width;
		height = srcNode.height;
	}
	return( { x : xPos , y : yPos , w : width , h : height } );
}