﻿/// --------------------------------------------------
/// ModalPopUp Reaction Object
/// --------------------------------------------------
var Reaction =
{
    Reaction__Extender : null,
    Reaction__TB_Nom_Prenom : null,
    Reaction__TB_Email : null,
    Reaction__TB_Reaction: null,
    currentButtonUID : null
}

Reaction.Init = function() {
    this.Reaction__Extender = $find('ReactionBehavior');
    this.Reaction__TB_Nom_Prenom = document.forms[0].ctl00$CPH_Page$ctl00$TB_Nom_Prenom;
    this.Reaction__TB_Email = document.forms[0].ctl00$CPH_Page$ctl00$TB_Email;
    this.Reaction__TB_Reaction = document.forms[0].ctl00$CPH_Page$ctl00$TA_Reaction;
};



Reaction.Show = function(_button) {
    this.Reaction__TB_Nom_Prenom.value='';
    this.Reaction__TB_Email.value='';
    this.Reaction__TB_Reaction.value='';
    
    this.currentButtonUID = _button.name;
    this.Reaction__Extender.show();
};

Reaction.CancelConfirm = function() {
    this.Reaction__TB_Nom_Prenom.value='';
    this.Reaction__TB_Email.value='';
    this.Reaction__TB_Reaction.value='';
    
    this.Reaction__Extender.hide();
    this.currentButtonUID = null;
};

Reaction.ValidConfirm = function() {
    
    if (this.currentButtonUID) {
        __doPostBack(this.currentButtonUID, "");
    }
    this.Reaction__Extender.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>
    Reaction.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'/>";
}