The thing is, a URL is not necessarily a directory reference. It looks like one (this was deliberate), and there is often a fairly good correspondence, but it doesn't quite hold.
You're mostly sunk, I'm afraid. If you need to get back to your DOCUMENT_ROOT without knowing where your own page is, you have to use absolute URL's.
There is something you can do to spare yourself some pain, though. HTML has a tag called BASE. You can put this in the HEAD of your document, and use it to determine the "starting point" for all relative URL's in that page. You can put this tag into a server-side include and then include that in all the files which need it, and then if you ever have to change the URL for your DOCUMENT_ROOT you only have to change the one file and it'll be reflected in all of them.