function launchWindow(newURL, newName, newFeatures, orgName) {

	var remote = open(newURL, newName, newFeatures);

	// *** inteval is in Milliseconds (3600000 - 60min.) ***
	//window.setInterval("reFresh(newName)",3600000);
	window.setInterval("reFresh('" + remote + "')",5000);

	//if (remote.opener == null) // if something went wrong
	//remote.opener = window;
	//remote.opener.name = orgName;
	//return remote;

}

var newwindow = '';

function launchWindow(url,windowName) {

	if (!newwindow.closed && newwindow.location) {
		newwindow.location.href = url;
	}
	else {
		newwindow=window.open(url,windowName,'location=yes,toolbar=no,resizable=yes,scrollbars=yes');
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus) {newwindow.focus()}
	//return false;

	window.setInterval("reFresh()",3600000);
}

function reFresh() {
	if (!newwindow.closed) {
		newwindow.location.href = 'http://www.vlibrary.ab.ca/resource_access_denied.html';
	}
}

function HandleOnClose() {

	// http://dotnetjunkies.com/WebLog/familjones/archive/2004/04/06/10884.aspx
	if (newwindow.opener != null) {
		if (!newwindow.closed) {
			//event.returnValue = "If you leave this page your resource window will be closed!";
			//closeWindow = confirm("If you leave this page your resource window will be closed!");
			newwindow.close();
		}
	}
}

function HandleOnClose1() {
   if (event.clientY < 0) {

	alert("close");

	if (!newwindow.closed) {
		newwindow.close();
	}

   }
}
