how can i find the pixel value of the bottom of an element. eg. the #posts div. i want to create a infinite scroller. and this is so that i can detect if the user has reached near/at the bottom of the #posts and i want to load new posts if so.

update:
i guess 1 option is to use
$("#header").height() + $("#posts").height()
but i want to make the code generic. so maybe i can convert this functionality into a plugin. the code above will not have taken into consideration, padding, margins, any elements above #posts etc.