Access the nid of the node that the current node references
After much trial and alot of error I finally figured out how to access the nid of the node that the current node references. The code first tests that you are on a node, and not editing it. Then the node is loaded up. the tricky part was the ['nid'] part. Usually this is something like ['view'] or ['value'].
if ( arg(0) == 'node' && is_numeric(arg(1)) && ! arg(2) ) {
$node = node_load(arg(1));
$customer_nid = $node->field_customer_name[0]['nid'];
}
$output .= '<p>NodeRef: ' . $customer_nid . '</p>';
print $output;