Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.abbrDayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.abbrMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Date.firstDayOfWeek=1;Date.format="dd/mm/yyyy";Date.fullYearStart="20";(function(){function B(C,D){if(!Date.prototype[C]){Date.prototype[C]=D}}B("isLeapYear",function(){var C=this.getFullYear();return(C%4==0&&C%100!=0)||C%400==0});B("isWeekend",function(){return this.getDay()==0||this.getDay()==6});B("isWeekDay",function(){return !this.isWeekend()});B("getDaysInMonth",function(){return[31,(this.isLeapYear()?29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()]});B("getDayName",function(C){return C?Date.abbrDayNames[this.getDay()]:Date.dayNames[this.getDay()]});B("getMonthName",function(C){return C?Date.abbrMonthNames[this.getMonth()]:Date.monthNames[this.getMonth()]});B("getDayOfYear",function(){var C=new Date("1/1/"+this.getFullYear());return Math.floor((this.getTime()-C.getTime())/86400000)});B("getWeekOfYear",function(){return Math.ceil(this.getDayOfYear()/7)});B("setDayOfYear",function(C){this.setMonth(0);this.setDate(C);return this});B("addYears",function(C){this.setFullYear(this.getFullYear()+C);return this});B("addMonths",function(D){var C=this.getDate();this.setMonth(this.getMonth()+D);if(C>this.getDate()){this.addDays(-this.getDate())}return this});B("addDays",function(C){this.setTime(this.getTime()+(C*86400000));return this});B("addHours",function(C){this.setHours(this.getHours()+C);return this});B("addMinutes",function(C){this.setMinutes(this.getMinutes()+C);return this});B("addSeconds",function(C){this.setSeconds(this.getSeconds()+C);return this});B("zeroTime",function(){this.setMilliseconds(0);this.setSeconds(0);this.setMinutes(0);this.setHours(0);return this});B("asString",function(D){var C=D||Date.format;if(C.split("mm").length>1){C=C.split("mmmm").join(this.getMonthName(false)).split("mmm").join(this.getMonthName(true)).split("mm").join(A(this.getMonth()+1))}else{C=C.split("m").join(this.getMonth()+1)}C=C.split("yyyy").join(this.getFullYear()).split("yy").join((this.getFullYear()+"").substring(2)).split("dd").join(A(this.getDate())).split("d").join(this.getDate());return C});Date.fromString=function(N){var J=Date.format;var L=new Date("01/01/1970");if(N==""){return L}N=N.toLowerCase();var I="";var D=[];var C=/(dd?d?|mm?m?|yy?yy?)+([^(m|d|y)])?/g;var G;while((G=C.exec(J))!=null){switch(G[1]){case"d":case"dd":case"m":case"mm":case"yy":case"yyyy":I+="(\\d+\\d?\\d?\\d?)+";D.push(G[1].substr(0,1));break;case"mmm":I+="([a-z]{3})";D.push("M");break}if(G[2]){I+=G[2]}}var H=new RegExp(I);var M=N.match(H);for(var F=0;F<D.length;F++){var K=M[F+1];switch(D[F]){case"d":L.setDate(K);break;case"m":L.setMonth(Number(K)-1);break;case"M":for(var E=0;E<Date.abbrMonthNames.length;E++){if(Date.abbrMonthNames[E].toLowerCase()==K){break}}L.setMonth(E);break;case"y":L.setYear(K);break}}return L};var A=function(C){var D="0"+C;return D.substring(D.length-2)}})();
