
jsworld={};jsworld.formatIsoDateTime=function(d,withTZ){if(typeof d==="undefined")
d=new Date();if(typeof withTZ==="undefined")
withTZ=false;var s=jsworld.formatIsoDate(d)+" "+jsworld.formatIsoTime(d);if(withTZ){var diff=d.getHours()-d.getUTCHours();var hourDiff=Math.abs(diff);var minuteUTC=d.getUTCMinutes();var minute=d.getMinutes();if(minute!=minuteUTC&&minuteUTC<30&&diff<0)
hourDiff--;if(minute!=minuteUTC&&minuteUTC>30&&diff>0)
hourDiff--;var minuteDiff;if(minute!=minuteUTC)
minuteDiff=":30";else
minuteDiff=":00";var timezone;if(hourDiff<10)
timezone="0"+hourDiff+minuteDiff;else
timezone=""+hourDiff+minuteDiff;if(diff<0)
timezone="-"+timezone;else
timezone="+"+timezone;s=s+timezone;}
return s;};jsworld.formatIsoDate=function(d){if(typeof d==="undefined")
d=new Date();var year=d.getFullYear();var month=d.getMonth()+1;var day=d.getDate();return year+"-"+jsworld._zeroPad(month,2)+"-"+jsworld._zeroPad(day,2);};jsworld.formatIsoTime=function(d){if(typeof d==="undefined")
d=new Date();var hour=d.getHours();var minute=d.getMinutes();var second=d.getSeconds();return jsworld._zeroPad(hour,2)+":"+jsworld._zeroPad(minute,2)+":"+jsworld._zeroPad(second,2);};jsworld.parseIsoDateTime=function(isoDateTimeVal){if(typeof isoDateTimeVal!="string")
throw"Error: The parameter must be a string";var matches=isoDateTimeVal.match(/^(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)/);if(matches===null)
matches=isoDateTimeVal.match(/^(\d\d\d\d)(\d\d)(\d\d)[T ](\d\d)(\d\d)(\d\d)/);if(matches===null)
matches=isoDateTimeVal.match(/^(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d)(\d\d)(\d\d)/);if(matches===null)
matches=isoDateTimeVal.match(/^(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)/);if(matches===null)
throw"Error: Invalid ISO-8601 date/time string";var year=parseInt(matches[1],10);var month=parseInt(matches[2],10);var day=parseInt(matches[3],10);var hour=parseInt(matches[4],10);var mins=parseInt(matches[5],10);var secs=parseInt(matches[6],10);if(month<1||month>12||day<1||day>31||hour<0||hour>23||mins<0||mins>59||secs<0||secs>59)
throw"Error: Invalid ISO-8601 date/time value";var d=new Date(year,month-1,day,hour,mins,secs);if(d.getDate()!=day||d.getMonth()+1!=month)
throw"Error: Invalid date";return d;};jsworld.parseIsoDate=function(isoDateVal){if(typeof isoDateVal!="string")
throw"Error: The parameter must be a string";var matches=isoDateVal.match(/^(\d\d\d\d)-(\d\d)-(\d\d)/);if(matches===null)
matches=isoDateVal.match(/^(\d\d\d\d)(\d\d)(\d\d)/);if(matches===null)
throw"Error: Invalid ISO-8601 date string";var year=parseInt(matches[1],10);var month=parseInt(matches[2],10);var day=parseInt(matches[3],10);if(month<1||month>12||day<1||day>31)
throw"Error: Invalid ISO-8601 date value";var d=new Date(year,month-1,day);if(d.getDate()!=day||d.getMonth()+1!=month)
throw"Error: Invalid date";return d;};jsworld.parseIsoTime=function(isoTimeVal){if(typeof isoTimeVal!="string")
throw"Error: The parameter must be a string";var matches=isoTimeVal.match(/^(\d\d):(\d\d):(\d\d)/);if(matches===null)
matches=isoTimeVal.match(/^(\d\d)(\d\d)(\d\d)/);if(matches===null)
throw"Error: Invalid ISO-8601 date/time string";var hour=parseInt(matches[1],10);var mins=parseInt(matches[2],10);var secs=parseInt(matches[3],10);if(hour<0||hour>23||mins<0||mins>59||secs<0||secs>59)
throw"Error: Invalid ISO-8601 time value";return new Date(0,0,0,hour,mins,secs);};jsworld._trim=function(str){var whitespace=' \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000';for(var i=0;i<str.length;i++){if(whitespace.indexOf(str.charAt(i))===-1){str=str.substring(i);break;}}
for(i=str.length-1;i>=0;i--){if(whitespace.indexOf(str.charAt(i))===-1){str=str.substring(0,i+1);break;}}
return whitespace.indexOf(str.charAt(0))===-1?str:'';};jsworld._isNumber=function(arg){if(typeof arg=="number")
return true;if(typeof arg!="string")
return false;var s=arg+"";return(/^-?(\d+|\d*\.\d+)$/).test(s);};jsworld._isInteger=function(arg){if(typeof arg!="number"&&typeof arg!="string")
return false;var s=arg+"";return(/^-?\d+$/).test(s);};jsworld._isFloat=function(arg){if(typeof arg!="number"&&typeof arg!="string")
return false;var s=arg+"";return(/^-?\.\d+?$/).test(s);};jsworld._hasOption=function(option,optionsString){if(typeof option!="string"||typeof optionsString!="string")
return false;if(optionsString.indexOf(option)!=-1)
return true;else
return false;};jsworld._stringReplaceAll=function(s,target,replacement){var out;if(target.length==1&&replacement.length==1){out="";for(var i=0;i<s.length;i++){if(s.charAt(i)==target.charAt(0))
out=out+replacement.charAt(0);else
out=out+s.charAt(i);}
return out;}
else{out=s;var index=out.indexOf(target);while(index!=-1){out=out.replace(target,replacement);index=out.indexOf(target);}
return out;}};jsworld._stringStartsWith=function(testedString,sub){if(testedString.length<sub.length)
return false;for(var i=0;i<sub.length;i++){if(testedString.charAt(i)!=sub.charAt(i))
return false;}
return true;};jsworld._getPrecision=function(optionsString){if(typeof optionsString!="string")
return-1;var m=optionsString.match(/\.(\d)/);if(m)
return parseInt(m[1],10);else
return-1;};jsworld._splitNumber=function(amount){if(typeof amount=="number")
amount=amount+"";var obj={};if(amount.charAt(0)=="-")
amount=amount.substring(1);var amountParts=amount.split(".");if(!amountParts[1])
amountParts[1]="";obj.integer=amountParts[0];obj.fraction=amountParts[1];return obj;};jsworld._formatIntegerPart=function(intPart,grouping,thousandsSep){if(thousandsSep==""||grouping=="-1")
return intPart;var groupSizes=grouping.split(";");var out="";var pos=intPart.length;var size;while(pos>0){if(groupSizes.length>0)
size=parseInt(groupSizes.shift(),10);if(isNaN(size))
throw"Error: Invalid grouping";if(size==-1){out=intPart.substring(0,pos)+out;break;}
pos-=size;if(pos<1){out=intPart.substring(0,pos+size)+out;break;}
out=thousandsSep+intPart.substring(pos,pos+size)+out;}
return out;};jsworld._formatFractionPart=function(fracPart,precision){for(var i=0;fracPart.length<precision;i++)
fracPart=fracPart+"0";return fracPart;};jsworld._zeroPad=function(number,length){var s=number+"";while(s.length<length)
s="0"+s;return s;};jsworld._spacePad=function(number,length){var s=number+"";while(s.length<length)
s=" "+s;return s;};jsworld.Locale=function(properties){this._className="jsworld.Locale";this._parseList=function(names,expectedItems){var array=[];if(names==null){throw"Names not defined";}
else if(typeof names=="object"){array=names;}
else if(typeof names=="string"){array=names.split(";",expectedItems);for(var i=0;i<array.length;i++){if(array[i][0]=="\""&&array[i][array[i].length-1]=="\"")
array[i]=array[i].slice(1,-1);else
throw"Missing double quotes";}}
else{throw"Names must be an array or a string";}
if(array.length!=expectedItems)
throw"Expected "+expectedItems+" items, got "+array.length;return array;};this._validateFormatString=function(formatString){if(typeof formatString=="string"&&formatString.length>0)
return formatString;else
throw"Empty or no string";};if(properties==null||typeof properties!="object")
throw"Error: Invalid/missing locale properties";if(typeof properties.decimal_point!="string")
throw"Error: Invalid/missing decimal_point property";this.decimal_point=properties.decimal_point;if(typeof properties.thousands_sep!="string")
throw"Error: Invalid/missing thousands_sep property";this.thousands_sep=properties.thousands_sep;if(typeof properties.grouping!="string")
throw"Error: Invalid/missing grouping property";this.grouping=properties.grouping;if(typeof properties.int_curr_symbol!="string")
throw"Error: Invalid/missing int_curr_symbol property";if(!/[A-Za-z]{3}.?/.test(properties.int_curr_symbol))
throw"Error: Invalid int_curr_symbol property";this.int_curr_symbol=properties.int_curr_symbol;if(typeof properties.currency_symbol!="string")
throw"Error: Invalid/missing currency_symbol property";this.currency_symbol=properties.currency_symbol;if(typeof properties.frac_digits!="number"&&properties.frac_digits<0)
throw"Error: Invalid/missing frac_digits property";this.frac_digits=properties.frac_digits;if(properties.mon_decimal_point===null||properties.mon_decimal_point==""){if(this.frac_digits>0)
throw"Error: Undefined mon_decimal_point property";else
properties.mon_decimal_point="";}
if(typeof properties.mon_decimal_point!="string")
throw"Error: Invalid/missing mon_decimal_point property";this.mon_decimal_point=properties.mon_decimal_point;if(typeof properties.mon_thousands_sep!="string")
throw"Error: Invalid/missing mon_thousands_sep property";this.mon_thousands_sep=properties.mon_thousands_sep;if(typeof properties.mon_grouping!="string")
throw"Error: Invalid/missing mon_grouping property";this.mon_grouping=properties.mon_grouping;if(typeof properties.positive_sign!="string")
throw"Error: Invalid/missing positive_sign property";this.positive_sign=properties.positive_sign;if(typeof properties.negative_sign!="string")
throw"Error: Invalid/missing negative_sign property";this.negative_sign=properties.negative_sign;if(properties.p_cs_precedes!==0&&properties.p_cs_precedes!==1)
throw"Error: Invalid/missing p_cs_precedes property, must be 0 or 1";this.p_cs_precedes=properties.p_cs_precedes;if(properties.n_cs_precedes!==0&&properties.n_cs_precedes!==1)
throw"Error: Invalid/missing n_cs_precedes, must be 0 or 1";this.n_cs_precedes=properties.n_cs_precedes;if(properties.p_sep_by_space!==0&&properties.p_sep_by_space!==1&&properties.p_sep_by_space!==2)
throw"Error: Invalid/missing p_sep_by_space property, must be 0, 1 or 2";this.p_sep_by_space=properties.p_sep_by_space;if(properties.n_sep_by_space!==0&&properties.n_sep_by_space!==1&&properties.n_sep_by_space!==2)
throw"Error: Invalid/missing n_sep_by_space property, must be 0, 1, or 2";this.n_sep_by_space=properties.n_sep_by_space;if(properties.p_sign_posn!==0&&properties.p_sign_posn!==1&&properties.p_sign_posn!==2&&properties.p_sign_posn!==3&&properties.p_sign_posn!==4)
throw"Error: Invalid/missing p_sign_posn property, must be 0, 1, 2, 3 or 4";this.p_sign_posn=properties.p_sign_posn;if(properties.n_sign_posn!==0&&properties.n_sign_posn!==1&&properties.n_sign_posn!==2&&properties.n_sign_posn!==3&&properties.n_sign_posn!==4)
throw"Error: Invalid/missing n_sign_posn property, must be 0, 1, 2, 3 or 4";this.n_sign_posn=properties.n_sign_posn;if(typeof properties.int_frac_digits!="number"&&properties.int_frac_digits<0)
throw"Error: Invalid/missing int_frac_digits property";this.int_frac_digits=properties.int_frac_digits;if(properties.int_p_cs_precedes!==0&&properties.int_p_cs_precedes!==1)
throw"Error: Invalid/missing int_p_cs_precedes property, must be 0 or 1";this.int_p_cs_precedes=properties.int_p_cs_precedes;if(properties.int_n_cs_precedes!==0&&properties.int_n_cs_precedes!==1)
throw"Error: Invalid/missing int_n_cs_precedes property, must be 0 or 1";this.int_n_cs_precedes=properties.int_n_cs_precedes;if(properties.int_p_sep_by_space!==0&&properties.int_p_sep_by_space!==1&&properties.int_p_sep_by_space!==2)
throw"Error: Invalid/missing int_p_sep_by_spacev, must be 0, 1 or 2";this.int_p_sep_by_space=properties.int_p_sep_by_space;if(properties.int_n_sep_by_space!==0&&properties.int_n_sep_by_space!==1&&properties.int_n_sep_by_space!==2)
throw"Error: Invalid/missing int_n_sep_by_space property, must be 0, 1, or 2";this.int_n_sep_by_space=properties.int_n_sep_by_space;if(properties.int_p_sign_posn!==0&&properties.int_p_sign_posn!==1&&properties.int_p_sign_posn!==2&&properties.int_p_sign_posn!==3&&properties.int_p_sign_posn!==4)
throw"Error: Invalid/missing int_p_sign_posn property, must be 0, 1, 2, 3 or 4";this.int_p_sign_posn=properties.int_p_sign_posn;if(properties.int_n_sign_posn!==0&&properties.int_n_sign_posn!==1&&properties.int_n_sign_posn!==2&&properties.int_n_sign_posn!==3&&properties.int_n_sign_posn!==4)
throw"Error: Invalid/missing int_n_sign_posn property, must be 0, 1, 2, 3 or 4";this.int_n_sign_posn=properties.int_n_sign_posn;if(properties==null||typeof properties!="object")
throw"Error: Invalid/missing time locale properties";try{this.abday=this._parseList(properties.abday,7);}
catch(error){throw"Error: Invalid abday property: "+error;}
try{this.day=this._parseList(properties.day,7);}
catch(error){throw"Error: Invalid day property: "+error;}
try{this.abmon=this._parseList(properties.abmon,12);}catch(error){throw"Error: Invalid abmon property: "+error;}
try{this.mon=this._parseList(properties.mon,12);}catch(error){throw"Error: Invalid mon property: "+error;}
try{this.d_fmt=this._validateFormatString(properties.d_fmt);}catch(error){throw"Error: Invalid d_fmt property: "+error;}
try{this.t_fmt=this._validateFormatString(properties.t_fmt);}catch(error){throw"Error: Invalid t_fmt property: "+error;}
try{this.d_t_fmt=this._validateFormatString(properties.d_t_fmt);}catch(error){throw"Error: Invalid d_t_fmt property: "+error;}
try{var am_pm_strings=this._parseList(properties.am_pm,2);this.am=am_pm_strings[0];this.pm=am_pm_strings[1];}catch(error){this.am="";this.pm="";}
this.getAbbreviatedWeekdayName=function(weekdayNum){if(typeof weekdayNum=="undefined"||weekdayNum===null)
return this.abday;if(!jsworld._isInteger(weekdayNum)||weekdayNum<0||weekdayNum>6)
throw"Error: Invalid weekday argument, must be an integer [0..6]";return this.abday[weekdayNum];};this.getWeekdayName=function(weekdayNum){if(typeof weekdayNum=="undefined"||weekdayNum===null)
return this.day;if(!jsworld._isInteger(weekdayNum)||weekdayNum<0||weekdayNum>6)
throw"Error: Invalid weekday argument, must be an integer [0..6]";return this.day[weekdayNum];};this.getAbbreviatedMonthName=function(monthNum){if(typeof monthNum=="undefined"||monthNum===null)
return this.abmon;if(!jsworld._isInteger(monthNum)||monthNum<0||monthNum>11)
throw"Error: Invalid month argument, must be an integer [0..11]";return this.abmon[monthNum];};this.getMonthName=function(monthNum){if(typeof monthNum=="undefined"||monthNum===null)
return this.mon;if(!jsworld._isInteger(monthNum)||monthNum<0||monthNum>11)
throw"Error: Invalid month argument, must be an integer [0..11]";return this.mon[monthNum];};this.getDecimalPoint=function(){return this.decimal_point;};this.getCurrencySymbol=function(){return this.currency_symbol;};this.getIntCurrencySymbol=function(){return this.int_curr_symbol.substring(0,3);};this.currencySymbolPrecedes=function(){if(this.p_cs_precedes==1)
return true;else
return false;};this.intCurrencySymbolPrecedes=function(){if(this.int_p_cs_precedes==1)
return true;else
return false;};this.getMonetaryDecimalPoint=function(){return this.mon_decimal_point;};this.getFractionalDigits=function(){return this.frac_digits;};this.getIntFractionalDigits=function(){return this.int_frac_digits;};};jsworld.NumericFormatter=function(locale){if(typeof locale!="object"||locale._className!="jsworld.Locale")
throw"Constructor error: You must provide a valid jsworld.Locale instance";this.lc=locale;this.format=function(number,options){if(typeof number=="string")
number=jsworld._trim(number);if(!jsworld._isNumber(number))
throw"Error: The input is not a number";var floatAmount=parseFloat(number,10);var reqPrecision=jsworld._getPrecision(options);if(reqPrecision!=-1)
floatAmount=Math.round(floatAmount*Math.pow(10,reqPrecision))/Math.pow(10,reqPrecision);var parsedAmount=jsworld._splitNumber(String(floatAmount));var formattedIntegerPart;if(floatAmount===0)
formattedIntegerPart="0";else
formattedIntegerPart=jsworld._hasOption("^",options)?parsedAmount.integer:jsworld._formatIntegerPart(parsedAmount.integer,this.lc.grouping,this.lc.thousands_sep);var formattedFractionPart=reqPrecision!=-1?jsworld._formatFractionPart(parsedAmount.fraction,reqPrecision):parsedAmount.fraction;var formattedAmount=formattedFractionPart.length?formattedIntegerPart+this.lc.decimal_point+formattedFractionPart:formattedIntegerPart;if(jsworld._hasOption("~",options)||floatAmount===0){return formattedAmount;}
else{if(jsworld._hasOption("+",options)||floatAmount<0){if(floatAmount>0)
return"+"+formattedAmount;else if(floatAmount<0)
return"-"+formattedAmount;else
return formattedAmount;}
else{return formattedAmount;}}};};jsworld.DateTimeFormatter=function(locale){if(typeof locale!="object"||locale._className!="jsworld.Locale")
throw"Constructor error: You must provide a valid jsworld.Locale instance.";this.lc=locale;this.formatDate=function(date){var d=null;if(typeof date=="string"){try{d=jsworld.parseIsoDate(date);}catch(error){d=jsworld.parseIsoDateTime(date);}}
else if(date!==null&&typeof date=="object"){d=date;}
else{throw"Error: Invalid date argument, must be a Date object or an ISO-8601 date/time string";}
return this._applyFormatting(d,this.lc.d_fmt);};this.formatTime=function(date){var d=null;if(typeof date=="string"){try{d=jsworld.parseIsoTime(date);}catch(error){d=jsworld.parseIsoDateTime(date);}}
else if(date!==null&&typeof date=="object"){d=date;}
else{throw"Error: Invalid date argument, must be a Date object or an ISO-8601 date/time string";}
return this._applyFormatting(d,this.lc.t_fmt);};this.formatDateTime=function(date){var d=null;if(typeof date=="string"){d=jsworld.parseIsoDateTime(date);}
else if(date!==null&&typeof date=="object"){d=date;}
else{throw"Error: Invalid date argument, must be a Date object or an ISO-8601 date/time string";}
return this._applyFormatting(d,this.lc.d_t_fmt);};this._applyFormatting=function(d,s){s=s.replace(/%%/g,'%');s=s.replace(/%a/g,this.lc.abday[d.getDay()]);s=s.replace(/%A/g,this.lc.day[d.getDay()]);s=s.replace(/%b/g,this.lc.abmon[d.getMonth()]);s=s.replace(/%B/g,this.lc.mon[d.getMonth()]);s=s.replace(/%d/g,jsworld._zeroPad(d.getDate(),2));s=s.replace(/%e/g,jsworld._spacePad(d.getDate(),2));s=s.replace(/%F/g,d.getFullYear()+"-"+
jsworld._zeroPad(d.getMonth()+1,2)+"-"+
jsworld._zeroPad(d.getDate(),2));s=s.replace(/%h/g,this.lc.abmon[d.getMonth()]);s=s.replace(/%H/g,jsworld._zeroPad(d.getHours(),2));s=s.replace(/%I/g,jsworld._zeroPad(this._hours12(d.getHours()),2));s=s.replace(/%k/g,d.getHours());s=s.replace(/%l/g,this._hours12(d.getHours()));s=s.replace(/%m/g,jsworld._zeroPad(d.getMonth()+1,2));s=s.replace(/%n/g,"\n");s=s.replace(/%M/g,jsworld._zeroPad(d.getMinutes(),2));s=s.replace(/%p/g,this._getAmPm(d.getHours()));s=s.replace(/%P/g,this._getAmPm(d.getHours()).toLocaleLowerCase());s=s.replace(/%R/g,jsworld._zeroPad(d.getHours(),2)+":"+
jsworld._zeroPad(d.getMinutes(),2));s=s.replace(/%S/g,jsworld._zeroPad(d.getSeconds(),2));s=s.replace(/%T/g,jsworld._zeroPad(d.getHours(),2)+":"+
jsworld._zeroPad(d.getMinutes(),2)+":"+
jsworld._zeroPad(d.getSeconds(),2));s=s.replace(/%w/g,this.lc.day[d.getDay()]);s=s.replace(/%y/g,new String(d.getFullYear()).substring(2));s=s.replace(/%Y/g,d.getFullYear());s=s.replace(/%Z/g,"");s=s.replace(/%[a-zA-Z]/g,"");return s;};this._hours12=function(hour24){if(hour24===0)
return 12;else if(hour24>12)
return hour24-12;else
return hour24;};this._getAmPm=function(hour24){if(hour24===0||hour24>12)
return this.lc.pm;else
return this.lc.am;};};jsworld.MonetaryFormatter=function(locale,currencyCode,altIntSymbol){if(typeof locale!="object"||locale._className!="jsworld.Locale")
throw"Constructor error: You must provide a valid jsworld.Locale instance";this.lc=locale;this.currencyFractionDigits={"AFN":0,"ALL":0,"AMD":0,"BHD":3,"BIF":0,"BYR":0,"CLF":0,"CLP":0,"COP":0,"CRC":0,"DJF":0,"GNF":0,"GYD":0,"HUF":0,"IDR":0,"IQD":0,"IRR":0,"ISK":0,"JOD":3,"JPY":0,"KMF":0,"KRW":0,"KWD":3,"LAK":0,"LBP":0,"LYD":3,"MGA":0,"MMK":0,"MNT":0,"MRO":0,"MUR":0,"OMR":3,"PKR":0,"PYG":0,"RSD":0,"RWF":0,"SLL":0,"SOS":0,"STD":0,"SYP":0,"TND":3,"TWD":0,"TZS":0,"UGX":0,"UZS":0,"VND":0,"VUV":0,"XAF":0,"XOF":0,"XPF":0,"YER":0,"ZMK":0};if(typeof currencyCode=="string"){this.currencyCode=currencyCode.toUpperCase();var numDigits=this.currencyFractionDigits[this.currencyCode];if(typeof numDigits!="number")
numDigits=2;this.lc.frac_digits=numDigits;this.lc.int_frac_digits=numDigits;}
else{this.currencyCode=this.lc.int_curr_symbol.substring(0,3).toUpperCase();}
this.intSep=this.lc.int_curr_symbol.charAt(3);if(this.currencyCode==this.lc.int_curr_symbol.substring(0,3)){this.internationalFormatting=false;this.curSym=this.lc.currency_symbol;}
else{if(typeof altIntSymbol=="string"){this.curSym=altIntSymbol;this.internationalFormatting=false;}
else{this.internationalFormatting=true;}}
this.getCurrencySymbol=function(){return this.curSym;};this.currencySymbolPrecedes=function(intFlag){if(typeof intFlag=="string"&&intFlag=="i"){if(this.lc.int_p_cs_precedes==1)
return true;else
return false;}
else{if(this.internationalFormatting){if(this.lc.int_p_cs_precedes==1)
return true;else
return false;}
else{if(this.lc.p_cs_precedes==1)
return true;else
return false;}}};this.getDecimalPoint=function(){return this.lc.mon_decimal_point;};this.getFractionalDigits=function(intFlag){if(typeof intFlag=="string"&&intFlag=="i"){return this.lc.int_frac_digits;}
else{if(this.internationalFormatting)
return this.lc.int_frac_digits;else
return this.lc.frac_digits;}};this.format=function(amount,options){var floatAmount;if(typeof amount=="string"){amount=jsworld._trim(amount);floatAmount=parseFloat(amount);if(typeof floatAmount!="number"||isNaN(floatAmount))
throw"Error: Amount string not a number";}
else if(typeof amount=="number"){floatAmount=amount;}
else{throw"Error: Amount not a number";}
var reqPrecision=jsworld._getPrecision(options);if(reqPrecision!=-1)
floatAmount=Math.round(floatAmount*Math.pow(10,reqPrecision))/Math.pow(10,reqPrecision);var parsedAmount=jsworld._splitNumber(String(floatAmount));var formattedIntegerPart;if(floatAmount===0)
formattedIntegerPart="0";else
formattedIntegerPart=jsworld._hasOption("^",options)?parsedAmount.integer:jsworld._formatIntegerPart(parsedAmount.integer,this.lc.mon_grouping,this.lc.mon_thousands_sep);var formattedFractionPart;if(reqPrecision==-1){if(this.internationalFormatting||jsworld._hasOption("i",options))
formattedFractionPart=jsworld._formatFractionPart(parsedAmount.fraction,this.lc.int_frac_digits);else
formattedFractionPart=jsworld._formatFractionPart(parsedAmount.fraction,this.lc.frac_digits);}
else{formattedFractionPart=jsworld._formatFractionPart(parsedAmount.fraction,reqPrecision);}
var quantity;if(this.lc.frac_digits>0||formattedFractionPart.length)
quantity=formattedIntegerPart+this.lc.mon_decimal_point+formattedFractionPart;else
quantity=formattedIntegerPart;if(jsworld._hasOption("~",options)){return quantity;}
else{var suppressSymbol=jsworld._hasOption("!",options)?true:false;var sign=floatAmount<0?"-":"+";if(this.internationalFormatting||jsworld._hasOption("i",options)){if(suppressSymbol)
return this._formatAsInternationalCurrencyWithNoSym(sign,quantity);else
return this._formatAsInternationalCurrency(sign,quantity);}
else{if(suppressSymbol)
return this._formatAsLocalCurrencyWithNoSym(sign,quantity);else
return this._formatAsLocalCurrency(sign,quantity);}}};this._formatAsLocalCurrency=function(sign,q){if(sign=="+"){if(this.lc.p_sign_posn===0&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return"("+q+this.curSym+")";}
else if(this.lc.p_sign_posn===0&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return"("+this.curSym+q+")";}
else if(this.lc.p_sign_posn===0&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return"("+q+" "+this.curSym+")";}
else if(this.lc.p_sign_posn===0&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return"("+this.curSym+" "+q+")";}
else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return this.lc.positive_sign+q+this.curSym;}
else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+this.curSym+q;}
else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return this.lc.positive_sign+q+" "+this.curSym;}
else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+this.curSym+" "+q;}
else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return this.lc.positive_sign+" "+q+this.curSym;}
else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+" "+this.curSym+q;}
else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return q+this.curSym+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return this.curSym+q+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return q+" "+this.curSym+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return this.curSym+" "+q+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return q+this.curSym+" "+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return this.curSym+q+" "+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return q+this.lc.positive_sign+this.curSym;}
else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+this.curSym+q;}
else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return q+" "+this.lc.positive_sign+this.curSym;}
else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+this.curSym+" "+q;}
else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return q+this.lc.positive_sign+" "+this.curSym;}
else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+" "+this.curSym+q;}
else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return q+this.curSym+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return this.curSym+this.lc.positive_sign+q;}
else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return q+" "+this.curSym+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return this.curSym+this.lc.positive_sign+" "+q;}
else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return q+this.curSym+" "+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return this.curSym+" "+this.lc.positive_sign+q;}}
else if(sign=="-"){if(this.lc.n_sign_posn===0&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return"("+q+this.curSym+")";}
else if(this.lc.n_sign_posn===0&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return"("+this.curSym+q+")";}
else if(this.lc.n_sign_posn===0&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return"("+q+" "+this.curSym+")";}
else if(this.lc.n_sign_posn===0&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return"("+this.curSym+" "+q+")";}
else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return this.lc.negative_sign+q+this.curSym;}
else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+this.curSym+q;}
else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return this.lc.negative_sign+q+" "+this.curSym;}
else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+this.curSym+" "+q;}
else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return this.lc.negative_sign+" "+q+this.curSym;}
else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+" "+this.curSym+q;}
else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return q+this.curSym+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return this.curSym+q+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return q+" "+this.curSym+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return this.curSym+" "+q+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return q+this.curSym+" "+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return this.curSym+q+" "+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return q+this.lc.negative_sign+this.curSym;}
else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+this.curSym+q;}
else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return q+" "+this.lc.negative_sign+this.curSym;}
else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+this.curSym+" "+q;}
else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return q+this.lc.negative_sign+" "+this.curSym;}
else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+" "+this.curSym+q;}
else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return q+this.curSym+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return this.curSym+this.lc.negative_sign+q;}
else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return q+" "+this.curSym+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return this.curSym+this.lc.negative_sign+" "+q;}
else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return q+this.curSym+" "+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return this.curSym+" "+this.lc.negative_sign+q;}}
throw"Error: Invalid POSIX LC MONETARY definition";};this._formatAsInternationalCurrency=function(sign,q){if(sign=="+"){if(this.lc.int_p_sign_posn===0&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return"("+q+this.currencyCode+")";}
else if(this.lc.int_p_sign_posn===0&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return"("+this.currencyCode+q+")";}
else if(this.lc.int_p_sign_posn===0&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return"("+q+this.intSep+this.currencyCode+")";}
else if(this.lc.int_p_sign_posn===0&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return"("+this.currencyCode+this.intSep+q+")";}
else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return this.lc.positive_sign+q+this.currencyCode;}
else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.currencyCode+q;}
else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return this.lc.positive_sign+q+this.intSep+this.currencyCode;}
else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.currencyCode+this.intSep+q;}
else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return this.lc.positive_sign+this.intSep+q+this.currencyCode;}
else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.intSep+this.currencyCode+q;}
else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return q+this.currencyCode+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return this.currencyCode+q+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return q+this.intSep+this.currencyCode+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return this.currencyCode+this.intSep+q+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return q+this.currencyCode+this.intSep+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return this.currencyCode+q+this.intSep+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return q+this.lc.positive_sign+this.currencyCode;}
else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.currencyCode+q;}
else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return q+this.intSep+this.lc.positive_sign+this.currencyCode;}
else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.currencyCode+this.intSep+q;}
else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return q+this.lc.positive_sign+this.intSep+this.currencyCode;}
else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.intSep+this.currencyCode+q;}
else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return q+this.currencyCode+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return this.currencyCode+this.lc.positive_sign+q;}
else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return q+this.intSep+this.currencyCode+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return this.currencyCode+this.lc.positive_sign+this.intSep+q;}
else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return q+this.currencyCode+this.intSep+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return this.currencyCode+this.intSep+this.lc.positive_sign+q;}}
else if(sign=="-"){if(this.lc.int_n_sign_posn===0&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return"("+q+this.currencyCode+")";}
else if(this.lc.int_n_sign_posn===0&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return"("+this.currencyCode+q+")";}
else if(this.lc.int_n_sign_posn===0&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return"("+q+this.intSep+this.currencyCode+")";}
else if(this.lc.int_n_sign_posn===0&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return"("+this.currencyCode+this.intSep+q+")";}
else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return this.lc.negative_sign+q+this.currencyCode;}
else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.currencyCode+q;}
else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return this.lc.negative_sign+q+this.intSep+this.currencyCode;}
else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.currencyCode+this.intSep+q;}
else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return this.lc.negative_sign+this.intSep+q+this.currencyCode;}
else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.intSep+this.currencyCode+q;}
else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return q+this.currencyCode+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return this.currencyCode+q+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return q+this.intSep+this.currencyCode+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return this.currencyCode+this.intSep+q+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return q+this.currencyCode+this.intSep+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return this.currencyCode+q+this.intSep+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return q+this.lc.negative_sign+this.currencyCode;}
else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.currencyCode+q;}
else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return q+this.intSep+this.lc.negative_sign+this.currencyCode;}
else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.currencyCode+this.intSep+q;}
else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return q+this.lc.negative_sign+this.intSep+this.currencyCode;}
else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.intSep+this.currencyCode+q;}
else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return q+this.currencyCode+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return this.currencyCode+this.lc.negative_sign+q;}
else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return q+this.intSep+this.currencyCode+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return this.currencyCode+this.lc.negative_sign+this.intSep+q;}
else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return q+this.currencyCode+this.intSep+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return this.currencyCode+this.intSep+this.lc.negative_sign+q;}}
throw"Error: Invalid POSIX LC MONETARY definition";};this._formatAsLocalCurrencyWithNoSym=function(sign,q){if(sign=="+"){if(this.lc.p_sign_posn===0){return"("+q+")";}
else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return this.lc.positive_sign+q;}
else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+q;}
else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return this.lc.positive_sign+q;}
else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+q;}
else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return this.lc.positive_sign+" "+q;}
else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+" "+q;}
else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return q+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return q+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return q+" "+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return q+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return q+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return q+" "+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return q+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+q;}
else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return q+" "+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+" "+q;}
else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return q+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+" "+q;}
else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return q+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+q;}
else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return q+" "+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+" "+q;}
else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return q+" "+this.lc.positive_sign;}
else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+q;}}
else if(sign=="-"){if(this.lc.n_sign_posn===0){return"("+q+")";}
else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return this.lc.negative_sign+q;}
else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+q;}
else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return this.lc.negative_sign+q;}
else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+" "+q;}
else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return this.lc.negative_sign+" "+q;}
else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+" "+q;}
else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return q+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return q+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return q+" "+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return q+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return q+" "+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return q+" "+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return q+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+q;}
else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return q+" "+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+" "+q;}
else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return q+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+" "+q;}
else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return q+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+q;}
else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return q+" "+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+" "+q;}
else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return q+" "+this.lc.negative_sign;}
else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+q;}}
throw"Error: Invalid POSIX LC MONETARY definition";};this._formatAsInternationalCurrencyWithNoSym=function(sign,q){if(sign=="+"){if(this.lc.int_p_sign_posn===0){return"("+q+")";}
else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return this.lc.positive_sign+q;}
else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+q;}
else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return this.lc.positive_sign+q;}
else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.intSep+q;}
else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return this.lc.positive_sign+this.intSep+q;}
else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.intSep+q;}
else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return q+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return q+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return q+this.intSep+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return q+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return q+this.intSep+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return q+this.intSep+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return q+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+q;}
else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return q+this.intSep+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.intSep+q;}
else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return q+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.intSep+q;}
else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return q+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+q;}
else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return q+this.intSep+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.intSep+q;}
else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return q+this.intSep+this.lc.positive_sign;}
else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+q;}}
else if(sign=="-"){if(this.lc.int_n_sign_posn===0){return"("+q+")";}
else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return this.lc.negative_sign+q;}
else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+q;}
else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return this.lc.negative_sign+q;}
else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.intSep+q;}
else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return this.lc.negative_sign+this.intSep+q;}
else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.intSep+q;}
else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return q+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return q+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return q+this.intSep+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return q+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return q+this.intSep+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return q+this.intSep+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return q+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+q;}
else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return q+this.intSep+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.intSep+q;}
else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return q+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.intSep+q;}
else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return q+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+q;}
else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return q+this.intSep+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.intSep+q;}
else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return q+this.intSep+this.lc.negative_sign;}
else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+q;}}
throw"Error: Invalid POSIX LC_MONETARY definition";};};jsworld.NumericParser=function(locale){if(typeof locale!="object"||locale._className!="jsworld.Locale")
throw"Constructor error: You must provide a valid jsworld.Locale instance";this.lc=locale;this.parse=function(formattedNumber){if(typeof formattedNumber!="string")
throw"Parse error: Argument must be a string";var s=jsworld._trim(formattedNumber);s=jsworld._stringReplaceAll(formattedNumber,this.lc.thousands_sep,"");s=jsworld._stringReplaceAll(s,this.lc.decimal_point,".");if(jsworld._isNumber(s))
return parseFloat(s,10);else
throw"Parse error: Invalid number string";};};jsworld.DateTimeParser=function(locale){if(typeof locale!="object"||locale._className!="jsworld.Locale")
throw"Constructor error: You must provide a valid jsworld.Locale instance.";this.lc=locale;this.parseTime=function(formattedTime){if(typeof formattedTime!="string")
throw"Parse error: Argument must be a string";var dt=this._extractTokens(this.lc.t_fmt,formattedTime);var timeDefined=false;if(dt.hour!==null&&dt.minute!==null&&dt.second!==null){timeDefined=true;}
else if(dt.hourAmPm!==null&&dt.am!==null&&dt.minute!==null&&dt.second!==null){if(dt.am){dt.hour=parseInt(dt.hourAmPm,10);}
else{if(dt.hourAmPm==12)
dt.hour=0;else
dt.hour=parseInt(dt.hourAmPm,10)+12;}
timeDefined=true;}
if(timeDefined)
return jsworld._zeroPad(dt.hour,2)+":"+
jsworld._zeroPad(dt.minute,2)+":"+
jsworld._zeroPad(dt.second,2);else
throw"Parse error: Invalid/ambiguous time string";};this.parseDate=function(formattedDate){if(typeof formattedDate!="string")
throw"Parse error: Argument must be a string";var dt=this._extractTokens(this.lc.d_fmt,formattedDate);var dateDefined=false;if(dt.year!==null&&dt.month!==null&&dt.day!==null){dateDefined=true;}
if(dateDefined)
return jsworld._zeroPad(dt.year,4)+"-"+
jsworld._zeroPad(dt.month,2)+"-"+
jsworld._zeroPad(dt.day,2);else
throw"Parse error: Invalid date string";};this.parseDateTime=function(formattedDateTime){if(typeof formattedDateTime!="string")
throw"Parse error: Argument must be a string";var dt=this._extractTokens(this.lc.d_t_fmt,formattedDateTime);var timeDefined=false;var dateDefined=false;if(dt.hour!==null&&dt.minute!==null&&dt.second!==null){timeDefined=true;}
else if(dt.hourAmPm!==null&&dt.am!==null&&dt.minute!==null&&dt.second!==null){if(dt.am){dt.hour=parseInt(dt.hourAmPm,10);}
else{if(dt.hourAmPm==12)
dt.hour=0;else
dt.hour=parseInt(dt.hourAmPm,10)+12;}
timeDefined=true;}
if(dt.year!==null&&dt.month!==null&&dt.day!==null){dateDefined=true;}
if(dateDefined&&timeDefined)
return jsworld._zeroPad(dt.year,4)+"-"+
jsworld._zeroPad(dt.month,2)+"-"+
jsworld._zeroPad(dt.day,2)+" "+
jsworld._zeroPad(dt.hour,2)+":"+
jsworld._zeroPad(dt.minute,2)+":"+
jsworld._zeroPad(dt.second,2);else
throw"Parse error: Invalid/ambiguous date/time string";};this._extractTokens=function(fmtSpec,s){var dt={"year":null,"month":null,"day":null,"hour":null,"hourAmPm":null,"am":null,"minute":null,"second":null,"weekday":null};while(fmtSpec.length>0){if(fmtSpec.charAt(0)=="%"&&fmtSpec.charAt(1)!=""){var placeholder=fmtSpec.substring(0,2);if(placeholder=="%%"){s=s.substring(1);}
else if(placeholder=="%a"){for(var i=0;i<this.lc.abday.length;i++){if(jsworld._stringStartsWith(s,this.lc.abday[i])){dt.weekday=i;s=s.substring(this.lc.abday[i].length);break;}}
if(dt.weekday===null)
throw"Parse error: Unrecognised abbreviated weekday name (%a)";}
else if(placeholder=="%A"){for(var i=0;i<this.lc.day.length;i++){if(jsworld._stringStartsWith(s,this.lc.day[i])){dt.weekday=i;s=s.substring(this.lc.day[i].length);break;}}
if(dt.weekday===null)
throw"Parse error: Unrecognised weekday name (%A)";}
else if(placeholder=="%b"||placeholder=="%h"){for(var i=0;i<this.lc.abmon.length;i++){if(jsworld._stringStartsWith(s,this.lc.abmon[i])){dt.month=i+1;s=s.substring(this.lc.abmon[i].length);break;}}
if(dt.month===null)
throw"Parse error: Unrecognised abbreviated month name (%b)";}
else if(placeholder=="%B"){for(var i=0;i<this.lc.mon.length;i++){if(jsworld._stringStartsWith(s,this.lc.mon[i])){dt.month=i+1;s=s.substring(this.lc.mon[i].length);break;}}
if(dt.month===null)
throw"Parse error: Unrecognised month name (%B)";}
else if(placeholder=="%d"){if(/^0[1-9]|[1-2][0-9]|3[0-1]/.test(s)){dt.day=parseInt(s.substring(0,2),10);s=s.substring(2);}
else
throw"Parse error: Unrecognised day of the month (%d)";}
else if(placeholder=="%e"){var day=s.match(/^\s?(\d{1,2})/);dt.day=parseInt(day,10);if(isNaN(dt.day)||dt.day<1||dt.day>31)
throw"Parse error: Unrecognised day of the month (%e)";s=s.substring(day.length);}
else if(placeholder=="%F"){if(/^\d\d\d\d/.test(s)){dt.year=parseInt(s.substring(0,4),10);s=s.substring(4);}
else{throw"Parse error: Unrecognised date (%F)";}
if(jsworld._stringStartsWith(s,"-"))
s=s.substring(1);else
throw"Parse error: Unrecognised date (%F)";if(/^0[1-9]|1[0-2]/.test(s)){dt.month=parseInt(s.substring(0,2),10);s=s.substring(2);}
else
throw"Parse error: Unrecognised date (%F)";if(jsworld._stringStartsWith(s,"-"))
s=s.substring(1);else
throw"Parse error: Unrecognised date (%F)";if(/^0[1-9]|[1-2][0-9]|3[0-1]/.test(s)){dt.day=parseInt(s.substring(0,2),10);s=s.substring(2);}
else
throw"Parse error: Unrecognised date (%F)";}
else if(placeholder=="%H"){if(/^[0-1][0-9]|2[0-3]/.test(s)){dt.hour=parseInt(s.substring(0,2),10);s=s.substring(2);}
else
throw"Parse error: Unrecognised hour (%H)";}
else if(placeholder=="%I"){if(/^0[1-9]|1[0-2]/.test(s)){dt.hourAmPm=parseInt(s.substring(0,2),10);s=s.substring(2);}
else
throw"Parse error: Unrecognised hour (%I)";}
else if(placeholder=="%k"){var h=s.match(/^(\d{1,2})/);dt.hour=parseInt(h,10);if(isNaN(dt.hour)||dt.hour<0||dt.hour>23)
throw"Parse error: Unrecognised hour (%k)";s=s.substring(h.length);}
else if(placeholder=="%l"){var h=s.match(/^(\d{1,2})/);dt.hourAmPm=parseInt(h,10);if(isNaN(dt.hourAmPm)||dt.hourAmPm<1||dt.hourAmPm>12)
throw"Parse error: Unrecognised hour (%l)";s=s.substring(h.length);}
else if(placeholder=="%m"){if(/^0[1-9]|1[0-2]/.test(s)){dt.month=parseInt(s.substring(0,2),10);s=s.substring(2);}
else
throw"Parse error: Unrecognised month (%m)";}
else if(placeholder=="%M"){if(/^[0-5][0-9]/.test(s)){dt.minute=parseInt(s.substring(0,2),10);s=s.substring(2);}
else
throw"Parse error: Unrecognised minute (%M)";}
else if(placeholder=="%n"){if(s.charAt(0)=="\n")
s=s.substring(1);else
throw"Parse error: Unrecognised new line (%n)";}
else if(placeholder=="%p"){if(jsworld._stringStartsWith(s,this.lc.am)){dt.am=true;s=s.substring(this.lc.am.length);}
else if(jsworld._stringStartsWith(s,this.lc.pm)){dt.am=false;s=s.substring(this.lc.pm.length);}
else
throw"Parse error: Unrecognised AM/PM value (%p)";}
else if(placeholder=="%P"){if(jsworld._stringStartsWith(s,this.lc.am.toLowerCase())){dt.am=true;s=s.substring(this.lc.am.length);}
else if(jsworld._stringStartsWith(s,this.lc.pm.toLowerCase())){dt.am=false;s=s.substring(this.lc.pm.length);}
else
throw"Parse error: Unrecognised AM/PM value (%P)";}
else if(placeholder=="%R"){if(/^[0-1][0-9]|2[0-3]/.test(s)){dt.hour=parseInt(s.substring(0,2),10);s=s.substring(2);}
else
throw"Parse error: Unrecognised time (%R)";if(jsworld._stringStartsWith(s,":"))
s=s.substring(1);else
throw"Parse error: Unrecognised time (%R)";if(/^[0-5][0-9]/.test(s)){dt.minute=parseInt(s.substring(0,2),10);s=s.substring(2);}
else
throw"Parse error: Unrecognised time (%R)";}
else if(placeholder=="%S"){if(/^[0-5][0-9]/.test(s)){dt.second=parseInt(s.substring(0,2),10);s=s.substring(2);}
else
throw"Parse error: Unrecognised second (%S)";}
else if(placeholder=="%T"){if(/^[0-1][0-9]|2[0-3]/.test(s)){dt.hour=parseInt(s.substring(0,2),10);s=s.substring(2);}
else
throw"Parse error: Unrecognised time (%T)";if(jsworld._stringStartsWith(s,":"))
s=s.substring(1);else
throw"Parse error: Unrecognised time (%T)";if(/^[0-5][0-9]/.test(s)){dt.minute=parseInt(s.substring(0,2),10);s=s.substring(2);}
else
throw"Parse error: Unrecognised time (%T)";if(jsworld._stringStartsWith(s,":"))
s=s.substring(1);else
throw"Parse error: Unrecognised time (%T)";if(/^[0-5][0-9]/.test(s)){dt.second=parseInt(s.substring(0,2),10);s=s.substring(2);}
else
throw"Parse error: Unrecognised time (%T)";}
else if(placeholder=="%w"){if(/^\d/.test(s)){dt.weekday=parseInt(s.substring(0,1),10);s=s.substring(1);}
else
throw"Parse error: Unrecognised weekday number (%w)";}
else if(placeholder=="%y"){if(/^\d\d/.test(s)){var year2digits=parseInt(s.substring(0,2),10);if(year2digits>50)
dt.year=1900+year2digits;else
dt.year=2000+year2digits;s=s.substring(2);}
else
throw"Parse error: Unrecognised year (%y)";}
else if(placeholder=="%Y"){if(/^\d\d\d\d/.test(s)){dt.year=parseInt(s.substring(0,4),10);s=s.substring(4);}
else
throw"Parse error: Unrecognised year (%Y)";}
else if(placeholder=="%Z"){if(fmtSpec.length===0)
break;}
fmtSpec=fmtSpec.substring(2);}
else{if(fmtSpec.charAt(0)!=s.charAt(0))
throw"Parse error: Unexpected symbol \""+s.charAt(0)+"\" in date/time string";fmtSpec=fmtSpec.substring(1);s=s.substring(1);}}
return dt;};};jsworld.MonetaryParser=function(locale){if(typeof locale!="object"||locale._className!="jsworld.Locale")
throw"Constructor error: You must provide a valid jsworld.Locale instance";this.lc=locale;this.parse=function(formattedCurrency){if(typeof formattedCurrency!="string")
throw"Parse error: Argument must be a string";var symbolType=this._detectCurrencySymbolType(formattedCurrency);var formatType,s;if(symbolType=="local"){formatType="local";s=formattedCurrency.replace(this.lc.getCurrencySymbol(),"");}
else if(symbolType=="int"){formatType="int";s=formattedCurrency.replace(this.lc.getIntCurrencySymbol(),"");}
else if(symbolType=="none"){formatType="local";s=formattedCurrency;}
else
throw"Parse error: Internal assert failure";s=jsworld._stringReplaceAll(s,this.lc.mon_thousands_sep,"");s=s.replace(this.lc.mon_decimal_point,".");s=s.replace(/\s*/g,"");s=this._removeLocalNonNegativeSign(s,formatType);s=this._normaliseNegativeSign(s,formatType);if(jsworld._isNumber(s))
return parseFloat(s,10);else
throw"Parse error: Invalid currency amount string";};this._detectCurrencySymbolType=function(formattedCurrency){if(this.lc.getCurrencySymbol().length>this.lc.getIntCurrencySymbol().length){if(formattedCurrency.indexOf(this.lc.getCurrencySymbol())!=-1)
return"local";else if(formattedCurrency.indexOf(this.lc.getIntCurrencySymbol())!=-1)
return"int";else
return"none";}
else{if(formattedCurrency.indexOf(this.lc.getIntCurrencySymbol())!=-1)
return"int";else if(formattedCurrency.indexOf(this.lc.getCurrencySymbol())!=-1)
return"local";else
return"none";}};this._removeLocalNonNegativeSign=function(s,formatType){s=s.replace(this.lc.positive_sign,"");if(((formatType=="local"&&this.lc.p_sign_posn===0)||(formatType=="int"&&this.lc.int_p_sign_posn===0))&&/\(\d+\.?\d*\)/.test(s)){s=s.replace("(","");s=s.replace(")","");}
return s;};this._normaliseNegativeSign=function(s,formatType){s=s.replace(this.lc.negative_sign,"-");if((formatType=="local"&&this.lc.n_sign_posn===0)||(formatType=="int"&&this.lc.int_n_sign_posn===0)){if(/^\(\d+\.?\d*\)$/.test(s)){s=s.replace("(","");s=s.replace(")","");return"-"+s;}}
if(formatType=="local"&&this.lc.n_sign_posn==2||formatType=="int"&&this.lc.int_n_sign_posn==2){if(/^\d+\.?\d*-$/.test(s)){s=s.replace("-","");return"-"+s;}}
if(formatType=="local"&&this.lc.n_cs_precedes===0&&this.lc.n_sign_posn==3||formatType=="local"&&this.lc.n_cs_precedes===0&&this.lc.n_sign_posn==4||formatType=="int"&&this.lc.int_n_cs_precedes===0&&this.lc.int_n_sign_posn==3||formatType=="int"&&this.lc.int_n_cs_precedes===0&&this.lc.int_n_sign_posn==4){if(/^\d+\.?\d*-$/.test(s)){s=s.replace("-","");return"-"+s;}}
return s;};};