﻿/// <reference name="MicrosoftAjax.js"/>

Type.registerNamespace("WebControls");

// This 'element' here should be the inputEl
WebControls.Label = function(element) {
    WebControls.Label.initializeBase(this, [element]);
    
    this._validationOn = false;
}

WebControls.Label.prototype = {
    initialize: function() {
        WebControls.Label.callBaseMethod(this, 'initialize');

        var that = this;                

    },
    dispose: function() {
        //Add custom dispose actions here
        WebControls.Label.callBaseMethod(this, 'dispose');
    },
    
    get_value : function() {
        return this._element.innerHTML;
    },
 
    set_value : function(value) {
        if ((value == null || value == '') && value != '0') {
            // this._element.innerHTML = "";
            this._element.innerHTML = "&nbsp;";  // To maintain the normal height
        } else {
            if (this._htmlMode) {
                this._element.innerHTML = value.toString().replaceAll('\n', '<br/>');
            } else if (this._type == 'Date') {
                this._element.innerHTML = formatDate(value);
            } else if (this._type == 'DateTime') {
                this._element.innerHTML = formatDateTime(value);
            } else {
                this._element.innerHTML = value;
            }
        }
    },
    
    flashMessage: function(message, milliseconds) {
        var that = this;
        
        if (!milliseconds) {
            milliseconds = 1000;
        }
        
        this.set_value(message);
        
        setTimeout(
            function() {
                that.set_value('');
            }, milliseconds           
        );
    }    
 
}
WebControls.Label.createProperty('htmlMode');
WebControls.Label.createProperty('type');

WebControls.Label.registerClass('WebControls.Label', WebControls.BaseInput);

if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();