Fixes problem in IE where offsetParent was null, putting after null chec...

...k. Also avoids an unnecessary variable assignment if we are returning out of the function.