﻿if (!SIGI) throw ("SIGI.ComboBox depends on the following scripts. Please make sure these are included.\nSIGI.js");

// === classes ===
SIGI.TextBox = function() {
    this._initialDisplay = "block";
};
SIGI.TextBox.inherits(SIGI.UI.Control);

SIGI.TextBox.prototype.get_text = function() {
    return this.get_element().value;
};
SIGI.TextBox.prototype.set_text = function(pValue) {
    this.get_element().value = pValue;
};
SIGI.TextBox.prototype.get_enabled = function() {
    return !this.get_element().disabled;
};
SIGI.TextBox.prototype.set_enabled = function(pValue) {
    SIGI.changeState(this.get_element(), !pValue);
    if (this.get_element().simpleValidator) {
        //document.getElementById(this.get_element().simpleValidator).style.display = this.get_element().style.display;
        document.getElementById(this.get_element().simpleValidator).style.display = "none";
    }
};
SIGI.TextBox.prototype.get_allowKeys = function() {
    return this.get_element().getAttribute("allowKeys");
};
SIGI.TextBox.prototype.set_allowKeys = function(pValue) {
    this.get_element().setAttribute("allowKeys", pValue)
};
SIGI.TextBox.prototype.get_toolTip = function() {
    return this.get_element().getAttribute("tooltip");
};
SIGI.TextBox.prototype.set_toolTip = function(pValue) {
    this.get_element().setAttribute("tooltip", pValue);
};
SIGI.TextBox.prototype.get_statusText = function() {
    return this.get_element().getAttribute("statustext");
};
SIGI.TextBox.prototype.set_statusText = function(pValue) {
    this.get_element().setAttribute("statustext", pValue);
};
SIGI.TextBox.prototype.get_visible = function() {
    if (this.get_element().style.display == "none")
        return false;
    else
        return true;
};
SIGI.TextBox.prototype.set_visible = function(pValue) {
    if (pValue) {
        if (this._initialDisplay.toLowerCase() == "none") {
            this.get_element().style.display = "block";
        }
        else {
            this.get_element().style.display = this._initialDisplay;
        }
    }
    else {
        this.get_element().style.display = "none";
    }
    if (this.get_element().simpleValidator) {
        //document.getElementById(this.get_element().simpleValidator).style.display = this.get_element().style.display;
        document.getElementById(this.get_element().simpleValidator).style.display = "none";
    }
    if (this.get_element().label) {
        if (SIGI.Validation.hideLabelWithElement(this.get_element())) {
            try {
                this.get_element().label.style.display = this.get_element().style.display;
                this.get_element().label.className = "FormLabel";
            }
            catch (e) {
                document.getElementById(this.get_element().label).style.display = this.get_element().style.display;
                document.getElementById(this.get_element().label).className = "FormLabel";
            }
        }
    }
};
SIGI.TextBox.prototype.focus = function() {
    SIGI.setFocus(this.get_element());
};
SIGI.TextBox.prototype.initialize = function() {
    this._initialDisplay = this.get_element().style.display;
};


