Contextual information on custom Access Denied page
Supposing that the site is using clean URLs, I would rather use the following code:

function fn_custom_access_denied() {
  $path = drupal_get_normal_path(trim($_SERVER['REQUEST_URI'], '/'));

  if (($node = menu_get_object('node', 1, $path)) &amp;&amp; ($node-&gt;type == 'event')) {
    drupal_set_message(t("%event is a private event.", array('%event' =&gt; $node-&gt;title));
  }

  return "";
}