Hi, thanks for the reply.
I took out all code I had tried with regards to closing the popup in the onSubmit of the form, as I wanted to make it as unconfusing as possible for anyone willing to help.
With that said, I did already try what you said with regards to firing the same code in the onSubmit that is called when the user clicks away from the page (and it closes).
When I try this nothing happens and the popup remains in view and blank (submit still works to the database) but it does not hide itself.
I am new to jQuery (and java in general really) so I guess I am not not calling the correct jQuery code or it is a scope issue with the fact it is in a div/iframe maybe, as I cannot even get an alert() to trigger with the form onSubmit(), so it seems it isn't even being called.