$$SearchTemplateDefault and Anchor link with "#" as href

I have a anchor link on a $$SearchTemplateDefault form.

The link goes like this:

Logout

When I click on the link the JS script runs AND a link with the address

http://computed servername/database path/database.nsf/#

is opened.

If I use the same link on a document level the JS script runs BUT no new address is loaded (which was the idea).

Can anybody explain WHY the address is generated before the # sign on the form and HOW I can prevent this happening?

Thanks a lot!

MvH

Patrick