﻿Type.registerNamespace('Inductronic');Inductronic.LogOnHyperlinkBehavior = function(element) {
Inductronic.LogOnHyperlinkBehavior.initializeBase(this, [element]);this._onLinkClickDelegate = null;this._onLogoutDelegate = null;this._targetUrl = '';}
Inductronic.LogOnHyperlinkBehavior.prototype = {
initialize: function() {
Inductronic.LogOnHyperlinkBehavior.callBaseMethod(this, 'initialize');var el = this.get_element();if (this._onLinkClickDelegate == null) {
this._onLinkClickDelegate = Function.createDelegate(this, this._onLinkClickEvent);$addHandler(el, "click", this._onLinkClickDelegate);}
if (this._onLogoutDelegate == null) {
this._onLogoutDelegate = Function.createDelegate(this, this._onLogoutEvent);}
var applicationManager = this.get_applicationManager();applicationManager.add_logout(this._onLogoutDelegate);},
dispose: function() {
var el = this.get_element();if (this._onLinkClickDelegate) {
$removeHandler(el, "click", this._onLinkClickDelegate);delete this._onLinkClickDelegate;this._onLinkClickDelegate = null;}
var applicationManager = this.get_applicationManager();if (applicationManager) {
applicationManager.remove_logout(this._onLogoutDelegate);}
Inductronic.LogOnHyperlinkBehavior.callBaseMethod(this, 'dispose');},
get_applicationManager: function() {
return Inductronic.ApplicationManagerBehavior.getInstance();},
_onLinkClickEvent: function(ev) {
var el = this.get_element();if (this.get_applicationManager().get_isAuth()) { 
this._targetUrl = el.href;el.href = '';ev.preventDefault();$common.setVisible(el, false);this.get_applicationManager().startLogout();}
},
_onLogoutEvent: function(sender, args) {
if (this._targetUrl != null && this._targetUrl.length > 0) {
window.location.href = this._targetUrl;}
}
}
Inductronic.LogOnHyperlinkBehavior.registerClass('Inductronic.LogOnHyperlinkBehavior', AjaxControlToolkit.BehaviorBase , Sys.IDisposable);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();