﻿Type.registerNamespace('IWCtrls');
IWCtrls.SessionKeeper = function(element) { 
    IWCtrls.SessionKeeper.initializeBase(this, [element]);
    this.Interval = 100000;    
    this._timer = null;
}

IWCtrls.SessionKeeper.prototype = {

    initialize : function() {        
        IWCtrls.SessionKeeper.callBaseMethod(this, 'initialize');
        this._timer = window.setInterval(Function.createDelegate(this, this.Poll), this.Interval);
    },

    Poll: function() {        
        var sskpr = new Imin.Web.Services.Imin();
        sskpr.ServerTime( function(result){ $('.SessionKeeper').empty().append(result);} );        
    },

    dispose : function() {
        if (this._timer != null)
        {
            window.clearInterval(this._timer);
            this._timer = null;
        }
        $clearHandlers(this.get_element());
        IWCtrls.SessionKeeper.callBaseMethod(this, 'dispose');
    }
}

IWCtrls.SessionKeeper.registerClass('IWCtrls.SessionKeeper', Sys.UI.Control);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();