Thanks for your quick response Adam.
window.top.close() worked fine so thanks for that.
I cant use the exact code you provided for my 1st problem as my project has many CE controls that are dynamically rendered to the screen hence my modifed version which uses a hidden CE as an image selector and provided the image to the correct calling CE. Something somewhere has changed so I will take a closer look tonight.
Is there a way I can set the property SetSecurityImageGalleryPath from Javascript? This would make life a lot easier and my code a lot simpler :)