I'm using a simple solution for getting the server root and it works quite well with my includes:
<?php $root = $_SERVER['DOCUMENT_ROOT'].'/frizkie'; ?>
onClick="document.location.href='<?php echo $root; ?>/planners/agility.php';"
$_SERVER['DOCUMENT_ROOT'] is for server-side pathing so to speak, as you already noted. You don't need to put it in your markup, CSS and JS. I'd stick with absolute-relative paths like
/images/background.jpg (note the leading slash). That way even if your page is accessed by a URL like
the image is downloaded from
DOCUMENT_ROOT helps a lot when including multiple files scattered around your document root - using relative paths here gives me a headache. If you really want full urls in your pages, though, you can try using
$_SERVER['SERVER_NAME'] for that matter, but I really don't understand the need to do so.