/**
 * Open url in separate window
 */
function OW(p_url, p_win, p_extra) {
	newWin = window.open(p_url, p_win, p_extra);
	if (newWin.opener==null) {
		newWin.opener = self;
	}
	/* FIXME: is that good to activate an already existing window? (it would stay in background otherwise) */
	if (newWin!=null) {
		newWin.focus();
	}
}

/**
 * Open url in opener-window, if it exists.
 * if it does not exist, open it in a new window.
 */
function OWp(p_url, p_win, p_extra) {
	if (window.opener==null || window.opener.closed) {
		newWin = window.open(p_url, p_win, p_extra);
		// OW(p_url, '', p_extra);
	} else {
		window.opener.location.href = p_url;
		window.opener.focus();
	}
}

function registerSelfClose() {
	window.setTimeout("window.self.close();", 2000);
}

