onStateChange event can be applied to Two State Button item only. This event calls user-defined handlers (if there are any) and passes the following parameters:
toolbar.attachEvent("onStateChange", function(id, state){});