﻿///// --------------------------------------------------
///// mainScreen object
///// --------------------------------------------------
var mainScreen =
{
//    mainModalExtender : null,           // modalExtender object on main page
//    mainModalTitleSpan : null,          // title span object
//    mainModalContentsDiv : null,        // div inside modal dialog
//    pageTheme : "Theme1"
}

mainScreen.Init = function() {
    /// <summary>
    /// Initializes mainScreen variables
    /// </summary>
//    this.mainModalExtender = $find('mbMain');
//    this.mainModalTitleSpan = $get("spanTitle");
//    this.mainModalContentsDiv = $get("mainModalContents");
};
//mainScreen.ShowConfirm = function(_button,_title, _html) {
//    /// <summary>
//    /// Shows modal dialog with contents equal to _html
//    /// </summary>
//    /// <param name="_button">Button object</param>
//    /// <param name="_title">Title of modal popup</param>
//    /// <param name="_html">HTML that should be shown inside popup</param>
//    this.currentButtonUID = _button.name
//    this.mainModalTitleSpan.innerHTML = _title;
//    this.mainModalContentsDiv.innerHTML = _html;
//    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>
//    if(this.currentButtonUID) {
//        __doPostBack(this.currentButtonUID, "");
//    }
//    this.mainModalExtender.hide();
//    this.currentButtonUID = null;
//};


/// --------------------------------------------------
/// 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'/>";
}
