jQuery.fn.extend( {

	getPos: function( deep )
	{
		if( typeof deep == 'undefined' ) deep = true;

		var obj = this.get()[0];
		if( !obj ) return false;

		var curleft = curtop = 0;
		if( obj.offsetParent )
		{
			while( 1 )
			{
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;

				if( !obj.offsetParent ) break;
				obj = obj.offsetParent;

				if( deep )
				{
					$obj = $( obj );
					if( $obj.css( 'position' ) == 'relative' || $obj.css( 'position' ) == 'absolute' || $obj.css( 'position' ) == 'fixed' )
					{
						break;
					}
				}
			}
		}
		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;
	}

} );