text: Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.abbrDayNames=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];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.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"};Date.firstDayOfWeek=1;Date.DEBUG_MODE=!1;(function($){Date.prototype.dateFormat=function(b){if(b=="unixtime"){return parseInt(this.getTime()/1000)}
  if(Date.formatFunctions[b]==null){Date.createNewFormat(b)}
  var a=Date.formatFunctions[b];return this[a]()};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0")};Date.prototype.getDayOfYear=function(){var a=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var b=0;b<this.getMonth();++b){a+=Date.daysInMonth[b]}
  return a+this.getDate()};Date.prototype.getWeekOfYear=function(){var b=this.getDayOfYear()+(4-this.getDay());var a=new Date(this.getFullYear(),0,1);var c=(7-a.getDay()+4);return String.leftPad(Math.ceil((b-c)/7)+1,2,"0")};Date.prototype.isLeapYear=function(){var a=this.getFullYear();return((a&3)==0&&(a%100||(a%400==0&&a)))};Date.prototype.getFirstDayOfMonth=function(){var a=(this.getDay()-(this.getDate()-1))%7;return(a<0)?(a+7):a};Date.prototype.getLastDayOfMonth=function(){var a=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(a<0)?(a+7):a};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()]};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return "st";case 2:case 22:return "nd";case 3:case 23:return "rd";default:return "th"}};String.escape=function(a){return a.replace(/('|\\)/g,"\\$1")};String.leftPad=function(d,b,c){var a=new String(d);if(c==null){c=" "}
  while(a.length<b){a=c+a}
  return a}})();(function(){function add(name,method){if(!Date.prototype[name]){Date.prototype[name]=method}};add("clone",function(){return new Date(this.getTime())});add("isLeapYear",function(){var y=this.getFullYear();return(y%4==0&&y%100!=0)||y%400==0});add("isWeekend",function(){return this.getDay()==0||this.getDay()==6});add("firstDate",function(){return new Date(this.getFullYear(),this.getMonth(),1)});add("lastDate",function(){return new Date(this.getFullYear(),this.getMonth()+1,0)});add("isWeekDay",function(){return!this.isWeekend()});add("getDaysInMonth",function(){return[31,(this.isLeapYear()?29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()]});add("getDayName",function(abbreviated){return abbreviated&&Date.abbrDayNames&&Date.abbrDayNames.length>=this.getDay()?Date.abbrDayNames[this.getDay()]:Date.dayNames?Date.dayNames[this.getDay()]:null});add("getMonthName",function(abbreviated){return abbreviated&&Date.abbrMonthNames&&Date.abbrMonthNames.length>=this.getMonth()?Date.abbrMonthNames[this.getMonth()]:Date.monthNames?Date.monthNames[this.getMonth()]:null});add("getDayOfYear",function(){var tmpdtm=new Date("1/1/"+this.getFullYear());return Math.floor((this.getTime()-tmpdtm.getTime())/86400000)});add("getWeekOfYear",function(){return Math.ceil(this.getDayOfYear()/7)});add("setDayOfYear",function(day){this.setMonth(0);this.setDate(day);return this});add("addYears",function(num){this.setFullYear(this.getFullYear()+num);return this});add("addMonths",function(num){var tmpdtm=this.getDate();this.setMonth(this.getMonth()+num);if(tmpdtm>this.getDate())
  this.addDays(-this.getDate());return this});add("addDays",function(num){this.setTime(this.getTime()+(num*86400000));return this});add("addHours",function(num){this.setHours(this.getHours()+num);return this});add("addMinutes",function(num){this.setMinutes(this.getMinutes()+num);return this});add("addSeconds",function(num){this.setSeconds(this.getSeconds()+num);return this});add("zeroTime",function(){this.setMilliseconds(0);this.setSeconds(0);this.setMinutes(0);this.setHours(0);return this});add("asString",function(format){var r=format||'mm/dd/yyyy';return r.split('yyyy').join(this.getFullYear()).split('YYYY').join(this.getFullYear()).split('yy').join((this.getFullYear()+'').substring(2)).split('mmmm').join(this.getMonthName(!1)).split('mmm').join(this.getMonthName(!0)).split('mm').join(_zeroPad(this.getMonth()+1)).split('MM').join(_zeroPad(this.getMonth()+1)).split('dd').join(_zeroPad(this.getDate())).split('DD').join(_zeroPad(this.getDate()))});add("diff",function(d,what){var time1=this.getTime();var time2=d.getTIme();what=(isNaN(what)?0:what<0||what>6?0:what);switch(what){case 0:return(time2-time1);case 1:return((time2-time1)/1000);case 2:return((time2-time1)/(60*1000));case 3:return((time2-time1)/(60*60*1000));case 4:return((time2-time1)/(24*60*60*1000));case 5:return((time2-time1)/(7*24*60*60*1000));case 6:{var d1Y=this.getFullYear();var d2Y=d.getFullYear();var d1M=this.getMonth();var d2M=d.getMonth();return((d2M+(12*d2Y))-(d1M+(12*d1Y)))}
  case 7:return d.getFullYear()-this.getFullYear()}
  return-1});Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var code="Date.prototype."+funcName+" = function() {return ";var special=!1;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=!0}else{if(special){special=!1;code+="'"+String.escape(ch)+"' + "}else{code+=Date.getFormatCode(ch)}}}
  eval(code.substring(0,code.length-3)+";}")};Date.getFormatCode=function(a){switch(a){case "d":return "String.leftPad(this.getDate(), 2, '0') + ";case "D":return "Date.dayNames[this.getDay()].substring(0, 3) + ";case "j":return "this.getDate() + ";case "l":return "Date.dayNames[this.getDay()] + ";case "S":return "this.getSuffix() + ";case "w":return "this.getDay() + ";case "z":return "this.getDayOfYear() + ";case "W":return "this.getWeekOfYear() + ";case "F":return "Date.monthNames[this.getMonth()] + ";case "m":return "String.leftPad(this.getMonth() + 1, 2, '0') + ";case "M":return "Date.monthNames[this.getMonth()].substring(0, 3) + ";case "n":return "(this.getMonth() + 1) + ";case "t":return "this.getDaysInMonth() + ";case "L":return "(this.isLeapYear() ? 1 : 0) + ";case "Y":return "this.getFullYear() + ";case "y":return "('' + this.getFullYear()).substring(2, 4) + ";case "a":return "(this.getHours() < 12 ? 'am' : 'pm') + ";case "A":return "(this.getHours() < 12 ? 'AM' : 'PM') + ";case "g":return "((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case "G":return "this.getHours() + ";case "h":return "String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case "H":return "String.leftPad(this.getHours(), 2, '0') + ";case "i":return "String.leftPad(this.getMinutes(), 2, '0') + ";case "s":return "String.leftPad(this.getSeconds(), 2, '0') + ";case "O":return "this.getGMTOffset() + ";case "T":return "this.getTimezone() + ";case "Z":return "(this.getTimezoneOffset() * -60) + ";default:return "'"+String.escape(a)+"' + "}};Date.parseDate=function(a,c){if(c=="unixtime"){return new Date(!isNaN(parseInt(a))?parseInt(a)*1000:0)}
  if(Date.parseFunctions[c]==null){Date.createParser(c)}
  var b=Date.parseFunctions[c];return Date[b](a)};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (results && results.length > 0) {";var regex="";var special=!1;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=!0}else{if(special){special=!1;regex+=String.escape(ch)}else{obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c}}}}
  code+="if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}";code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code)};Date.formatCodeToRegex=function(b,a){switch(b){case "D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case "j":case "d":return{g:1,c:"d = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case "l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case "S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case "w":return{g:0,c:null,s:"\\d"};case "z":return{g:1,c:"z = parseInt(results["+a+"], 10);\n",s:"(\\d{1,3})"};case "W":return{g:0,c:null,s:"(?:\\d{2})"};case "F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case "M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case "n":case "m":return{g:1,c:"m = parseInt(results["+a+"], 10) - 1;\n",s:"(\\d{1,2})"};case "t":return{g:0,c:null,s:"\\d{1,2}"};case "L":return{g:0,c:null,s:"(?:1|0)"};case "Y":return{g:1,c:"y = parseInt(results["+a+"], 10);\n",s:"(\\d{4})"};case "y":return{g:1,c:"var ty = parseInt(results["+a+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case "a":return{g:1,c:"if (results["+a+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case "A":return{g:1,c:"if (results["+a+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case "g":case "G":case "h":case "H":return{g:1,c:"h = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case "i":return{g:1,c:"i = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case "s":return{g:1,c:"s = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case "O":return{g:0,c:null,s:"[+-]\\d{4}"};case "T":return{g:0,c:null,s:"[A-Z]{3}"};case "Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(b)}}};Date.toDate=function(obj,fmt){if(!obj)return null;if(obj.constructor===Date)_debug('value is Date!');if(obj.constructor===Array)_debug('value is Array!');if(obj.constructor===Number)_debug('value is Number!');if(obj.constructor===String)_debug('value is String!');if(typeof obj==="object")_debug('value is Object!');return(obj.constructor===Date?obj:obj.constructor===Array?new Date(obj[0],obj[1],obj[2]):obj.constructor===Number?new Date(obj):obj.constructor===String?Date.parseDate(obj,fmt):typeof obj==="object"?new Date(obj.year,obj.month,obj.date):null)};Date.isValidDate=function(obj,fmt){return(Date.toDate(obj,fmt)!=null)};Date.compare=function(d1,d2,fmt){var DEBUG_GROUP="Date Utils - Compare dates";_debugStart(DEBUG_GROUP);var dd1=Date.toDate(d1,fmt);var dd2=Date.toDate(d2,fmt);if(dd1==null){throw "Date 1 ["+d1+"] is not a valid date"}
  else if(dd2==null){throw "Date 2 ["+d2+"] is not a valid date"}
  var res=((dd1>dd2)-(dd1<dd2));_debugEnd(DEBUG_GROUP);return res};Date.inRange=function(d,start,end,fmt){var dd=Date.toDate(d,fmt);var dstart=Date.toDate(start,fmt);var dend=Date.toDate(end,fmt);if(dd==null){throw "Date 1 ["+d+"] is not a valid date"}
  else if(dstart==null){throw "Date start of range ["+start+"] is not a valid date"}
  else if(dend==null){throw "Date end of range ["+end+"] is not a valid date"}
  return(dstart<=dd&&dd<=dend)};var _zeroPad=function(num){var s='0'+num;return s.substring(s.length-2)};function _debug(message){if(Date.DEBUG_MODE&&Date.DEBUG_MODE===!0&&window.console){try{console.log(message)}
  catch(e){}}}
  function _debugStart(groupName){if(Date.DEBUG_MODE&&Date.DEBUG_MODE===!0&&window.console){try{console.group(groupName)}
  catch(e){}}}
  function _debugEnd(groupName){if(Date.DEBUG_MODE&&Date.DEBUG_MODE===!0&&window.console){try{console.groupEnd(groupName)}
  catch(e){}}}})()