/*! globalize - v0.1.0pre - 2012-10-18 * http://wiki.jqueryui.com/Globalize * Copyright 2012 ; Licensed MIT */ (function(e,t){var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N;n=function(e){return new n.prototype.init(e)},typeof require!="undefined"&&typeof exports!="undefined"&&typeof module!="undefined"?module.exports=n:e.Globalize=n,n.cultures={},n.prototype={constructor:n,init:function(e){return this.cultures=n.cultures,this.cultureSelector=e,this}},n.prototype.init.prototype=n.prototype,n.cultures["default"]={name:"en",englishName:"English",nativeName:"English",isRTL:!1,language:"en",numberFormat:{pattern:["-n"],decimals:2,",":",",".":".",groupSizes:[3],"+":"+","-":"-",NaN:"NaN",negativeInfinity:"-Infinity",positiveInfinity:"Infinity",percent:{pattern:["-n %","n %"],decimals:2,groupSizes:[3],",":",",".":".",symbol:"%"},currency:{pattern:["($n)","$n"],decimals:2,groupSizes:[3],",":",",".":".",symbol:"$"}},calendars:{standard:{name:"Gregorian_USEnglish","/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],twoDigitYearMax:2029,patterns:{d:"M/d/yyyy",D:"dddd, MMMM dd, yyyy",t:"h:mm tt",T:"h:mm:ss tt",f:"dddd, MMMM dd, yyyy h:mm tt",F:"dddd, MMMM dd, yyyy h:mm:ss tt",M:"MMMM dd",Y:"yyyy MMMM",S:"yyyy'-'MM'-'dd'T'HH':'mm':'ss"}}},messages:{}},n.cultures["default"].calendar=n.cultures["default"].calendars.standard,n.cultures.en=n.cultures["default"],n.cultureSelector="en",r=/^0x[a-f0-9]+$/i,i=/^[+\-]?infinity$/i,s=/^[+\-]?\d*\.?\d*(e[+\-]?\d+)?$/,o=/^\s+|\s+$/g,u=function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n1&&r.length1?parseInt(l[1],10):0;a=l[0],l=a.split("."),a=l[0],f=l.length>1?l[1]:"";var h;c>0?(f=m(f,c,!1),a+=f.slice(0,c),f=f.substr(c)):c<0&&(c=-c,a=m(a,c+1,!0),f=a.slice(-c,a.length)+f,a=a.slice(0,-c)),t>0?f=n["."]+(f.length>t?f.slice(0,t):m(f,t)):f="";var p=a.length-1,d=n[","],v="";while(p>=0){if(i===0||i>p)return a.slice(0,p+1)+(v.length?d+v+f:f);v=a.slice(p-i+1,p+1)+(v.length?d+v:""),p-=i,s1&&(o=parseInt(n.slice(1),10));var a=n.charAt(0).toUpperCase(),f;switch(a){case"D":u="n",s=v(s),o!==-1&&(s=m(""+s,o,!0)),t<0&&(s="-"+s);break;case"N":f=i;case"C":f=f||i.currency;case"P":f=f||i.percent,u=t<0?f.pattern[0]:f.pattern[1]||"n",o===-1&&(o=f.decimals),s=e(s*(a==="P"?100:1),o,f);break;default:throw"Bad number format specifier: "+a}var l=/n|\$|-|%/g,c="";for(;;){var h=l.lastIndex,p=l.exec(u);c+=u.slice(h,p?p.index:u.length);if(!p)break;switch(p[0]){case"n":c+=s;break;case"$":c+=i.currency.symbol;break;case"-":/[1-9]/.test(s)&&(c+=i["-"]);break;case"%":c+=i.percent.symbol}}return c}}(),E=function(){return/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g},S=function(e,t){if(!t)return 0;var n,r=e.getTime();for(var i=0,s=t.length;i=n)return i}return 0},x=function(e,t,n,r){var i=e.getFullYear();return!r&&t.eras&&(i-=t.eras[n].offset),i},function(){var e,t,n,r,i,s,o;e=function(e,t){if(t<100){var n=new Date,r=S(n),i=x(n,e,r),s=e.twoDigitYearMax;s=typeof s=="string"?(new Date).getFullYear()%100+parseInt(s,10):s,t+=i-i%100,t>s&&(t-=100)}return t},t=function(e,t,n){var r,i=e.days,a=e._upperDays;return a||(e._upperDays=a=[o(i.names),o(i.namesAbbr),o(i.namesShort)]),t=s(t),n?(r=u(a[1],t),r===-1&&(r=u(a[2],t))):r=u(a[0],t),r},n=function(e,t,n){var r=e.months,i=e.monthsGenitive||e.months,a=e._upperMonths,f=e._upperMonthsGen;a||(e._upperMonths=a=[o(r.names),o(r.namesAbbr)],e._upperMonthsGen=f=[o(i.names),o(i.namesAbbr)]),t=s(t);var l=u(n?a[1]:a[0],t);return l<0&&(l=u(n?f[1]:f[0],t)),l},r=function(e,t){var n=e._parseRegExp;if(!n)e._parseRegExp=n={};else{var r=n[t];if(r)return r}var i=y(e,t).replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1"),s=["^"],o=[],u=0,a=0,f=E(),l;while((l=f.exec(i))!==null){var c=i.slice(u,l.index);u=f.lastIndex,a+=g(c,s);if(a%2){s.push(l[0]);continue}var h=l[0],p=h.length,d;switch(h){case"dddd":case"ddd":case"MMMM":case"MMM":case"gg":case"g":d="(\\D+)";break;case"tt":case"t":d="(\\D*)";break;case"yyyy":case"fff":case"ff":case"f":d="(\\d{"+p+"})";break;case"dd":case"d":case"MM":case"M":case"yy":case"y":case"HH":case"H":case"hh":case"h":case"mm":case"m":case"ss":case"s":d="(\\d\\d?)";break;case"zzz":d="([+-]?\\d\\d?:\\d{2})";break;case"zz":case"z":d="([+-]?\\d\\d?)";break;case"/":d="(\\/)";break;default:throw"Invalid date format pattern '"+h+"'."}d&&s.push(d),o.push(l[0])}g(i.slice(u),s),s.push("$");var v=s.join("").replace(/\s+/g,"\\s+"),m={regExp:v,groups:o};return n[t]=m},i=function(e,t,n){return en},s=function(e){return e.split("Â ").join(" ").toUpperCase()},o=function(e){var t=[];for(var n=0,r=e.length;nt.pri?-1:0});for(s=0;s-1&&(e=e.replace(o.numberFormat.currency.symbol,""),e=e.replace(o.numberFormat.currency["."],o.numberFormat["."])),e.indexOf(o.numberFormat.percent.symbol)>-1&&(e=e.replace(o.numberFormat.percent.symbol,"")),e=e.replace(/ /g,"");if(i.test(e))u=parseFloat(e);else if(!t&&r.test(e))u=parseInt(e,16);else{var f=N(e,a,a.pattern[0]),l=f[0],c=f[1];l===""&&a.pattern[0]!=="(n)"&&(f=N(e,a,"(n)"),l=f[0],c=f[1]),l===""&&a.pattern[0]!=="-n"&&(f=N(e,a,"-n"),l=f[0],c=f[1]),l=l||"+";var h,p,d=c.indexOf("e");d<0&&(d=c.indexOf("E")),d<0?(p=c,h=null):(p=c.substr(0,d),h=c.substr(d+1));var v,m,g=a["."],y=p.indexOf(g);y<0?(v=p,m=null):(v=p.substr(0,y),m=p.substr(y+g.length));var b=a[","];v=v.split(b).join("");var w=b.replace(/\u00A0/g," ");b!==w&&(v=v.split(w).join(""));var E=l+v;m!==null&&(E+="."+m);if(h!==null){var S=N(h,a,"-n");E+="e"+(S[0]||"+")+S[1]}s.test(E)&&(u=parseFloat(E))}return u},n.culture=function(e){return typeof e!="undefined"&&(this.cultureSelector=e),this.findClosestCulture(e)||this.cultures["default"]}})(this);