var wizTypes="text,password,textarea,select-one,radio,file".split(","),wizards=[],wizardFields="add,Class,dispose,function,getColumns,getElements,getRows,hideErrors,index,initialized,initializing,keys,name,onChange,post,refresh,replacements,tables,toString".split(",");
TWizard=function(a,b){this.Class="TWizard";this.guid=b;this.index=wizards.length;this.initializing=!0;this.keys=[];this.loaded=!1;this.name=a;this.onChange=null;this.postPage="misc/postWizard.aspx";this.replacements=[];this.tables=[];wizards[this.index]=this;addEvent(window,"load","wizards["+this.index+"].load( event );");addEvent(window,"unload","wizards["+this.index+"].dispose();");setTimeout("wizards["+this.index+"].checkLoad();",5E3)};
TWizard.prototype.add=function(a){if("undefined"==typeof this.tables[a]){var b=this.tables.length,c=new TTable(this,a,b);this.tables[b]=c;this.tables[a]=c;-1==wizardFields.indexOf(a)&&eval(this.name+"."+a+" = "+this.name+'.tables["'+a+'"];');return c}throw Error("This table already exists in the collection.");};TWizard.prototype.checkLoad=function(){!this.loaded&&!this.load()&&setTimeout("wizards["+this.index+"].checkLoad();",100)};
TWizard.prototype.dispose=function(){for(var a=0;a<this.tables.length;a++)this.tables[a].dispose(),this.tables[a]=null;this.onChange=null;this.tables=[];wizards[this.index]=null};TWizard.prototype.getColumns=function(a,b){for(var c=a.documentElement.getElementsByTagName("declaration")[0].getElementsByTagName("table"),d=0;d<c.length;d++)if(c[d].getAttribute("name")==b)return c[d].getElementsByTagName("column");return null};
TWizard.prototype.getElements=function(){for(var a=0;a<this.tables.length;a++)for(var b=this.tables[a],c=0;c<b.rows.length;c++)b.rows[c].getElements()};TWizard.prototype.getRows=function(a,b){for(var c=[],d=0;d<a.documentElement.childNodes.length;d++){var e=a.documentElement.childNodes[d];e.nodeType==ntElement&&e.nodeName==b&&c.add(e)}return c};TWizard.prototype.hideErrors=function(){for(var a=0;a<this.tables.length;a++)this.tables[a].hideErrors()};
TWizard.prototype.initialized=function(a){if("undefined"!=typeof a)this.postPage=a;this.initializing=!1};TWizard.prototype.load=function(){return!this.loaded&&document.body?(this.loaded=!0,this.getElements(),!0):!1};
TWizard.prototype.refresh=function(a){var b=[];this.initializing=!0;try{for(var c=0;c<this.tables.length;c++){for(var d=this.tables[c],e=this.getRows(a,d.name),i=this.getColumns(a,d.name),f=0;f<e.length;f++){var h=e[f],k=null;if("deleted"!=h.parentNode.nodeName)for(var k=f>=d.rows.length?d.addRow():d.rows[f],l=0;l<i.length;l++){var m=i[l],g=k.fields[m.getAttribute("name")],n=h.getElementsByTagName(m.getAttribute("name"))[0],o=null!=n&&n.firstChild?fromXml(n.firstChild.data,g.type):null,p=parseInt(m.getAttribute("error"));
isSame(o,g.FValue)||(b.add({field:g,oldValue:g.FValue}),g.value(o),g.updateElements(o),g.errorsShown&&g.checksOut()&&g.hideErrors());if(p==f)g.error=!0}}for(;d.rows.length>e.length;)d.rows.length--;if(d.row>=d.rows.length)d.row=d.rows.length-1;d.bof=0>=d.row;d.eof=d.row==d.rows.length-1}}catch(j){Log.error(j),j.description?alert(j.description):j.message?alert(j.message):alert(j)}finally{this.initializing=!1;for(a=0;a<b.length;a++)if(g=b[a].field,c=b[a].oldValue,this.onChange&&(g.table.setRow(),this.onChange(this,
g,c)),null!=g.onchange)g.onchange(g,c)}};TWizard.prototype.post=function(a){if(this.initializing)return!0;try{var b=new Url(this.postPage),b=b.add("guid",this.guid),a=b.request("post",a,!0,!1);if("boolean"!=typeof a)return this.refresh(a),!0}catch(c){Log.error(c)}return!1};
TWizard.prototype.toString=function(a,b,c){if(null==a)return"";switch(b){case dtInteger:case dtLong:return""+a;case dtDouble:return"undefined"!=typeof c?a.formatString(c):a.formatString("0.########");case dtPercentage:return"undefined"!=typeof c?a.formatString(c):a.formatString("0.########")+"%";case dtMoney:return"undefined"!=typeof c?a.formatString(c):a.formatString("0.00");case dtDateTime:return"undefined"!=typeof c?(null==c||""==c?c="g":1<c.length&&(c=c.replace(/d/gi,"D"),c=c.replace(/m/g,"N"),
c=c.replace(/y/gi,"Y"),c=c.replace(/h/gi,"H"),c=c.replace(/s/gi,"S"),c=c.replace(/\//gi,"-")),a.formatString(c)):"000000"==a.formatString("HHnnss")?a.formatString("d"):a.formatString("g");case dtString:case dtGuid:return""+a;case dtBoolean:return a?trueText[Languages.current]:falseText[Languages.current]}};
var tableFields="addColumn,addRow,bof,canSave,Class,columns,current,dispose,eof,first,function,getRow,gotoRow,hideErrors,index,initialize,last,name,next,prior,owner,removeRow,removeRowAt,row,Rows,rows,setRow,wizard".split(","),formatable=[dtDouble,dtMoney,dtPercentage,dtDateTime];
TTable=function(a,b,c){this.bof=!0;this.Class="TTable";this.columns=[];this.eof=!0;this.index=c;this.name=b;this.owner=a;this.row=-1;this.rows=[];this.wizard=a;this.setRow=function(){var a=this.current();if(null==a)for(var b=0;b<this.columns.length;b++){var a=this.columns[b],c=this.wizard.name+"."+this.name;-1==tableFields.indexOf(a.name)&&eval(c+"."+a.name+" = null;")}else for(b=0;b<a.fields.length;b++){var f=a.fields[b],c=this.wizard.name+"."+this.name,h=c+".rows["+a.index+"]";-1==tableFields.indexOf(f.name)&&
eval(c+"."+f.name+" = "+h+".fields["+b+"];")}}};TTable.prototype.addColumn=function(a,b){if("undefined"==typeof this.columns[a]){var c=this.columns.length,d=new TColumn(this,a,b,c);this.columns[c]=d;return this.columns[a]=d}throw Error("This column already exists in the collection.");};TTable.prototype.addRow=function(){if(this.bof&&this.eof)this.bof=!1;this.eof=!1;var a=this.row=this.rows.length,b=new TRow(this,this.row,arguments);this.rows[a]=b;b.addFields();b.getElements();this.setRow();return b};
TTable.prototype.canSave=function(){if(0==this.rows.length)return!1;for(var a=0;a<this.rows.length;a++)if(0<this.rows[a].canSave().length)return!1;return!0};TTable.prototype.current=function(){return-1<this.row?this.rows[this.row]:null};TTable.prototype.dispose=function(){for(var a=0;a<this.rows.length;a++)this.rows[a].dispose(),this.rows[a]=null;for(a=0;a<this.columns.length;a++)this.columns[a].dispose(),this.columns[a]=null;this.columns=[];this.owner=null;this.rows=[];this.wizard=null};
TTable.prototype.find=function(a,b){return this.getRow(a,b)};TTable.prototype.first=function(){return 0<this.rows.length?(this.bof=!0,this.eof=!1,this.row=0,this.setRow(),this.current()):null};TTable.prototype.getRow=function(a,b){for(var c=0;c<this.rows.length;c++)if(this.rows[c].fields[a].FValue==b)return this.rows[c];return null};
TTable.prototype.gotoRow=function(a,b){if("undefined"==typeof b&&"number"==typeof a){if(0<=a&&a<this.rows.length)return this.row=a,this.bof=0>=a,this.eof=a==this.rows.length-1,this.setRow(),!0;throw Error("Illegal call to TTable.gotoRow( index ). The index was out of range.");}for(var c=0;c<this.rows.length;c++)if(this.rows[c].fields[a].FValue==b)return this.bof=0>=c,this.eof=c==this.rows.length-1,this.row=c,this.setRow(),!0;return!1};TTable.prototype.hideErrors=function(){for(var a=0;a<this.rows.length;a++)this.rows[a].hideErrors()};
TTable.prototype.initialize=function(){for(var a=0;a<this.rows.length;a++)this.rows[a].initialize()};TTable.prototype.last=function(){return 0<this.rows.length?(this.bof=!1,this.eof=!0,this.row=this.rows.length-1,this.setRow(),this.current()):null};TTable.prototype.next=function(){return 0<this.rows.length?(this.row==this.rows.length-1?(this.bof=!1,this.eof=!0):this.row++,this.setRow(),this.current()):null};
TTable.prototype.prior=function(){return 0<this.rows.length?(0==this.row?(this.bof=!0,this.eof=!1):this.row--,this.setRow(),this.current()):null};TTable.prototype.removeRow=function(a){for(var b=a.index;b<this.rows.length-1;b++)this.rows[b]=this.rows[b+1],this.rows[b].index=b,this.rows[b].updateElements();a.clear();this.rows.length--;if(this.row>=this.rows.length)this.row=this.rows.length-1;this.bof=0>=this.row;this.eof=this.row==this.rows.length-1;this.wizard.post(a.xml("delete"));this.setRow()};
TTable.prototype.removeRowAt=function(a){if(0<=a&&a<this.rows.length)this.removeRow(this.rows[a]);else throw Error('Illegal call to method "removeRowAt". Index out of range ("'+a+'").');};TTable.prototype.Rows=function(a){"undefined"==typeof a&&(a=0);if(0>a)throw Error('Illegal call to method "Rows( index )". Index out of range ("'+a+'").');for(;a>=this.rows.length;)this.addRow();return this.rows[a]};
TColumn=function(a,b,c,d){this.checks=[];this.Class="TColumn";this.elements=[];this.index=d;this.name=b;this.table=this.owner=a;this.type=c;this.wizard=a.wizard;a.initialize()};TColumn.prototype.change=function(a,b){return null!=this.owner.current()?this.owner.current().fields[this.index].change(a,b):b.returnValue=!1};
TColumn.prototype.dispose=function(){for(var a=0;a<this.checks.length;a++)this.checks[a].dispose(),this.checks[a]=null;for(a=0;a<this.elements.length;a++)this.elements[a]=null;this.checks=[];this.elements=[];this.wizard=this.table=this.owner=null};TColumn.prototype.value=function(a){if(null!=this.owner.current()){if("undefined"==typeof a)return this.owner.current().fields[this.index].FValue;this.owner.current().fields[this.index].value(a)}};
TCheck=function(a,b,c){this.eval=null;this.message=b;this.owner=a;this.regex=null;this.wizard=a.wizard;if("string"==typeof c)this.eval=c;else if("undefined"!=typeof c&&null!=c)this.regex=c};TCheck.prototype.dispose=function(){this.wizard=this.owner=this.regex=null};
TCheck.prototype.test=function(a){if(this.eval){var b=this.eval,b=b.replace(/\bthis\b/gi,this.toJs(a)),b=b.replace(/\bthis$/gi,this.toJs(a)),b=b.replace(/^this\b/gi,this.toJs(a)),b=b.replace(/^this$/gi,this.toJs(a));return!0==eval(b)}if(this.regex){var b=void 0,c="null";if(a.type==dtDateTime)b="DD-MM-YYYY HH:NN:SS";else if(a.type==dtDouble||a.type==dtMoney||a.type==dtPercentage)b="0.0";null!=a.value&&(c=this.wizard.toString(a.value(),a.type,b));return RegExp(this.regex.source,this.regex.ignoreCase?
"ig":"g").test(c)}return null!=a.value()};TCheck.prototype.toJs=function(a){var b=a.value();if(null==b)return"null";switch(a.type){case dtInteger:case dtLong:return""+b;case dtDouble:case dtPercentage:case dtMoney:return b.formatString("0.");case dtDateTime:return b.jsDate();case dtString:case dtGuid:return(""+b).toJs();case dtBoolean:return b?"true":"false";default:return""}};var rowFields="addFields,Class,dispose,fields,function,getElements,hideErrors,index,initialize,owner,table,wizard,xml".split(",");
TRow=function(a,b,c){this.Class="TRow";this.fields=[];this.index=b;this.table=this.owner=a;this.wizard=a.wizard;this.initialize();if("undefined"!=typeof c){for(a=0;a<this.owner.columns.length;a++)if(a<c.length)this.fields[a].FValue=convert(c[a],this.owner.columns[a].type);if(!this.wizard.initializing){this.wizard.post(this.xml());try{if(this.wizard.onChange)this.wizard.onChange(this.wizard,null,null)}catch(d){Log.error(d),d.description?alert(d.description):d.message?alert(d.message):alert(d)}}}};
TRow.prototype.addFields=function(){for(var a=0;a<this.fields.length;a++){var b=this.fields[a],c=this.wizard.name+"."+this.table.name+".rows["+this.index+"]";-1==rowFields.indexOf(b.name)&&eval(c+"."+b.name+" = "+c+".fields["+a+"];")}};TRow.prototype.canSave=function(){this.hideErrors();this.setCurrent();this.wizard.post(this.xml("canSave"));for(var a=[],b=0;b<this.fields.length;b++){var c=this.fields[b];if(c.checksOut()){if(c.error&&!a.contains(c))a.add(c),c.error=!1}else a.add(c)}return a};
TRow.prototype.clear=function(){for(var a=0;a<this.fields.length;a++){var b=this.fields[a];b.FValue=null;b.updateElements(null)}};TRow.prototype.dispose=function(){for(var a=0;a<this.fields.length;a++)this.fields[a].dispose(),this.fields[a]=null;this.fields=[];this.wizard=this.table=this.owner=null};
TRow.prototype.getElements=function(){for(var a=0;a<this.fields.length;a++){for(var b=!1,c=this.fields[a],d=this.wizard.name+"_"+this.table.name+"_"+c.name+"_"+this.index,e=document.getElementsByName(d),i=Html.get("btn"+d.upperFirst()),d="lbl"+d.upperFirst(),f=0;f<c.elements.length;f++)c.elements[f]=null;c.elements=[];for(f=0;f<e.length;f++){var h=e[f],k="undefined"!=typeof h.type?h.type:null;h.disabled&&(b=!0);c.elements.add(h);h.field=c;if("text"==k&&formatable.contains(c.type)&&""!=h.title&&"undefined"==
typeof h.format)h.format=h.title,h.title=""}if(b)c.disabled=!0;b=document.getElementsByTagName("SPAN");for(f=0;f<b.length;f++)if(e=b[f],e.id==d){c.elements.add(e);e.field=c;if("undefined"==typeof e.toHtml)e.toHtml="1"==e.lang,e.removeAttribute("lang");if(""!=e.title&&"undefined"==typeof e.format)e.format=e.title,e.title=""}if(null!=i)c.elements.add(i),i.field=c}};TRow.prototype.hideErrors=function(){for(var a=0;a<this.fields.length;a++)this.fields[a].hideErrors()};
TRow.prototype.initialize=function(){for(var a=this.fields.length;a<this.owner.columns.length;a++){var b=new TField(this,this.owner.columns[a]);this.fields[b.index]=b;this.fields[b.name]=b}};
TRow.prototype.updateElements=function(){for(var a=0;a<this.fields.length;a++)for(var b=this.fields[a],c=0;c<b.elements.length;c++){var d=b.elements[c];d.id.startsWith("lbl")?d.id="lbl"+this.wizard.name.upperFirst()+"_"+this.table.name+"_"+b.name+"_"+this.index:d.id.startsWith("btn")?d.id="btn"+this.wizard.name.upperFirst()+"_"+this.table.name+"_"+b.name+"_"+this.index:(d.name=this.wizard.name+"_"+this.table.name+"_"+b.name+"_"+this.index,d.id=4<d.id.split(/_/gi).length?"edt"+this.wizard.name.upperFirst()+
"_"+this.table.name+"_"+b.name+"_"+this.index+"_"+d.value:"edt"+this.wizard.name.upperFirst()+"_"+this.table.name+"_"+b.name+"_"+this.index);if(d.onblur)d.onblur=new Function(this.wizard.name+"."+this.table.name+".Rows("+this.index+').fields["'+b.name+'"].blur( this, event );');if(d.onchange)d.onchange=new Function(this.wizard.name+"."+this.table.name+".Rows("+this.index+').fields["'+b.name+'"].change( this, event );');if(d.onfocus)d.onfocus=new Function(this.wizard.name+"."+this.table.name+".Rows("+
this.index+').fields["'+b.name+'"].focus( this, event );')}};TRow.prototype.setCurrent=function(){return this.table.gotoRow(this.index)};
TRow.prototype.xml=function(a){for(var a="<"+this.wizard.name+("undefined"!=typeof a?' action="'+a+'"':"")+">\r\n\t<"+this.table.name+' index="'+this.index+'">',b=0;b<this.fields.length;b++)null!=this.fields[b].FValue&&(a+="\r\n\t\t<"+this.fields[b].column.name+""+(null==this.fields[b].FValue?"/>\n":">"+toXml(this.fields[b].FValue,this.fields[b].type)+"</"+this.fields[b].column.name+">"));return a+="\r\n\t</"+this.table.name+">\r\n</"+this.wizard.name+">"};
TField=function(a,b){this.changing=!1;this.Class="TField";this.column=b;this.FDateInput=null;this.disabled=!1;this.elements=[];this.exError=this.errorsShown=this.error=!1;this.index=b.index;this.message=null;this.name=b.name;this.owner=a;this.replaced=!1;this.row=a;this.spans=[];this.table=a.table;this.type=b.type;this.FValue=null;this.wizard=a.wizard;this.onblur=this.getEvent("blur");this.onchange=this.getEvent("change");this.onfocus=this.getEvent("focus")};
TField.prototype.blur=function(a,b){if(null!=this.onblur)this.onblur(this,a,b);"select-one"!=a.type&&Element.removeClassName(a,"focused")};
TField.prototype.change=function(a,b){if(!this.changing){this.changing=!0;if(b&&"undefined"!=typeof b.type)b.cancelBubble=!0;var c;try{if("undefined"!=typeof a.DateInput)c=a.DateInput.date();else if(wizTypes.contains(a.type))c=a.value;else if("checkbox"==a.type)c=a.checked;else throw Error("Illegal sender: "+a.type);if("t"==a.format&&null!=this.dateInput()){var d=this.dateInput().date(),e=c,e=null==e||""==e?new Date(1900,0,1,0,0):convert(e,this.type);c=d.integrateTime(e)}this.value(c);c=convert(c,
this.type);isSame(this.FValue,c)?(this.format(a),this.updateElements(c,a)):this.correct(a,this.FValue);this.errorsShown&&this.checksOut()&&this.hideErrors();this.changing=!1;return!0}catch(i){return Log.error(i),i.description?alert(i.description):i.message?alert(i.message):alert(i),-1<window.navigator.appVersion.indexOf("MSIE")?(a.select?a.select():a.focus?a.focus():this.correct(a,this.FValue),b.returnValue=!1):this.correct(a,this.FValue),!1}finally{this.changing=!1}}};
TField.prototype.checksOut=function(){for(var a=0;a<this.column.checks.length;a++){var b=this.column.checks[a];if(!b.test(this))return null==this.message?(this.message=b.message,this.changing&&this.updateErrors(this.message)):this.errorsShown&&this.updateErrors(b.message),!1}return this.exError?!1:!0};TField.prototype.clearError=function(){this.exError=!1;this.hideErrors()};
TField.prototype.correct=function(a,b){if("checkbox"==a.type)a.checked=b?!0:!1;else if("radio"==a.type)for(var c=a.checked=!1,d=0;d<this.elements.length&&!c;d++){var e=this.elements[d];if(isSame(e.value,b,this.type))c=e.checked=!0}else a.value=this.wizard.toString(b,this.type,a.format)};
TField.prototype.dateInput=function(){if(null==this.FDateInput){this.FDateInput="no";for(var a=0;a<this.elements.length;a++)if("undefined"!=typeof this.elements[a].DateInput)this.FDateInput=this.elements[a].DateInput}return"no"==this.FDateInput?null:this.FDateInput};
TField.prototype.disable=function(){if(!this.disabled){this.disabled=!0;for(var a=0;a<this.elements.length;a++){var b=this.elements[a],c=null;if("checkbox"==b.type)for(c=b.nextSibling;c&&"LABEL"!=c.nodeName;)c=c.nextSibling;b.disabled=!0;Html.addClass(b,"disabled");if(c)c.disabled=!0,Html.addClass(c,"disabled")}}};
TField.prototype.dispose=function(){for(var a=0;a<this.elements.length;a++)this.elements[a].field=null,this.elements[a]=null;for(a=0;a<this.spans.length;a++)this.spans[a]=null;this.dateInput=this.column=null;this.elements=[];this.row=this.owner=null;this.spans=[];this.onfocus=this.onchange=this.onblur=this.wizard=this.table=null};
TField.prototype.enable=function(){if(this.disabled){this.disabled=!1;for(var a=0;a<this.elements.length;a++){var b=this.elements[a],c=null;if("checkbox"==b.type)for(c=b.nextSibling;c&&"LABEL"!=c.nodeName;)c=c.nextSibling;b.disabled=!1;Html.removeClass(b,"disabled");if(c)c.disabled=!1,Html.removeClass(c,"disabled")}}};
TField.prototype.focus=function(a,b){if("undefined"==typeof a&&"undefined"==typeof b)for(var c=0;c<this.elements.length;c++){var d=this.elements[c];if(d.select&&"select-one"!=d.type){d.select();break}if(d.focus){d.focus();break}}else{if(null!=this.onfocus)this.onfocus(this,a,b);"select-one"!=a.type&&Element.addClassName(a,"focused")}};
TField.prototype.format=function(a){if(null!=this.FValue){var b="undefined"!=typeof a.format?a.format:this.type==dtDouble?"0.########":this.type==dtMoney?"0.00":this.type==dtPercentage?"0.########%":null;if(formatable.contains(this.type)&&b){var c=this.FValue.formatString(b);a.value="t"==b&&(null==this.FValue||"000000"==this.FValue.formatString("HHnnss"))?"":"d"==b&&(null==this.FValue||"19000101"==this.FValue.formatString("yyyymmmdd"))?"":c}}};
TField.prototype.getEvent=function(a){return TEvent.find(this.wizard.name+"_"+this.table.name+"_"+this.row.index+"_"+this.name+a.upperFirst(),this.wizard.name+"_"+this.table.name+"_"+this.name+a.upperFirst(),this.table.name+"_"+this.name+a.upperFirst(),this.name+a.upperFirst(),this.wizard.name+"_"+this.table.name+a.upperFirst(),this.wizard.name+a.upperFirst(),"field"+a.upperFirst())};
TField.prototype.handleReplacements=function(a){var b=[];if(!this.replaced&&(this.replaced=!0,b=a?a.match(/\[[A-Z]+\]/g):[],null!=b&&b.length))for(var c=0;c<b.length;c++)this.wizard.keys.contains(b[c])||this.wizard.keys.add(b[c].replace(/[\[\]]/g,""));b=this.wizard.keys;for(c=0;c<b.length;c++)a=a.replace("["+b[c]+"]",this.wizard.replacements[b[c]]||"");return a};
TField.prototype.hideErrors=function(){this.errorsShown=this.error=!1;if(!this.exError)this.message=null;for(var a=0;a<this.spans.length;a++)this.spans[a].style.display="none";for(a=0;a<this.elements.length;a++)Element.removeClassName(this.elements[a],"wrong")};TField.prototype.isVisible=function(){for(var a=0;a<this.elements.length;a++){var b=Element.getStyle(this.elements[a],"display"),c=Element.getStyle(this.elements[a],"visibility");if("none"!=b&&"hidden"!=c)return!0}return!1};
TField.prototype.showError=function(a){if(!this.errorsShown){if(this.message&&"undefined"==typeof a)a=this.message;if(this.changing)this.exError=!0,this.message=a;for(var a=this.handleReplacements(a),b=0;b<this.elements.length;b++){var c=this.elements[b];Element.addClassName(c,"wrong");if(!("undefined"!=typeof c.type&&"radio"==c.type&&b<this.elements.length-1)&&(!c.type||"button"!=c.type))if(b>this.spans.length-1){var d=c.parentNode,e=document.createElement("DIV");if("undefined"!=typeof c.type&&"radio"==
c.type)d=d.parentNode;e.id="spnError"+this.name.upperFirst()+"_"+b;e.className="error";e.innerHTML=(""+a).htmlEncode();e.style.display="block";e.style.clear="both";if(this.type==dtDateTime&&"TD"==d.nodeName)d=c.parentNode.parentNode.parentNode.parentNode.parentNode;this.spans.add(d.appendChild(e));this.errorsShown=!0}else if("none"==this.spans[b].style.display)this.spans[b].style.display="block",this.spans[b].innerHTML=(""+a).htmlEncode(),this.errorsShown=!0}}};
TField.prototype.updateElements=function(a,b){for(var c=0;c<this.elements.length;c++){var d=this.elements[c];if(d!=b)if("checkbox"==d.type)d.checked=a?!0:!1;else if("radio"==d.type)d.checked=convert(d.value,this.type)==a;else if(d.type&&"button"!=d.type)d.value=this.wizard.toString(a,this.type,d.format);else if(!d.id.startsWith("btn")){var e=this.wizard.toString(a,this.type,d.format);d.innerHTML=d.toHtml?Html.toHtml(e):e}}};
TField.prototype.updateErrors=function(a){this.message=a;for(var a=this.handleReplacements(a),b=0;b<this.spans.length;b++)this.spans[b].innerHTML=(""+a).htmlEncode()};
TField.prototype.value=function(a){if("undefined"==typeof a)return this.type==dtDateTime&&null!==this.FValue?new Date(this.FValue):this.FValue;var b=this.FValue;this.FValue=convert(a,this.type);if(!isSame(b,this.FValue)&&!this.wizard.initializing)if(this.wizard.post(this.xml())){if(this.changing||(this.updateElements(this.FValue),this.errorsShown&&this.checksOut()&&this.hideErrors()),this.wizard.onChange&&(this.table.setRow(),this.wizard.onChange(this.wizard,this,b)),null!=this.onchange)this.onchange(this,
b)}else this.FValue=b};TField.prototype.xml=function(){return"<"+this.wizard.name+">\r\n\t<"+this.table.name+' index="'+this.row.index+'">\r\n\t\t<'+this.name+(null==this.FValue?" />\r\n":">"+toXml(this.FValue,this.type)+"</"+this.name+">\r\n")+"\t</"+this.table.name+">\r\n</"+this.wizard.name+">"};

