
var popUpBlockerTesterWinRef = null;
function CheckForPopUpBlocker(checkPage, blockedPopUpHandlingMsg) {
    popUpBlockerTesterWinRef = CenterOpenWindow(IsNullOrMissing(checkPage) ? "about:blank" : checkPage, "_popUpBlockerTester", 320, 240, false, "", 0, 0, blockedPopUpHandlingMsg);
    if (!IsNullOrMissing(popUpBlockerTesterWinRef)) {
        setTimeout("popUpBlockerTesterWinRef.close()", "1000");
    }
}
function CenterOpenWindow(url, name, width, height, bModal_dialog, extra_options, offsetX, offsetY, blockedPopUpHandlingMsg) {

    //**************************************************************************
    //Programmer:		Awah Teh
    //Date Written:		June 13, 2001,
    //Purpose:			Opens a new window in the center of the user's screen
    //Revision History:	
    //**************************************************************************
    var oWindowRef = null;
    try {
        var new_win_width = width
        var new_win_height = height
        var new_win_url = url
        var new_win_name = name
        if (isMissing(bModal_dialog)) { bModal_dialog = false }
        if (isMissing(extra_options)) { extra_options = "" }
        if (isMissing(offsetX)) { offsetX = 0; }
        if (isMissing(offsetY)) { offsetY = 0; }
        var new_win_options = "" +
								  "width=" + new_win_width +
								  ",height=" + new_win_height +
								  ",top=" + (parseInt(offsetY) + ((screen.height / 2) - (new_win_height / 2))) +
								  ",left=" + (parseInt(offsetX) + ((screen.width / 2) - (new_win_width / 2)))

        if (offsetY != 0 || offsetX != 0) {
            alert(
                "top=" + (parseInt(offsetY) + ((screen.height / 2) - (new_win_height / 2))) +
				"left=" + (parseInt(offsetX) + ((screen.width / 2) - (new_win_width / 2)))
								  );
        }

        if (extra_options != "") { new_win_options += "," + extra_options }

        if (bModal_dialog) { new_win_options += ",alwaysRaised=1" }

        oWindowRef = window.open(new_win_url, new_win_name, new_win_options);
        //alert(oWindowRef.onblur)
        if (bModal_dialog) { ; oWindowRef.onblur = modalWindow_onBlur; } //Set the window to modal if it host application requested so.

    }
    catch (e) {    }
    if (IsNullOrMissing(oWindowRef)) {
        blockedPopUpHandlingMsg = IsNullOrMissing(blockedPopUpHandlingMsg) ? "A eMedical Lending Platform window was unable to open, and may have been blocked by a pop-up blocker. Please add this website to the list of sites your pop-up blocker allows to open new windows:\n\n   " + window.location.hostname : blockedPopUpHandlingMsg;
        alert(blockedPopUpHandlingMsg);
    }
    return oWindowRef;
}

function isMissing(function_parameter) {
    //**************************************************************************
    //Programmer:		Awah Teh
    //Date Written:		June 13, 2001,
    //Purpose:			Checks to see if the parameter of a given fucntion is
    //					has been passed to that function. Note: its similar and
    //					actually attempts to behave like the isMissing function
    //					in VB.
    //Revision History:	
    //**************************************************************************
    var undefined_var;
    return (function_parameter == undefined_var);
}
function IsNullOrMissing(function_parameter) {
    //**************************************************************************
    //Programmer:		Awah Teh
    //Date Written:		June 13, 2001,
    //Purpose:			Checks to see if the parameter of a given fucntion is
    //					has been passed to that function. Note: its similar and
    //					actually attempts to behave like the isMissing function
    //					in VB.
    //Revision History:	
    //**************************************************************************
    var undefined_var;
    return (function_parameter == undefined_var) || ("undefined" == typeof (function_parameter) || "unknown" == typeof (function_parameter) || null == function_parameter)
}
