
/*
Testing - Amey
*/

/// --------------------------------------------------
/// mainScreen object
/// --------------------------------------------------
var mainScreen =
{
    mainModalExtender : null,           // modalExtender object on main page
    mainModalTitleSpan : null,          // title span object
    mainModalContentsDiv : null,        // div inside modal dialog
    pageTheme : "Default"
}

mainScreen.Init = function() {
    /// <summary>
    /// Initializes mainScreen variables
    /// </summary>
    this.mainModalExtender = $find('mbMain');
    this.mainModalTitleSpan = $get("spanTitle");
    this.mainModalContentsDiv = $get("mainModalContents");
};
mainScreen.ShowConfirm = function(_extLink) {
    /// <summary>
    /// Shows modal dialog with contents equal to _html
    /// </summary>
    /// <param name="_extLink">Button object</param>
    /// <param name="_title">Title of modal popup</param>
    /// <param name="_html">HTML that should be shown inside popup</param>
    var extHtml = 'You are now leaving myCME.com.<br/>myCME(and its operators) do not control or endorse and are not responsible for the content,<br/>practices or other policies of the site that you are now entering or any other site(s)<br/>you might visit outside myCME.com.<br/><br/>For information about the practices of the website you are accessing<br/>please refer to the respective policies of that website.';

    this.currentButtonUID = _extLink;
    this.mainModalTitleSpan.innerHTML = "Please Confirm";
    this.mainModalContentsDiv.innerHTML = extHtml + "<br/><br/>";
    this.mainModalExtender.show();
};
mainScreen.CancelConfirm = function() {
    /// <summary>
    /// Hides modal dialog 
    /// </summary>
    this.mainModalExtender.hide();
    this.currentButtonUID = null;
};
mainScreen.SubmitConfirm = function() {
    /// <summary>
    /// Hides modal dialog 
    /// </summary>
    var extLink = this.currentButtonUID;
    this.currentButtonUID = null;
    if(extLink) {
        window.open(extLink);
    }
    this.mainModalExtender.hide();
};

/// --------------------------------------------------
/// Page events processing
/// --------------------------------------------------

Sys.Application.add_load(
    applicationLoadHandler
    );
   
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(
    endRequestHandler
    );
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(
    beginRequestHandler
    );

function applicationLoadHandler() {
    /// <summary>
    /// Raised after all scripts have been loaded and 
    /// the objects in the application have been created 
    /// and initialized.
    /// </summary>
    mainScreen.Init()
}

function endRequestHandler() {
    /// <summary>
    /// Raised before processing of an asynchronous 
    /// postback starts and the postback request is 
    /// sent to the server.
    /// </summary>
    
    // TODO: Add your custom processing for event
}

function beginRequestHandler() {
    /// <summary>
    /// Raised after an asynchronous postback is 
    /// finished and control has been returned 
    /// to the browser.
    /// </summary>

//    $get("resultDiv").innerHTML = 
//        "<img src='App_Themes/"+
//        mainScreen.pageTheme+
//        "/Img/activity_small.gif'/>";
}

/* End Testing - Amey */

