﻿// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.


Type.registerNamespace("AjaxControlToolkit");

AjaxControlToolkit.NoBotBehavior = function(element) {
    AjaxControlToolkit.NoBotBehavior.initializeBase(this, [element]);
    
    this._ChallengeScript = "";
}
AjaxControlToolkit.NoBotBehavior.prototype = {
    initialize : function() {
        AjaxControlToolkit.NoBotBehavior.callBaseMethod(this, "initialize");
        // Evaluate challenge script and store response in ClientState
        var response = eval(this._ChallengeScript);
        AjaxControlToolkit.NoBotBehavior.callBaseMethod(this, "set_ClientState", [response]);
    },

    dispose : function() {
        AjaxControlToolkit.NoBotBehavior.callBaseMethod(this, "dispose");
    },

//    getDescriptor : function() {
//        var td = AjaxControlToolkit.NoBotBehavior.callBaseMethod(this, "getDescriptor");
//        td.addProperty("ChallengeScript", String);
//        return td;
//    },

    get_ChallengeScript : function() {
        return this._ChallengeScript;
    },

    set_ChallengeScript : function(value) {
        if (this._ChallengeScript != value) { 
            this._ChallengeScript = value;
            this.raisePropertyChanged('ChallengeScript');
        }
    }
}

AjaxControlToolkit.NoBotBehavior.registerClass("AjaxControlToolkit.NoBotBehavior", AjaxControlToolkit.BehaviorBase);

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();