function DateRange(b,a){this.from=b;this.to=a}DateRange.prototype.withinRange=function(a){return(this.from.getTime()<=a.getTime()&&a.getTime()<=this.to.getTime())};DateRange.prototype.intersectsRange=function(a){return((a.from.getTime()<=this.to.getTime()&&this.to.getTime()<=a.to.getTime())||(a.from.getTime()<=this.from.getTime()&&this.from.getTime()<=a.to.getTime()))};DateRange.prototype.intersectsRanges=function(a){for(var b=0;b<a.length;++b){if(this.intersectsRange(a[b])){return true}}};Date.prototype.padded=function(a){return(a<10?("0"+a):a.toString())};Date.prototype.getFullMonth=function(){return Date.Months[this.getMonth()]};Date.prototype.getShortMonth=function(){return Date.ShortMonths[this.getMonth()]};Date.prototype.getFullDay=function(){return Date.Days[this.getDay()]};Date.prototype.getShortDay=function(){return Date.ShortDays[this.getDay()]};Date.prototype.getShortDayIndex=function(a){return Date.ShortDays[a]};Date.prototype.format=function(a){var b=new String(a);b=b.replace("HH",this.padded(this.getHours()));b=b.replace("H",this.getHours().toString());b=b.replace("MM",this.padded(this.getMinutes()));b=b.replace("M",this.getMinutes().toString());b=b.replace("SS",this.padded(this.getSeconds()));b=b.replace("S",this.getSeconds().toString());b=b.replace("YYYY",this.getFullYear().toString());b=b.replace("YY",this.getFullYear().toString().substring(2,4));b=b.replace("DDDD",this.getFullDay());b=b.replace("DDD",this.getShortDay());b=b.replace("DD",this.padded(this.getDate()));b=b.replace("mmmm",this.getFullMonth());b=b.replace("mmm",this.getShortMonth());b=b.replace("mm",this.padded(this.getMonth()+1));return b};Date.prototype.withinRange=function(a){return(a.from.getTime()<=this.getTime()&&this.getTime()<=a.to.getTime())};Date.prototype.withinRanges=function(a){for(var b=0;b<a.length;++b){if(this.withinRange(a[b])){return true}}return false};Date.prototype.dateWithinRange=function(c){var b=new Date(c.from.getTime());var a=new Date(c.to.getTime());b.setHours(0,0,0,0);a.setHours(23,59,59,999);return(b.getTime()<=this.getTime()&&this.getTime()<=a.getTime())};Date.prototype.dateWithinRanges=function(a){for(var b=0;b<a.length;++b){if(this.dateWithinRange(a[b])){return true}}return false};Date.prototype.monthWithinRange=function(c){var b=new Date(c.from.getTime());var a=new Date(c.to.getTime());b.setDate(1);b.setHours(0,0,0,0);a.setMonth(c.to.getMonth()+1,1);a.setHours(0,0,0,0);a.setTime(a.getTime()-1);return(b.getTime()<=this.getTime()&&this.getTime()<=a.getTime())};Date.prototype.monthWithinRanges=function(a){for(var b=0;b<a.length;++b){if(this.monthWithinRange(a[b])){return true}}return false};
