Sliding tab as user scrolls between two points


I am a total jQuery newbie and I am completely stuck with a small piece of functionality. On the following site: I have the tab on the side of the page scroll with the user once the top of the browser window hits the top of the main content area. However, I would like to move the tab to be attached to the right of the content area, rather than to the right of the window.

The only way I can think to do this is to wrap the tab up within another DIV and put the z-index behind the main content…trouble is that my navigation positioning is now screwed up.

I’ve been working on this for hours and am at a total loss. I would really appreciate any help with how this thing is working :S

Many thanks,

edit (addition) If I delete the tab everything goes how it should be.