﻿/// <reference name="MicrosoftAjax.debug.js" />
/// <reference name="MicrosoftAjaxTimer.debug.js" />
/// <reference name="MicrosoftAjaxWebForms.debug.js" />

// Register namespace
Type.registerNamespace('MyNamespace');

//constructor
MyNamespace.MyClass = function() {
    
    // register the object as disposable, so the application will call it's dispose method when needed
    if(typeof(Sys) !== "undefined")Sys.Application.registerDisposableObject(this);
    
    // initialize class level variables from arguments
    this.MyVar1 = $get(arguments[0]);
    this.MyVar2 = $get(arguments[1]);
    
    // initialize other class level variables and constants
    this._myCssClassName = "someClass";
};

MyNamespace.MyClass.prototype = {

    dispose : function() {
        /// <summary>
        /// Implements dispose method
        /// of IDisposable interface,
        /// cleanup resources here.
        /// mainly detach events you attached earlier,
        /// assign nulls to elements that may leak etc...
        /// </summary>    
        this.MyVar1 = null;
        this.MyVar2 = null;
        alert("dispose executed!");
    },
    
    myMethod1 : function(param1, param2) {
        // TODO: implement logic
    },
    
    myMethod2 : function(param1, param2) {
        // TODO: implement logic
    },
    
    myMethod3 : function(param1, param2) {
        // TODO: implement logic
    }
};

// claim the class is implementing IDisposable
if(typeof(Sys) !== "undefined")MyNamespace.MyClass.registerClass('MyNamespace.MyClass', null, Sys.IDisposable);

// standard call for non-embedded scripts.
if(typeof(Sys) !== "undefined")Sys.Application.notifyScriptLoaded();