I'm sure you could make the shadowbox.open function conditional, but is will require hand coding of the shadow box API that I cannot offer support for.
if you put the same link on another page besides the login loader page, does it work?
it could be that the login loader page is killing the session variable somehow.