Javascript variable

Hi, i currently open a browser window in Javascript successfully. The issue i now have is that i want to keep a global reference to this window in the HTML page.

My code is currently:-

	String myJs = "window.open(\"http://www.google.co.uk\", 'MyUniqueName', 'location=no, titlebar=no');";

and its is executed successfully using :-

JavaScript.getCurrent().execute(myJs);

But i want to keep a handle to the window (so i can only open one instance of the browser window), but i need a javascript variable at ‘Global level’ so it is maintained in the page:-

var wnd=null;

if (wnd==null || wnd.closed){
	wnd = window.open("http://www.foo.co.uk", 'MyUniqueName', 'location=no, titlebar=no'); 
}else{
	wnd.location="http://www.bar.co.uk";
}


How can i achieve this?