﻿/// <reference name="MicrosoftAjax.debug.js" />
/// <reference name="MicrosoftAjaxTimer.debug.js" />
/// <reference name="MicrosoftAjaxWebForms.debug.js" />

Type.registerNamespace("ZikBay.Web.UI.Controls");

// --------------------------------------------------------------
// HoverCurrencyExtender class, derived from Sys.Sys.UI.Control
// --------------------------------------------------------------

ZikBay.Web.UI.Controls.HoverCurrencyExtender = function(element) {
    //#region Constructor
    ZikBay.Web.UI.Controls.HoverCurrencyExtender.initializeBase(this, [element]);
    this._tooltipBehaviorID = null;
    this._tooltip = null;
    this._hoverCurrencyTitle;
    this._hoverCurrencyText;
    //#endregion
}

ZikBay.Web.UI.Controls.HoverCurrencyExtender.prototype = {
    // Overrides
    //#region
    initialize: function() {
        ZikBay.Web.UI.Controls.HoverCurrencyExtender.callBaseMethod(this, 'initialize');
        var attr = document.createAttribute("tooltiptitle");
        attr.value = this._hoverCurrencyTitle;
        this.get_element().attributes.setNamedItem(attr);
        this.get_element().title = this._hoverCurrencyText;
        this.attachTooltip();
    },

    dispose: function() {
        this.detachTooltip();
        ZikBay.Web.UI.Controls.HoverCurrencyExtender.callBaseMethod(this, 'dispose');
    },
    //#endregion
    
    //#region Properties
    get_tooltipBehaviorID : function() {
        return this._tooltipBehaviorID;
    },
    set_tooltipBehaviorID : function(value) {
        this._tooltipBehaviorID = value;
    },
    get_hoverCurrencyTitle : function() {
        return this._hoverCurrencyTitle;
    },
    set_hoverCurrencyTitle : function(value) {
        this._hoverCurrencyTitle = value;
    },
    get_hoverCurrencyText : function() {
        return this._hoverCurrencyText;
    },
    set_hoverCurrencyText : function(value) {
        this._hoverCurrencyText = value;
    },
    //#endregion
    
    //#region Private functions
    attachTooltip : function() {
        if(this._tooltipBehaviorID && this._tooltipBehaviorID!="") {
            this._tooltip = $find(this._tooltipBehaviorID);
            if(this._tooltip) {
                this._tooltip.addTooltipControl(this.get_element());
            }
        }
    },
    detachTooltip : function() {
        if(this._tooltip) {
            this._tooltip.removeTooltipControl(this.get_element());
        }
    }
    //#endregion
}
ZikBay.Web.UI.Controls.HoverCurrencyExtender.registerClass('ZikBay.Web.UI.Controls.HoverCurrencyExtender', Sys.UI.Behavior);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();