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 a(a,b){if(!Date.prototype[a]){Date.prototype[a]=b}}a("isLeapYear",function(){var a=this.getFullYear();return a%4==0&&a%100!=0||a%400==0});a("isWeekend",function(){return this.getDay()==0||this.getDay()==6});a("isWeekDay",function(){return!this.isWeekend()});a("getDaysInMonth",function(){return[31,this.isLeapYear()?29:28,31,30,31,30,31,31,30,31,30,31][this.getMonth()]});a("getDayName",function(a){return a?Date.abbrDayNames[this.getDay()]:Date.dayNames[this.getDay()]});a("getMonthName",function(a){return a?Date.abbrMonthNames[this.getMonth()]:Date.monthNames[this.getMonth()]});a("getDayOfYear",function(){var a=new Date("1/1/"+this.getFullYear());return Math.floor((this.getTime()-a.getTime())/864e5)});a("getWeekOfYear",function(){return Math.ceil(this.getDayOfYear()/7)});a("setDayOfYear",function(a){this.setMonth(0);this.setDate(a);return this});a("addYears",function(a){this.setFullYear(this.getFullYear()+a);return this});a("addMonths",function(a){var b=this.getDate();this.setMonth(this.getMonth()+a);if(b>this.getDate())this.addDays(-this.getDate());return this});a("addDays",function(a){this.setTime(this.getTime()+a*864e5);return this});a("addHours",function(a){this.setHours(this.getHours()+a);return this});a("addMinutes",function(a){this.setMinutes(this.getMinutes()+a);return this});a("addSeconds",function(a){this.setSeconds(this.getSeconds()+a);return this});a("zeroTime",function(){this.setMilliseconds(0);this.setSeconds(0);this.setMinutes(0);this.setHours(0);return this});a("asString",function(a){var c=a||Date.format;return c.split("yyyy").join(this.getFullYear()).split("yy").join((this.getFullYear()+"").substring(2)).split("mmmm").join(this.getMonthName(false)).split("mmm").join(this.getMonthName(true)).split("mm").join(b(this.getMonth()+1)).split("dd").join(b(this.getDate())).split("hh").join(b(this.getHours())).split("min").join(b(this.getMinutes())).split("ss").join(b(this.getSeconds()))});Date.fromString=function(a,b){var c=b||Date.format;var d=new Date("01/01/1977");var e=0;var f=c.indexOf("mmmm");if(f>-1){for(var g=0;g<Date.monthNames.length;g++){var h=a.substr(f,Date.monthNames[g].length);if(Date.monthNames[g]==h){e=Date.monthNames[g].length-4;break}}d.setMonth(g)}else{f=c.indexOf("mmm");if(f>-1){var h=a.substr(f,3);for(var g=0;g<Date.abbrMonthNames.length;g++){if(Date.abbrMonthNames[g]==h)break}d.setMonth(g)}else{d.setMonth(Number(a.substr(c.indexOf("mm"),2))-1)}}var i=c.indexOf("yyyy");if(i>-1){if(f<i){i+=e}d.setFullYear(Number(a.substr(i,4)))}else{if(f<i){i+=e}d.setFullYear(Number(Date.fullYearStart+a.substr(c.indexOf("yy"),2)))}var j=c.indexOf("dd");if(f<j){j+=e}d.setDate(Number(a.substr(j,2)));if(isNaN(d.getTime())){return false}return d};var b=function(a){var b="0"+a;return b.substring(b.length-2)}})()
