
// Static class for error identification and construction.
var ErrorCls = function() {
    var errorHTMLStyle = "<SPAN style=\"MARGIN-LEFT: 3px; COLOR: red;\">";
    var errorToken = "Error: ";
    return {
        // token prefixing every error message
        ErrorToken: function() { return errorToken; },

        // test text or html message for embedded error token
        IsErrorMessage: function(possibleError) { return (possibleError == null || null == possibleError.match(errorToken)) ? false : true; },

        // msgBody already has error token within ( ususally as prefix )
        FormatHtmlErrorMessage: function(msgBodyPrefixedWithErrorToken) {
        var tmp = errorHTMLStyle;
            // TODO: if (!IsErrorMessage(msgBodyPrefixedWithErrorToken))  ERROR:
            tmp += msgBodyPrefixedWithErrorToken == null ? "" : msgBodyPrefixedWithErrorToken;
            tmp += "</span>";
            return tmp;
        },

        // prefix a possibly null msgBody, then format
        CreateHtmlErrorMessage: function(msgBody) { return this.FormatHtmlErrorMessage(errorToken + (msgBody == null ? "" : msgBody)); }
    };
} ();


