function UIErrorField(b,a){this.constructor=UIErrorField;this.constructor.name="UIErrorField";if(b){if(b.getErrors==undefined){throw new Error("[UIErrorField] form is undefined");}else{this.form=b;}}if(a&&a.messageContainer){if(a.messageContainer.indexOf("{input}")==0){this.type="single";this.container=a.messageContainer.substring(7,a.messageContainer.length);}else{this.type="general";this.container=a.messageContainer;}}else{throw new Error("[UIErrorField] messageContainer is not specified");}if(a&&a.errorElement){if(a.messageContainer.indexOf("{input}")==0){this.errorElement={element:a.errorElement,type:"relative"};}else{this.errorElement={element:a.errorElement,type:"absolute"};}}else{this.errorElement={element:this.container};this.errorElement.type=(this.type=="single")?"relative":"absolute";}this.errorClass=(a&&a.errorClass)?a.errorClass:"error";this.wrapper=(a&&a.wrapper)?a.wrapper:"<div>";this.messages=[];this.errorClassedElements=[];this._argsRegExp=/[\(][\'\"]?[\w]+[\'\"]?[\)]/;this._funcRegExp=/\.[\w]+[\(][\'\"]?[\w]+[\'\"]?[\)]/g;}UIErrorField.prototype={showErrors:function(){var e=this.form.getErrors();var c,b;this.removeErrors();if(this.type=="single"){for(var d in e){if(e[d].length>0){var a=this._getRelativeContainer(d,this.container);this._addClass(d);for(b=0,l=e[d].length;b<l;b++){c=$(this.wrapper).append(e[d][b]);this.messages.push(c);$(a).append(c);}}}}else{for(var d in e){if(e[d].length>0){this._addClass(d);for(b=0,l=e[d].length;b<l;b++){c=$(this.wrapper).append(e[d][b]);this.messages.push(c);$(this.container).append(c);}}}}},removeErrors:function(){for(var d=0,a=this.messages.length;d<a;d++){this.messages[d].remove();}for(var c=0,b=this.errorClassedElements.length;c<b;c++){this.errorClassedElements[c].removeClass(this.errorClass);}},getErrorsElement:function(){return this.messages;},_getRelativeContainer:function(f,a){var c=$(this.form.form).find("*[name="+f+"]");var e=a.match(this._funcRegExp);if(e!=null){for(var d=0,b=e.length;d<b;d++){match=e[d].substring(1,e[d].length);args=e[d].match(this._argsRegExp);args=args[0].replace(/[\'\"\(\)]/g,"");match=match.replace(this._argsRegExp,"");c=$(c)[match](args);}}return c;},_addClass:function(a){var b;if(this.errorElement.type=="relative"){b=this._getRelativeContainer(a,this.errorElement.element);}else{b=this.errorElement;}this.errorClassedElements.push($(b));$(b).addClass(this.errorClass);}};
