Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.abbrDayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];Date.smallAbbrDayNames=["Su","Mo","Tu","We","Th","Fr","Sa"];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="mm/dd/yyyy";Date.invalidSeperators=" -.\\*+_";Date.validSeperator="/";Date.baseYearStart="19";Date.yearsAllowedBeforeCenturySwitch=2;(function(){function a(b,c){if(!Date.prototype[b]){Date.prototype[b]=c}}a("isLeapYear",function(){var b=this.getFullYear();return(b%4==0&&b%100!=0)||b%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(b){return b?Date.abbrDayNames[this.getDay()]:Date.dayNames[this.getDay()]});a("getSmallDayName",function(){return Date.smallAbbrDayNames[this.getDay()]});a("getMonthName",function(b){return b?Date.abbrMonthNames[this.getMonth()]:Date.monthNames[this.getMonth()]});a("getDayOfYear",function(){var b=new Date("1/1/"+this.getFullYear());return Math.floor((this.getTime()-b.getTime())/86400000)});a("getWeekOfYear",function(){return Math.ceil(this.getDayOfYear()/7)});a("getFirstOfNextMonth",function(){this.setMonth(this.getMonth()+2);this.setDate(1);return this});a("getFirstOfMonth",function(){this.setDate(1);return this});a("setDayOfYear",function(b){this.setMonth(0);this.setDate(b);return this});a("addYears",function(b){this.setFullYear(this.getFullYear()+b);return this});a("addMonths",function(c){var b=this.getDate();this.setMonth(this.getMonth()+c);if(b>this.getDate()){this.addDays(-this.getDate())}return this});a("addDays",function(b){this.setTime(this.getTime()+(b*86400000));return this});a("addHours",function(b){this.setHours(this.getHours()+b);return this});a("addMinutes",function(b){this.setMinutes(this.getMinutes()+b);return this});a("addSeconds",function(b){this.setSeconds(this.getSeconds()+b);return this});a("zeroTime",function(){this.setMilliseconds(0);this.setSeconds(0);this.setMinutes(0);this.setHours(0);return this});a("asString",function(c){var b=Date.format;if(c!=null&&c!=undefined){b=c.toLowerCase()}return b.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(Date.pad((this.getMonth()+1),2)).split("dd").join(Date.pad(this.getDate(),2)).split("ee").join(this.getDayName(false))});a("compare",function(b){if(this==null||this==undefined||b==null||b==undefined){return -1}else{if(this>b){return 1}}return 0});a("equals",function(b){if(this==null||this==undefined||b==null||b==undefined){return false}else{if(this.getTime()==b.getTime()){return true}}return false});Date.fixYear=function(f,i){var g;var d;var c;var j;try{if(f.length==4||f.length==0){return f}g=new Date().getFullYear().toString();d=g.substr(2,2);j=g.substr(0,2);if(f.length==3){if(f=="000"||f=="200"){return"2000"}if(f=="190"){return"1900"}}var b=Number(d)+Number(i);if(f.length<=2){if(Number(f)<b){return j+Date.pad(f,2)+""}else{return Date.baseYearStart+Date.pad(f,2)+""}}}catch(h){}return f};Date.fromString=function(b,m,l){var f=(l==null?Date.format:l);var k;if(m==null||m==undefined||m==0){k=Date.yearsAllowedBeforeCenturySwitch}else{k=m}var c=new Date("01/01/1977");var h=0;b=Date.cleanFormat(b,Date.validSeperator);if(b==null){return false}if(!Date.validateDateParts(b)){return false}var j=f.indexOf("mmmm");if(j>-1){for(var g=0;g<Date.monthNames.length;g++){var e=b.substr(j,Date.monthNames[g].length);if(Date.monthNames[g]==e){h=Date.monthNames[g].length-4;break}}c.setMonth(g)}else{j=f.indexOf("mmm");if(j>-1){var e=b.substr(j,3);for(var g=0;g<Date.abbrMonthNames.length;g++){if(Date.abbrMonthNames[g]==e){break}}c.setMonth(g)}else{c.setMonth(Number(b.substr(f.indexOf("mm"),2))-1)}}var d=f.indexOf("yyyy");if(d>-1){if(j<d){d+=h}c.setFullYear(Number(Date.fixYear(b.substr(d,4),k)))}else{if(j<d){d+=h}c.setFullYear(Number(Date.fixYear(b.substr(f.indexOf("yy"),2),k)))}var n=f.indexOf("dd");if(n>-1){if(j<n){n+=h}c.setDate(Number(b.substr(n,2)))}else{n=f.indexOf("d");if(j<n){n+=h}c.setDate(Number(b.substr(n,1)))}if(isNaN(c.getTime())){return false}return c};Date.validateDateParts=function(e){var d=e.split("/");var c=parseInt(d[0]);var b=parseInt(d[1]);var f=parseInt(d[2]);if(isNaN(f)||isNaN(c)||isNaN(b)||c>12||b>31){return false}return true};Date.cleanSeperators=function(f){var c=Date.invalidSeperators;var b="";for(var d=0;d<f.length;d++){var e=f.charAt(d);if(c.indexOf(e)>-1){b+="/"}else{b+=e}}return b};Date.cleanFormat=function(d,c){try{d=Date.cleanSeperators(d);var b=d.split(c);if(b.length<3){return null}d=Date.pad(b[0],2)+c+Date.pad(b[1],2)+c+b[2];return d}catch(f){}return null};Date.pad=function(c,d){c=Date.trim(c);d=parseInt(d)||2;var b=c;while(b.length<d){b="0"+b}return b};Date.trim=function(b){return b.toString().replace(/^\s+|\s+$/g,"")}})();