use render_error() instead of alert()
Send to permalink in window.opener when in popup