When a node is being viewed, being that the ad_gallery module uses arg(1) to know what node to node_load(), if fails when the node is referenced like in nodereference CCK.

Being that I sometimes refer to nodes via CCK and display in full, this causes a problem.

To resolve I added an additional method for the NID to be found when missing:
ad_gallery.theme.inc:25

$gallery = node_load(arg(1));
if(!$gallery) $gallery = $vars['element']['#node'];