I guess that your field popup is not known at the onLoad event. Try to put your code with passthru HTML directly on the form and not into the JS events. Replace the JS variable “current” by a Notes field that displays the value of your popup field.
e.g. on the form write the follwing code and put in a Notes field where xxxxxxx is
The field might be the popup field directly, or a computed-for-display field which holds the value of popup.