var  Offset = Class.create({
	
	until: null,
	obj: null,
	left:  0,
	top: 0,
	
	initialize:  function(obj, until)
	{
		if (until) this.until = until;
		this.obj = $(obj);
		this.find();
	},

	find:  function()
	{
		var obj = this.obj;
		var x = y = 0;
		while (obj != null) {
			if (this.until != null) {
				if (this.until == obj) return true;
			}
			x += obj.offsetLeft;
			y += obj.offsetTop;
			obj = obj.offsetParent;
		}
		this.left = x;
		this.top = y;
	},

	get:  function()
	{
		
		return  {
			x: this.left,
			y: this.top
		};
	}
	
});