if ($rel == 'lightframe' && arg(0) == 'node' && arg(1) == $node->nid) 

Was trying to do something else and noticed this; in the situation of say node//edit, node//bleh, etc. won't this incorrectly turn the lightframe into a lightbox?

if ($rel == 'lightframe' && arg(0) == 'node' && arg(1) == $node->nid && empty(arg(2)))  

probably be better