function Abstract(){throw"abstract class"}var Common={Browser:{isIE:function(){return jQuery.browser.msie},isOpera:function(){return jQuery.browser.opera},isSafari:function(){return jQuery.browser.safari},isMozilla:function(){return jQuery.browser.mozilla}},Class:{match:function(a,b){return $(a).hasClass(b)},add:function(a,b){return $(a).addClass(b)},replace:function(a,b,c,d){if(this.match(a,b)){this.remove(a,b);this.add(a,c)}else{if(d&&this.match(a,c)){this.remove(a,c);this.add(a,b)}else{this.add(a,c)}}},remove:function(a,b){return $(a).removeClass(b)}},Event:{TYPE_DOM_CONTENT_LOADED:"DOMContentLoaded",add:function(a,b,c){if(b==this.TYPE_DOM_CONTENT_LOADED){return $(document).ready(c)}$(a).bind(Common.Utils.isArray(b)?b.join(" "):b,c)},remove:function(a,b,c){$(a).unbind(Common.Utils.isArray(b)?b.join(" "):b,c)},cancel:function(a){var a=this.normalize(a);a.cancelBubble=true;a.returnValue=false;a.preventDefault();a.stopPropagation();return false},normalize:function(a){var a=jQuery.event.fix(a||window.event);a.iKeyCode=a.which;if(a.wheelDelta){a.iMouseWheelDelta=a.wheelDelta/120;if(window.opera){a.iMouseWheelDelta*=-1}}else{if(a.detail){a.iMouseWheelDelta=-a.detail/3}}return a},getAbsoluteCoords:function(a){var a=jQuery.event.fix(a||window.event);return{iLeft:a.pageX,iTop:a.pageY}}},Dom:{getUniqueId:function(a){return Common.Utils.getUniqueId(a)},getAbsoluteCoords:function(a){var b=$(a).offset();return{iTop:b.top,iLeft:b.left}},getAttribute:function(a,b){return $(a).attr(b)},createElement:function(a,b,c){var d="<"+a;if(b){$.each(b,function(a,b){if(typeof b!="undefined"){d+=" "+a+'="'+b+'"'}})}var e=$(d+" />");if(c){e.html(c)}return e.get(0)},setStyle:function(a,b){if(typeof a.style.cssText!="undefined"){a.style.cssText=b}else{a.setAttribute("style",b)}},getElementsByClassName:function(a,b,c,d){this.getElementsByClassName=function(a,b,c,d){return $(a).find((d?">":"")+(c?c:"")+"."+b)};return this.getElementsByClassName(a,b,c,d)}},Object:{extend:function(a,b,c){if(!b){return a}var a=a||{};for(var d in b){if((c||typeof a[d]=="undefined")&&typeof b[d]!="undefined"){a[d]=b[d]}}return a}},Observable:{aObservers:[],attach:function(a,b,c){var d=0;if(Common.Utils.isArray(a)){while(a[d]){this.attach(a[d++],b,c)}return}if(Common.Utils.isArray(b)){while(b[d]){this.attach(a,b[d++],c)}return}if(Common.Utils.isArray(c)){while(c[d]){this.attach(a,b,c[d++])}return}if(!this.aObservers[a]){this.aObservers[a]=[]}var e=this.aObservers[a],f=Common.Utils.getUniqueId(c);if(!e[f]){e[f]=[]}e[f].push(b)},detach:function(a,b,c){var d=0;if(Common.Utils.isArray(a)){while(a[d]){this.detach(a[d++],b,c)}return}if(Common.Utils.isArray(b)){while(b[d]){this.detach(a,b[d++],c)}return}if(Common.Utils.isArray(c)){while(c[d]){this.detach(a,b,c[d++])}return}var e=this.aObservers[a];if(!e){return}var f=Common.Utils.getUniqueId(c);if(e[f]){e[f].remove(b)}},notify:function(a,b,c){var d=this.aObservers[a];if(!d){return}var e=Common.Utils.getUniqueId(b);if(!d[e]){return}var f=0,g=d[e],h;while(h=g[f++]){h(a,b,c)}}},Utils:{getUniqueId:function(a){if(a.uniqueID){return a.uniqueID}if(!arguments.callee.counter){arguments.callee.counter=0}a.uniqueID="__uid-"+arguments.callee.counter++;return a.uniqueID},isArray:function(a){return Object.prototype.toString.call(a)==="[object Array]"}}};Common.Object.extend(Function.prototype,{inheritTo:function(a,b){var c=this,d=function(){if(this.__constructor){this.__constructor.apply(this,arguments)}},e=function(){};Common.Object.extend(d,c);e.prototype=this.prototype;d.prototype=new e;d.prototype.constructor=d;d.prototype.__self=d;if(a){for(var f in a){if(typeof d.prototype[f]=="function"){(function(b){d.prototype[b]=function(){var d=this.__base;this.__base=c.prototype[b];var e=a[b].apply(this,arguments);this.__base=d;return e}})(f)}else{d.prototype[f]=a[f]}}}if(b){Common.Object.extend(d,b,true)}return d}});Common.Object.extend(Array.prototype,{isEmpty:function(){return this.length==0},remove:function(a){for(var b=0;b<this.length;b++){if(this[b]==a){this.splice(b,1);break}}},indexOf:function(a){for(var b=0;b<this.length;b++){if(this[b]==a){return b}}return-1},indexOfByFunction:function(a,b){if(!b){return this.indexOf(a)}for(var c=0;c<this.length;c++){if(b(this[c],a)){return c}}return-1},contains:function(a,b){return this.indexOfByFunction(a,b)>-1},intersect:function(a){return $.grep(this.concat([]),function(b){return a.contains(b)})}});Common.Object.extend(String.prototype,{formatNumber:function(a,b){var a=a||" ",b=b||",",c=this.indexOf("."),d=c>-1?this.substring(c+1):"",e=c>-1?this.substring(0,c):this;if(e.length<5){return e+(c>-1?b+d:"")}var f="";while(e.length>3){f=e.substring(e.length-3)+(f.length>0?a:"")+f;e=e.substring(0,e.length-3)}f=e+a+f+(c>-1?b+d:"");return f}});Common.Object.extend(Number.prototype,{formatNumber:function(a,b){return this.toString().formatNumber(a,b)}});Common.Utils.StringBuffer=Abstract.inheritTo({__constructor:function(a){this.aBuffer=[];if(a){this.append(a)}},append:function(a){this.aBuffer.push(a);return this},get:function(){return this.aBuffer.join("")},clear:function(){this.aBuffer=[];return this}});document.documentElement.id="with-js";window.onerror=function(){$("body").addClass("with-js-error")};var ZForms={EVENT_TYPE_ON_INIT:"zf:oninit",EVENT_TYPE_ON_CHANGE:"zf:onchange",EVENT_TYPE_ON_BEFORE_SUBMIT:"zf:onbeforesubmit",EVENT_TYPE_ON_READY_CHANGE:"zf:onreadychange",createWidget:function(){return new arguments[0](arguments[1][0],arguments[1][1],arguments[1][2])},createTextInput:function(){return this.createWidget(ZForms.Widget.Text,arguments)},createNumberInput:function(){return this.createWidget(ZForms.Widget.Text.Number,arguments)},createSelectInput:function(){return this.createWidget(ZForms.Widget.Select,arguments)},createComboInput:function(){return this.createWidget(ZForms.Widget.Text.Combo,arguments)},createContainer:function(){return this.createWidget(ZForms.Widget.Container,arguments)},createDateInput:function(){return this.createWidget(ZForms.Widget.Container.Date,arguments)},createInputGroup:function(){var a=this.createWidget(arguments[0],arguments[1]);if(arguments[1][3]){for(var b=0;b<arguments[1][3].length;b++){a.addChild(this.createStateInput(arguments[1][3][b][0],arguments[1][3][b][1],arguments[1][2]))}}return a},createStateInput:function(){return this.createWidget(ZForms.Widget.Text.State,arguments)},createCheckBoxGroup:function(){return this.createInputGroup(ZForms.Widget.Container.Group.CheckBox,arguments)},createRadioButtonGroup:function(){return this.createInputGroup(ZForms.Widget.Container.Group.RadioButton,arguments)},createSlider:function(){return this.createWidget(ZForms.Widget.Container.Slider,arguments)},createSliderVertical:function(){return this.createWidget(ZForms.Widget.Container.Slider.Vertical,arguments)},createButton:function(){return this.createWidget(ZForms.Widget.Button,arguments)},createSubmitButton:function(){return this.createWidget(ZForms.Widget.Button.Submit,arguments)},createSheet:function(){return this.createWidget(ZForms.Widget.Container.Sheet,arguments)},createSheetContainer:function(){return this.createWidget(ZForms.Widget.Container.SheetContainer,arguments)},createMultiplicator:function(){return this.createWidget(ZForms.Widget.Container.Multiplicator,arguments)},createForm:function(){this.aForms.push(this.createWidget(ZForms.Widget.Container.Form,arguments));return this.aForms[this.aForms.length-1]},createEnabledDependence:function(a,b){return new this.Dependence.Enabled(a,b.rPattern,b.iLogic,b.bInverse,b.bFocusOnEnable)},createRequiredDependence:function(a,b){var b=b||{};return new this.Dependence.Required(a,b.rPattern?b.rPattern:b.iMin>1?new RegExp("\\S.{"+(b.iMin-2)+",}\\S"):/\S+/,b.iLogic,false,b.iMin)},createValidDependence:function(a,b){var b=b||{};return new this.Dependence.Valid(a,b.rPattern,b.iLogic,b.bInverse,b.sClassName,b.bCheckForEmpty)},createValidEmailDependence:function(a,b){return this.createValidDependence(a,Common.Object.extend({rPattern:/^[a-zA-Z0-9][a-zA-Z0-9\.\-\_\~]*\@[a-zA-Z0-9\.\-\_]+\.[a-zA-Z]{2,4}$/},b))},createOptionsDependence:function(a,b){var b=b||{};return new this.Dependence.Options(this.Dependence.TYPE_OPTIONS,a,b.aPatterns||[],b.iLogic)},createClassDependence:function(a,b){var b=b||{};return new this.Dependence.Class(a,b.aPatternToClasses||[],b.iLogic)},createFunctionDependence:function(a,b){var b=b||{};return new this.Dependence.Function(b.iType||ZForms.Dependence.TYPE_VALID,a,b.fFunction||function(){return true},b.iLogic,b.bInverse)},createCompareDependence:function(a,b){var b=b||{},c=function(a,b){var c=arguments.callee.iType==ZForms.Dependence.TYPE_VALID&&!arguments.callee.oOptions.bCheckForEmpty&&arguments.callee.oWidget.getValue().isEmpty()||arguments.callee.oWidget.getValue()[arguments.callee.sFunctionName](arguments.callee.mArgument instanceof ZForms.Widget?arguments.callee.mArgument.getValue():arguments.callee.mArgument);if(arguments.callee.iType==ZForms.Dependence.TYPE_VALID&&arguments.callee.oOptions.sClassName){b.setResult({bAdd:!c,sClassName:arguments.callee.oOptions.sClassName})}else{if(arguments.callee.iType==ZForms.Dependence.TYPE_ENABLED&&arguments.callee.oOptions.bFocusOnEnable){b.setResult({bFocusOnEnable:c})}}return c},d=new this.Dependence.Function(b.iType,a,c,b.iLogic,b.bInverse);c.iType=b.iType;c.oWidget=a;c.mArgument=b.mArgument;c.sFunctionName=this.Dependence.COMPARE_FUNCTIONS[b.sCondition||"eq"];c.oOptions=b;if(!(b.mArgument instanceof ZForms.Widget)){return d}return[d,new this.Dependence.Function(b.iType,b.mArgument,c,b.iLogic,b.bInverse)]},createValidCompareDependence:function(a,b){return this.createCompareDependence(a,Common.Object.extend({iType:this.Dependence.TYPE_VALID},b))},createEnabledCompareDependence:function(a,b){return this.createCompareDependence(a,Common.Object.extend({iType:this.Dependence.TYPE_ENABLED},b))},buildForm:function(a){return(new this.Builder(a)).build()},throwException:function(a){throw"ZForms: "+a},aForms:[],getFormById:function(a){return this.aForms[a]},bInited:false,isInited:function(){return this.bInited},attachObserver:function(a,b,c,d){Common.Observable.attach(a,b,c||this);if(a==this.EVENT_TYPE_ON_INIT&&c==this&&this.isInited()||d){b(a,c)}else{if(a==this.EVENT_TYPE_ON_READY_CHANGE){b(a,c,c.isReadyForSubmit())}}},detachObserver:function(a,b,c){Common.Observable.detach(a,b,c)},notifyObservers:function(a,b,c){Common.Observable.notify(a,b,c)}};ZForms.Value=Abstract.inheritTo({__constructor:function(a){this.mValue=null;this.reset();if(a!=null){this.set(a)}},reset:function(){this.set("")},get:function(){return this.mValue},set:function(a){this.mValue=typeof a=="string"?a:a.toString()},match:function(a){return a.test(this.get())},clone:function(){var a=new this.__self;a.set(this.get());return a},isEqual:function(a){if(!this.checkForCompareTypes(a)){return false}var b=a instanceof this.__self?a:new this.__self(a);return this.mValue===b.mValue},isGreater:function(a){if(!this.checkForCompareTypes(a)){return false}var b=a instanceof this.__self?a:new this.__self(a);return this.get().length>b.get().length},isGreaterOrEqual:function(a){return this.isGreater(a)||this.isEqual(a)},isLess:function(a){return this.checkForCompareTypes(a)&&!this.isGreaterOrEqual(a)},isLessOrEqual:function(a){return this.checkForCompareTypes(a)&&!this.isGreater(a)},checkForCompareTypes:function(a){return a instanceof this.__self||typeof a=="string"},isEmpty:function(){return this.mValue===""},toStr:function(){return this.get().toString()}});ZForms.Value.Number=ZForms.Value.inheritTo({set:function(a){this.mValue=parseFloat(a.toString().replace(/[^0-9\.\,\-]/g,"").replace(/\,/g,"."))},match:function(a){return a.test(isNaN(this.mValue)?"":this.mValue.toString())},isEmpty:function(){return isNaN(this.mValue)},isEqual:function(a){if(!this.checkForCompareTypes(a)){return false}var b=a instanceof this.__self?a:new this.__self(a instanceof ZForms.Value?a.get():a);return this.get()===b.get()},isGreater:function(a){if(!this.checkForCompareTypes(a)){return false}var b=a instanceof this.__self?a:new this.__self(a instanceof ZForms.Value?a.get():a);return this.get()>b.get()},checkForCompareTypes:function(a){return a instanceof this.__self||a instanceof ZForms.Value&&!isNaN(parseFloat(a.get()))||typeof a=="number"||typeof a=="string"&&!isNaN(parseFloat(a.toString()))},toStr:function(){return isNaN(this.mValue)?"":this.mValue.toString()}});ZForms.Value.Multiple=ZForms.Value.inheritTo({reset:function(){this.set([])},set:function(a){this.mValue=a instanceof Array?a:[a]},match:function(a){if(this.isEmpty()){return a.test("")}for(var b=0;b<this.mValue.length;b++){if(a.test(this.mValue[b])){return true}}return false},clone:function(){var a=new this.__self;for(var b=0;b<this.mValue.length;b++){a.add(this.mValue[b])}return a},isEqual:function(a){if(!(a instanceof this.__self||a instanceof Array)){return this.mValue.length==1&&this.mValue[0]===(a instanceof ZForms.Value?a.get():a)}var b=a instanceof this.__self?a:new this.__self(a);if(this.mValue.length!=b.mValue.length){return false}for(var c=0;c<this.mValue.length;c++){if(this.mValue[c]!=b.mValue[c]){return false}}return true},isGreater:function(a){if(!(a instanceof this.__self||a instanceof Array)){return false}return this.get().length>(a instanceof this.__self?a:new this.__self(a)).get().length},checkForCompareTypes:function(a){return a instanceof this.__self||a instanceof Array},isEmpty:function(){return this.mValue.length==0},add:function(a){if(this.mValue.contains(a)){return}this.mValue.push(a)},remove:function(a){this.mValue.remove(a)}});ZForms.Value.Date=ZForms.Value.inheritTo({reset:function(){this.mValue=[];this.mValue[this.__self.PART_YEAR]="";this.mValue[this.__self.PART_MONTH]="";this.mValue[this.__self.PART_DAY]=""},get:function(){if(this.isEmpty()){return""}return this.getYear()+"-"+this.getMonth()+"-"+this.getDay()},set:function(a){var b=null;if(a instanceof Date){b=a}else{var c=a.match(/^(-?\d{1,4})-(\d{1,2})-(-?\d{1,2})/);if(c){b=new Date(parseInt(c[1],10),parseInt(c[2],10)-1,parseInt(c[3],10))}}if(b){this.mValue[this.__self.PART_YEAR]=b.getFullYear();this.mValue[this.__self.PART_MONTH]=b.getMonth()+1;this.mValue[this.__self.PART_DAY]=b.getDate()}else{this.reset()}},isEqual:function(a){if(a instanceof this.__self.Time){return this.get()+" 0:0:0"==a.get()}if(a instanceof this.__self){return this.get()==a.get()}if(a instanceof ZForms.Value){return this.get()==a.get()}if(a instanceof Date){return this.get()==(new this.__self(a)).get()}return this.get()===a},isGreater:function(a){var b=a instanceof ZForms.Value.Date?a:new ZForms.Value.Date(a instanceof ZForms.Value?a.get():a);if(this.isEmpty()||b.isEmpty()){return false}if(this.getYear()>b.getYear()){return true}if(this.getYear()==b.getYear()){if(this.getMonth()>b.getMonth()){return true}return this.getMonth()==b.getMonth()&&this.getDay()>b.getDay()}return false},checkForCompareTypes:function(a){if(a instanceof this.__self||a instanceof this.__self.Time){return!a.isEmpty()}if(a instanceof ZForms.Value){return!(new ZForms.Value.Date(a.get())).isEmpty()}if(typeof a=="string"){return!(new ZForms.Value.Date(a)).isEmpty()}return a instanceof Date},isEmpty:function(){return!this.mValue||this.mValue[this.__self.PART_YEAR]==""||this.mValue[this.__self.PART_MONTH]==""||this.mValue[this.__self.PART_DAY]==""},getYear:function(){return this.mValue[this.__self.PART_YEAR]},getMonth:function(){return this.mValue[this.__self.PART_MONTH]},getDay:function(){return this.mValue[this.__self.PART_DAY]},toStr:function(){if(this.isEmpty()){return""}return this.getYear()+"-"+(this.getMonth()<10?"0":"")+this.getMonth()+"-"+(this.getDay()<10?"0":"")+this.getDay()}},{PART_YEAR:"year",PART_MONTH:"month",PART_DAY:"day"});ZForms.Value.Date.Time=ZForms.Value.Date.inheritTo({reset:function(){this.__base();this.mValue[this.__self.PART_HOUR]="";this.mValue[this.__self.PART_MINUTE]="";this.mValue[this.__self.PART_SECOND]=""},get:function(){if(this.isEmpty()){return""}return this.__base()+" "+this.getHour()+":"+this.getMinute()+":"+this.getSecond()},set:function(a){var b=null;if(a instanceof Date){b=a}else{var c=a.match(/^(-?\d{1,4})-(\d{1,2})-(-?\d{1,2})( (-?\d{1,2}):(-?\d{1,2}):(-?\d{1,2}))?/);if(c){b=new Date(parseInt(c[1],10),parseInt(c[2],10)-1,parseInt(c[3],10),c[5]?parseInt(c[5],10):0,c[6]?parseInt(c[6],10):0,c[7]?parseInt(c[7],10):0)}}if(b){this.mValue[this.__self.PART_YEAR]=b.getFullYear();this.mValue[this.__self.PART_MONTH]=b.getMonth()+1;this.mValue[this.__self.PART_DAY]=b.getDate();this.mValue[this.__self.PART_HOUR]=b.getHours();this.mValue[this.__self.PART_MINUTE]=b.getMinutes();this.mValue[this.__self.PART_SECOND]=b.getSeconds()}else{this.reset()}},isEqual:function(a){if(a instanceof this.__self){return this.get()==a.get()}if(a instanceof ZForms.Value.Date){return this.get()==a.get()+" 0:0:0"}if(a instanceof ZForms.Value||typeof a=="string"){return this.isEqual(new this.__self(typeof a=="string"?a:a.get()))}if(a instanceof Date){return this.get()==(new this.__self(a)).get()}return false},isGreater:function(a){if(this.__base(a)){return true}var b=a instanceof this.__self?a:new this.__self(a instanceof ZForms.Value.Date?a.get()+" 0:0:0":a instanceof ZForms.Value?a.get():a);if(this.getDay()==b.getDay()){if(this.getHour()>b.getHour()){return true}else{if(this.getHour()==b.getHour()){if(this.getMinute()>b.getMinute()){return true}else{return this.getMinute()==b.getMinute()&&this.getSecond()>b.getSecond()}}}}return false},checkForCompareTypes:function(a){if(a instanceof this.__self||a instanceof ZForms.Value.Date){return!a.isEmpty()}if(a instanceof ZForms.Value){return!(new ZForms.Value.Date(a.get())).isEmpty()}if(typeof a=="string"){return!(new ZForms.Value.Date.Time(a)).isEmpty()}return a instanceof Date},isEmpty:function(){return this.__base()||this.mValue[this.__self.PART_HOUR]===""||this.mValue[this.__self.PART_MINUTE]===""||this.mValue[this.__self.PART_SECOND]===""},getHour:function(){return this.mValue[this.__self.PART_HOUR]},getMinute:function(){return this.mValue[this.__self.PART_MINUTE]},getSecond:function(){return this.mValue[this.__self.PART_SECOND]},toStr:function(){if(this.isEmpty()){return""}return this.__base()+" "+(this.getHour()<10?"0":"")+this.getHour()+":"+(this.getMinute()<10?"0":"")+this.getMinute()+":"+(this.getSecond()<10?"0":"")+this.getSecond()}},{PART_HOUR:"hour",PART_MINUTE:"minute",PART_SECOND:"second"});ZForms.Widget=Abstract.inheritTo({__constructor:function(a,b,c){this.oElement=a;this.oClassElement=b||a;this.oOptions=c?Common.Object.extend(this.getDefaultOptions(),c,true):this.getDefaultOptions();this.sId=Common.Dom.getAttribute(a,"id")||Common.Dom.getUniqueId(a);this.oDependenceProcessor=new ZForms.DependenceProcessor(this);this.aObservers=[];this.oParent=null;this.oForm=null;this.bEnabled=true;this.bRequired=false;this.bValid=true;this.oMultiplier=null;this.oValue=this.createValue();this.setValueFromElement(true);this.oInitialValue=this.oValue.clone();this.oLastProcessedValue=this.oValue.clone();this.bInitialValueChanged=false;this.bInited=false;this.addHandlers()},getDefaultOptions:function(){return{bTemplate:false,bFocusOnInit:false}},createValue:function(a){return new ZForms.Value(a)},addHandlers:function(){function b(b){var b=Common.Event.normalize(b);b.cancelBubble=true;a.processEvents(true)}if(this.isTemplate()){return}var a=this;Common.Event.add(this.oElement,this.getEventList(),b)},getEventList:function(){return[]},processEvents:function(a,b,c){this.setValueFromElement();if(!(b||this.isChanged())||this.isTemplate()){return}else{this.checkForInitialValueChanged();this.updateLastProcessedValue()}this.notifyObservers();ZForms.notifyObservers(ZForms.EVENT_TYPE_ON_CHANGE,this);if(!c){if(this.oParent){this.oParent.processEvents(a,true)}else{if(a&&this.oForm){this.oForm.updateSubmit()}}}},isChanged:function(){return!this.oValue.isEqual(this.oLastProcessedValue)},updateLastProcessedValue:function(){this.oLastProcessedValue=this.oValue.clone()},isInitialValueChanged:function(){return this.bInitialValueChanged},checkForInitialValueChanged:function(){if(!this.oForm){return}if(!this.isInitialValueChanged()&&!this.compareValueWithInitialValue()){this.oForm.increaseChangedCounter();this.bInitialValueChanged=true;this.addClass(this.__self.CLASS_NAME_CHANGED)}else{if(this.isInitialValueChanged()&&this.compareValueWithInitialValue()){this.oForm.decreaseChangedCounter();this.bInitialValueChanged=false;this.removeClass(this.__self.CLASS_NAME_CHANGED)}}},compareValueWithInitialValue:function(){return this.oValue.isEqual(this.oInitialValue)},init:function(){if(this.isTemplate()){return}if(this.oElement.disabled){this.disable()}this.processEvents(false,true);if(this.oMultiplier){this.oMultiplier.init()}if(this.oOptions.bFocusOnInit){this.focus()}this.bInited=true;ZForms.notifyObservers(ZForms.EVENT_TYPE_ON_INIT,this)},isInited:function(){return this.bInited},getValue:function(){return this.oValue},setValue:function(a){if(!this.hasValue()){return}this.oValue=a;this.processEvents(true)},setValueFromElement:function(){},hasValue:function(){return true},getId:function(){return this.sId},setId:function(a){this.sId=a},getName:function(){return this.oElement.name},isTemplate:function(){return this.oOptions.bTemplate},addClass:function(a,b){Common.Class.add(b?b:this.oClassElement,a)},removeClass:function(a,b){Common.Class.remove(b?b:this.oClassElement,a)},replaceClass:function(a,b,c){Common.Class.replace(c?c:this.oClassElement,a,b)},disable:function(a){if(!this.isEnabled()){return false}this.bEnabled=false;this.oElement.disabled=true;this.oClassElement.disabled=true;this.addClass(this.__self.CLASS_NAME_DISABLED);if(a){this.processEvents(true,true,true)}if(this.oMultiplier){this.oMultiplier.disableByOuter()}return true},enable:function(a){if(!this.allowEnable()){return false}this.bEnabled=true;this.oElement.disabled=false;this.oClassElement.disabled=false;this.removeClass(this.__self.CLASS_NAME_DISABLED);if(a){this.processEvents(true,true,true);this.updateByObservable(true)}if(this.oMultiplier){this.oMultiplier.enableByOuter()}return true},allowEnable:function(){return!this.isEnabled()&&!(this.oParent&&!this.oParent.isEnabled())},isEnabled:function(){return this.bEnabled},setRequired:function(){this.replaceClass(this.__self.CLASS_NAME_REQUIRED_OK,this.__self.CLASS_NAME_REQUIRED);this.bRequired=true},unsetRequired:function(){this.replaceClass(this.__self.CLASS_NAME_REQUIRED,this.__self.CLASS_NAME_REQUIRED_OK);this.bRequired=false},isRequired:function(){return this.bRequired},setValid:function(){if(this.hasValue()&&this.getValue().isEmpty()){this.removeClass(this.bValid?this.__self.CLASS_NAME_INVALID_OK:this.__self.CLASS_NAME_INVALID)}else{this.replaceClass(this.__self.CLASS_NAME_INVALID,this.__self.CLASS_NAME_INVALID_OK)}this.bValid=true},setInvalid:function(){this.replaceClass(this.__self.CLASS_NAME_INVALID_OK,this.__self.CLASS_NAME_INVALID);this.bValid=false},isValid:function(){return this.bValid},isReadyForSubmit:function(){return!this.isEnabled()||!this.isRequired()&&(!this.oForm.oOptions.bCheckForValid||this.isValid())},setParent:function(a){this.oParent=a},setForm:function(a){if(this.oForm){return}this.oForm=a;a.addWidget(this)},hide:function(){this.addClass(this.__self.CLASS_NAME_INVISIBLE)},show:function(){this.removeClass(this.__self.CLASS_NAME_INVISIBLE)},focus:function(){var a=this.oParent;do{if(a instanceof ZForms.Widget.Container.Sheet){a.oParent.select(a)}a=a.oParent}while(a);try{this.oElement.focus()}catch(b){}},attachObserver:function(a){this.aObservers.push(a)},detachObserver:function(a){this.aObservers.remove(a)},detachObservers:function(){for(var a=0,b,c;a<this.aObservers.length;){if(this.aObservers[a]==this){a++;continue}c=this.aObservers[a];b=this.aObservers[a].getDependencies();for(var d=0;d<b.length;d++){if(b[d].getFrom()==this){this.aObservers[a].removeDependence(b[d])}}this.detachObserver(c);if(c.oParent){c.updateByObservable()}}},notifyObservers:function(){for(var a=0;a<this.aObservers.length;a++){this.aObservers[a].updateByObservable()}},updateByObservable:function(a){this.oDependenceProcessor.process();if(!a&&this.oParent){this.oParent.oDependenceProcessor.process()}},addDependence:function(a){if(a instanceof Array){for(var b=0;b<a.length;b++){this.addDependence(a[b])}return}a.getFrom().attachObserver(this);this.oDependenceProcessor.addDependence(a)},removeDependence:function(a){this.oDependenceProcessor.removeDependence(a)},getDependencies:function(){return this.oDependenceProcessor.getDependencies()},getMultiplier:function(){return this.oMultiplier},setMultiplier:function(a){this.oMultiplier=a},updateElements:function(a){this.oElement=document.getElementById(a>0?this.oElement.id.match(ZForms.Widget.Container.Multiplicator.REG_EXP_REPLACE)[1]+"_"+a:this.oElement.id);this.oClassElement=document.getElementById(a>0?this.oClassElement.id.match(ZForms.Widget.Container.Multiplicator.REG_EXP_REPLACE)[1]+"_"+a:this.oClassElement.id);this.updateId(this.oElement.id);if(this.oElement.attachEvent){this.addHandlers();this.addExtendedHandlers()}},updateId:function(a){this.oForm.removeWidget(this);this.setId(a);this.oForm.addWidget(this)},addId:function(a){this.setId(this.addIdToElement(this.oElement,this.__self.ID_PREFIX,a));this.addIdToElement(this.oClassElement,this.__self.ROW_ID_PREFIX,a);if(this.oMultiplier){this.oMultiplier.addId(a)}},addIdToElement:function(a,b,c){if(!!a.getAttribute("id")){return a.getAttribute("id")}var d=b+Common.Dom.getUniqueId(a)+(c>0?"_"+c:"");a.setAttribute("id",d);return d},addChild:function(a){return a},getCountChildrenByPattern:function(){return 0},destruct:function(){this.oElement=null;this.oClassElement=null;if(this.oMultiplier){this.oMultiplier.destruct()}},afterClone:function(){this.processEvents(true,true)},prepareForSubmit:function(){},addExtendedHandlers:function(){},removeChild:function(a){},removeChildren:function(a){},enableOptionsByValue:function(a,b){},clone:function(a,b,c){var d=Common.Object.extend({bTemplate:false},this.oOptions);return new this.__self(a,b,d)}},{CLASS_NAME_REQUIRED:"zf-required",CLASS_NAME_REQUIRED_OK:"zf-required-ok",CLASS_NAME_INVALID:"zf-invalid",CLASS_NAME_INVALID_OK:"zf-invalid-ok",CLASS_NAME_DISABLED:"zf-disabled",CLASS_NAME_INVISIBLE:"zf-invisible",CLASS_NAME_SELECTED:"zf-selected",CLASS_NAME_HIDDEN:"zf-hidden",CLASS_NAME_SELECTED_INITIAL:"zf-selected-initial",CLASS_NAME_CHANGED:"zf-changed",KEY_CODE_ARROW_RIGHT:39,KEY_CODE_ARROW_LEFT:37,KEY_CODE_ARROW_UP:38,KEY_CODE_ARROW_DOWN:40,KEY_CODE_PAGE_UP:33,KEY_CODE_PAGE_DOWN:34,KEY_CODE_HOME:36,KEY_CODE_END:35,KEY_CODE_ENTER:13,KEY_CODE_TAB:9,KEY_CODE_ESCAPE:27,DOM_EVENT_TYPE_KEYUP:"keyup",DOM_EVENT_TYPE_KEYDOWN:"keydown",DOM_EVENT_TYPE_KEYPRESS:"keypress",DOM_EVENT_TYPE_CLICK:"click",DOM_EVENT_TYPE_BLUR:"blur",DOM_EVENT_TYPE_FOCUS:"focus",DOM_EVENT_TYPE_CHANGE:"change",DOM_EVENT_TYPE_MOUSEDOWN:"mousedown",DOM_EVENT_TYPE_MOUSEUP:"mouseup",DOM_EVENT_TYPE_MOUSEMOVE:"mousemove",DOM_EVENT_TYPE_SELECTSTART:"selectstart",DOM_EVENT_TYPE_UNLOAD:"unload",DOM_EVENT_TYPE_BEFOREUNLOAD:"beforeunload",DOM_EVENT_TYPE_PASTE:"paste",ID_PREFIX:"input-",ROW_ID_PREFIX:"row-"});ZForms.Widget.Container=ZForms.Widget.inheritTo({__constructor:function(a,b,c){this.aChildren=[];this.__base(a,b,c)},addChild:function(a,b){if(b>-1&&b<this.aChildren.length){this.aChildren.splice(b,0,a)}else{this.aChildren.push(a)}a.setParent(this);if(this.oForm){a.setForm(this.oForm)}return a},removeChild:function(a){a.detachObservers();a.removeChildren();this.aChildren.remove(a);if(this.oForm){this.oForm.removeWidget(a);if(a.isInitialValueChanged()){this.oForm.decreaseChangedCounter()}}a.setParent(null);a=null},removeChildren:function(){while(this.aChildren.length>0){this.removeChild(this.aChildren[0])}},getChildren:function(){return this.aChildren},setForm:function(a){this.__base(a);for(var b=0,c=this.aChildren.length;b<c;b++){this.aChildren[b].setForm(a)}},disable:function(a){if(!this.__base(a)){return false}for(var b=0,c=this.aChildren.length;b<c;b++){this.aChildren[b].disable(true)}return true},enable:function(a){if(!this.allowEnable()){return false}this.bEnabled=true;for(var b=0,c=this.aChildren.length;b<c;b++){this.aChildren[b].enable(true);this.aChildren[b].updateByObservable(true)}this.bEnabled=false;this.__base(a);return true},isValid:function(){if(!this.__base()){return false}for(var a=0,b=this.aChildren.length;a<b;a++){if(!this.aChildren[a].isValid()&&this.aChildren[a].isEnabled()){return false}}return true},isRequired:function(){if(this.__base()){return true}for(var a=0,b=this.aChildren.length;a<b;a++){if(this.aChildren[a].isRequired()&&this.aChildren[a].isEnabled()){return true}}return false},init:function(){for(var a=0,b=this.aChildren.length;a<b;a++){this.aChildren[a].init()}this.__base()},afterClone:function(){this.__base();for(var a=0,b=this.aChildren.length;a<b;a++){this.aChildren[a].afterClone()}},hasValue:function(){return false},isChanged:function(){return true},focus:function(){if(this.aChildren.length>0){this.aChildren[0].focus()}},getCountChildrenByPattern:function(a){var b=0;for(var c=0,d=this.aChildren.length;c<d;c++){if(!this.aChildren[c].isEnabled()){continue}if(this.aChildren[c]instanceof ZForms.Widget.Container){if(this.aChildren[c].getCountChildrenByPattern(a)>0){b++}}else{if(this.aChildren[c].getValue().match(a)){b++}}}return b},updateElements:function(a){this.__base(a);for(var b=0,c=this.aChildren.length;b<c;b++){this.aChildren[b].updateElements(a)}},addId:function(a){this.__base(a);for(var b=0,c=this.aChildren.length;b<c;b++){this.aChildren[b].addId(a)}},clone:function(a,b,c){var d=this.__base(a,b,c);this.cloneChildren(d,c);return d},cloneChildren:function(a,b){for(var c=0,d=this.aChildren.length;c<d;c++){a.addChild(this.aChildren[c].clone(document.getElementById(this.aChildren[c].oElement.id.match(ZForms.Widget.Container.Multiplicator.REG_EXP_REPLACE)[1]+"_"+b),document.getElementById(this.aChildren[c].oClassElement.id.match(ZForms.Widget.Container.Multiplicator.REG_EXP_REPLACE)[1]+"_"+b),b))}},destruct:function(){for(var a=0,b=this.aChildren.length;a<b;a++){this.aChildren[a].destruct()}this.__base()},prepareForSubmit:function(){for(var a=0,b=this.aChildren.length;a<b;a++){this.aChildren[a].prepareForSubmit()}this.__base()}});ZForms.Widget.Container.Sheet=ZForms.Widget.Container.inheritTo({__constructor:function(a,b,c){this.__base(a,b,c);this.oLegendButton=null;this.oPrevButton=null;this.oNextButton=null;if(this.oOptions.oElementLegend){this.addLegendButton(new ZForms.Widget.Button(this.oOptions.oElementLegend,null,{bTemplate:this.oOptions.bTemplate}))}if(this.oOptions.oElementPrev){this.addPrevButton(new ZForms.Widget.Button(this.oOptions.oElementPrev,null,{bTemplate:this.oOptions.bTemplate}))}if(this.oOptions.oElementNext){this.addNextButton(new ZForms.Widget.Button(this.oOptions.oElementNext,null,{bTemplate:this.oOptions.bTemplate}))}this.bSelected=Common.Class.match(this.oClassElement,this.__self.CLASS_NAME_SELECTED)},addLegendButton:function(a){this.oLegendButton=a;this.addChild(a);var b=this;a.setHandler(function(){b.oParent.select(b);return false})},addPrevButton:function(a){this.oPrevButton=a;this.addChild(a);var b=this;a.setHandler(function(){b.oParent.prev(b);return false})},addNextButton:function(a){this.oNextButton=a;this.addChild(a);var b=this;a.setHandler(function(){b.oParent.next(b);return false})},setParent:function(a){this.__base(a);if(this.isSelected()){this.oParent.select(this)}},isSelected:function(){return this.bSelected},select:function(){this.bSelected=true;this.addClass(this.__self.CLASS_NAME_SELECTED);if(this.oLegendButton){this.oLegendButton.addClass(this.__self.CLASS_NAME_SELECTED)}},unselect:function(){this.bSelected=false;this.removeClass(this.__self.CLASS_NAME_SELECTED);if(this.oLegendButton){this.oLegendButton.removeClass(this.__self.CLASS_NAME_SELECTED)}},destruct:function(){if(this.oLegendButton){this.oLegendButton.destruct()}if(this.oPrevButton){this.oPrevButton.destruct()}if(this.oNextButton){this.oNextButton.destruct()}this.__base()}});ZForms.Widget.Container.SheetContainer=ZForms.Widget.Container.inheritTo({__constructor:function(a,b,c){this.__base(a||document.createElement("div"),b,c);this.iCurrentSheetIndex=0},addChild:function(a){if(!(a instanceof ZForms.Widget.Container.Sheet)){return}return this.__base(a)},findSheetIndex:function(a){return this.aChildren.indexOf(a)},select:function(a){this.selectByIndex(this.findSheetIndex(a))},prev:function(a){this.selectByIndex(this.findSheetIndex(a)-1)},next:function(a){this.selectByIndex(this.findSheetIndex(a)+1)},selectByIndex:function(a){if(!this.aChildren[a]){return}this.aChildren[this.iCurrentSheetIndex].unselect();this.aChildren[a].select();this.iCurrentSheetIndex=a}},{CLASS_NAME_INITED:"zf-sheetcontainer-inited"});ZForms.Widget.Container.Group=ZForms.Widget.Container.inheritTo({hasValue:function(){return true},getName:function(){return this.aChildren[0]?this.aChildren[0].oElement.name:""},addChild:function(a){if(!(a instanceof ZForms.Widget.Text.State)){return}return this.__base(a)},processEvents:function(a,b,c){this.__base(a,b,c);if(!c){for(var d=0;d<this.aChildren.length;d++){this.aChildren[d].updateLastProcessedValue();if(this.aChildren[d].isChecked()){this.aChildren[d].addClass(this.__self.CLASS_NAME_SELECTED)}else{this.aChildren[d].removeClass(this.__self.CLASS_NAME_SELECTED)}}}},enable:function(a){var b=this.__base(a);if(b&&!a){this.setValueFromElement()}return b},disable:function(a){var b=this.__base(this,a);if(b&&!a){this.setValueFromElement()}return b},isChanged:function(){return this.__base()}});ZForms.Widget.Container.Group.CheckBox=ZForms.Widget.Container.Group.inheritTo({createValue:function(a){return new ZForms.Value.Multiple(a)},setValue:function(a){for(var b=0,c=a.get();b<this.aChildren.length;b++){if(c.contains(this.aChildren[b].getValue().get())){this.aChildren[b].check()}else{this.aChildren[b].uncheck()}}this.__base(a)},setValueFromElement:function(){this.oValue.reset();for(var a=0;a<this.aChildren.length;a++){if(this.aChildren[a].isChecked()&&this.aChildren[a].isEnabled()){this.oValue.add(this.aChildren[a].getValue().get())}}this.__base()},addChild:function(a){if(!this.__base(a)){return}if(a.isChecked()){this.oValue.add(a.getValue().get());this.oInitialValue.add(a.getValue().get())}return a},enableOptionsByValue:function(a,b,c){for(var d=0,e,f,g;d<this.aChildren.length;d++){f=this.aChildren[d];g=false;for(var h=0;h<a.length;h++){e=false;for(var i=0;i<a[h].length&&!e;i++){e=f.getValue().match(a[h][i])?true:false}if(e){if(b||h==0){g=true}}else{if(!b){g=false}}}if(g){if(c){f.check()}else{if(this.isEnabled()){f.enable()}}}else{if(c){f.uncheck()}else{f.disable()}}}this.processEvents(true)}});ZForms.Widget.Container.Group.RadioButton=ZForms.Widget.Container.Group.inheritTo({setValue:function(a){for(var b=0;b<this.aChildren.length;b++){if(a.isEqual(this.aChildren[b].getValue())){this.aChildren[b].check()}}this.__base(a)},setValueFromElement:function(){this.oValue.reset();for(var a=0;a<this.aChildren.length;a++){if(this.aChildren[a].isChecked()&&this.aChildren[a].isEnabled()){this.oValue.set(this.aChildren[a].getValue().get());break}}this.__base()},addChild:function(a){if(!this.__base(a)){return}if(a.isChecked()){this.oValue.set(a.getValue().get());this.oInitialValue.set(a.getValue().get())}return a},enableOptionsByValue:function(a,b){var c=false,d=-1;for(var e=0,f,g,h;e<this.aChildren.length;e++){g=this.aChildren[e];h=false;for(var i=0;i<a.length;i++){f=false;for(var j=0;j<a[i].length&&!f;j++){f=g.getValue().match(a[i][j])?true:false}if(f){if(d<0){d=e}if(b||i==0){h=true}}else{if(!b){h=false}}}if(h&&this.isEnabled()){g.enable()}else{if(g.isEnabled()){g.disable()}}if(!g.isEnabled()&&g.isChecked()){c=true}}if(c&&d>-1){this.oValue.set(this.aChildren[d].getValue());this.aChildren[d].check()}this.processEvents(true)}});ZForms.Widget.Text=ZForms.Widget.inheritTo({__constructor:function(a,b,c){this.__base(a,b,c);this.bPlaceHolderEnabled=false;this.iMaxLength=this.oOptions.iMaxLength?this.oOptions.iMaxLength:a.maxLength>0?a.maxLength:0;this.bTextArea=this.oElement.tagName.toLowerCase()=="textarea";this.bNeedReplaceType=this.hasPlaceHolder()&&this.oElement.type.toLowerCase()=="password";this.oPasswordReplacerElement=this.createPasswordElement();if(!this.isTemplate()){this.addExtendedHandlers()}},getDefaultOptions:function(){return Common.Object.extend(this.__base(),{sPlaceHolder:""},true)},updateElementValue:function(a){if(a.isEmpty()&&this.bPlaceHolderEnabled){return}this.oElement.value=a.toStr()},setValue:function(a){if(a.isEmpty()){this.updateElementValue(a);this.enablePlaceHolder()}else{this.disablePlaceHolder();this.updateElementValue(this.processValueMaxLength(a))}this.__base(a)},getEventList:function(){return[this.__self.DOM_EVENT_TYPE_KEYUP,this.__self.DOM_EVENT_TYPE_BLUR,this.__self.DOM_EVENT_TYPE_CHANGE]},setValueFromElement:function(){if(!this.oElement){return}if(this.bPlaceHolderEnabled){return}this.oValue=this.processValueMaxLength(this.createValue(this.oElement.value));this.__base()},init:function(){if(!this.isTemplate()){this.enablePlaceHolder()}this.__base()},focus:function(){if(this.oPasswordReplacerElement&&this.bPlaceHolderEnabled){this.oPasswordReplacerElement.focus()}else{this.__base()}},afterClone:function(){this.__base();this.enablePlaceHolder()},hasPlaceHolder:function(){return!!this.oOptions.sPlaceHolder},addExtendedHandlers:function(){if(this.isTemplate()){return false}var a=this;this.addMaxLengthHandlers();Common.Event.add(this.oPasswordReplacerElement||this.oElement,this.__self.DOM_EVENT_TYPE_FOCUS,function(){a.addClass(a.__self.CLASS_NAME_FOCUSED);if(a.disablePlaceHolder()&&Common.Browser.isIE()){a.oElement.createTextRange().select()}});Common.Event.add(this.oElement,this.__self.DOM_EVENT_TYPE_BLUR,function(){if(a.oElement){a.removeClass(a.__self.CLASS_NAME_FOCUSED);a.enablePlaceHolder()}});return true},addMaxLengthHandlers:function(){if(this.iMaxLength==0){return}if(!this.bTextArea){this.oElement.maxLength=this.iMaxLength;return}var a=this,b;if(Common.Browser.isOpera()&&this.oElement.isSameNode){Common.Event.add(this.oElement,this.__self.DOM_EVENT_TYPE_KEYDOWN,function(a){b=a.keyCode})}Common.Event.add(this.oElement,this.__self.DOM_EVENT_TYPE_KEYPRESS,function(c){var c=Common.Event.normalize(c);if(c.iKeyCode!=13&&(c.ctrlKey||c.metaKey||c.charCode==0||c.which==0||b==c.keyCode&&(c.keyCode==46||c.keyCode==45||c.keyCode==36||c.keyCode==35||c.keyCode==9||c.keyCode==8))){return}var d=document.selection?document.selection.createRange().text.length:a.oElement.selectionEnd-a.oElement.selectionStart;if(d<=0&&a.oElement.value.length>=a.iMaxLength){Common.Event.cancel(c)}});Common.Event.add(this.oElement,this.__self.DOM_EVENT_TYPE_PASTE,function(){setTimeout(function(){a.setValue(a.createValue(a.oElement.value))},0)});if(Common.Browser.isOpera()){Common.Event.add(this.oElement,this.__self.DOM_EVENT_TYPE_BLUR,function(){a.setValue(a.createValue(a.oElement.value))})}},processValueMaxLength:function(a){if(this.iMaxLength==0){return a}if(a.toStr().length>this.iMaxLength){a.set(a.get().toString().substr(0,this.iMaxLength))}return a},enablePlaceHolder:function(){if(this.bPlaceHolderEnabled||!this.hasPlaceHolder()||!this.getValue().isEmpty()){return false}this.addClass(this.__self.CLASS_NAME_PLACE_HOLDER,this.oPasswordReplacerElement||this.oElement);if(!this.bTextArea&&this.iMaxLength>0){this.oElement.maxLength=this.oOptions.sPlaceHolder.length}this.setPasswordAttribute(false);if(this.oPasswordReplacerElement){this.oPasswordReplacerElement.value=this.oOptions.sPlaceHolder}else{this.oElement.value=this.oOptions.sPlaceHolder}this.bPlaceHolderEnabled=true;return true},disablePlaceHolder:function(){if(!this.bPlaceHolderEnabled||!this.hasPlaceHolder()||!this.getValue().isEmpty()){return false}this.removeClass(this.__self.CLASS_NAME_PLACE_HOLDER,this.oElement);if(!this.bTextArea&&this.iMaxLength>0){this.oElement.maxLength=this.iMaxLength}this.oElement.value="";this.setPasswordAttribute(true);if(this.bNeedReplaceType&&Common.Browser.isOpera()){this.oElement.focus()}this.bPlaceHolderEnabled=false;return true},createPasswordElement:function(){if(!this.bNeedReplaceType||!Common.Browser.isIE()){return}return Common.Dom.createElement(this.oElement.tagName,{type:"text",name:this.oElement.name,id:this.oElement.id,"class":this.oElement.className,size:this.oElement.size,maxlength:this.oElement.maxLength,value:this.oElement.value,style:this.oElement.style.cssText})},setPasswordAttribute:function(a){if(!this.bNeedReplaceType){return}if(!this.oPasswordReplacerElement){this.oElement.type=a?"password":"text";return}if(a){if(!this.oPasswordReplacerElement.parentNode){return}this.oPasswordReplacerElement.parentNode.replaceChild(this.oElement,this.oPasswordReplacerElement);var b=this;setTimeout(function(){b.oElement.focus()},0)}else{if(!this.oElement.parentNode){return}this.oElement.parentNode.replaceChild(this.oPasswordReplacerElement,this.oElement)}},addId:function(a){this.__base(a);if(this.oPasswordReplacerElement){this.addIdToElement(this.oPasswordReplacerElement,this.__self.ID_PREFIX,a)}},destruct:function(){if(this.oPasswordReplacerElement){this.oPasswordReplacerElement=null}if(this.oElement){this.disablePlaceHolder()}this.__base()},prepareForSubmit:function(){this.disablePlaceHolder();this.__base()}},{CLASS_NAME_FOCUSED:"zf-focused",CLASS_NAME_PLACE_HOLDER:"zf-placeholder"});ZForms.Widget.Text.Number=ZForms.Widget.Text.inheritTo({__constructor:function(a,b,c){this.__base(a,b,c);this.oHiddenElement=null;this.iTimer=null;if(this.isTemplate()){return}this.replaceElement(a)},replaceElement:function(a){this.oHiddenElement=a.parentNode.insertBefore(Common.Dom.createElement("input",{type:"hidden",value:a.value}),a);if(a.getAttribute("id")){this.oHiddenElement.setAttribute("id","value-"+a.getAttribute("id"))}if(a.getAttribute("name")){this.oHiddenElement.setAttribute("name",a.getAttribute("name"));a.removeAttribute("name")}},getName:function(){return this.oHiddenElement?this.oHiddenElement.name:this.oElement.name},getDefaultOptions:function(){return Common.Object.extend(this.__base(),{bFloat:false,bNegative:false,iErrorTimeout:230},true)},createValue:function(a){return new ZForms.Value.Number(a)},compareValueWithInitialValue:function(){return this.__base()||this.oValue.isEmpty()&&this.oInitialValue.isEmpty()},addExtendedHandlers:function(){if(!this.__base()){return}var a=this,b=-1;if(Common.Browser.isOpera()&&this.oElement.isSameNode){Common.Event.add(this.oElement,this.__self.DOM_EVENT_TYPE_KEYDOWN,function(a){b=a.keyCode})}Common.Event.add(this.oElement,this.__self.DOM_EVENT_TYPE_KEYPRESS,function(c){if(a.iTimer){clearTimeout(a.iTimer);a.removeClass(a.__self.CLASS_NAME_INVALID_KEY)}var c=Common.Event.normalize(c);if(c.ctrlKey||c.metaKey||c.charCode==0||c.which==0||b==c.keyCode&&(c.keyCode==46||c.keyCode==45||c.keyCode==36||c.keyCode==35||c.keyCode==9||c.keyCode==8)||c.keyCode==13||c.iKeyCode>=48&&c.iKeyCode<=57||a.oOptions.bFloat&&(c.iKeyCode==44||c.iKeyCode==46)&&!/\.|\,/.test(a.oElement.value)||a.oOptions.bNegative&&c.iKeyCode==45&&a.oElement.value.charAt(0)!="-"&&a.getCursorPosition()==0){return}Common.Event.cancel(c);a.addClass(a.__self.CLASS_NAME_INVALID_KEY);a.iTimer=setTimeout(function(){a.removeClass(a.__self.CLASS_NAME_INVALID_KEY)},a.oOptions.iErrorTimeout)});Common.Event.add(this.oElement,this.__self.DOM_EVENT_TYPE_BLUR,function(){if(a.bPlaceHolderEnabled){return}a.setValue(a.createValue(a.oElement.value))})},getCursorPosition:function(){if("selectionStart"in this.oElement){return this.oElement.selectionStart}if(document.selection){var a=document.selection.createRange();if(!a){return 0}var b=this.oElement.createTextRange(),c=b.duplicate();b.moveToBookmark(a.getBookmark());c.setEndPoint("EndToStart",b);return c.text.length}return 0},updateElementValue:function(a){this.oHiddenElement.value=a.toStr();if(ZForms.Resources.getNumberSeparator()==","){a=new ZForms.Value(a.toStr().replace(/\./g,","))}this.__base(a)},setValue:function(a){if(!a.isEmpty()){if(!this.oOptions.bFloat){a.set(parseInt(a.get().toString().replace(/[\.\,].*/g,""),10))}if(!this.oOptions.bNegative&&a.get()<0){a.set(a.get()*-1)}}return this.__base(a)},init:function(){this.__base();if(!this.bPlaceHolderEnabled){this.setValue(this.getValue())}},disable:function(a){if(!this.__base(a)){return false}if(this.oHiddenElement){this.oHiddenElement.disabled=true}return true},enable:function(a){if(!this.__base(a)){return false}if(this.oHiddenElement){this.oHiddenElement.disabled=false}return true},destruct:function(){this.oHiddenElement=null;this.__base()}},{CLASS_NAME_INVALID_KEY:"zf-invalid-key"});ZForms.Widget.Container.Date=ZForms.Widget.Container.inheritTo({__constructor:function(a,b,c){this.__base(a,b,c);if(this.isTemplate()){return}this.oDayInput=this.createNumberInput("day",2,this.oOptions.oPlaceHolders.sDay);this.oMonthInput=this.createMonthInput("month");this.oYearInput=this.createNumberInput("year",4,this.oOptions.oPlaceHolders.sYear);if(this.oOptions.bWithTime){this.oHourInput=this.createNumberInput("hour",2,this.oOptions.oPlaceHolders.sHour);this.oMinuteInput=this.createNumberInput("minute",2,this.oOptions.oPlaceHolders.sMinute);this.oSecondInput=this.createNumberInput("second",2,this.oOptions.oPlaceHolders.sSecond)}this.addChild(this.oDayInput);this.addChild(this.oMonthInput);this.addChild(this.oYearInput);if(this.oOptions.bWithTime){this.addChild(this.oHourInput);this.addChild(this.oMinuteInput);this.addChild(this.oSecondInput)}this.replaceElement();this.setValueFromElement();this.addExtendedHandlers();this.initValue();this.oCalendar=this.oOptions.oPickerOpenerElement?new ZForms.Calendar(this):null},getDefaultOptions:function(){return Common.Object.extend(this.__base(),{bWithTime:false,bOnlyMonths:false,oPlaceHolders:{sDay:"",sYear:"",sHour:"",sMinute:"",sSecond:""}},true)},createValue:function(a){return this.oOptions.bWithTime?new ZForms.Value.Date.Time(a):new ZForms.Value.Date(a)},hasValue:function(){return true},setValue:function(a){var b=this.oDayInput.createValue(a.getDay()),c=this.oYearInput.createValue(a.getYear());if((this.oYearInput.getValue().isEmpty()||!c.isEmpty())&&!c.isEqual(this.oYearInput.getValue())){this.oYearInput.setValue(c)}this.oMonthInput.setValue(this.oMonthInput.createValue(a.getMonth()));if((this.oDayInput.getValue().isEmpty()||!b.isEmpty())&&!b.isEqual(this.oDayInput.getValue())){this.oDayInput.setValue(b)}if(this.oOptions.bWithTime){var d=this.oHourInput.createValue(a.getHour()),e=this.oMinuteInput.createValue(a.getMinute()),f=this.oSecondInput.createValue(a.getSecond());if((this.oHourInput.getValue().isEmpty()||!d.isEmpty())&&!d.isEqual(this.oHourInput.getValue())){this.oHourInput.setValue(d)}if((this.oMinuteInput.getValue().isEmpty()||!e.isEmpty())&&!e.isEqual(this.oMinuteInput.getValue())){this.oMinuteInput.setValue(e)}if((this.oSecondInput.getValue().isEmpty()||!f.isEmpty())&&!f.isEqual(this.oSecondInput.getValue())){this.oSecondInput.setValue(f)}}this.oElement.value=a.toStr();this.__base(a)},isRequired:function(){return ZForms.Widget.prototype.isRequired.call(this)},isValid:function(){return ZForms.Widget.prototype.isValid.call(this)},isChanged:function(){return ZForms.Widget.prototype.isChanged.call(this)},replaceElement:function(){var a=Common.Dom.createElement("input",{type:"hidden",id:this.oElement.getAttribute("id"),name:this.oElement.getAttribute("name"),value:this.oElement.value});this.oElement.parentNode.replaceChild(a,this.oElement);this.oElement=a},addExtendedHandlers:function(){if(this.isTemplate()){return}var a=this,b=this.oOptions.bWithTime?[this.oDayInput.oElement,this.oMonthInput.oElement,this.oYearInput.oElement,this.oHourInput.oElement,this.oMinuteInput.oElement,this.oSecondInput.oElement]:[this.oDayInput.oElement,this.oMonthInput.oElement,this.oYearInput.oElement];Common.Event.add(b,this.__self.DOM_EVENT_TYPE_BLUR,function(){a.processDate()});Common.Event.add(b,this.__self.DOM_EVENT_TYPE_KEYDOWN,function(b){if(Common.Event.normalize(b).iKeyCode==a.__self.KEY_CODE_ENTER){a.processDate()}})},processDate:function(){var a=this.oYearInput.getValue().get(),b=this.oMonthInput.getValue().get(),c=this.oDayInput.getValue().isEmpty()&&this.oOptions.bOnlyMonths?1:this.oDayInput.getValue().get(),d=this.oOptions.bWithTime?this.oHourInput.getValue().get():0,e=this.oOptions.bWithTime?this.oMinuteInput.getValue().get():0,f=this.oOptions.bWithTime?this.oSecondInput.getValue().get():0;this.setValue(this.createValue(this.oOptions.bWithTime?a+"-"+b+"-"+c+" "+d+":"+e+":"+f:a+"-"+b+"-"+c))},createNumberInput:function(a,b,c){var d=ZForms.createNumberInput(this.oElement.parentNode.insertBefore(Common.Dom.createElement("input",{type:this.oOptions.bOnlyMonths&&a=="day"?"hidden":"text",id:this.oElement.id?a+"-"+this.oElement.id:"",size:b,maxlength:b,"class":"zf-input-"+a}),this.oElement),null,{sPlaceHolder:c});d.checkForInitialValueChanged=function(){return false};return d},createMonthInput:function(a){var b=Common.Dom.createElement("select",{id:this.oElement.id?a+"-"+this.oElement.id:"","class":"zf-input-"+a}),c=this.oOptions.bOnlyMonths?ZForms.Resources.getMonthsByType("normal"):ZForms.Resources.getMonthsByType("genitive");document.body.appendChild(b);b.options.length=0;for(var d=0;d<c.length;d++){b.options[b.options.length]=new Option(c[d],d+1)}var e=ZForms.createSelectInput(this.oElement.parentNode.insertBefore(document.body.removeChild(b),this.oElement));e.checkForInitialValueChanged=function(){return false};return e},setValueFromElement:function(){if(this.isTemplate()||!this.oYearInput){return}this.oValue.set(this.oYearInput.getValue().get()+"-"+this.oMonthInput.getValue().get()+"-"+(this.oOptions.bOnlyMonths&&this.oDayInput.getValue().isEmpty()?1:this.oDayInput.getValue().get())+(this.oOptions.bWithTime?" "+this.oHourInput.getValue().get()+":"+this.oMinuteInput.getValue().get()+":"+this.oSecondInput.getValue().get():""));ZForms.Widget.prototype.setValueFromElement.call(this)},initValue:function(){this.oInitialValue=this.createValue(this.oElement.value);this.setValue(this.oInitialValue.clone());this.oDayInput.oInitialValue=this.oDayInput.createValue(this.oValue.getDay());this.oMonthInput.oInitialValue=this.oMonthInput.createValue(this.oValue.getMonth()||1);this.oYearInput.oInitialValue=this.oYearInput.createValue(this.oValue.getYear());if(this.oOptions.bWithTime){this.oHourInput.oInitialValue=this.oHourInput.createValue(this.oValue.getHour());this.oMinuteInput.oInitialValue=this.oMinuteInput.createValue(this.oValue.getMinute());this.oSecondInput.oInitialValue=this.oSecondInput.createValue(this.oValue.getSecond())}if(!this.getValue().isEmpty()){this.addClass(this.__self.CLASS_NAME_SELECTED_INITIAL,this.oMonthInput.oElement.options[this.oMonthInput.oElement.selectedIndex])}},disable:function(a){if(this.__base(a)){return false}if(this.oCalendar){this.oCalendar.disable()}return true},enable:function(a){if(this.__base(a)){return false}if(this.oCalendar){this.oCalendar.enable()}return true},addId:function(a){this.__base(a);if(this.oOptions.oPickerOpenerElement){this.addIdToElement(this.oOptions.oPickerOpenerElement,"opener-",a)}},clone:function(a,b,c){return new this.__self(a,b,Common.Object.extend({oPickerOpenerElement:this.oOptions.oPickerOpenerElement?document.getElementById(this.oOptions.oPickerOpenerElement.id.match(ZForms.Widget.Container.Multiplicator.REG_EXP_REPLACE)[1]+"_"+c):null,bTemplate:false},this.oOptions))},destruct:function(){this.__base();if(this.oCalendar){this.oCalendar.destruct()}}});ZForms.Widget.Text.State=ZForms.Widget.Text.inheritTo({__constructor:function(a,b,c){this.__base(a,b,c);this.bLastProcessedChecked=null},getName:function(){},check:function(){this.oElement.checked=true},uncheck:function(){this.oElement.checked=false},isChecked:function(){return this.oElement.checked},getEventList:function(){return[this.__self.DOM_EVENT_TYPE_CLICK]},isChanged:function(){return this.bLastProcessedChecked!=this.oElement.checked},updateLastProcessedValue:function(){this.bLastProcessedChecked=this.oElement.checked},addId:function(a){var b=this.oParent.getChildren().indexOf(this)+1;this.addIdToElement(this.oElement,this.__self.ID_PREFIX+b+"-",a);this.addIdToElement(this.oClassElement,this.__self.ROW_ID_PREFIX+b+"-",a)}});ZForms.Widget.Select=ZForms.Widget.inheritTo({__constructor:function(a,b,c){this.__base(a,b,c);this.aOptions=[];for(var d=0;d<this.oElement.options.length;d++){this.aOptions[d]={sLabel:this.oElement.options[d].innerHTML,sValue:this.oElement.options[d].value}}},setValue:function(a){for(var b=0;b<this.aOptions.length;b++){if(this.aOptions[b].sValue==a.toStr()){this.oElement.selectedIndex=b;break}}this.__base(a)},getEventList:function(){return[this.__self.DOM_EVENT_TYPE_CHANGE,this.__self.DOM_EVENT_TYPE_KEYUP]},setValueFromElement:function(){if(this.oElement.selectedIndex>=0){this.oValue.set(this.oElement.options[this.oElement.selectedIndex].value)}else{this.oValue.reset()}this.__base()},enableOptionsByValue:function(a,b){this.oElement.options.length=0;for(var c=0,d,e,f;c<this.aOptions.length;c++){f=this.aOptions[c];e=false;for(var g=0;g<a.length;g++){d=false;for(var h=0;h<a[g].length&&!d;h++){d=a[g][h].test(f.sValue)}if(d){if(b||g==0){e=true}}else{if(!b){e=false}}}if(e){this.oElement.options[this.oElement.options.length]=new Option(f.sLabel,f.sValue,this.getValue().isEqual(f.sValue))}}this.processEvents(true)}});ZForms.Widget.Text.Combo=ZForms.Widget.Text.inheritTo({__constructor:function(a,b,c){if(!c.bTemplate&&Common.Browser.isOpera()){var d=Common.Dom.createElement("select",{name:c.oOptionsElement.name,id:c.oOptionsElement.id,"class":c.oOptionsElement.className});for(var e=0,f=c.oOptionsElement.options;e<f.length;e++){d.options[d.options.length]=new Option(f[e].innerHTML,f[e].value)}c.oOptionsElement.parentNode.replaceChild(d,c.oOptionsElement);c.oOptionsElement=d;c.oOptionsElement.size=this.__self.DEFAULT_PAGE_SIZE}this.oShowOptionsButton=null;if(!c.bTemplate&&c.oShowOptionsElement){c.oShowOptionsElement.tabIndex=-1;this.oShowOptionsButton=ZForms.createButton(c.oShowOptionsElement)}this.__base(a,b,c);this.oOptions.oOptionsElement=c.oOptionsElement;this.oOptions.oOptionsElement.tabIndex=-1;if(this.isTemplate()){return}this.iPageSize=this.oOptions.oOptionsElement.size||this.__self.DEFAULT_PAGE_SIZE;Common.Class.add(this.oOptions.oOptionsElement,this.__self.CLASS_NAME_COMBO_LIST);this.bOptionsShowed=false;this.aOptions=[];this.aOptionsCurrent=[];this.oElement.setAttribute("autocomplete","off");this.oOptions.oOptionsElement.setAttribute("size",this.iPageSize);this.iSelectedIndex=0;this.sLastSearchValue=null;this.initOptions();this.hideOptions();this.oOptions.oOptionsElement.options.length=0},addExtendedHandlers:function(){var a=this,b=true,c=true;Common.Event.add(this.oPasswordReplacerElement||this.oElement,this.__self.DOM_EVENT_TYPE_FOCUS,function(){a.addClass(a.__self.CLASS_NAME_FOCUSED);if(a.hasPlaceHolder()){a.disablePlaceHolder()}});Common.Event.add(this.oElement,this.__self.DOM_EVENT_TYPE_KEYUP,function(b){a.dispatchKeyEvent(Common.Event.normalize(b).iKeyCode)});Common.Event.add(this.oElement,this.__self.DOM_EVENT_TYPE_FOCUS,function(){if(!b){b=true;return}if(a.disablePlaceHolder()&&Common.Browser.isIE()){a.oElement.createTextRange().select()}a.updateOptions(true)});Common.Event.add(this.oElement,this.__self.DOM_EVENT_TYPE_KEYPRESS,function(b){var b=Common.Event.normalize(b);if(b.iKeyCode==a.__self.KEY_CODE_ENTER&&a.bOptionsShowed){Common.Event.cancel(b)}});Common.Event.add(document,this.__self.DOM_EVENT_TYPE_CLICK,function(b){var c=Common.Event.normalize(b).target;if(c==a.oElement||a.oOptions.oShowOptionsElement&&a.oOptions.oShowOptionsElement==c){return}a.hideOptions();a.enablePlaceHolder()});Common.Event.add([this.oOptions.oOptionsElement,this.oElement],this.__self.DOM_EVENT_TYPE_BLUR,function(){if(c&&a.hasPlaceHolder()){a.enablePlaceHolder()}if(c&&a.oElement){a.removeClass(a.__self.CLASS_NAME_FOCUSED);a.hideOptions()}c=true});Common.Event.add(this.oOptions.oOptionsElement,this.__self.DOM_EVENT_TYPE_FOCUS,function(){a.showOptions()});Common.Event.add(this.oOptions.oOptionsElement,this.__self.DOM_EVENT_TYPE_CHANGE,function(){a.selectFromOptions();b=false;a.oElement.focus()});Common.Event.add([this.oOptions.oOptionsElement].concat(this.oOptions.oShowOptionsElement?[this.oOptions.oShowOptionsElement]:[]),this.__self.DOM_EVENT_TYPE_MOUSEDOWN,function(){c=false});if(this.oShowOptionsButton){Common.Event.add(this.oOptions.oShowOptionsElement,this.__self.DOM_EVENT_TYPE_MOUSEUP,function(){c=true});this.oShowOptionsButton.setHandler(function(c){a.updateOptions(true,"");b=false;a.disablePlaceHolder();a.oElement.focus();if(a.oElement.createTextRange&&!Common.Browser.isOpera()){var d=a.oElement.createTextRange();d.collapse(true);d.moveStart("character",1e3);d.moveEnd("character",1e3);d.select()}})}},initOptions:function(){var a=this.oOptions.oOptionsElement.options;for(var b=0;b<a.length;b++){this.aOptions[b]={sLabel:a[b].innerHTML,sValue:a[b].value,sSearchValue:a[b].innerHTML.toLowerCase()}}this.aOptionsCurrent=this.aOptions},dispatchKeyEvent:function(a){switch(a){case this.__self.KEY_CODE_ARROW_UP:this.selectPrevOption();break;case this.__self.KEY_CODE_ARROW_DOWN:this.selectNextOption();break;case this.__self.KEY_CODE_PAGE_UP:this.selectPrevPage();break;case this.__self.KEY_CODE_PAGE_DOWN:this.selectNextPage();break;case this.__self.KEY_CODE_HOME:this.selectFirstOption();break;case this.__self.KEY_CODE_END:this.selectLastOption();break;case this.__self.KEY_CODE_ENTER:if(this.bOptionsShowed){this.selectFromOptions()}break;case this.__self.KEY_CODE_TAB:return;break;default:this.updateOptions(false);break}},selectPrevOption:function(){if(this.iSelectedIndex>0){this.iSelectedIndex--}this.updateSelectedIndex()},selectNextOption:function(){if(this.iSelectedIndex<this.oOptions.oOptionsElement.options.length-1){this.iSelectedIndex++}this.updateSelectedIndex()},selectPrevPage:function(){var a=this.iSelectedIndex-this.iPageSize;if(a>0){this.iSelectedIndex=a}else{this.iSelectedIndex=0}this.updateSelectedIndex()},selectNextPage:function(){var a=this.iSelectedIndex+this.iPageSize;if(a<this.oOptions.oOptionsElement.options.length-1){this.iSelectedIndex=a}else{this.iSelectedIndex=this.oOptions.oOptionsElement.options.length-1}this.updateSelectedIndex()},selectFirstOption:function(){this.iSelectedIndex=0;this.updateSelectedIndex()},selectLastOption:function(){this.iSelectedIndex=this.oOptions.oOptionsElement.options.length-1;this.updateSelectedIndex()},selectFromOptions:function(){if(this.oOptions.oOptionsElement.options.length>0&&this.oOptions.oOptionsElement.selectedIndex>-1){if(this.hasPlaceHolder()){this.disablePlaceHolder()}this.iSelectedIndex=this.oOptions.oOptionsElement.selectedIndex;this.sLastSearchValue=this.oElement.value.toLowerCase();this.setValue(new ZForms.Value(this.oOptions.oOptionsElement.options[this.iSelectedIndex].innerHTML))}var a=this;setTimeout(function(){a.hideOptions()},0)},updateSelectedIndex:function(){if(this.iSelectedIndex>-1){this.oOptions.oOptionsElement.selectedIndex=this.iSelectedIndex}},updateOptions:function(a,b){var c=this.oElement.value.toLowerCase(),d=typeof b=="undefined"?c:b;if(!a&&this.sLastSearchValue==d){return}var e=0,f,g=0,h=false,i=this.oOptions.oOptionsElement,j=i.options;this.sLastSearchValue=d;j.length=0;i.innerHTML="";while(f=this.aOptionsCurrent[e++]){if(f.sSearchValue.indexOf(d)>-1){j[g++]=new Option(f.sLabel,f.sValue);if(c===f.sSearchValue){this.iSelectedIndex=g-1;h=true}}}if(!h){this.iSelectedIndex=-1;i.selectedIndex=-1}if(g>0){this.updateSelectedIndex();this.showOptions()}else{this.hideOptions()}},showOptions:function(){if(this.bOptionsShowed){return}this.addClass(this.__self.CLASS_NAME_COMBO_LIST_ACTIVE);this.bOptionsShowed=true},hideOptions:function(){if(!this.bOptionsShowed){return}this.removeClass(this.__self.CLASS_NAME_COMBO_LIST_ACTIVE);this.bOptionsShowed=false},enableOptionsByValue:function(a,b){this.aOptionsCurrent=[];for(var c=0,d,e,f;c<this.aOptions.length;c++){f=this.aOptions[c];e=false;for(var g=0;g<a.length;g++){d=false;for(var h=0;h<a[g].length&&!d;h++){d=a[g][h].test(f.sValue)}if(d){if(b||g==0){e=true}}else{if(!b){e=false}}}if(e){this.aOptionsCurrent.push(f)}}this.sLastSearchValue=null;this.iSelectedIndex=-1},disable:function(a){if(!this.__base(a)){return false}this.oOptions.oOptionsElement.disabled=true;if(this.oShowOptionsButton){this.oShowOptionsButton.disable()}return true},enable:function(a){if(!this.__base(a)){return false}this.oOptions.oOptionsElement.disabled=false;if(this.oShowOptionsButton){this.oShowOptionsButton.enable()}return true},updateElements:function(a){this.oOptions.oOptionsElement=document.getElementById(a>0?this.oOptions.oOptionsElement.id.match(ZForms.Widget.Container.Multiplicator.REG_EXP_REPLACE)[1]+"_"+a:this.oOptions.oOptionsElement.id);this.__base(a)},addId:function(a){this.__base(a);this.addIdToElement(this.oOptions.oOptionsElement,"options-",a);if(this.oOptions.oShowOptionsElement){this.addIdToElement(this.oOptions.oShowOptionsElement,"show-",a)}},clone:function(a,b,c){var d=Common.Object.extend({oOptionsElement:document.getElementById(this.oOptions.oOptionsElement.id.match(ZForms.Widget.Container.Multiplicator.REG_EXP_REPLACE)[1]+"_"+c),oShowOptionsElement:this.oOptions.oShowOptionsElement?document.getElementById(this.oOptions.oShowOptionsElement.id.match(ZForms.Widget.Container.Multiplicator.REG_EXP_REPLACE)[1]+"_"+c):null,bTemplate:false},this.oOptions);return new this.__self(a,b,d)},destruct:function(){this.oOptions.oOptionsElement=null;if(this.oShowOptionsButton){this.oShowOptionsButton.destruct()}this.__base()}},{DEFAULT_PAGE_SIZE:5,CLASS_NAME_COMBO_LIST:"zf-combolist",CLASS_NAME_COMBO_LIST_ACTIVE:"zf-combolist-active"});ZForms.Widget.Container.Slider=ZForms.Widget.Container.inheritTo({__constructor:function(a,b,c){c=c||{};this.aSlideRules=c.aSlideRules||this.getDefaultOptions().aSlideRules;this.dMin=this.aSlideRules[0].dValue;this.dMax=this.aSlideRules[this.aSlideRules.length-1].dValue;this.__base(a,b,c);if(this.isTemplate()){return}this.aSlideRules[0].dPercent=0;this.aSlideRules[this.aSlideRules.length-1].dPercent=100;var d=this.createElements(a);this.oContainer=d.oContainer;this.oScaleElement=d.oScaleElement;this.aControls=[];this.aMarks=this.createMarks(d.oScaleElement);this.bEnabled=true;this.iLastControlPosition=0;this.iCurrentControlIndex=-1;this.iFocusedChildIndex=-1;this.oContainerOffset=null;this.fClickHandler=null;this.fDragStartHandler=null;this.fDragHandler=null;this.fDragEndHandler=null;this.fNullHandler=null;this.fSyncHandler=null;this.addExtendedHandlers();this.iIndex=this.__self.add(this);this.oLastProcessedValue=null},getDefaultOptions:function(){return Common.Object.extend(this.__base(),{aSlideRules:[{dValue:0,dPercent:0,dStep:1,sLabel:"0"},{dValue:100,dPercent:100,dStep:1,sLabel:"100"}]},true)},createElements:function(a){var b={oContainer:document.createElement("div"),oScaleElement:document.createElement("div"),aMarkElements:[]};Common.Class.add(b.oContainer,this.__self.CLASS_NAME_SLIDER);Common.Class.add(b.oScaleElement,this.__self.CLASS_NAME_SLIDER_SCALE);b.oContainer.appendChild(b.oScaleElement);a.insertBefore(b.oContainer,a.firstChild);return b},createMarks:function(a){var b=[];for(var c=0,d;c<this.aSlideRules.length;c++){d=document.createElement("div");Common.Class.add(d,this.__self.CLASS_NAME_MARK_ELEMENT+" "+this.__self.CLASS_NAME_MARK_ELEMENT+"-"+this.aSlideRules[c].dValue);this.setupMarkElementPosition(d,this.aSlideRules[c].dPercent);if(typeof this.aSlideRules[c].sLabel!="undefined"){d.innerHTML="<span>"+this.aSlideRules[c].sLabel+"</span>"}a.appendChild(d);b.push({oElement:d,dValue:this.aSlideRules[c].dValue,bSelected:false})}return b},setupMarkElementPosition:function(a,b){a.style.left=b+"%"},createControl:function(a,b){var c={oElement:document.createElement("div"),oValueElement:document.createElement("div")},d=this,e=this.getChildren().length-1;if(a){c.oElement.id="control-"+a}Common.Class.add(c.oElement,this.__self.CLASS_NAME_CONTROL_ELEMENT+" "+this.__self.CLASS_NAME_CONTROL_ELEMENT+"-"+e);Common.Class.add(c.oValueElement,this.__self.CLASS_NAME_VALUE_ELEMENT);b.appendChild(c.oElement);b.appendChild(c.oValueElement);Common.Event.add(c.oElement,this.__self.DOM_EVENT_TYPE_MOUSEDOWN,function(a){if(d.iFocusedChildIndex>-1){d.aChildren[d.iFocusedChildIndex].oElement.blur()}Common.Event.cancel(a);d.__self.setActiveIndex(d.iIndex);d.fDragStartHandler(e)});return c},createRangeElements:function(a){this.aControls[a].oLeftRangeElement=a==0?this.createRangeElement(a):this.aControls[a-1].oRightRangeElement;this.aControls[a].oRightRangeElement=this.createRangeElement(a+1)},createRangeElement:function(a){var b=document.createElement("div");Common.Class.add(b,this.__self.CLASS_NAME_RANGE_ELEMENT+" "+this.__self.CLASS_NAME_RANGE_ELEMENT+"-"+a);this.oContainer.insertBefore(b,this.oScaleElement);return b},addChild:function(a,b){if(!(a instanceof ZForms.Widget.Text.Number)){return}var c=this.__base(a,b);if(this.isTemplate()){return c}var d=this.createControl(a.oElement.id,this.oContainer);this.aControls.push({oElement:d.oElement,oValueElement:d.oValueElement,dPosition:null,bSelected:false});this.createRangeElements(this.aControls.length-1,this.oContainer);var e=this,b=this.getChildren().length-1;Common.Event.add(a.oElement,this.__self.DOM_EVENT_TYPE_FOCUS,function(){e.iFocusedChildIndex=b});Common.Event.add(a.oElement,this.__self.DOM_EVENT_TYPE_BLUR,function(){e.iFocusedChildIndex=-1;e.fSyncHandler(b)});a.setValue=function(c,d){if(c.isGreater(e.getMax())){c.set(e.getMax())}else{if(c.isLess(e.getMin())){c.set(e.getMin())}}ZForms.Widget.Text.Number.prototype.setValue.call(a,c);if(!d){e.fSyncHandler(b)}};a.disable=function(a){if(!ZForms.Widget.prototype.disable.call(this,a)){return false}e.disableControlByIndex(b)};a.enable=function(a){if(!ZForms.Widget.prototype.enable.call(this,a)){return false}e.enableControlByIndex(b)};this.setCurrentControlIndex(b);this.setValue(a.getValue());return c},addExtendedHandlers:function(){var a=this;this.fClickHandler=function(b){var b=Common.Event.normalize(b),c=a.getNearestControlIndex(b);if(c<0){return c}a.__self.setActiveIndex(a.iIndex);a.setCurrentControlIndex(c);a.drag(b);return c};this.fDragStartHandler=function(b){a.dragStart(b)};this.fDragHandler=function(b){a.drag(Common.Event.normalize(b))};this.fDragEndHandler=function(b){a.dragEnd(Common.Event.normalize(b))};this.fNullHandler=function(a){Common.Event.cancel(a)};this.fSyncHandler=function(b){a.setCurrentControlIndex(b);a.setValue(a.getChildren()[b].getValue(),true)};Common.Event.add(this.oContainer,this.__self.DOM_EVENT_TYPE_MOUSEDOWN,function(b){Common.Event.cancel(b);if(a.iFocusedChildIndex>-1){a.aChildren[a.iFocusedChildIndex].oElement.blur()}var c=a.fClickHandler(b);if(c>=0){a.fDragStartHandler(c)}})},getMin:function(){return this.dMin},getMax:function(){return this.dMax},getCurrentControl:function(){return this.aControls[this.iCurrentControlIndex]},getCurrentControlIndex:function(){return this.iCurrentControlIndex},setCurrentControlIndex:function(a){if(this.getCurrentControlIndex()==a){return}if(this.getCurrentControlIndex()>-1){Common.Class.remove(this.getCurrentControl().oElement,this.__self.CLASS_NAME_CONTROL_ELEMENT_SELECTED)}this.iCurrentControlIndex=a;Common.Class.add(this.getCurrentControl().oElement,this.__self.CLASS_NAME_CONTROL_ELEMENT_SELECTED)},getNearestControlIndex:function(a){this.updateContainerOffset();var b=this.calculateValueByOffset(this.calculateOffset(a)),c=-1,d=Math.abs(this.getMax()-this.getMin()),e=0,f,g;while(f=this.aChildren[e++]){if(!f.isEnabled()){continue}g=Math.abs(f.getValue().get()-b.get());if(g<d||Math.abs(g-d)<1e-5&&f.getValue().get()<b.get()){d=g;c=e-1}}return c},dragStart:function(a){if(!this.isEnabled()||!this.getChildren()[a].isEnabled()){return false}this.setCurrentControlIndex(a);this.updateContainerOffset();Common.Event.add(document,this.__self.DOM_EVENT_TYPE_SELECTSTART,this.fNullHandler);Common.Event.add(document,this.__self.DOM_EVENT_TYPE_MOUSEMOVE,this.fDragHandler);Common.Event.add(document,this.__self.DOM_EVENT_TYPE_MOUSEUP,this.fDragEndHandler)},drag:function(a){if(!this.isEnabled()){return false}this.updateContainerOffset();this.setValue(this.calculateValueByOffset(this.calculateOffset(a)))},dragEnd:function(){Common.Event.remove(document,this.__self.DOM_EVENT_TYPE_MOUSEMOVE,this.fDragHandler);Common.Event.remove(document,this.__self.DOM_EVENT_TYPE_MOUSEUP,this.fDragEndHandler);Common.Event.remove(document,this.__self.DOM_EVENT_TYPE_SELECTSTART,this.fNullHandler)},setValue:function(a,b){if(!this.getCurrentControl()){return}var c=this.findSlideRuleIndexByValue(a),d=this.getSlideRuleByIndex(c),e=this.getSlideRuleByIndex(c-1),f=this.getSlideRuleByIndex(c+1),g=parseFloat((Math.round((a.get()-d.dValue)/d.dStep)*d.dStep+d.dValue).toFixed(8)),h=this.getChildren()[this.getCurrentControlIndex()-1],i=this.getChildren()[this.getCurrentControlIndex()+1],j;if(e&&g<e.dValue){g=e.dValue}else{if(f&&g>f.dValue){g=f.dValue}}if(g<this.getMin()){g=this.getMin()}if(h&&h.getValue().get()>g){if(b&&this.getChildren()[this.getCurrentControlIndex()-1].isEnabled()){j=this.getChildren()[this.getCurrentControlIndex()];j.setValue(j.createValue(parseFloat(g)),true);--this.iCurrentControlIndex;this.setValue(j.createValue(parseFloat(g)),b);++this.iCurrentControlIndex}g=h.getValue().get()}else{if(i&&i.getValue().get()<g){if(b&&this.getChildren()[this.getCurrentControlIndex()+1].isEnabled()){j=this.getChildren()[this.getCurrentControlIndex()];j.setValue(j.createValue(parseFloat(g)),true);++this.iCurrentControlIndex;this.setValue(j.createValue(parseFloat(g)),b);--this.iCurrentControlIndex}g=i.getValue().get()}}j=this.getChildren()[this.getCurrentControlIndex()];j.setValue(j.createValue(parseFloat(g)),true);this.syncControlElement()},syncControlElement:function(){var a=this.calculatePositionByValue(this.getChildren()[this.getCurrentControlIndex()].getValue());if(a==this.getCurrentControl().dPosition){return}this.getCurrentControl().dPosition=a;this.updateControlElement();this.updateRanges();this.updateBounds()},updateControlElement:function(){var a=this.getCurrentControl();a.oElement.style.left=Math.round(a.dPosition)+"%";a.oValueElement.style.left=Math.round(a.dPosition)+"%";a.oValueElement.innerHTML=this.getChildren()[this.getCurrentControlIndex()].getValue().get().formatNumber()},updateRanges:function(){var a=this.getCurrentControlIndex(),b=this.getCurrentControl();this.moveRangeElement(b.oLeftRangeElement,a>0?this.aControls[a-1].dPosition:0,b.dPosition);this.moveRangeElement(b.oRightRangeElement,b.dPosition,a<this.aControls.length-1?this.aControls[a+1].dPosition:100)},moveRangeElement:function(a,b,c){Common.Dom.setStyle(a,"left: "+Math.round(b)+"%;width: "+(Math.round(c)-Math.round(b))+"%")},updateBounds:function(){var a=[],b=this.getChildren(),c=function(a,b){return a.dValue==b};for(var d=0,e;d<b.length;d++){e=parseFloat(b[d].getValue().get());a.push(e);if(this.aControls[d].bSelected){if(!this.aMarks.contains(e,c)){Common.Class.remove(this.aControls[d].oValueElement,this.__self.CLASS_NAME_VALUE_ELEMENT_SELECTED);this.aControls[d].bSelected=false}}else{if(this.aMarks.contains(e,c)){Common.Class.add(this.aControls[d].oValueElement,this.__self.CLASS_NAME_VALUE_ELEMENT_SELECTED);this.aControls[d].bSelected=true}}}for(var d=0;d<this.aMarks.length;d++){if(this.aMarks[d].bSelected){if(!a.contains(this.aMarks[d].dValue)){Common.Class.remove(this.aMarks[d].oElement,this.__self.CLASS_NAME_MARK_ELEMENT_SELECTED);this.aMarks[d].bSelected=false}}else{if(a.contains(this.aMarks[d].dValue)){Common.Class.add(this.aMarks[d].oElement,this.__self.CLASS_NAME_MARK_ELEMENT_SELECTED);this.aMarks[d].bSelected=true}}}},next:function(){if(!this.isEnabled()||!this.getChildren()[this.getCurrentControlIndex()].isEnabled()){return false}var a=this.getChildren()[this.getCurrentControlIndex()].getValue();this.setValue(new ZForms.Value.Number(parseFloat(a.get())+parseFloat(this.findNextStepByValue(a))))},prev:function(){if(!this.isEnabled()||!this.getChildren()[this.getCurrentControlIndex()].isEnabled()){return false}var a=this.getChildren()[this.getCurrentControlIndex()].getValue();this.setValue(new ZForms.Value.Number(parseFloat(a.get())-parseFloat(this.findPrevStepByValue(a))))},updateContainerOffset:function(){this.oContainerOffset=Common.Dom.getAbsoluteCoords(this.oContainer)},calculateOffset:function(a){return Common.Event.getAbsoluteCoords(a).iLeft-this.oContainerOffset.iLeft},calculatePositionByValue:function(a){var b=this.findSlideRuleIndexByValue(a),c=this.getSlideRuleByIndex(b),d=this.getSlideRuleByIndex(b+1);return(a.get()-c.dValue)/(d.dValue-c.dValue)*(d.dPercent-c.dPercent)+c.dPercent},calculateValueByOffset:function(a){var b=this.calculatePercentByOffset(a);if(b>100){b=100}else{if(b<0){b=0}}var c=this.findSlideRuleIndexByPercent(b),d=this.getSlideRuleByIndex(c),e=this.getSlideRuleByIndex(c+1);return new ZForms.Value.Number((b-this.aSlideRules[c].dPercent)/(e.dPercent-d.dPercent)*(e.dValue-d.dValue)+d.dValue)},calculatePercentByOffset:function(a){return a/this.oContainer.offsetWidth*100},findSlideRuleIndexByPercent:function(a){if(a==0){return 0}for(var b=0;b<this.aSlideRules.length;b++){if(this.aSlideRules[b].dPercent>=a){return b-1}}return this.aSlideRules.length-2},findSlideRuleIndexByValue:function(a){if(a.get()==this.getMin()){return 0}for(var b=1;b<this.aSlideRules.length;b++){if(this.aSlideRules[b].dValue>=a.get()){return b-1}}return this.aSlideRules.length-2},findNextStepByValue:function(a){if(a.get()==this.getMin()){return this.aSlideRules[0].dStep}for(var b=0;b<this.aSlideRules.length;b++){if(this.aSlideRules[b].dValue==a.get()){return this.aSlideRules[b].dStep}else{if(this.aSlideRules[b].dValue>a.get()){return this.aSlideRules[b-1].dStep}}}return this.aSlideRules[this.aSlideRules.length-1].dStep},findPrevStepByValue:function(a){if(a.get()==this.getMin()){return this.aSlideRules[0].dStep}for(var b=0;b<this.aSlideRules.length;b++){if(this.aSlideRules[b].dValue>=a.get()){return this.aSlideRules[b-1].dStep}}return this.aSlideRules[this.aSlideRules.length-1].dStep},getSlideRuleByIndex:function(a){return this.aSlideRules[a]},disableControlByIndex:function(a){Common.Class.add(this.aControls[a].oElement,this.__self.CLASS_NAME_CONTROL_ELEMENT_DISABLED);Common.Class.add(this.aControls[a].oValueElement,this.__self.CLASS_NAME_VALUE_ELEMENT_DISABLED)},enableControlByIndex:function(a){Common.Class.remove(this.aControls[a].oElement,this.__self.CLASS_NAME_CONTROL_ELEMENT_DISABLED);Common.Class.remove(this.aControls[a].oValueElement,this.__self.CLASS_NAME_VALUE_ELEMENT_DISABLED)},destruct:function(){this.oContainer=null;this.oScaleElement=null;if(!this.isTemplate()){for(i=0;i<this.aMarks.length;i++){this.aMarks[i].oElement=null}for(i=0;i<this.aControls.length;i++){this.aControls[i].oElement=null;this.aControls[i].oValueElement=null;this.aControls[i].oLeftRangeElement=null;this.aControls[i].oRightRangeElement=null}}this.__base()}},{CLASS_NAME_SLIDER:"zf-slider-horizontal",CLASS_NAME_SLIDER_SCALE:"zf-slider-scale",CLASS_NAME_CONTROL_ELEMENT:"zf-slider-control",CLASS_NAME_CONTROL_ELEMENT_SELECTED:"zf-slider-control-selected",CLASS_NAME_CONTROL_ELEMENT_DISABLED:"zf-slider-control-disabled",CLASS_NAME_VALUE_ELEMENT:"zf-slider-value",CLASS_NAME_VALUE_ELEMENT_SELECTED:"zf-slider-value-selected",CLASS_NAME_VALUE_ELEMENT_DISABLED:"zf-slider-value-disabled",CLASS_NAME_MARK_ELEMENT:"zf-slider-mark",CLASS_NAME_MARK_ELEMENT_SELECTED:"zf-slider-mark-selected",CLASS_NAME_RANGE_ELEMENT:"zf-slider-range",aAll:[],iActiveIndex:0,add:function(a){if(!(a instanceof this)){return}this.aAll.push(a);return this.aAll.length-1},setActiveIndex:function(a){this.iActiveIndex=a}});ZForms.Widget.Container.Slider.Vertical=ZForms.Widget.Container.Slider.inheritTo({setupMarkElementPosition:function(a,b){a.style.bottom=b+"%"},updateControlElement:function(){var a=this.getCurrentControl();a.oElement.style.bottom=Math.round(a.dPosition)+"%";a.oValueElement.style.bottom=Math.round(a.dPosition)+"%";a.oValueElement.innerHTML=this.getChildren()[this.getCurrentControlIndex()].getValue().get().formatNumber()},moveRangeElement:function(a,b,c){var d=Math.round(c)-Math.round(b);Common.Dom.setStyle(a,"bottom: "+Math.round(b)+"%;height: "+(d>0?a.parentNode.offsetHeight*d/100+"px;":"0px;"))},calculateOffset:function(a){return this.oContainerOffset.iTop+this.oContainer.offsetHeight-Common.Event.getAbsoluteCoords(a).iTop},calculatePercentByOffset:function(a){return a/this.oContainer.offsetHeight*100}},{CLASS_NAME_SLIDER:"zf-slider-vertical"});ZForms.Widget.Button=ZForms.Widget.inheritTo({__constructor:function(a,b,c){this.__base(a,b,c);this.fHandler=null;this.fDisableHandler=function(a){Common.Event.cancel(a)}},hasValue:function(){return false},setHandler:function(a){if(this.fHandler){Common.Event.remove(this.oElement,this.__self.DOM_EVENT_TYPE_CLICK,this.fHandler)}this.fHandler=a;if(this.isEnabled()){this.enable(false,true)}},enable:function(a,b){var c=this.__base(a);if(!(c||b)){return false}if((b||c)&&this.fHandler){Common.Event.add(this.oElement,this.__self.DOM_EVENT_TYPE_CLICK,this.fHandler)}if(c){Common.Event.remove([this.oElement,this.oClassElement],[this.__self.DOM_EVENT_TYPE_CLICK,this.__self.DOM_EVENT_TYPE_MOUSEDOWN,this.__self.DOM_EVENT_TYPE_SELECTSTART],this.fDisableHandler)}return c},disable:function(a){if(!this.__base(a)){return false}if(this.fHandler){Common.Event.remove(this.oElement,this.__self.DOM_EVENT_TYPE_CLICK,this.fHandler)}Common.Event.add([this.oElement,this.oClassElement],[this.__self.DOM_EVENT_TYPE_CLICK,this.__self.DOM_EVENT_TYPE_MOUSEDOWN,this.__self.DOM_EVENT_TYPE_SELECTSTART],this.fDisableHandler);return true}},{CLASS_NAME_BUTTON:"zf-button"});ZForms.Widget.Button.Submit=ZForms.Widget.Button.inheritTo({getDefaultOptions:function(){return Common.Object.extend(this.__base(),{bDisableOnSubmit:true},true)},setForm:function(a){this.__base(a);this.oForm.addSubmit(this);if(!this.oOptions.bDisableOnSubmit){return}var b=this;this.setHandler(function(){b.oForm.setCurrentSubmit(b)})},prepareForSubmit:function(){if(this.oOptions.bDisableOnSubmit){this.disable()}this.__base()},addDependence:function(a){}});ZForms.Widget.Container.Form=ZForms.Widget.Container.inheritTo({__constructor:function(a,b,c){this.__base(a,b,c);this.oForm=this;this.aWidgets=[];this.aWidgets[this.getId()]=this;this.aSubmits=[];this.oCurrentSubmit=null;this.oHiddenSubmitElement=null;this.iChangedCounter=0;this.bReadyForSubmit=true;this.bSubmitted=false;this.addExtendedHandlers();ZForms.aForms[this.getId()]=this},getDefaultOptions:function(){return Common.Object.extend(this.__base(),{bUpdatableSubmit:true,bCheckForValid:true,bCheckForChanged:false,bPreventSubmit:false},true)},addExtendedHandlers:function(){var a=this;Common.Event.add(this.oElement,this.__self.DOM_EVENT_TYPE_SUBMIT,function(b){if(!a.checkForSubmit()||a.bSubmitted){return Common.Event.cancel(b)}ZForms.notifyObservers(ZForms.EVENT_TYPE_ON_BEFORE_SUBMIT,a);if(a.oOptions.bPreventSubmit){return Common.Event.cancel(b)}a.prepareForSubmit();a.bSubmitted=true});Common.Event.add(window,Common.Browser.isIE()?this.__self.DOM_EVENT_TYPE_BEFOREUNLOAD:this.__self.DOM_EVENT_TYPE_UNLOAD,function(){a.destruct()})},checkForSubmit:function(){if(this.isReadyForSubmit()){return true}this.getFirstErrorWidget().focus();this.addClass(this.__self.CLASS_NAME_SUBMITTED);return false},init:function(){var a=this;setTimeout(function(){a.addClass(a.__self.CLASS_NAME_INITED);ZForms.Widget.Container.prototype.init.call(a);a.updateSubmit(true)},0)},setForm:function(a){},increaseChangedCounter:function(){this.iChangedCounter++},decreaseChangedCounter:function(){this.iChangedCounter--},isChanged:function(){return this.iChangedCounter>0},addChild:function(a){a.setForm(this);return this.__base(a)},addSubmit:function(a){if(!(a instanceof ZForms.Widget.Button.Submit)){return}this.aSubmits.push(a)},updateSubmit:function(a){var b=this.isReadyForSubmit(true);if(!a&&b==this.bReadyForSubmit){return}this.bReadyForSubmit=b;if(this.oOptions.bUpdatableSubmit&&this.aSubmits.length>0){if(b){this.enableSubmit()}else{this.disableSubmit()}}ZForms.notifyObservers(ZForms.EVENT_TYPE_ON_READY_CHANGE,this,b)},enableSubmit:function(){for(var a=0;a<this.aSubmits.length;a++){this.aSubmits[a].enable()}},disableSubmit:function(){for(var a=0;a<this.aSubmits.length;a++){this.aSubmits[a].disable()}},addWidget:function(a){this.aWidgets[a.getId()]=a},removeWidget:function(a){delete this.aWidgets[a.getId()]},getWidgetById:function(a){return this.aWidgets[a]},getWidgets:function(){return this.aWidgets},isReadyForSubmit:function(a){if(!a){return this.bReadyForSubmit}var b=this.aWidgets;for(var c in b){if(!b.hasOwnProperty(c)||b[c]==this){continue}if(!b[c].isReadyForSubmit()){return false}}return!this.oOptions.bCheckForChanged||this.isChanged()},getFirstErrorWidget:function(){for(var a in this.aWidgets){if(!this.aWidgets.hasOwnProperty(a)){continue}oWidget=this.aWidgets[a];if(oWidget.isEnabled()&&(oWidget.bRequired||this.oOptions.bCheckForValid&&!oWidget.bValid)){return oWidget}}},reset:function(){this.oElement.reset()},prepareForSubmit:function(){this.__base();if(this.oHiddenSubmitElement){this.oHiddenSubmitElement.parentNode.remove(this.oHiddenSubmitElement)}if(this.oCurrentSubmit&&this.oCurrentSubmit.oOptions.bDisableOnSubmit){this.oHiddenSubmitElement=this.oElement.appendChild(Common.Dom.createElement("input",{type:"hidden",name:this.oCurrentSubmit.oElement.name,value:this.oCurrentSubmit.oElement.value}));this.oCurrentSubmit=null}},setCurrentSubmit:function(a){this.oCurrentSubmit=a}},{CLASS_NAME_INITED:"zf-inited",CLASS_NAME_SUBMITTED:"zf-submitted",DOM_EVENT_TYPE_SUBMIT:"submit"});ZForms.Widget.Container.Multiplicator=ZForms.Widget.Container.inheritTo({__constructor:function(a,b,c){this.oTemplate=null;this.sButtonAddId=c?c.sButtonAddId:null;this.sButtonRemoveId=c?c.sButtonRemoveId:null;this.sButtonUpId=c?c.sButtonUpId:null;this.sButtonDownId=c?c.sButtonDownId:null;this.sInitialChildrenHash=null;this.sLastProcessedChildrenHash=null;this.__base(a||document.createElement("div"),b,c)},getDefaultOptions:function(){return Common.Object.extend(this.__base(),{iMin:1,iMax:10,bNameHasPostfix:false},true)},addChild:function(a,b){var c=b>-1?b:this.aChildren.length,d=new ZForms.Multiplier(this,a),e=c>0?"_"+c:"";if(this.sButtonAddId){d.addAddButton(ZForms.createButton(document.getElementById(this.sButtonAddId+e)))}if(this.sButtonRemoveId){d.addRemoveButton(ZForms.createButton(document.getElementById(this.sButtonRemoveId+e)))}if(this.sButtonUpId){d.addUpButton(ZForms.createButton(document.getElementById(this.sButtonUpId+e)))}if(this.sButtonDownId){d.addDownButton(ZForms.createButton(document.getElementById(this.sButtonDownId+e)))}a.setMultiplier(d);this.updateChildIndex(a,0,c);return this.__base(a,b)},addTemplate:function(a){this.oTemplate=a;a.setMultiplier(new ZForms.Multiplier(this,a));if(this.oForm){a.setForm(this.oForm)}return a},normalizeTemplateAttributes:function(a){var b=a.oClassElement.getElementsByTagName("script");while(b.length>0){b[0].parentNode.removeChild(b[0])}this.replacePostfixAtElement(a.oClassElement,this.oOptions.iMax+1);a.setId(a.oElement.id)},calculateCurrentChildrenHash:function(){var a="";for(var b=0,c=this.aChildren.length;b<c;b++){a+=Common.Dom.getUniqueId(this.aChildren[b].oElement)}return a},processChildrenHashChanged:function(){var a=this.calculateCurrentChildrenHash();if(this.sInitialChildrenHash==a){if(this.sLastProcessedChildrenHash!=this.sInitialChildrenHash){this.oForm.decreaseChangedCounter();this.oForm.updateSubmit()}}else{if(this.sLastProcessedChildrenHash==this.sInitialChildrenHash){this.oForm.increaseChangedCounter();this.oForm.updateSubmit()}}this.sLastProcessedChildrenHash=a},init:function(){this.__base();if(!this.oTemplate){ZForms.throwException("template not found")}for(var a=0;a<this.aChildren.length;a++){this.aChildren[a].addId(a)}this.oTemplate.hide();this.oTemplate.disable();this.oTemplate.addId(this.oOptions.iMax+1);this.normalizeTemplateAttributes(this.oTemplate);this.updateMultipliers();this.sInitialChildrenHash=this.calculateCurrentChildrenHash();this.sLastProcessedChildrenHash=this.sInitialChildrenHash},updateMultipliers:function(){for(var a=0;a<this.aChildren.length;a++){this.aChildren[a].getMultiplier().updateState(this.aChildren.length<this.oOptions.iMax,this.aChildren.length>this.oOptions.iMin,a>0,a<this.aChildren.length-1)}},add:function(a){var b=this.aChildren.indexOf(a)+1,c=this.oTemplate.oClassElement.cloneNode(true);this.increaseChildrenPostfix(b);this.removePostfixFromElement(c);this.addPostfixToElement(c,b);if(a.oClassElement.nextSibling){a.oClassElement.parentNode.insertBefore(c,a.oClassElement.nextSibling)}else{a.oClassElement.parentNode.appendChild(c)}var d=this.oTemplate.clone(document.getElementById(this.oTemplate.oElement.id.match(this.__self.REG_EXP_REPLACE)[1]+"_"+b),document.getElementById(this.oTemplate.oClassElement.id.match(this.__self.REG_EXP_REPLACE)[1]+"_"+b),b);var e=this.oTemplate.getMultiplier();if(!this.sButtonAddId&&e.oAddButton){this.sButtonAddId=e.oAddButton.oElement.id.match(this.__self.REG_EXP_REPLACE)[1]}if(!this.sButtonRemoveId&&e.oRemoveButton){this.sButtonRemoveId=e.oRemoveButton.oElement.id.match(this.__self.REG_EXP_REPLACE)[1]}if(!this.sButtonUpId&&e.oUpButton){this.sButtonUpId=e.oUpButton.oElement.id.match(this.__self.REG_EXP_REPLACE)[1]}if(!this.sButtonDownId&&e.oDownButton){this.sButtonDownId=e.oDownButton.oElement.id.match(this.__self.REG_EXP_REPLACE)[1]}this.addChild(d,b);d.disable();d.enable();d.show();this.updateMultipliers();this.addTemplateDependencies(this.oTemplate,d,d);d.afterClone();this.repaintFix();this.processChildrenHashChanged()},addTemplateDependencies:function(a,b,c){this.addDependenciesFrom(a,b,c);this.addDependenciesTo(a,b,c);if(a instanceof ZForms.Widget.Container){for(var d=0;d<a.aChildren.length;d++){this.addTemplateDependencies(a.aChildren[d],b.aChildren[d],c)}}},addDependenciesFrom:function(a,b,c){for(var d=0,e=a.getDependencies(),f,g;d<e.length;d++){f=this.findCorrespondingWidgetByTemplate(e[d].getFrom(),this.oTemplate,c)||e[d].getFrom();g=e[d].clone(f);if(g instanceof ZForms.Dependence.Function){g.getFunction().mArgument=this.findCorrespondingWidgetByTemplate(e[d].getFunction().mArgument,this.oTemplate,c)||e[d].getFunction().mArgument;g.getFunction().oWidget=this.findCorrespondingWidgetByTemplate(e[d].getFunction().oWidget,this.oTemplate,c)||e[d].getFunction().oWidget;g.getFunction().iType=e[d].getFunction().iType;g.getFunction().sFunctionName=e[d].getFunction().sFunctionName;g.getFunction().oOptions=e[d].getFunction().oOptions}b.addDependence(g);f.processEvents(true,true)}},addDependenciesTo:function(a,b,c){for(var d=0,e;d<a.aObservers.length;d++){if(this.findCorrespondingWidgetByTemplate(a.aObservers[d],this.oTemplate,c)){continue}e=a.aObservers[d].getDependencies();for(var f=0;f<e.length;f++){if(e[f].getFrom()==a){a.aObservers[d].addDependence(e[f].clone(b))}}}},findCorrespondingWidgetByTemplate:function(a,b,c){if(b==a){return c}if(b instanceof ZForms.Widget.Container){for(var d=0,e;d<b.aChildren.length;d++){e=this.findCorrespondingWidgetByTemplate(a,b.aChildren[d],c.aChildren[d]);if(e){return e}}}},remove:function(a){var b=this.aChildren.indexOf(a);a.oClassElement.parentNode.removeChild(a.oClassElement);this.decreaseChildrenPostfix(b+1);this.removeChild(a);this.processEvents(true);this.updateMultipliers();this.repaintFix();this.processChildrenHashChanged()},up:function(a){var b=this.aChildren.indexOf(a);this.aChildren[b-1].oClassElement.parentNode.insertBefore(a.oClassElement.parentNode.removeChild(a.oClassElement),this.aChildren[b-1].oClassElement);this.aChildren.remove(a);this.aChildren.splice(b-1,0,a);if(b-1>0){this.replacePostfixAtElement(this.aChildren[b].oClassElement,b)}else{this.addPostfixToElement(this.aChildren[b].oClassElement,b)}this.updateChildIndex(this.aChildren[b-1],b,b-1);this.replacePostfixAtElement(this.aChildren[b-1].oClassElement,b-1);this.aChildren[b-1].updateElements(b-1);this.updateChildIndex(this.aChildren[b],b-1,b);this.aChildren[b].updateElements(b);this.updateMultipliers();this.repaintFix();this.processChildrenHashChanged()},down:function(a){var b=this.aChildren.indexOf(a);if(this.aChildren[b+2]){this.aChildren[b+2].oClassElement.parentNode.insertBefore(a.oClassElement.parentNode.removeChild(a.oClassElement),this.aChildren[b+2].oClassElement)}else{this.aChildren[b+1].oClassElement.parentNode.insertBefore(a.oClassElement.parentNode.removeChild(a.oClassElement),this.oTemplate.oClassElement)}this.aChildren.remove(a);this.aChildren.splice(b+1,0,a);this.updateChildIndex(this.aChildren[b],b+1,b);this.replacePostfixAtElement(this.aChildren[b].oClassElement,b);this.aChildren[b].updateElements(b);this.updateChildIndex(this.aChildren[b+1],b,b+1);if(b>0){this.replacePostfixAtElement(this.aChildren[b+1].oClassElement,b+1)}else{this.addPostfixToElement(this.aChildren[b+1].oClassElement,b+1)}this.aChildren[b+1].updateElements(b+1);this.updateMultipliers();this.repaintFix();this.processChildrenHashChanged()},updateChildIndex:function(a,b,c){a.replaceClass(this.__self.CHILD_INDEX_CLASS_NAME_PREFIX+b,this.__self.CHILD_INDEX_CLASS_NAME_PREFIX+c)},increaseChildrenPostfix:function(a){for(var b=this.aChildren.length-1;b>=a;b--){this.replacePostfixAtElement(this.aChildren[b].oClassElement,b+1);this.aChildren[b].updateElements(b+1);this.updateChildIndex(this.aChildren[b],b,b+1)}},decreaseChildrenPostfix:function(a){for(var b=a;b<this.aChildren.length;b++){this.replacePostfixAtElement(this.aChildren[b].oClassElement,b-1);this.aChildren[b].updateElements(b-1);this.updateChildIndex(this.aChildren[b],b,b-1)}},replacePostfixAtElement:function(a,b){for(var c=0;c<a.childNodes.length;c++){this.replacePostfixAtElement(a.childNodes[c],b)}this.replacePostfixAtNode(a,b)},replacePostfixAtNode:function(a,b){if(a.id){a.id=a.id.replace(this.__self.REG_EXP_REPLACE,"$1"+(b>0?"_"+b:""))}if(a.htmlFor){a.htmlFor=a.htmlFor.replace(this.__self.REG_EXP_REPLACE,"$1"+(b>0?"_"+b:""))}if(this.oOptions.bNameHasPostfix&&a.name){a.name=a.name.replace(this.__self.REG_EXP_REPLACE,"$1"+(b>0?"_"+b:"")+"$2");this.fixNode(a)}},removePostfixFromElement:function(a){for(var b=0;b<a.childNodes.length;b++){this.removePostfixFromElement(a.childNodes[b])}this.removePostfixFromNode(a)},removePostfixFromNode:function(a){if(this.oOptions.bNameHasPostfix&&a.name){a.name=a.name.replace(this.__self.REG_EXP_REPLACE,"$1$2")}if(a.id){a.id=a.id.replace(this.__self.REG_EXP_REPLACE,"$1")}if(a.htmlFor){a.htmlFor=a.htmlFor.replace(this.__self.REG_EXP_REPLACE,"$1")}},addPostfixToElement:function(a,b){for(var c=0;c<a.childNodes.length;c++){this.addPostfixToElement(a.childNodes[c],b)}this.addPostfixToNode(a,b)},addPostfixToNode:function(a,b){if(a.id){a.id+="_"+b}if(a.htmlFor){a.htmlFor+="_"+b}if(this.oOptions.bNameHasPostfix&&a.name){a.name=a.name.replace(/^([^\[]+)(\[\])?$/,"$1_"+b+"$2");this.fixNode(a)}},fixNode:function(a){var b=a.type.toLowerCase();if(!Common.Browser.isIE()||!(b=="text"||b=="radio"||b=="checkbox")){return}var c={type:a.type,name:a.name,id:a.id,"class":a.className,size:a.size,maxlength:a.maxLength,value:a.value,style:a.style.cssText};if(a.checked){c.checked="checked"}a.parentNode.replaceChild(Common.Dom.createElement("input",c),a).outerHTML=""},destruct:function(){if(this.oTemplate){this.oTemplate.destruct()}this.__base()},repaintFix:function(){if(document.compatMode){return}document.body.className+=""}},{POSTFIX_ID:"_multiplicator",REG_EXP_REPLACE:/^(.+)_\d+(\[\])?$/,CHILD_INDEX_CLASS_NAME_PREFIX:"zf-child_"});ZForms.Multiplier=Abstract.inheritTo({__constructor:function(a,b){this.oMultiplicator=a;this.oWidget=b;this.bCanAdd=true;this.bCanRemove=true;this.bCanUp=true;this.bCanDown=true;this.oAddButton=null;this.oRemoveButton=null;this.oUpButton=null;this.oDownButton=null;this.bDisabledByOuter=false},addAddButton:function(a){this.oAddButton=a;var b=this;a.setHandler(function(){b.oMultiplicator.add(b.oWidget);return false})},addRemoveButton:function(a){this.oRemoveButton=a;var b=this;a.setHandler(function(){b.oMultiplicator.remove(b.oWidget);return false})},addUpButton:function(a){this.oUpButton=a;var b=this;a.setHandler(function(){b.oMultiplicator.up(b.oWidget);return false})},addDownButton:function(a){this.oDownButton=a;var b=this;a.setHandler(function(){b.oMultiplicator.down(b.oWidget);return false})},enableByOuter:function(){this.bDisabledByOuter=false;if(this.bCanAdd){this.enableAdd()}if(this.bCanRemove){this.enableRemove()}},disableByOuter:function(){this.bDisabledByOuter=true;if(this.oAddButton){this.oAddButton.disable()}if(this.oRemoveButton){this.oRemoveButton.disable()}},enableAdd:function(){this.bCanAdd=true;if(this.bDisabledByOuter){return}if(this.oAddButton){this.oAddButton.enable()}},disableAdd:function(){this.bCanAdd=false;if(this.oAddButton){this.oAddButton.disable()}},enableRemove:function(){this.bCanRemove=true;if(this.bDisabledByOuter){return}if(this.oRemoveButton){this.oRemoveButton.enable()}},disableRemove:function(){this.bCanRemove=false;if(this.oRemoveButton){this.oRemoveButton.disable()}},enableUp:function(){this.bCanUp=true;if(this.bDisabledByOuter){return}if(this.oUpButton){this.oUpButton.enable()}},disableUp:function(){this.bCanUp=false;if(this.oUpButton){this.oUpButton.disable()}},enableDown:function(){this.bCanDown=true;if(this.bDisabledByOuter){return}if(this.oDownButton){this.oDownButton.enable()}},disableDown:function(){this.bCanDown=false;if(this.oDownButton){this.oDownButton.disable()}},updateState:function(a,b,c,d){if(a){this.enableAdd()}else{this.disableAdd()}if(b){this.enableRemove()}else{this.disableRemove()}if(c){this.enableUp()}else{this.disableUp()}if(d){this.enableDown()}else{this.disableDown()}},init:function(){if(this.oAddButton){this.oAddButton.init()}if(this.oRemoveButton){this.oRemoveButton.init()}if(this.oUpButton){this.oUpButton.init()}if(this.oDownButton){this.oDownButton.init()}},addId:function(a){if(this.oAddButton){this.oAddButton.addId(a)}if(this.oRemoveButton){this.oRemoveButton.addId(a)}if(this.oUpButton){this.oUpButton.addId(a)}if(this.oDownButton){this.oDownButton.addId(a)}},destruct:function(){if(this.oAddButton){this.oAddButton.destruct()}if(this.oRemoveButton){this.oRemoveButton.destruct()}if(this.oUpButton){this.oUpButton.destruct()}if(this.oDownButton){this.oDownButton.destruct()}}});ZForms.Dependence=Abstract.inheritTo({__constructor:function(a,b,c,d,e){this.iType=a;this.oFrom=b;this.rPattern=c;this.iLogic=d||this.__self.LOGIC_OR;this.bInverse=e||false},check:function(){if(this.oFrom.isTemplate()){return true}var a=this.oFrom.getValue().match(this.rPattern);return this.isInverse()?!a:a},getType:function(){return this.iType},getFrom:function(){return this.oFrom},getPattern:function(){return this.rPattern},getLogic:function(){return this.iLogic},isInverse:function(){return this.bInverse},clone:function(a){return new this.__self(this.getType(),a,this.getPattern(),this.getLogic(),this.isInverse())},getResult:function(){}},{TYPE_REQUIRED:1,TYPE_VALID:2,TYPE_ENABLED:3,TYPE_OPTIONS:4,TYPE_CLASS:5,TYPE_CHECK:6,LOGIC_OR:1,LOGIC_AND:2,COMPARE_FUNCTIONS:{eq:"isEqual",gt:"isGreater",gte:"isGreaterOrEqual",lt:"isLess",lte:"isLessOrEqual"}});ZForms.Dependence.Enabled=ZForms.Dependence.inheritTo({__constructor:function(a,b,c,d,e){this.__base(this.__self.TYPE_ENABLED,a,b,c,d);this.bCheckResult=false;this.bFocusOnEnable=e},check:function(){if(this.oFrom.isTemplate()){return true}this.bCheckResult=this.__base();return this.bCheckResult},getResult:function(){if(!this.bFocusOnEnable){return}return{bFocusOnEnable:this.bCheckResult}}});ZForms.Dependence.Valid=ZForms.Dependence.inheritTo({__constructor:function(a,b,c,d,e,f){this.__base(this.__self.TYPE_VALID,a,b,c,d);this.bCheckResult=false;this.sClassName=e;this.bCheckForEmpty=f},check:function(){if(this.oFrom.isTemplate()||!this.bCheckForEmpty&&this.oFrom.getValue().isEmpty()){return true}this.bCheckResult=this.__base();return this.bCheckResult},getResult:function(){if(!this.sClassName){return}return{bAdd:!this.bCheckResult,sClassName:this.sClassName}},clone:function(a){return new this.__self(a,this.getPattern(),this.getLogic(),this.isInverse(),this.sClassName,this.bCheckForEmpty)}});ZForms.Dependence.Options=ZForms.Dependence.inheritTo({__constructor:function(a,b,c,d,e){this.__base(a,b,null,d,e);this.aPatterns=c;this.aResult=[]},getPatterns:function(){return this.aPatterns},check:function(){if(this.oFrom.isTemplate()){return true}this.aResult=[];var a=this.oFrom.getValue(),b=false;for(var c=0;c<this.aPatterns.length;c++){b=a.match(this.aPatterns[c].rSource);if(this.bInverse?!b:b){this.aResult.push(this.aPatterns[c].rDestination)}}return true},getResult:function(){return this.aResult}});ZForms.Dependence.Required=ZForms.Dependence.inheritTo({__constructor:function(a,b,c,d,e){this.__base(this.__self.TYPE_REQUIRED,a,b,c,d);this.iMin=e||1;if(!(this.getFrom()instanceof ZForms.Widget.Container)){this.iMin=1}},getMin:function(){return this.iMin},check:function(){if(this.oFrom.isTemplate()){return true}var a=0,b=false,c=true,d=false;if(this.oFrom instanceof ZForms.Widget.Container.Group){for(var e=0;e<this.oFrom.aChildren.length;e++){if(this.oFrom.aChildren[e].isChecked()){a++}}}else{if(this.oFrom instanceof ZForms.Widget.Container&&!(this.oFrom instanceof ZForms.Widget.Container.Date)){c=false;for(var e=0;e<this.oFrom.aChildren.length;e++){if(this.oFrom.aChildren[e].isEnabled()){c=true}else{continue}if(this.oFrom.aChildren[e]instanceof ZForms.Widget.Container&&!(this.oFrom.aChildren[e]instanceof ZForms.Widget.Container.Date)){if(this.oFrom.aChildren[e].isRequired()){b=true}else{var f=0;if(this.oFrom.aChildren[e]instanceof ZForms.Widget.Container.Group){for(var g=0;g<this.oFrom.aChildren[e].aChildren.length;g++){if(this.oFrom.aChildren[e].aChildren[g].isChecked()){f++}}}else{f=this.oFrom.aChildren[e].getCountChildrenByPattern(this.rPattern)}if(this.oFrom.aChildren[e]instanceof ZForms.Widget.Container.Multiplicator){a+=f}else{if(f>0){a++}}}}else{if(this.oFrom.aChildren[e].isRequired()){b=true}else{if(this.oFrom.aChildren[e].getValue().match(/\S+/)){a++}}}}}else{if(this.oFrom.getValue().match(this.rPattern)){a++}}}d=!b&&(a>=this.iMin||!c);return this.isInverse()?!d:d},clone:function(a){return new this.__self(a,this.getPattern(),this.getLogic(),this.isInverse(),this.getMin())}});ZForms.Dependence.Class=ZForms.Dependence.inheritTo({__constructor:function(a,b,c){this.__base(this.__self.TYPE_CLASS,a,null,c,false);this.aPatternToClasses=b;this.aResult=[]},getPatternToClasses:function(){return this.aPatternToClasses},check:function(){if(this.oFrom.isTemplate()){return true}this.aResult=[];var a=this.oFrom.getValue(),b=0,c;while(c=this.aPatternToClasses[b++]){this.aResult.push({sClassName:c.sClassName,bMatched:a.match(c.rPattern)?!c.bInverse:c.bInverse})}return this.aResult.length>0},clone:function(a){return new this.__self(a,this.getPatternToClasses(),this.getLogic())},getResult:function(){return this.aResult}});ZForms.Dependence.Function=ZForms.Dependence.inheritTo({__constructor:function(a,b,c,d,e){this.__base(a,b,null,d,e);this.fFunction=c;this.mResult=null},getFunction:function(){return this.fFunction},check:function(){if(this.oFrom.isTemplate()){return true}this.mResult=null;var a=this.fFunction(this.oFrom,this);return this.isInverse()?!a:a},setResult:function(a){this.mResult=a},getResult:function(){return this.mResult},clone:function(oFrom){eval("var fClonedFunction = "+this.getFunction().toString());return new this.__self(this.getType(),oFrom,fClonedFunction,this.getLogic(),this.isInverse())}});ZForms.DependenceGroup=Abstract.inheritTo({__constructor:function(a){this.iType=a;this.aDependencies=[]},getType:function(){return this.iType},addDependence:function(a){this.aDependencies.push(a)},removeDependence:function(a){this.aDependencies.remove(a)},getDependencies:function(){return this.aDependencies},check:function(){var a=this.aDependencies.length==0,b=false;for(var c=0,d=false;c<this.aDependencies.length;c++){b=this.aDependencies[c].check();if(d){continue}if(b&&this.aDependencies[c].getLogic()==ZForms.Dependence.LOGIC_OR){a=true;if(!(this.getType()==ZForms.Dependence.TYPE_CLASS||this.getType()==ZForms.Dependence.TYPE_OPTIONS)){break}}else{if(!b&&this.aDependencies[c].getLogic()==ZForms.Dependence.LOGIC_AND){a=false;d=true;if(this.getType()!=ZForms.Dependence.TYPE_VALID){break}}else{a=b}}}return a},getResult:function(){for(var a=0,b=[],c;a<this.aDependencies.length;a++){b.push(this.aDependencies[a].getResult())}return b}});ZForms.DependenceProcessor=Abstract.inheritTo({__constructor:function(a){this.oWidget=a;this.aDependenceGroups=[];this.aCheckingOrder=[ZForms.Dependence.TYPE_ENABLED,ZForms.Dependence.TYPE_VALID,ZForms.Dependence.TYPE_REQUIRED,ZForms.Dependence.TYPE_OPTIONS,ZForms.Dependence.TYPE_CHECK,ZForms.Dependence.TYPE_CLASS]},addDependence:function(a){if(!this.hasDependenciesByType(a.getType())){this.aDependenceGroups[a.getType()]=new ZForms.DependenceGroup(a.getType())}this.aDependenceGroups[a.getType()].addDependence(a)},removeDependence:function(a){this.aDependenceGroups[a.getType()].removeDependence(a)},getDependencies:function(){var a=[];for(var b=0;b<this.aCheckingOrder.length;b++){if(!this.hasDependenciesByType(this.aCheckingOrder[b])){continue}a=a.concat(this.aDependenceGroups[this.aCheckingOrder[b]].getDependencies())}return a},hasDependenciesByType:function(a){return this.aDependenceGroups[a]&&this.aDependenceGroups[a].getDependencies().length>0},process:function(){if(this.oWidget.isTemplate()){return}for(var a=0;a<this.aCheckingOrder.length;a++){this.dispatchProcessDependencies(this.aCheckingOrder[a])}},dispatchProcessDependencies:function(a){if(!this.hasDependenciesByType(a)){return}switch(a){case ZForms.Dependence.TYPE_ENABLED:this.processEnableDependencies();break;case ZForms.Dependence.TYPE_VALID:this.processValidDependencies();break;case ZForms.Dependence.TYPE_REQUIRED:this.processRequiredDependencies();break;case ZForms.Dependence.TYPE_OPTIONS:case ZForms.Dependence.TYPE_CHECK:this.processOptionsDependencies(a);break;case ZForms.Dependence.TYPE_CLASS:this.processClassDependencies();break;default:break}},processEnableDependencies:function(){var a=this.aDependenceGroups[ZForms.Dependence.TYPE_ENABLED].check(),b=this.aDependenceGroups[ZForms.Dependence.TYPE_ENABLED].getResult();if(a){this.oWidget.enable()}else{this.oWidget.disable()}if(!this.oWidget.isInited()){return}var c,d=0;while(c=b[d++]){if(c.bFocusOnEnable){return this.oWidget.focus()}}},processValidDependencies:function(){var a=this.aDependenceGroups[ZForms.Dependence.TYPE_VALID].check(),b=this.aDependenceGroups[ZForms.Dependence.TYPE_VALID].getResult(),c=0;if(a){this.oWidget.setValid()}else{this.oWidget.setInvalid()}while(c<b.length){if(b[c]&&b[c].sClassName){this.oWidget[(b[c].bAdd&&!a?"add":"remove")+"Class"](b[c].sClassName)}++c}},processRequiredDependencies:function(){if(this.aDependenceGroups[ZForms.Dependence.TYPE_REQUIRED].check()&&this.oWidget.isValid()){this.oWidget.unsetRequired()}else{this.oWidget.setRequired()}},processOptionsDependencies:function(a){var b=this.aDependenceGroups[a].check(),c=this.aDependenceGroups[a].getResult();this.oWidget.enableOptionsByValue(c,this.aDependenceGroups[a].getDependencies()[0].getLogic()==ZForms.Dependence.LOGIC_OR,a==ZForms.Dependence.TYPE_CHECK)},processClassDependencies:function(){var a=this.aDependenceGroups[ZForms.Dependence.TYPE_CLASS].check(),b=this.aDependenceGroups[ZForms.Dependence.TYPE_CLASS].getResult(),c=this.aDependenceGroups[ZForms.Dependence.TYPE_CLASS].getDependencies()[0].getLogic()==ZForms.Dependence.LOGIC_AND,d=[];for(var e=0;e<b.length;e++){d=this.joinClassGroup(d,b[e],c)}if(a&&d.length==0){return}for(var e=0;e<d.length;e++){if(d[e].bMatched){this.oWidget.addClass(d[e].sClassName)}else{this.oWidget.removeClass(d[e].sClassName)}}},joinClassGroup:function(a,b,c){if(a.length==0){return b}for(var d=0,e=a.length;d<e;d++){for(var f=0;f<b.length;f++){if(a[d].sClassName==b[f].sClassName){if(!c&&b[f].bMatched||c&&!b[f].bMatched){a[d]=b[f]}else{b[f]=a[d]}}else{if(!a.contains(b[f])){a[a.length]=b[f]}}}}return a}});ZForms.Calendar=Abstract.inheritTo({__constructor:function(a){this.oWidget=a;this.oPickerButton=ZForms.createButton(a.oOptions.oPickerOpenerElement);this.oElement=Common.Dom.createElement("table",{"class":this.__self.CLASS_NAME_CALENDAR+" "+this.__self.CLASS_NAME_HIDDEN}).appendChild(Common.Dom.createElement("tbody"));this.oYearTitleElement=Common.Dom.createElement("span",{"class":this.__self.CLASS_NAME_TITLE});this.oMonthTitleElement=Common.Dom.createElement("span",{"class":this.__self.CLASS_NAME_TITLE});this.oDate=new Date;this.oDateNow=new Date;this.bShowed=false;this.fClickHandler=null;this.fMouseHandler=null;this.init()},init:function(){var a=this.oElement.parentNode.insertBefore(document.createElement("thead"),this.oElement),b=a.appendChild(document.createElement("tr")).appendChild(Common.Dom.createElement("th",{colspan:7})),c=b.appendChild(Common.Dom.createElement("input",{type:"button",value:"←","class":this.__self.CLASS_NAME_ARROW_PREV+" "+ZForms.Widget.Button.CLASS_NAME_BUTTON})),d=b.appendChild(Common.Dom.createElement("input",{type:"button",value:"→","class":this.__self.CLASS_NAME_ARROW_NEXT+" "+ZForms.Widget.Button.CLASS_NAME_BUTTON})),e=a.appendChild(document.createElement("tr")).appendChild(Common.Dom.createElement("th",{colspan:7})),f=e.appendChild(Common.Dom.createElement("input",{type:"button",value:"←","class":this.__self.CLASS_NAME_ARROW_PREV+" "+ZForms.Widget.Button.CLASS_NAME_BUTTON})),g=e.appendChild(Common.Dom.createElement("input",{type:"button",value:"→","class":this.__self.CLASS_NAME_ARROW_NEXT+" "+ZForms.Widget.Button.CLASS_NAME_BUTTON})),h=a.appendChild(document.createElement("tr"));b.appendChild(this.oYearTitleElement);e.appendChild(this.oMonthTitleElement);for(var i=0;i<7;i++){h.appendChild(Common.Dom.createElement("th",{"class":i>4?this.__self.CLASS_NAME_WEEKEND:null},ZForms.Resources.getDaysOfWeek()[i]))}var j=this;this.oPickerButton.setHandler(function(){if(j.isShowed()){j.hide()}else{var a=j.oWidget.getValue();if(j.oWidget.oOptions.bWithTime&&a.isEmpty()&&!j.oWidget.oYearInput.getValue().isEmpty()){j.setDate(new Date(j.oWidget.oYearInput.getValue().get(),j.oWidget.oMonthInput.getValue().get(),j.oWidget.oDayInput.getValue().get()))}else{if(!a.isEmpty()){j.setDate(new Date(a.getYear(),a.getMonth()-1,a.getDay()))}}j.show()}});Common.Event.add(this.oElement.parentNode,"click",function(a){Common.Event.cancel(a)});Common.Event.add(document,"click",function(a){if(Common.Event.normalize(a).target!=j.oPickerButton.oElement){j.hide()}});Common.Event.add(c,"click",function(){j.setPrevYear()});Common.Event.add(d,"click",function(){j.setNextYear()});Common.Event.add(f,"click",function(){j.setPrevMonth()});Common.Event.add(g,"click",function(){j.setNextMonth()});this.oPickerButton.oElement.parentNode.appendChild(this.oElement.parentNode);this.fClickHandler=function(a){j.hide();var b=Common.Event.normalize(a).target,c=parseInt(b.innerHTML,10);j.setDate(new Date(j.oDate.getFullYear(),j.oDate.getMonth()+(Common.Class.match(b,j.__self.CLASS_NAME_ADD)?c>15?-1:1:0),b.innerHTML));if(j.oWidget.oOptions.bWithTime){j.oDate.setHours(j.oWidget.oHourInput.getValue().isEmpty()?0:j.oWidget.oHourInput.getValue().get());j.oDate.setMinutes(j.oWidget.oMinuteInput.getValue().isEmpty()?0:j.oWidget.oMinuteInput.getValue().get());j.oDate.setSeconds(j.oWidget.oSecondInput.getValue().isEmpty()?0:j.oWidget.oSecondInput.getValue().get())}j.oWidget.setValue(j.oWidget.createValue(j.oDate))};this.fMouseHandler=function(a){if(Common.Browser.isOpera()){a.target.style.display="none";a.target.style.display="table-cell"}else{var a=Common.Event.normalize(a);Common.Class[a.type=="mouseover"?"add":"remove"](a.target,j.__self.CLASS_NAME_HOVERED)}}},setDate:function(a){this.oDate=a;if(this.isShowed()){this.render()}},isShowed:function(){return this.bShowed},show:function(){if(this.isShowed()){return}this.render();this.oWidget.addClass(this.__self.CLASS_NAME_PICKER_ACTIVE);Common.Class.remove(this.oElement.parentNode,this.__self.CLASS_NAME_HIDDEN);this.bShowed=true},hide:function(){if(!this.isShowed()){return}Common.Class.add(this.oElement.parentNode,this.__self.CLASS_NAME_HIDDEN);this.oWidget.removeClass(this.__self.CLASS_NAME_PICKER_ACTIVE);this.bShowed=false},render:function(){this.oYearTitleElement.innerHTML=this.oDate.getFullYear();this.oMonthTitleElement.innerHTML=ZForms.Resources.getMonthsByType("normal")[this.oDate.getMonth()];var a=new Date(this.oDate.getFullYear(),this.oDate.getMonth(),1),b=(new Date(this.oDate.getFullYear(),this.oDate.getMonth(),-.5)).getDate(),c=(a.getDay()==0?7:a.getDay())-1,d=new Date(this.oDate.getFullYear(),this.oDate.getMonth()+1,-.5),e=7-(d.getDay()==0?7:d.getDay()),f=new Common.Utils.StringBuffer("<table>");for(var g=1;g<=c;g++){if(g%7==1){f.append(g>1?"</tr>":"").append("<tr>")}f.append('<td class="').append(this.__self.CLASS_NAME_ADD).append('"').append(g%7==6||g%7==0?" "+this.__self.CLASS_NAME_WEEKEND:"").append('">').append(b-c+g).append("</td>")}for(var g=c+1,h=d.getDate(),i=1,j;i<=h;g++){if(g%7==1){f.append("</tr><tr>")}j="";if(i==this.oDateNow.getDate()&&this.oDate.getMonth()==this.oDateNow.getMonth()&&this.oDate.getYear()==this.oDateNow.getYear()){j=this.__self.CLASS_NAME_NOW}if(g%7==6||g%7==0){j+=(j.length>0?" ":"")+this.__self.CLASS_NAME_WEEKEND}f.append("<td");if(j.length>0){f.append(' class="').append(j).append('"')}f.append(">").append(i++).append("</td>")}for(var g=c+h+1,i=1;i<=e;g++){if(g%7==1){f.append("</tr><tr>")}f.append('<td class="').append(this.__self.CLASS_NAME_ADD).append(g%7==6||g%7==0?" "+this.__self.CLASS_NAME_WEEKEND:"").append('">').append(i++).append("</td>")}f.append("</tr></table>");var k=document.createElement("div");k.innerHTML=f.get();k=k.getElementsByTagName("tbody")[0];Common.Event.remove(this.oElement,"click",this.fClickHandler);Common.Event.add(k,"click",this.fClickHandler);if(Common.Browser.isOpera()||Common.Browser.isIE()&&(!document.compatMode||document.compatMode=="BackCompat"||!window.XMLHttpRequest)){var l=this.oElement.getElementsByTagName("td");for(var g=0;g<l.length;g++){Common.Event.remove(l[g],["mouseover","mouseout"],this.fMouseHandler)}l=k.getElementsByTagName("td");for(var g=0;g<l.length;g++){Common.Event.add(l[g],["mouseover","mouseout"],this.fMouseHandler)}}this.oElement.parentNode.replaceChild(k,this.oElement);this.oElement=k},setPrevMonth:function(){this.setDate(new Date(this.oDate.getFullYear(),this.oDate.getMonth(),-.5))},setNextMonth:function(){this.setDate(new Date(this.oDate.getFullYear(),this.oDate.getMonth(),33))},setPrevYear:function(){this.setDate(new Date(this.oDate.getFullYear()-1,this.oDate.getMonth(),1))},setNextYear:function(){this.setDate(new Date(this.oDate.getFullYear()+1,this.oDate.getMonth(),1))},enable:function(){this.oPickerButton.enable()},disable:function(){this.hide();this.oPickerButton.disable()},destruct:function(){this.oWidget=null;this.oElement=null;this.oYearTitleElement=null;this.oMonthTitleElement=null;this.oPickerButton.destruct()}},{CLASS_NAME_CALENDAR:"zf-calendar",CLASS_NAME_HIDDEN:ZForms.Widget.CLASS_NAME_HIDDEN,CLASS_NAME_ARROW_PREV:"zf-buttonprev",CLASS_NAME_ARROW_NEXT:"zf-buttonnext",CLASS_NAME_TITLE:"zf-title",CLASS_NAME_WEEKEND:"zf-weekend",CLASS_NAME_NOW:"zf-now",CLASS_NAME_ADD:"zf-add",CLASS_NAME_PICKER_ACTIVE:"zf-picker-active",CLASS_NAME_HOVERED:"zf-hovered"});ZForms.Resources={sLanguage:document.documentElement.lang?document.documentElement.getAttribute("lang"):"ru",aMonths:{ru:{normal:["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"],genitive:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"]},en:{normal:["january","february","march","april","may","june","july","august","september","october","november","december"],genitive:["january","february","march","april","may","june","july","august","september","october","november","december"]}},aDaysOfWeek:{ru:["пн","вт","ср","чт","пт","сб","вс"],en:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]},aNumberSeparators:{ru:",",en:"."},getNumberSeparator:function(){return this.aNumberSeparators[this.sLanguage]},getDaysOfWeek:function(){return this.aDaysOfWeek[this.sLanguage]},getMonthsByType:function(a){return this.aMonths[this.sLanguage][a]}};ZForms.Builder=Abstract.inheritTo({__constructor:function(a){this.oFormElement=a;this.oForm=null;this.aWidgets=[];this.aWidgetsById=[];this.aSheetContainers=[];this.aRepeatContainers=[];this.oLastRepeatRoot=null;this.aDependencies=[];var b=this;Common.Event.add(window,ZForms.Widget[Common.Browser.isIE()?"DOM_EVENT_TYPE_BEFOREUNLOAD":"DOM_EVENT_TYPE_UNLOAD"],function(){b.oFormElement=null})},$:function(a){var b=document.getElementById(a);if(!b){ZForms.throwException('Element with id "'+a+'" no exists')}return b},build:function(){this.oForm=this.createWidgetByElement(this.oFormElement);var a=Common.Dom.getElementsByClassName(this.oFormElement,this.__self.CLASS_NAME_WIDGET),b=a.length,c=[],d=0;while(d<b){c.push(this.createWidgetByElement(a[d++]))}var e,d=0;while(e=c[d++]){this.aWidgets[e.getName()]=e;this.aWidgetsById[e.getId()]=e}this.buildDependencies();if(this.oForm){this.oForm.init()}delete this.oFormElement;delete this.aWidgets;delete this.aWidgetsById;delete this.aSheetContainers;delete this.aRepeatContainers;delete this.oLastRepeatRoot;delete this.aDependencies;return this.oForm},createWidgetByElement:function(a){var b=this.extractParamsFromElement(a),c=b.sType,d=this.getParentWidget(b,c,a),e=ZForms[this.getCreateWidgetFunction(c)](a,this.getClassElement(b.sCId,c,a),this.processParams(b,d));if(b.oRepeatOptions&&b.oRepeatOptions.sGroup){this.oLastRepeatRoot=e}if(b.oRequired||b.oValid||b.oEnabled||b.oDependedOptions||b.oDependedClasses){this.aDependencies.push({oWidget:e,oParams:b})}if(d){if(b.oRepeatOptions&&b.oRepeatOptions.sGroup&&e.isTemplate()){d.addTemplate(e)}else{if(c=="buttonprev"||c=="buttonnext"){d["add"+(c=="buttonprev"?"Prev":"Next")+"Button"](e)}else{if(c=="buttonadd"||c=="buttonremove"||c=="buttonup"||c=="buttondown"){var f=c.match(/button(\w)(.+)/);d.getMultiplier()["add"+f[1].toUpperCase()+f[2]+"Button"](e)}else{d.addChild(e)}}}}return e},processParams:function(a,b){if(a.oRepeatOptions&&a.oRepeatOptions.bTemplate||b&&b.isTemplate()){a.oOptions=Common.Object.extend({bTemplate:true},a.oOptions)}if(!a.oOptions){return}if(a.oOptions.sPickerId){a.oOptions.oPickerOpenerElement=this.$(a.oOptions.sPickerId);delete a.oOptions.sPickerId}if(a.oOptions.sTabId){a.oOptions.oElementLegend=this.$(a.oOptions.sTabId);delete a.oOptions.sTabId}if(a.oOptions.sListId){a.oOptions.oOptionsElement=this.$(a.oOptions.sListId);delete a.oOptions.sListId}if(a.oOptions.sListShowId){a.oOptions.oShowOptionsElement=this.$(a.oOptions.sListShowId);delete a.oOptions.sListShowId}return a.oOptions},getClassElement:function(a,b,c){if(a){return this.$(a)}if(b=="form"||b=="fieldset"||b=="sheet"||b=="slider"||b=="slidervertical"||b=="checkboxgroup"||b=="radiobuttongroup"||b=="submit"||b=="button"||b=="buttonprev"||b=="buttonnext"||b=="buttonadd"||b=="buttonremove"||b=="buttonup"||b=="buttondown"){return}if(b=="state"||b=="hidden"){return c.parentNode}return c.parentNode.parentNode},getParentWidget:function(a,b,c){if(b=="sheet"){return this.getSheetContainer(a,c)}if(a.oRepeatOptions&&a.oRepeatOptions.sGroup){return this.getRepeatContainer(a,c)}if(b=="buttonprev"||b=="buttonnext"){return this.getSheet(c)}if(b=="buttonadd"||b=="buttonremove"||b=="buttonup"||b=="buttondown"){return this.getRepeatRoot(c)}if(b=="form"){return}if(a.sPId){return this.oForm.getWidgetById(a.sPId)}while(c=c.parentNode){if(c.tagName.toLowerCase()=="form"||Common.Class.match(c,this.__self.CLASS_NAME_WIDGET)){return this.oForm.getWidgetById(this.__self.getId(c))}}},getRepeatContainer:function(a,b){if(!this.aRepeatContainers[a.oRepeatOptions.sGroup]){this.aRepeatContainers[a.oRepeatOptions.sGroup]=this.getParentWidget({},null,b).addChild(ZForms.createMultiplicator(null,null,a.oRepeatOptions))}return this.aRepeatContainers[a.oRepeatOptions.sGroup]},getRepeatRoot:function(){return this.oLastRepeatRoot},getSheetContainer:function(a,b){var c=a.sSheetGroup||this.__self.getId(b.parentNode);if(!this.aSheetContainers[c]){a.sType=null;this.aSheetContainers[c]=this.getParentWidget(a,null,b).addChild(ZForms.createSheetContainer())}return this.aSheetContainers[c]},getSheet:function(a){while(a=a.parentNode){if(a.tagName.toLowerCase()=="form"||Common.Class.match(a,this.__self.CLASS_NAME_WIDGET)){var b=this.oForm.getWidgetById(this.__self.getId(a));if(b instanceof ZForms.Widget.Container.Sheet){return b}}}},extractParamsFromElement:function(a){var b=a.onclick instanceof Function?a.onclick()||{}:{};b.sType=b.sType||this.extractTypeFromElement(a);return b},extractTypeFromElement:function(a){var b=a.tagName.toLowerCase(),c;if(b=="input"){c=a.type.toLowerCase();if(c=="radio"||c=="checkbox"){return"state"}}var d=a.className.match(this.__self.rTypePattern);if(d){return d[1]}switch(b){case"input":if(c=="search"){return"text"}return c;break;case"form":case"fieldset":case"select":return b;break;case"textarea":return"text";break}ZForms.throwException("can't extract widget type from element with id \""+this.__self.getId(a)+'"')},getCreateWidgetFunction:function(a){if(!this.__self.aTypesToCreateWidgetFunction[a]){ZForms.throwException('Unsupported widget type "'+a+'"')}return"create"+this.__self.aTypesToCreateWidgetFunction[a]},getWidgetByName:function(a){return this.aWidgets[a]},getWidgetById:function(a){return this.aWidgetsById[a]},buildDependencies:function(){var a=this.aDependencies,b=this.aDependencies.length,c=0,d,e;while(c<b){d=a[c++];e=d.oParams;if(e.oRequired){this.buildRequiredDependence(d.oWidget,e.oRequired)}if(e.oValid){this.buildValidOrEnabledDependence(d.oWidget,e.oValid,ZForms.Dependence.TYPE_VALID)}if(e.oEnabled){this.buildValidOrEnabledDependence(d.oWidget,e.oEnabled,ZForms.Dependence.TYPE_ENABLED)}if(e.oDependedOptions){this.buildOptionsDependence(d.oWidget,e.oDependedOptions)}if(e.oDependedClasses){this.buildClassesDependence(d.oWidget,e.oDependedClasses)}}},buildRequiredDependence:function(a,b){var c=this.getLogic(b);b.aFrom=this.__self.prependToArray({iMin:b.iMin},b.aFrom);var d=0,e,f;while(e=b.aFrom[d++]){f=this.getWidgetFrom(e,a);if(e.fFunction){a.addDependence(ZForms.createFunctionDependence(f,{iType:ZForms.Dependence.TYPE_REQUIRE,fFunction:e.fFunction,iLogic:c,bInverse:e.bInverse}))}else{a.addDependence(ZForms.createRequiredDependence(f,{rPattern:e.rPattern,iLogic:c,iMin:e.iMin?e.iMin:1}))}}},buildValidOrEnabledDependence:function(a,b,c){var d=this.getLogic(b),e;if(b.sType){e={sType:b.sType}}else{if(typeof b.rPattern!="undefined"){e={rPattern:b.rPattern}}else{if(b.fFunction){e={fFunction:b.fFunction}}else{if(b.oCompare){e={oCompare:b.oCompare}}}}}if(e){Common.Object.extend(e,{sId:b.sId,sName:b.sName,bInverse:b.bInverse,sClassName:b.sClassName,bCheckForEmpty:b.bCheckForEmpty,bFocusOnEnable:b.bFocusOnEnable})}b.aFrom=this.__self.prependToArray(e,b.aFrom);var f=0,g,h;while(g=b.aFrom[f++]){h=this.getWidgetFrom(g,a);if(g.sType&&g.sType=="email"&&c==ZForms.Dependence.TYPE_VALID){a.addDependence(ZForms.createValidEmailDependence(h,{iLogic:d,bInverse:g.bInverse,sClassName:g.sClassName,bCheckForEmpty:g.bCheckForEmpty}))}else{if(g.rPattern){a.addDependence(ZForms["create"+(c==ZForms.Dependence.TYPE_VALID?"Valid":"Enabled")+"Dependence"](h,{rPattern:this.__self.toPattern(g.rPattern),iLogic:d,bInverse:g.bInverse,sClassName:g.sClassName,bCheckForEmpty:g.bCheckForEmpty,bFocusOnEnable:g.bFocusOnEnable}))}else{if(g.oCompare){if(g.oCompare.sCondition&&!ZForms.Dependence.COMPARE_FUNCTIONS[g.oCompare.sCondition]){ZForms.throwException('unsupported type of compare condition: "'+g.oCompare.sCondition+'"')}a.addDependence(ZForms["create"+(c==ZForms.Dependence.TYPE_VALID?"Valid":"Enabled")+"CompareDependence"](h,{sCondition:g.oCompare.sCondition,mArgument:g.oCompare.sId?this.getWidgetById(g.oCompare.sId):g.oCompare.sName?this.getWidgetByName(g.oCompare.sName):g.oCompare.mValue,iLogic:d,bInverse:g.bInverse,sClassName:g.sClassName,bCheckForEmpty:g.bCheckForEmpty,bFocusOnEnable:g.bFocusOnEnable}))}else{if(g.fFunction){a.addDependence(ZForms.createFunctionDependence(h,{iType:c,fFunction:g.fFunction,iLogic:d,bInverse:g.bInverse}))}}}}}},buildOptionsDependence:function(a,b){var c=this.getLogic(b),d;if(b.aData){d={aData:b.aData}}else{if(b.fFunction){d={fFunction:b.fFunction}}}if(d){Common.Object.extend(d,{sId:b.sId,sName:b.sName})}b.aFrom=this.__self.prependToArray(d,b.aFrom);var e=0,f,g,h,i;while(g=b.aFrom[e++]){h=this.getWidgetFrom(g,a);if(g.aData){i=[];f=0;while(f<g.aData.length){i.push({rSource:this.__self.toPattern(g.aData[f][0]),rDestination:this.__self.toPattern(g.aData[f++][1])})}a.addDependence(ZForms.createOptionsDependence(h,{aPatterns:i,iLogic:c}))}else{if(g.fFunction){a.addDependence(ZForms.createFunctionDependence(h,{iType:ZForms.Dependence.TYPE_OPTIONS,fFunction:g.fFunction,iLogic:c,bInverse:g.bInverse}))}}}},buildClassesDependence:function(a,b){var c=this.getLogic(b),d;if(b.fFunction){d={fFunction:b.fFunction}}else{if(b.aData){d={aData:b.aData}}}if(d){Common.Object.extend(d,{sId:b.sId,sName:b.sName})}b.aFrom=this.__self.prependToArray(d,b.aFrom);var e=0,f,g,h,i;while(g=b.aFrom[e++]){h=this.getWidgetFrom(g,a);if(g.aData){i=[];f=0;while(f<g.aData.length){i.push({rPattern:this.__self.toPattern(g.aData[f][0]),sClassName:g.aData[f][1],bInverse:g.aData[f++][2]})}a.addDependence(ZForms.createClassDependence(h,{aPatternToClasses:i,iLogic:c}))}else{if(g.fFunction){a.addDependence(ZForms.createFunctionDependence(h,{iType:ZForms.Dependence.TYPE_CLASS,fFunction:g.fFunction,iLogic:c,bInverse:g.bInverse}))}}}},getLogic:function(a){return a.sLogic=="or"?ZForms.Dependence.LOGIC_OR:ZForms.Dependence.LOGIC_AND},getWidgetFrom:function(a,b){var c=a.sId?this.getWidgetById(a.sId):a.sName?this.getWidgetByName(a.sName):b;if(!c){this.throwDependenceException(a.sId||a.sName)}return c},throwDependenceException:function(a){ZForms.throwException('Widget with name/id "'+a+'" no exists')}},{prependToArray:function(a,b){if(typeof a=="undefined"){return b}if(!(a instanceof Array)){a=[a]}if(!(b instanceof Array)){b=[]}return a.concat(b)},toPattern:function(a){return a instanceof RegExp?a:new RegExp("^"+a+"$")},getId:function(a){return Common.Dom.getAttribute(a,"id")||Common.Dom.getUniqueId(a)},aTypesToCreateWidgetFunction:{form:"Form",text:"TextInput",password:"TextInput",file:"TextInput",hidden:"TextInput",number:"NumberInput",select:"SelectInput",combo:"ComboInput",date:"DateInput",submit:"SubmitButton",fieldset:"Container",checkboxgroup:"CheckBoxGroup",radiobuttongroup:"RadioButtonGroup",state:"StateInput",sheet:"Sheet",button:"Button",buttonprev:"Button",buttonnext:"Button",buttonadd:"Button",buttonremove:"Button",buttonup:"Button",buttondown:"Button",slider:"Slider",slidervertical:"SliderVertical"},rTypePattern:/zf-(form|text|number|select|combo|date|submit|fieldset|checkboxgroup|radiobuttongroup|state|sheet|slider|slidervertical|buttonprev|buttonnext|buttonadd|buttonremove|buttonup|buttondown|button)(\s+|$)/,CLASS_NAME_WIDGET:"zf"});Common.Event.add(document,Common.Event.TYPE_DOM_CONTENT_LOADED,function(){var a=Common.Dom.getElementsByClassName(document,ZForms.Builder.CLASS_NAME_WIDGET,"form"),b,c=0;while(b=a[c++]){if(!Common.Class.match(b,ZForms.Widget.Container.Form.CLASS_NAME_INITED)){ZForms.buildForm(b)}}setTimeout(function(){ZForms.notifyObservers(ZForms.EVENT_TYPE_ON_INIT,ZForms);ZForms.bInited=true},1)})
