<?
function nice_death($err = false){
	global $Config, $inc_dir, $db, $pgTitle, $server_root;
	if (!$err) $err = 'Unknown Error';

	require_once($inc_dir . 'header.inc');
	nodeHeader();
		?><h1>An Error Has Occurred!</h1>
		<br />
		<h2><?=$err?></h2>
		<br /><br />
		<? if ($pgTitle){ ?><a href="<?=$_SERVER['PHP_SELF']?>">Click here to return to <?=$pgTitle?>.</a><br /><? } ?>
		<a href="/">Click here to return to the front page.</a><?
	nodeFooter();
	require_once($inc_dir . 'footer.inc');
	die();
}

function nice_exit($msg){
	global $Config, $inc_dir, $db, $pgTitle, $server_root, $pgCaption, $PageID;
	$msg = trim($msg);
	if (!$msg) nice_death('Someone needs to read up on how to use the nice_exit function!');

	require_once($inc_dir . 'header.inc');
	?><div class="node">
		<div class="nodeTitleBar">
			<div class="nodeTitle"><?=$pgCaption?></div>
		</div>
		<div class="nodeContents">
			<div>
				<?=$msg?>
			</div>
			&nbsp;
			<div>
				<a href="?<?=$PageID?>">Click here to return to <?=$pgTitle?>.</a><br />
				<a href=".">Click here to return to the front page.</a>
			</div>
		</div>
	</div><?
	require_once($inc_dir . 'footer.inc');
	die();
}
?>
