var MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],DAY_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function LZ(c){return(c<0||c>9?"":"0")+c}function isDate(c,e){if(getDateFromFormat(c,e)==0)return false;return true}
function compareDates(c,e,b,i){c=getDateFromFormat(c,e);b=getDateFromFormat(b,i);if(c==0||b==0)return-1;else if(c>b)return 1;return 0}
function formatDate(c,e){e+="";var b="",i=0,f="",a="";f=c.getYear()+"";a=c.getMonth()+1;var l=c.getDate(),m=c.getDay(),h=c.getHours(),k=c.getMinutes(),j=c.getSeconds(),d={};if(f.length<4)f=""+(f-0+1900);d.y=""+f;d.yyyy=f;d.yy=f.substring(2,4);d.M=a;d.MM=LZ(a);d.MMM=MONTH_NAMES[a-1];d.NNN=MONTH_NAMES[a+11];d.d=l;d.dd=LZ(l);d.E=DAY_NAMES[m+7];d.EE=DAY_NAMES[m];d.H=h;d.HH=LZ(h);d.h=h==0?12:h>12?h-12:h;d.hh=LZ(d.h);d.K=h>11?h-12:h;d.k=h+1;d.KK=LZ(d.K);d.kk=LZ(d.k);d.a=h>11?"PM":"AM";d.m=k;d.mm=LZ(k);
d.s=j;for(d.ss=LZ(j);i<e.length;){f=e.charAt(i);for(a="";e.charAt(i)==f&&i<e.length;)a+=e.charAt(i++);b+=d[a]!=null?d[a]:a}return b}function _isInteger(c){for(var e=0;e<c.length;e++)if("1234567890".indexOf(c.charAt(e))==-1)return false;return true}function _getInt(c,e,b,i){for(i=i;i>=b;i--){var f=c.substring(e,e+i);if(f.length<b)break;if(_isInteger(f))return f}return null}
function getDateFromFormat(c,e){c+="";e+="";var b=0,i=0,f="",a="",l,m,h=new Date,k=h.getYear(),j=h.getMonth()+1,d=1,g=h.getHours(),n=h.getMinutes();h=h.getSeconds();for(var o="";i<e.length;){f=e.charAt(i);for(a="";e.charAt(i)==f&&i<e.length;)a+=e.charAt(i++);if(a=="yyyy"||a=="yy"||a=="y"){if(a=="yyyy")m=l=4;if(a=="yy")m=l=2;if(a=="y"){l=2;m=4}k=_getInt(c,b,l,m);if(k==null)return 0;b+=k.length;if(k.length==2)k=k>70?1900+(k-0):2E3+(k-0)}else if(a=="MMM"||a=="NNN"){for(f=j=0;f<MONTH_NAMES.length;f++){var p=
MONTH_NAMES[f];if(c.substring(b,b+p.length).toLowerCase()==p.toLowerCase())if(a=="MMM"||a=="NNN"&&f>11){j=f+1;if(j>12)j-=12;b+=p.length;break}}if(j<1||j>12)return 0}else if(a=="EE"||a=="E")for(f=0;f<DAY_NAMES.length;f++){a=DAY_NAMES[f];if(c.substring(b,b+a.length).toLowerCase()==a.toLowerCase()){b+=a.length;break}}else if(a=="MM"||a=="M"){j=_getInt(c,b,a.length,2);if(j==null||j<1||j>12)return 0;b+=j.length}else if(a=="dd"||a=="d"){d=_getInt(c,b,a.length,2);if(d==null||d<1||d>31)return 0;b+=d.length}else if(a==
"hh"||a=="h"){g=_getInt(c,b,a.length,2);if(g==null||g<1||g>12)return 0;b+=g.length}else if(a=="HH"||a=="H"){g=_getInt(c,b,a.length,2);if(g==null||g<0||g>23)return 0;b+=g.length}else if(a=="KK"||a=="K"){g=_getInt(c,b,a.length,2);if(g==null||g<0||g>11)return 0;b+=g.length}else if(a=="kk"||a=="k"){g=_getInt(c,b,a.length,2);if(g==null||g<1||g>24)return 0;b+=g.length;g--}else if(a=="mm"||a=="m"){n=_getInt(c,b,a.length,2);if(n==null||n<0||n>59)return 0;b+=n.length}else if(a=="ss"||a=="s"){h=_getInt(c,b,
a.length,2);if(h==null||h<0||h>59)return 0;b+=h.length}else if(a=="a"){if(c.substring(b,b+2).toLowerCase()=="am")o="AM";else if(c.substring(b,b+2).toLowerCase()=="pm")o="PM";else return 0;b+=2}else if(c.substring(b,b+a.length)!=a)return 0;else b+=a.length}if(b!=c.length)return 0;if(j==2)if(k%4==0&&k%100!=0||k%400==0){if(d>29)return 0}else if(d>28)return 0;if(j==4||j==6||j==9||j==11)if(d>30)return 0;if(g<12&&o=="PM")g=g-0+12;else if(g>11&&o=="AM")g-=12;return(new Date(k,j-1,d,g,n,h)).getTime()}
function parseDate(c){var e=arguments.length==2?arguments[1]:false;generalFormats=["y-M-d","MMM d, y","MMM d,y","y-MMM-d","d-MMM-y","MMM d"];monthFirst=["M/d/y","M-d-y","M.d.y","MMM-d","M/d","M-d"];dateFirst=["d/M/y","d-M-y","d.M.y","d-MMM","d/M","d-M"];e=["generalFormats",e?"dateFirst":"monthFirst",e?"monthFirst":"dateFirst"];for(var b=null,i=0;i<e.length;i++)for(var f=window[e[i]],a=0;a<f.length;a++){b=getDateFromFormat(c,f[a]);if(b!=0)return new Date(b)}return null};
