if (typeof window.location.gOpenerTopWindow == "undefined") {
	window.location.gOpenerTopWindow = (window.opener != null ? window.opener.top : null); 
}

if (typeof window.location.gOpenerWindow == "undefined") {
	window.location.gOpenerWindow = window.opener; 
}

// Script for a child window to trigger a postback-refresh in its opener.
//
// Assumption: the formID has been passed to the opener via the querystring
// and the layout system has automatically dumped the value to an inline
// client-side script variable called _webrOpenerFormID.
//
function _webrRefreshOpenerUsingPostback()
{
    // Verify that the opener window is still there and that we have the form ID.
    // Note: old browsers that don't support the opener property will effectively be
    // filtered-out by this check.
    if (typeof window.opener != "undefined" && typeof _webrOpenerFormID != "undefined") {
        if (typeof window.opener.closed != "undefined") {
            // The 'closed' property is not part of the official HTML spec.,
            // so browsers other than IE might not support it.  This should be tested
            // against all the browsers we intend to support.
            if (!window.opener.closed) {
                // We have an opener window and it is still open.
                // Verify that it is still on the postback-enabled page.
                // Of course, without knowing the original URL the opener could now be on any
                // postback-enabled page.  Even if it isn't on the right one, this would just 
                // end up being a no-op, right?
                if (typeof window.opener._webrDoRefreshPostBack != "undefined") {
                    window.opener._webrDoRefreshPostBack(_webrOpenerFormID);
                }
            }
        }
    }
}

// Script for a child window to trigger a refresh in its opener using a passed in url
//
function _webrRefreshOpener(url)
{
	var	w = window.location.gOpenerTopWindow;
	if (w == null) w = window.location.gOpenerWindow;
		
    // Verify that the opener window is still there.
    // Note: old browsers that don't support the opener property will effectively be
    // filtered-out by this check.
    if (typeof w != "undefined") {
        if (typeof w.closed != "undefined") {
            // The 'closed' property is not part of the official HTML spec.,
            // so browsers other than IE might not support it.  This should be tested
            // against all the browsers we intend to support.
            if (!w.closed) {
                // We have an opener window and it is still open.
                w.location.href = url;
            }
        }
    }
}

