﻿function pageLoad() {
    if (top.location.href != self.location.href) {
        top.location.href = "homeCP.aspx";
        return;
    }
}
function openWindow(url, name, title, height, width, modal, behaviors, closeProc) {
    var oManager = GetRadWindowManager();
    var oNew = oManager.open(url, name);
    oNew.set_title(title);
    oNew.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close);
    if (oManager.get_enableShadow()) {
        if (height != null)
            height = parseInt(height) + 12 + "px";
        if (width != null)
            width = parseInt(width) + 12 + "px";
    }

    if (height != null)
        oNew.set_height(height);

    if (width != null)
        oNew.set_width(width);
    oNew.add_close(closeProc);
    oNew.set_modal(modal);
    oNew.set_behaviors(behaviors);
    oNew.center();
}
function HandleJoinNow() {
    openWindow("NewUser.aspx", "NewUser", "New User Setup", "320px", "400px", true, Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close, OnClientClose);
}
function HandleForgotPass() {
    openWindow("ForgotPassword.aspx", "ForgotPass", "Reset Password", "250px", "300px", true, Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close, OnClientClose);
}
function OnClientClose(oWnd, eventArgs) {
    oWnd.SetUrl("blank.htm");
    oWnd.remove_close(OnClientClose);
    var arg = eventArgs.get_argument();
    if (arg) {
        if (arg == "Success") {
            window.location = "ResultsCenterPMCP.aspx";
        }
    }
}
function GetRadWindowMain() {
    var oWindow = null;
    if (window.radWindow)
        oWindow = window.radWindow;
    else if (window.frameElement != null)
        oWindow = window.frameElement.radWindow;
    return oWindow;
}

