toolbar events multiple firings

I have placed a toolbar in a window from the main page. Then I load a php page into the window which calls parent.webbar.attachevent to setup an onclick event handler which also is in the php file. This works fine, but after reloading the window (to handle submits, etc.) the event fires multiple times, one for each reload. Is there a way to unattach an event handler, or some other solution to this problem?

Is there a way to unattach an event handler
When code attached to some event, component returns event-handler-id

var event_id = some.attachEvent(“onClick”,some_code)

Which can be used later to detach event hadler

some.detachEvent(event_id);