﻿Type.registerNamespace("Evolutia");

Evolutia.formHelper = function(element) {
    Evolutia.formHelper.initializeBase(this, [element]);

    this._text = "Helper text";
    

}

Evolutia.formHelper.prototype = {
    initialize: function() {
        var element = this.get_element();
        //$clearHandlers(this.get_element());
        $addHandlers(this.get_element(), { 'focus' : this._focusHandler, 'blur' : this._blurHandler}, this);
    },
    
    dispose: function() {

        //$removeHandler(this.get_element(), "blur", this._blurHandler);
        //$removeHandler(this.get_element(), "focus", this._focusHandler);
        Evolutia.formHelper.callBaseMethod(this, 'dispose');
    },
    
    _focusHandler : function(event) {
        $get('helper').style.display = 'block';
        $('helper').injectInside($('main'));
        $('helper').style.left = $(this.get_element()).getLeft() + $(this.get_element()).getSize().x + 45 +  "px";
        $('helper').style.top = $(this.get_element()).getTop() + "px";
        $('helper').set('text', this._text);
        
    },
    
    _blurHandler : function(event) {
        $get('helper').style.display = 'none';
        
    },
    
    get_text : function() {
        return this._text;
    },
    
    set_text : function(value) {
        
        this._text = value;
    }
    
    
}

Evolutia.formHelper.registerClass('Evolutia.formHelper', Sys.UI.Control);

// 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();

