
    /** 
     * Class constructor
     * 
     */
    function eSASeKidsProtect()
	{ 
        //-- public properties --//
        this.iQuestionId,
        //--

        //-- private properties --//
        this._sWindowWrapper,
        this._sModuleUrl,
        this._sEmptyMessage,
        //--

        //-- PUBLIC METHODS --//

        /**
         * Init method
         *
         * @param sWindowWrapper string
         * @param sModuleUrl string
         * @param sEmptyMessage string
         * @return void
         */
        this.init = function(sWindowWrapper, sModuleUrl, sEmptyMessage)
        {
            this._sWindowWrapper = sWindowWrapper;
            this._sModuleUrl = sModuleUrl;
            this._sEmptyMessage = sEmptyMessage,
            this.iQuestionId = 0;

            this._getProtectWindow();
        },

        /**
         * Reload question
         *
         * @return void
         */
        this.reloadQuestion = function()
        {
            bx_loading(this._sWindowWrapper, true);
            this._getProtectWindow();
        }

        /**
         * Check answer to the question
         *
         * @param iQuestionId integer 
         * @param sAnswerWrapper string
         * @return void
         */
        this.checkAnswer = function(iQuestionId, sAnswerWrapper)
        {
            var sAnswer = $.trim( $('#' + sAnswerWrapper).val() );
            if(!sAnswer) {
                return alert(this._sEmptyMessage);
            }

            var self = this;
            $.post(this._sModuleUrl + 'ajaxCheckAnswer'
                , { 'question_id': iQuestionId, 'answer' : $('#' + sAnswerWrapper).val()}, function(sData){

                //process server's answer
                if(sData) {
                    alert(sData);
                }
                else {
                    //hide protect window
                    $('#' + self._sWindowWrapper).dolPopupHide({});
                }
            });
        }

        //--

        //-- PRIVATE METHODS --//

        /**
         * get protect window 
         *
         * @return void
         */
        this._getProtectWindow = function() 
        {
            var oPopupOptions = {
                fog: {color: '#000', opacity: .7},
                closeOnOuterClick : false
            };

           var sExtra = this.iQuestionId ? this.iQuestionId : '';
           $('#' + this._sWindowWrapper).load(
        		this._sModuleUrl + 'ajaxGetProtectWindow/' + sExtra,
        		function() {
        			$(this).dolPopup(oPopupOptions);
        		}
        	);
        }

        //--
    }
