jQuery.fn.extend( {

	getPos: function()
	{
		var obj = this.get()[0];

		var curleft = curtop = 0;
		if( obj.offsetParent )
		{
			while( 1 )
			{
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
				if( !obj.offsetParent ) break;
				obj = obj.offsetParent;
			}
		}
		else if( obj.x )
		{ 
			curleft += obj.x;
			curtop += obj.y;
		}

		return { left: curleft, top: curtop };
	},

	scrollTop: function()
	{
		var w = window;

		if( w.document.documentElement && w.document.documentElement.scrollTop ) offset=w.document.documentElement.scrollTop;
		else if( w.document.body && typeof w.document.body.scrollTop != 'undefined' ) offset = w.document.body.scrollTop;
		return offset;
	}

} );
