Ok, I found the answer:
in javascript i wrote:
var ctrl = $find('PopupCnt');
event.cancelBubble = true;
if (ctrl._popupVisible == true) ctrl.hidePopup(); else ctrl.showPopup();
the line "event.cancelBubble = true" did this.
and one more thing - I clicked the button that caused the postback, so even if the pop-up window showed that it would be reset when the new page looks like it doesn’t work. I just created a button without postback, and it worked.
source share