gx.date={clone:function(){return new Date(this.getTime())},equalsNoTime:function(a){if(this.getDay()==a.getDay()&&this.getMonth()==a.getMonth()&&this.getFullYear()==a.getFullYear()){return true}return false},toJson:function(){var a=new gx.date.gxdate("");a.assign_date(this);return a.json()},gxdate:function(c,b){this.json=function(){var g=e;e=24;var h=this.HasTimePart;this.HasTimePart=true;var f=this.getStringWithFmt("Y4MD")+" "+this.getTimeString(true,true);e=g;this.HasTimePart=h;return f};this.mapCTODFormatToPattern=function(f){if(f=="ANSI"){return"Y4MD"}else{return f}};this.emptyDateString=function(f){if(f.indexOf("Y4")==-1){if(gx.blankWhenEmpty){return"        "}else{return"  /  /  "}}else{if(gx.blankWhenEmpty){return"          "}else{return"  /  /    "}}};this.getStringWithFmt=function(g){g=this.mapCTODFormatToPattern(g);if(this.Value-new Date(0,0,0,0,0,0,0)==0){return this.emptyDateString(g)}var j=g;var h=gx.text.padr(this.Value.getDate().toString(),2,"0");var f=gx.text.padr((this.Value.getMonth()+1).toString(),2,"0");var k=gx.text.padr(this.Value.getFullYear().toString(),4,"0");var i=this.FormatPos(g);j=j.replace("D",h+((i.DPos<3)?"/":""));j=j.replace("M",f+((i.MPos<3)?"/":""));if(g.indexOf("Y4")==-1){k=k.slice(2,4);j=j.replace("Y",k+((i.YPos<3)?"/":""))}else{j=j.replace("Y4",k+((i.YPos<3)?"/":""))}return j};this.getString=function(f){if(gx.lang.emptyObject(f)){f=gx.dateFormat}return this.getStringWithFmt(f)};this.gxdtoc=function(h,f){var g=this.getStringWithFmt(this.mapCTODFormatToPattern(h));return g.replace("/",f)};this.getUrlVal=function(){var k=gx.dateFormat;var g=gx.text.padr(this.Value.getDate().toString(),2,"0");var f=gx.text.padr((this.Value.getMonth()+1).toString(),2,"0");var l=gx.text.padr(this.Value.getFullYear().toString(),4,"0");var h=this.HasTimePart?gx.text.padr(this.Value.getHours().toString(),2,"0"):"";var i=this.HasTimePart?gx.text.padr(this.Value.getMinutes().toString(),2,"0"):"";var j=this.HasTimePart?gx.text.padr(this.Value.getSeconds().toString(),2,"0"):"";return l+f+g+h+i+j};this.getTimeString=function(k,n,h){var m="";var i=this.Value.getHours();var h=h||true;if((e==12)&&(i>=12)){if(i>12){i=i-12}m=" PM"}else{if(e==12){m=" AM"}}var l=this.HasTimePart?gx.text.padr(i.toString(),2,"0"):"";var g=this.HasTimePart?gx.text.padr(this.Value.getMinutes().toString(),2,"0"):"";var j=this.HasTimePart?gx.text.padr(this.Value.getSeconds().toString(),2,"0"):"";if((this.Value-new Date(0,0,0,0,0,0,0)==0)&&(m!="")){l="12"}var f="";if(h){f=l}if(k){f=f+":"+g}if(n){f=f+":"+j}return f+m};this.FormatPos=function(f){if(f=="ANSI"){YPos=1;MPos=2;DPos=3}else{Y4Pos=f.indexOf("Y4");YPos=(Y4Pos==-1)?f.indexOf("Y")+1:Y4Pos+1;MPos=f.indexOf("M");if(Y4Pos!=0){MPos++}DPos=f.indexOf("D");if(Y4Pos!=0){DPos++}}return{YPos:YPos,MPos:MPos,DPos:DPos}};this.assign_date=function(f){if(f instanceof gx.date.gxdate){this.Value=f.Value}else{this.Value=f}};this.assign_string=function(g,l,o,j){ANSIDateExp=/([0-9]{1,4})\/?-?([0-9]{1,2})\/?-?([0-9]{1,4})\s?T?([0-9]{2})?:?([0-9]{2})?:?([0-9]{2})?:?([0-9]{2})?\s?(AM|PM)?/i;
var q=ANSIDateExp.exec(g);var f=0;if(q==null){if(g.indexOf("  /  /  ")!=-1){o=true}}else{var k=q.length;for(var h=1;h<k;h++){if(!gx.lang.emptyObject(q[h])){f++}}}var m=this.FormatPos(l);YY=0;MM=0;DD=0;Ho=0;Mi=0;Se=0;Ce=0;try{if((m.DPos+m.MPos+m.YPos==6)&&(q!=null)&&(f>=3)){if(q[m.YPos]!=null){YY=parseInt(q[m.YPos],10)}if(isNaN(YY)){throw"InvalidDate"}if(YY<d){YY+=2000}else{if(YY<100){YY+=1900}else{if(YY<1000){YY+=1000}}}if(q[m.MPos]!=null){MM=parseInt(q[m.MPos],10)-1}if(isNaN(MM)||(MM<0)||(MM>11)){throw"InvalidDate"}if(q[m.DPos]!=null){DD=parseInt(q[m.DPos],10)}if(isNaN(DD)||(DD<0)||(DD>gx.date.maxDays(MM,YY))){throw"InvalidDate"}}this.HasTimePart=false;var n=0;if(q==null){ANSIDateExp=/([0-9]{2}):?([0-9]{2})?:?([0-9]{2})?:?([0-9]{2})?\s?(AM|PM)?/i;q=ANSIDateExp.exec(g);if(q!=null){n=1;this.HasTimePart=true}}else{if(f>3){n=4;this.HasTimePart=true}}if(this.HasTimePart&&!o){if(q[n]!=null){Ho=parseInt(q[n],10)}if(gx.lang.emptyObject(q[n])||isNaN(Ho)){this.HasTimePart=false;throw"InvalidHour"}if(q[n+1]!=null){Mi=parseInt(q[n+1],10)}if(isNaN(Mi)){Mi=0}if(q[n+2]!=null){Se=parseInt(q[n+2],10)}if(isNaN(Se)){Se=0}if(q[n+3]!=null){Ce=parseInt(q[n+3],10)}if(isNaN(Ce)){Ce=0}if(!this.validTime((g.toLowerCase().indexOf("m")!=-1),Ho,Mi,Se,Ce)){throw"InvalidHour"}if((g.indexOf("PM")!=-1||g.indexOf("pm")!=-1)&&(Ho<12)){Ho+=12}}}catch(p){if(j){throw p}else{if(p=="InvalidDate"){YY=0;MM=0;DD=0;Ho=0;Mi=0;Se=0;Ce=0}if(p=="InvalidHour"){Ho=0;Mi=0;Se=0;Ce=0}}}this.Value=new Date(YY,MM,DD,Ho,Mi,Se,Ce)};this.validTime=function(h,i,f,g,j){if(h&&i>12){return false}if(!h&&(i>24||(i==24&&(f+g)>0))){return false}return((f<=59)||(g<=59)||(j<=59))};this.compare=function(f){if(typeof(f)=="string"){return this.compare_string(f)}return this.compare_date(f)};this.compare_string=function(f){DateValue=new gx.date.gxdate(f);return this.compare_date(DateValue.Value)};this.compare_date=function(f){var g;if(f instanceof gx.date.gxdate){g=f.Value}else{g=f}if(this.HasTimePart){return this.Value-g}else{if(this.Value.getFullYear()>g.getFullYear()){return 1}else{if(this.Value.getFullYear()<g.getFullYear()){return -1}else{if(this.Value.getMonth()>g.getMonth()){return 1}else{if(this.Value.getMonth()<g.getMonth()){return -1}else{if(this.Value.getDate()>g.getDate()){return 1}else{if(this.Value.getDate()<g.getDate()){return -1}else{return 0}}}}}}}};var e=gx.timeFormat||12;var a=b||gx.dateFormat;var d=gx.centuryFirstYear||40;if(typeof(c)=="string"){this.assign_string(c,a)}else{this.assign_date(c)}},isANSIDate:function(a){if(typeof(a)=="string"){var b=new RegExp("^[0-9]{4}[/-]{1}[0-9]{2}[/-]{1}[0-9]{2}$");if(b.test(a)){return true}}return false},isLeapYear:function(a){if(a%400==0){return true}if(a%100==0){return false}if(a%4==0){return true}return false},dateObject:function(a){if(a instanceof this.gxdate){return a.Value}if(typeof(a)=="string"){return new this.gxdate(a,(this.isANSIDate(a)?"Y4MD":undefined)).Value}if(a instanceof Date){return a}return new Date()},gxdateObject:function(b){if(b instanceof this.gxdate){return b
}if(typeof(b)=="string"){return new this.gxdate(b,(this.isANSIDate(b)?"Y4MD":undefined))}if(b instanceof Date){var a=new this.gxdate("");a.assign_date(b);return a}return new this.gxdate("")},clonedDate:function(c,a){var b=new this.gxdate("");b.assign_date(a);if(c instanceof this.gxdate){b.SFmt=c.SFmt;b.HasTimePart=c.HasTimePart}return b},nullDate:function(){return new this.gxdate("").Value},now:function(){return new Date()},today:function(){var a=new this.gxdate("");a.assign_date(new Date());return a},ctot:function(b,a){return new this.gxdate(b,a)},ctod:function(c,a){var b=new this.gxdate(c,a);b.Value.setHours(0,0,0,0);return b},ymdtod:function(c,d,b){var a=new this.gxdate(c+"/"+d+"/"+b,"ANSI");a.Value.setHours(0,0,0,0);return a},ymdhmstot:function(f,g,e,d,c,b){var a=new this.gxdate(f+"/"+g+"/"+e+" "+d+":"+c+":"+b,"ANSI");return a},hour:function(a){return(new this.gxdate(a)).Value.getHours()},minute:function(a){return(new this.gxdate(a)).Value.getMinutes()},second:function(a){return(new this.gxdate(a)).Value.getSeconds()},millisec:function(a){return a*24*60*60*1000},day:function(a){return(new this.gxdate(a)).Value.getDate()},month:function(a){return(new this.gxdate(a)).Value.getMonth()+1},year:function(a){return(new this.gxdate(a)).Value.getFullYear()},addDays:function(a,b){return this.addMill(a,this.dayToMillisec(b))},addSec:function(a,b){return this.addMill(a,this.secToMillisec(b))},addMill:function(a,d){var b=this.dateObject(a).clone();var c=new this.gxdate();c.assign_date(b);var e=b.getMilliseconds();b.setMilliseconds(e+d);return c.getString((this.isANSIDate(a)?"Y4MD":undefined))},secDiff:function(b,a){var c=this.millisecToSec(this.milliDiff(b,a));return c},daysDiff:function(b,a){var c=this.millisecToDay(this.milliDiff(b,a));return c},milliDiff:function(c,b){var a=this.gxdateObject(c);var d=this.gxdateObject(b);var c=a.Value.valueOf();var b=d.Value.valueOf();return c-b},dayToMillisec:function(a){return a*24*60*60*1000},secToMillisec:function(a){return a*1000},millisecToDay:function(a){return a/24/60/60/1000},millisecToSec:function(a){return a/1000},dateParm:function(a){if(typeof(a)=="string"){return new this.gxdate(a)}return a},urlDate:function(c,b){var d=c.value||gx.dom.spanValue(c)||c;var a=new this.gxdate(d,b);if(!this.isNullDate(a)){return a.Value.getFullYear().toString()+gx.text.padr((a.Value.getMonth()+1).toString(),2,"0")+gx.text.padr(a.Value.getDate().toString(),2,"0")}return""},urlDateTime:function(c,b){var d=c.value||gx.dom.spanValue(c)||c;var a=new this.gxdate(d,b);if(!this.isNullDate(a)){return a.Value.getFullYear().toString()+gx.text.padr((a.Value.getMonth()+1).toString(),2,"0")+gx.text.padr(a.Value.getDate().toString(),2,"0")+gx.text.padr(a.Value.getHours().toString(),2,"0")+gx.text.padr(a.Value.getMinutes().toString(),2,"0")+gx.text.padr(a.Value.getSeconds().toString(),2,"0")}return""},isNullDate:function(b){if(b instanceof this.gxdate){b=b.Value}var a=this.nullDate();if(a.getFullYear()!=b.getFullYear()){return false}if(a.getMonth()!=b.getMonth()){return false
}if(a.getDate()!=b.getDate()){return false}if(a.getHours()!=b.getHours()){return false}if(a.getMinutes()!=b.getMinutes()){return false}if(a.getSeconds()!=b.getSeconds()){return false}return true},dtoc:function(a,c,b){var e=new this.gxdate(a);return e.gxdtoc(c,b)},dttoc:function(c,f,e){var a=new this.gxdate(c);var d=gx.dateFormat;if((f>8)&&(d.indexOf("Y4")==-1)){d=d.replace("Y","Y4")}var b=a.getStringWithFmt(d);if(e>0){return b+" "+a.getTimeString(true,e==8)}return b},nulldate_toc:function(e,d){var a=new this.gxdate("");a.HasTimePart=true;var c=gx.dateFormat;var b="";if(e>0){if((e>8)&&(c.indexOf("Y4")==-1)){c=c.replace("Y","Y4")}b=a.getStringWithFmt(c)+" "}if(d>0&&!gx.blankWhenEmpty){return b+a.getTimeString(d>1,d==8,d>3)}return b},addyr:function(a,b){return this.addmth(a,12*b)},addmth:function(d,f){var c=this.gxdateObject(d);d=this.dateObject(d);f+=d.getMonth();var e=parseInt(f/12);var a=parseInt(f%12);d.setMonth(a);var b=d.getFullYear()+e;if(a==1&&d.getDate()==29&&!this.isLeapYear(b)){d.setDate(28)}d.setFullYear(b);return this.clonedDate(c,d)},dtadd:function(b,d){var a=this.gxdateObject(b);d=d*1000;b=this.dateObject(b);var c=b.getMilliseconds();b.setMilliseconds(c+d);return this.clonedDate(a,b)},dtdiff:function(b,a){b=this.dateObject(b);a=this.dateObject(a);return(b-a)/1000},maxDays:function(b,a){switch(b){case 0:return 31;case 1:if((a%100!=0)&&(a%4==0)||(a%400==0)){return 29}else{return 28}case 2:return 31;case 3:return 30;case 4:return 31;case 5:return 30;case 6:return 31;case 7:return 31;case 8:return 30;case 9:return 31;case 10:return 30;case 11:return 31}},eom:function(b){var a=this.gxdateObject(b);b=this.dateObject(b);var c=this.maxDays(b.getMonth(),b.getFullYear());b.setDate(c);return this.clonedDate(a,b)},dow:function(a){a=this.dateObject(a);if(a.equalsNoTime(this.nullDate())){return 0}return a.getDay()+1},age:function(i,g){var h;var c;var a;var d;var f;var e;c=this.dateObject(i);h=this.dateObject(g);var b=this.nullDate();if(c.equalsNoTime(b)||h.equalsNoTime(b)||c.equalsNoTime(h)){return 0}if(h>=c){d=(h.getUTCHours()*3600000+h.getUTCMinutes()*60000+h.getUTCSeconds()*1000)-(c.getUTCHours()*3600000+c.getUTCMinutes()*60000+c.getUTCSeconds()*1000);if(h.getUTCDate()>c.getUTCDate()||(h.getUTCDate()==c.getUTCDate()&&d>=0)){a=new Date(Date.UTC(h.getUTCFullYear(),h.getUTCMonth(),c.getUTCDate(),c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds()))}else{a=new Date(Date.UTC(h.getUTCFullYear(),h.getUTCMonth()-1,c.getUTCDate(),c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds()));e=h.getUTCMonth()-1;if(e==-1){e=11}while(a.getUTCMonth()!=e){a.setUTCDate(a.getUTCDate()-1)}}if(a.getUTCMonth()>=c.getUTCMonth()){f=a.getUTCFullYear()-c.getUTCFullYear()}else{f=(a.getUTCFullYear()-1)-c.getUTCFullYear()}return f}return 0},valid_date:function(e,n,t,r,a,p,i,q){var f=i||false;var g=/^([ ]*([\/|-][ ]*[\/|-][ ]*((00|12)(:00(:00)?)?[ ]*(a|am)?)?)?)?[ ]*$/i;var j;var v=false;var s="";var u=t;s=e.value;s=s.split("\n")[0];if(t=="YMD"){t=1}else{t=0}if(a==12){a=1}else{a=0
}if(g.test(s)){v=true;s=""}var b="";var c="^[ ]*(";if(n>0){if(n==8){c=c+"([0-9]{1,2})[/|-]?([0-9]{1,2})[/|-]?([0-9]{2})"}else{if(t==0){if(f){c=c+"([0-9]{1,2})[/|-]?([0-9]{1,2})[/|-]?([0-9]{4})"}else{c=c+"([0-9]{1,2})[/|-]?([0-9]{1,2})[/|-]?([0-9]{2,4})"}}else{if(f){c=c+"([0-9]{4})[/|-]?([0-9]{1,2})[/|-]?([0-9]{1,2})"}else{c=c+"([0-9]{2,4})[/|-]?([0-9]{1,2})[/|-]?([0-9]{1,2})"}}}}else{c=c+"( )?( )?( )?"}if(r>0){c=c+"(";if(n>0){c=c+"[ ]*"}c=c+"([0-9]{2})";if(r>2){c=c+"(:?([0-9]{2}))?"}else{c=c+"(( )?)?"}if(r>5){c=c+"(:?([0-9]{2}))?"}else{c=c+"(( )?)?"}if(a==1){c=c+"[ ]*(a|am|p|pm)?"}else{c=c+"(( )?)?"}c=c+")?"}c=c+")?[ ]*$";j=new RegExp(c,"i");if(j.test(s)){var d=s.match(j);if(n>0){var k="/";if(s.indexOf("-")>0){k="-"}if(d[2]==""||d[2]==null){if(q==1){b="        "}else{b="  "+k+"  "+k+"  "}if(n==10){b+="  "}}else{b=d[2]+k+d[3]+k+d[4]}}else{b=""}if(r>0){if(n>0){b=b+" "}if(q==1&&(d[6]==""||d[6]==null)&&(d[8]==""||d[8]==null)&&(d[10]==""||d[10]==null)){b=b+"        "}else{if(d[6]==""||d[6]==null){if(v){var o=s.match(g);if(o[4]!=""&&o[4]!=null){b=b+o[4]}else{b=b+((a==1)?"12":"00")}}else{b=b+((a==1)?"12":"00")}}else{b=b+d[6]}if(r>2){if(d[8]==""||d[8]==null){b=b+":00"}else{b=b+":"+d[8]}}if(r>5){if(d[10]==""||d[10]==null){b=b+":00"}else{b=b+":"+d[10]}}if(a==1){var l;if(d[11]==""||d[11]==null){l="a"}else{l=d[11].substr(0,1)}if(l.toLowerCase()=="p"){b=b+" PM"}else{b=b+" AM"}}}}var h=new this.gxdate("",u);try{h.assign_string(b,u,(r<=0),true)}catch(m){gx.fn.alert(e,gx.getMessage("GXM_invaliddate"));return false}if(b!=s){e.value=b;if(navigator.userAgent.indexOf("Firefox/2")!=-1){e.onchange()}}return true}gx.fn.alert(e,gx.getMessage("GXM_invaliddate"));return false},_init:function(){Date.prototype.equalsNoTime=this.equalsNoTime;Date.prototype.clone=this.clone;Date.prototype.json=this.toJson}};gx.text={stringBuffer:function(a){this.capacity=a||10;this.buffer=[];this.append=function(b){this.buffer.push(b);return this};this.clear=function(){delete this.buffer;this.buffer=[]};this.toString=function(){if(this.buffer.length==0){return""}return this.buffer.join("")};this.length=function(){return this.toString().length}},format:function(){var c=arguments[0];var a=arguments.length;for(var b=1;b<a;b++){c=c.replace("%"+b,gx.text.trim(arguments[b].toString()))}return c},formatString:function(c,a,b){if(b){return gx.text.padl("",a,"*")}else{return c}},replaceAll:function(c,a,b){if(c.toString().indexOf(a)!=-1){return String(c).split(a).join(b)}return c},charReplace:function(h,f,b){var j="";var g=h.length;for(var e=0;e<g;e++){var a=false;var d=f.length;for(var k=0;k<d;k++){if(h.charAt(e)==f[k]){if(k<b.length){j+=b[k];a=true;break}}}if(a==false){j+=h.charAt(e)}}return j},endsWith:function(b,a){return(b.charAt(b.length-1)==a)},length:function(a){return a.length},upper:function(a){return a.toUpperCase()},lower:function(a){return a.toLowerCase()},padr:function(g,a,d){var c=g.length;var f=a-c;if(f<1){return g}var b="";for(var e=0;e<f;e++){b+=d}b+=g;return b},padl:function(g,a,d){var c=g.length;
var f=a-c;if(f<1){return g}var b="";for(var e=0;e<f;e++){b+=d}b=b+g;return b},ltrim:function(a){return a.toString().replace(/^ */,"")},rtrim:function(a){return a.toString().replace(/ *$/,"")},trim:function(a){return this.rtrim(this.ltrim(a))},chr:function(a){return String.fromCharCode(a)},concat:function(c,b,a){return this.rtrim(c)+a+b},space:function(c){var a="";for(var b=0;b<c;b++){a+=" "}return a},substring:function(b,c,a){return b.toString().substring(c-1,c-1+a)},tostring:function(a){return a.toString()},toformattedstring:function(a){return a.toString()},newline:function(){return"\n"},escapeString:function(a){return('"'+a.replace(/(["\\])/g,"\\$1")+'"').replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r")},indexOf:function(c,b,a){if(a>c.length){return 0}if(a<=0){a=1}return c.indexOf(b,a-1)+1},lastIndexOf:function(c,b,a){if(a>c.length){return 0}if(a<=0){a=1}return c.lastIndexOf(b,a-1)+1}};gx.num={str:function(c,b,g){if(typeof(b)=="undefined"){b=10}if(typeof(g)=="undefined"||(b-1<=g)){g=0}c=this.round(c,g);if(g==0){var e=c.toString();if(e.length>b){return gx.text.padr("",b,"*")}else{return gx.text.padr(e,b," ")}}var e=c.toString();var a="";var f=e.indexOf(".");if(g>0){if(f<0){e+="."+gx.text.padr("",g,"0")}else{e=(f==0?"0":e.substring(0,f))+gx.text.padr(e.substring(f),g+1,"0")}}if(e.length<=b){return gx.text.padr(e,b," ")}f=e.indexOf(".");if(f>0){var d=e.substring(0,f);if(d.length<=b){return gx.num.str(gx.num.val(e),b,0)}}return gx.text.padr("",b,"*")},maxNumericPrecision:function(){return 15},extractValue:function(e,a){var c;if(e.charAt(0)=="+"||e.charAt(0)=="-"){c=e.replace(/[\+\-\d,*\.*Z*\s]+/,"")}else{c=e.replace(/[\d,*\.*Z*\s]+/g,"")}var d=a;for(var b=0;b<c.length;b++){d=d.replace(c.charAt(b),"")}return d},formatNumber:function(b,C,k,m,y,q){if(gx.lang.emptyObject(b)){b="0"}var A=k.indexOf(",")!=-1?gx.thousandSeparator:"";var c=gx.decimalPoint;if(typeof(b)=="string"&&A!=""){b=gx.text.replaceAll(b,A,"")}if(typeof(b)=="string"){b=b.replace(c,".")}if(gx.num.overflowNumber(b)){return b}try{b=gx.num.setScale(b,C)}catch(x){b=b.toString()}var w=b.split(".");var s,r;if(!w[0]){w[0]="0"}if(!w[1]){w[1]=""}if(q){if(w[1].length>C&&w[1].replace(/0*$/,"").length>C){throw"InvalidNumber"}else{var t=(C==0)?m:(m-C-1);if((y&&w[0].charAt(0)=="-"&&w[0].replace(/0*/,"").length>t)||(!y&&w[0].charAt(0)=="-")||(w[0].replace(/[+]?0*/,"").length>t)){throw"InvalidNumber"}}}if(w[1].length<C){var v=w[1];for(s=w[1].length+1;s<=C;s++){v+="0"}w[1]=v}var d="";if(y&&w[0].charAt(0)=="-"){d="-";w[0]=w[0].substring(1)}if(A!=""&&w[0].length>3){var u=w[0];w[0]="";for(r=3;r<u.length;r+=3){s=u.slice(u.length-r,u.length-r+3);w[0]=A+s+w[0]+""}r=u.substr(0,(u.length%3==0)?3:(u.length%3));w[0]=r+w[0]}c=(w[1]=="")?"":c;var l;if(C>0){l=k.split(".")}else{l=new Array(k)}var B="";var z=0;if(l.length>1){var o=l[1];for(var s=0;s<o.length;s++){var a=o.charAt(s);if(a=="9"||a=="Z"){if(w[1].length>z){B=B+w[1].charAt(z);z++}else{B=B+(a=="9"?"0":"")
}}else{if(a!="Z"&&a!="."&&a!=","){B=B+a}}}B=c+B}var p=l[0];z=w[0].length-1;for(var s=p.length-1;s>=0;s--){var n=p.charAt(s);if(n=="9"||n=="Z"){if(z>=0){B=w[0].charAt(z)+B;z--}else{B=(n=="9"?"0":"")+B}}else{if(n!="Z"&&n!=","){B=n+B}else{if(n==","&&w[0].charAt(z)==A){B=w[0].charAt(z)+B;z--}}}}return d+B},add:function(d,c){var f=gx.lang.instanceOf;if(f(d,Number)&&f(c,Number)||typeof(gx.num.dec)=="undefined"){return d+c}var e=gx.num.dec.bigDecimal;if(f(d,e)&&f(c,Number)){return d.add(new e(c.toString()))}else{if(f(d,Number)&&f(c,e)){return new e(d.toString()).add(c)}else{return d.add(c)}}},subtract:function(d,c){var f=gx.lang.instanceOf;if(f(d,Number)&&f(c,Number)||typeof(gx.num.dec)=="undefined"){return d-c}var e=gx.num.dec.bigDecimal;if(f(d,e)&&f(c,Number)){return d.subtract(new e(c.toString()))}else{if(f(d,Number)&&f(c,e)){return new e(d.toString()).subtract(c)}else{return d.subtract(c)}}},multiply:function(d,c){var f=gx.lang.instanceOf;if(f(d,Number)&&f(c,Number)||typeof(gx.num.dec)=="undefined"){return d*c}var e=gx.num.dec.bigDecimal;if(f(d,e)&&f(c,Number)){return d.multiply(new e(c.toString()))}else{if(f(d,Number)&&f(c,e)){return new e(d.toString()).multiply(c)}else{return d.multiply(c)}}},divide:function(d,c){var f=gx.lang.instanceOf;if(f(d,Number)&&f(c,Number)||typeof(gx.num.dec)=="undefined"){return d/c}var e=gx.num.dec.bigDecimal;if(f(d,e)&&f(c,Number)){return d.divide(new e(c.toString()))}else{if(f(d,Number)&&f(c,e)){return new e(d.toString()).divide(c)}else{return d.divide(c)}}},negate:function(b){if(gx.lang.instanceOf(b,Number)||typeof(gx.num.dec)=="undefined"){return -b}else{return b.negate()}},pow:function(d,c){var f=gx.lang.instanceOf;if(f(d,Number)&&f(c,Number)||typeof(gx.num.dec)=="undefined"){return d^c}var e=gx.num.dec.bigDecimal;if(f(d,e)&&f(c,Number)){return d.pow(new e(c.toString()))}else{if(f(d,Number)&&f(c,e)){return new e(d.toString()).pow(c)}else{return d.pow(c)}}},mod:function(d,c){var f=gx.lang.instanceOf;if(f(d,Number)&&f(c,Number)||typeof(gx.num.dec)=="undefined"){return d%c}var e=gx.num.dec.bigDecimal;if(f(d,e)&&f(c,Number)){return d.remainder(new e(c.toString()))}else{if(f(d,Number)&&f(c,e)){return new e(d.toString()).remainder(c)}else{return d.remainder(c)}}},setScale:function(e,c){if(gx.lang.instanceOf(e,Number)){return e.toFixed(c)}if(typeof(e)=="string"){e=gx.text.trim(e)}if(e.length<this.maxNumericPrecision()||typeof(gx.num.dec)=="undefined"){if(e.length==0&&c==0){return"0"}else{var d=e.split(".");var a;if(!d[1]){d[1]=""}if(d[1].length<c){var b=d[1];for(a=d[1].length+1;a<=c;a++){b+="0"}d[1]=b;return d[0]+((d[1]=="")?"":".")+d[1]}else{return Number(parseFloat(e)).toFixed(c)}}}else{return new gx.num.dec.bigDecimal(e).setScale(c,gx.num.dec.ROUND_UP).toString()}},parseFloat:function(c,b,a){if(typeof(c)=="number"||this.overflowNumber(c)){return c}var d=this.toInvariant(c,b,a);if(d.length>this.maxNumericPrecision()&&typeof(gx.num.dec)!="undefined"){return new gx.num.dec.bigDecimal(d)}else{return parseFloat(d)}},toInvariant:function(c,b,a){if(typeof(c)=="number"||(typeof(gx.num.dec)!="undefined"&&c instanceof gx.num.dec.bigDecimal)){return c
}else{return gx.text.replaceAll(c,b,"").replace(a,".")}},parseInt:function(c,a,b){if(typeof(c)=="number"){return c}var d=c;d=gx.text.replaceAll(c,b,"");return parseInt(d,a)},overflowNumber:function(b){var a=/\*(\**)/;return a.test(b)},urlDecimal:function(c,b,a){var d=(c.value!=undefined)?c.value:c;d=this.parseFloat(d,b,a);return d.toString()},random:function(){return Math.random()},intval:function(b){var a=0;if(typeof(b)!="undefined"){b=b.toString()}else{b=""}if(b.length<gx.num.maxNumericPrecision()||typeof(gx.num.dec)=="undefined"){a=parseInt(b)}else{a=new gx.num.dec.bigDecimal(b).setScale(0,gx.num.dec.ROUND_UP).toString()}if(isNaN(a)){a=0}return a},val:function(b){b=gx.text.trim(b).replace(",",".");var a=this.parseFloat(b);if(isNaN(a)){a=0}return a},trunc:function(e,g){var b=e;e=e.toString();var a=e.length;var c=e.indexOf(".");if(c!=-1){var f=e.substring(0,c);if(g==0){return f}var d="";if(c+g<=a){d=e.substring(c+1,c+1+g)}e=f+"."+d;b=gx.num.parseFloat(e);if(isNaN(b)){b=0}}return b},round:function(c,h){c=c.toString();var a=c.indexOf(".");var k="0000000000000000000000";var i="";var g="";var j="";var f=0;var b=parseInt(h)+1;var o=""+k.substring(1,b);var e="."+o+"5";var m=parseFloat(e);if(a==-1){g=k;i=""+c}else{if(a==0){i="0";f=0+parseFloat(c)+parseFloat(m);c=f+k;g=""+c.substring(1,c.length)}else{if(h==0){i=c.substring(0,a);var p=parseInt(i);var l=parseInt(c.substring(a+1,a+2));if(isNaN(p)){return 0}if(!isNaN(l)&&l>=5){p++}return p}f=parseFloat(c)+m;i=f.toString().substring(0,a);c=""+f+k;g=""+c.substring(a+1,a+1+parseInt(h))}}g=g.substring(0,parseInt(h));j=i+"."+g;var p=parseFloat(j);if(isNaN(p)){p=0}return p},valid_decimal:function(j,h,i,b){var g=j.value;var c=g.lastIndexOf(i);var k=true;if(i==","&&c==-1&&g.lastIndexOf(".")==g.indexOf(".")){g=g.replace(".",i)}var l=gx.O.getValidStructFld(j.id);if(!gx.lang.emptyObject(l)){g=gx.num.extractValue(l.pic,g)}var d=new RegExp("^[ ]*([+-]?[0-9]*(\\"+h+"[0-9]{3})*(\\"+i+"[0-9]*)?)?[ ]*$");if(d.test(g)){c=g.lastIndexOf(i);var a=g;if(c!=-1){a=g.slice(0,c+parseInt(b,10)+1)}try{if(!gx.lang.emptyObject(l)){a=gx.num.formatNumber(a,l.dec,l.pic,l.len,l.sign,true)}if(i!="."&&j.tagName=="SELECT"){a=gx.num.toInvariant(a,h,i)}}catch(f){k=false}if(k&&a!=gx.text.trim(j.value)){j.value=a;if(navigator.userAgent.indexOf("Firefox/2")!=-1){j.onchange()}}}else{k=false}if(!k){j.GXFormatError=true;gx.fn.alert(j,gx.getMessage("GXM_badnum"))}else{j.GXFormatError=false}},valid_integer:function(a,b){var c=new RegExp("^[ ]*([+-]?[0-9]*(\\"+b+"[0-9]{3})*)?[ ]*$");var g=a.value;var f=true;var h=gx.O.getValidStructFld(a.id);if(!gx.lang.emptyObject(h)){g=gx.num.extractValue(h.pic,g)}if(c.test(g)){try{if(!gx.lang.emptyObject(h)){g=gx.num.formatNumber(g,h.dec,h.pic,h.len,h.sign,true)}}catch(d){f=false}if(g!=gx.text.trim(a.value)){a.value=g;if(navigator.userAgent.indexOf("Firefox/2")!=-1){a.onchange()}}}else{f=false}if(!f){a.GXFormatError=true;gx.fn.alert(a,gx.getMessage("GXM_badnum"))}else{a.GXFormatError=false}}};gx.color={rgb:function(d,c,a){return(d*256*256)+c*256+a
},css:function(Color){if(Color.substring(0,3)=="rgb"){return eval(Color)}return(Color.charAt(0)=="#")?parseInt(Color.substring(1),16):0},html:function(a){var b=this.toHex(a);if(gx.lang.emptyObject(b)){b="000000"}b=gx.text.padr(b,6,"0");var c={};c.Hexa=b;c.Html="#"+b;c.R=parseInt(b.substring(0,2),16);c.G=parseInt(b.substring(2,4),16);c.B=parseInt(b.substring(4,6),16);return c},fromRGB:function(b,a,d){var c={};if((b!=undefined)&&(a!=undefined)&&(d!=undefined)){c.Hexa=this.toHex(b)+this.toHex(a)+this.toHex(d);c.Html="#"+c.Hexa;c.R=b;c.G=a;c.B=d}return c},ARGBToHex:function(d){var a=this.toHex((d>>24)&255);var c=this.toHex((d>>16)&255);var b=this.toHex((d>>8)&255);var e=this.toHex(d&255);return c+b+e},toHex:function(b){if(b==undefined){return"000000"}if(b<0){return gx.color.ARGBToHex(b)}var d="0123456789ABCDEF";if(b==0){return b+"0"}var a=0;var c="";while(b!=0){a=b%16;b=(b-a)/16;c=d.charAt(a)+c}if((c.length%2)!=0){c="0"+c}return c}};