﻿Type.registerNamespace("majax");

majax.ToggleButton = function() {
    majax.ToggleButton.initializeBase(this);
}

majax.ToggleButton.prototype = {

    initialize : function() {
        majax.ToggleButton.callBaseMethod(this, 'initialize');

        //  attach the plugin
        Sys.UI.Control.prototype.toggleButton = this._toggleButton;
    },


    dispose : function() {

        majax.ToggleButton.callBaseMethod(this, 'dispose');
    },

    _toggleButton : function(properties) {
        var element = this.get_element();
        //  create the extender control for each of the checkboxes
        if(element.tagName == 'INPUT') {
            $create(AjaxControlToolkit.ToggleButtonBehavior, properties, null, null, element);
        }
        else {
            $create(AjaxControlToolkit.ToggleButtonBehavior, properties, null, null, element.firstChild);
        }
    }
}

//  register the class
majax.ToggleButton.registerClass('majax.ToggleButton', Sys.Component);

//  create the singleton
$create(majax.ToggleButton, null, null, null);

// Since this script is not loaded by System.Web.Handlers.ScriptResourceHandler
// invoke Sys.Application.notifyScriptLoaded to notify ScriptManager 
// that this is the end of the script.
if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();