templates/calendar/jquery.calendar.min.js in compass-jquery-plugin-0.2.5.4 vs templates/calendar/jquery.calendar.min.js in compass-jquery-plugin-0.2.6.0
- old
+ new
@@ -1,11 +1,11 @@
-(function(c){c.widget("ui.weekCalendar",{_init:function(){var d=this;d._computeOptions();d._setupEventDelegation();d._renderCalendar();d._loadCalEvents();d._resizeCalendar();d._scrollToHour(d.options.date.getHours());c(window).unbind("resize.weekcalendar");c(window).bind("resize.weekcalendar",function(){d._resizeCalendar()})},refresh:function(){this._clearCalendar();this._loadCalEvents(this.element.data("startDate"))},clear:function(){this._clearCalendar()},today:function(){this._clearCalendar();this._loadCalEvents(new Date())},prevWeek:function(){var d=new Date(this.element.data("startDate").getTime()-(b/6));this._clearCalendar();this._loadCalEvents(d)},nextWeek:function(){var d=new Date(this.element.data("startDate").getTime()+b+(b/7));this._clearCalendar();this._loadCalEvents(d)},gotoWeek:function(d){this._clearCalendar();this._loadCalEvents(d)},removeEvent:function(d){this.element.find(".cal-event").each(function(){if(c(this).data("calEvent").id===d){c(this).fadeOut(function(){c(this).remove()});return false}})},removeUnsavedEvents:function(){this.element.find(".new-cal-event").fadeOut(function(){c(this).remove()})},updateEvent:function(d){this._updateEventInCalendar(d)},getTimeslotTimes:function(g){var f=this.options;var e=f.businessHours.limitDisplay?f.businessHours.start:0;var d=new Date(g.getFullYear(),g.getMonth(),g.getDate(),e);var m=[];var k=d.getTime();for(var j=0;j<f.timeslotsPerDay;j++){var l=k+f.millisPerTimeslot;m[j]={start:new Date(k),startFormatted:this._formatDate(new Date(k),f.timeFormat),end:new Date(l),endFormatted:this._formatDate(new Date(l),f.timeFormat)};k=l}return m},formatDate:function(d,e){if(e){return this._formatDate(d,e)}else{return this._formatDate(d,this.options.dateFormat)}},formatTime:function(d,e){if(e){return this._formatDate(d,e)}else{return this._formatDate(d,this.options.timeFormat)}},getData:function(d){return this._getData(d)},_computeOptions:function(){var d=this.options;if(d.businessHours.limitDisplay){d.timeslotsPerDay=d.timeslotsPerHour*(d.businessHours.end-d.businessHours.start);d.millisToDisplay=(d.businessHours.end-d.businessHours.start)*60*60*1000;d.millisPerTimeslot=d.millisToDisplay/d.timeslotsPerDay}else{d.timeslotsPerDay=d.timeslotsPerHour*24;d.millisToDisplay=a;d.millisPerTimeslot=a/d.timeslotsPerDay}},_resizeCalendar:function(){var e=this.options;if(e&&c.isFunction(e.height)){var g=e.height(this.element);var d=this.element.find(".week-calendar-header").outerHeight();var f=this.element.find(".calendar-nav").outerHeight();this.element.find(".calendar-scrollable-grid").height(g-f-d)}},_setupEventDelegation:function(){var d=this;var e=this.options;this.element.click(function(g){var f=c(g.target);if(f.data("preventClick")){return}if(f.hasClass("cal-event")){e.eventClick(f.data("calEvent"),f,g)}else{if(f.parent().hasClass("cal-event")){e.eventClick(f.parent().data("calEvent"),f.parent(),g)}}}).mouseover(function(g){var f=c(g.target);if(d._isDraggingOrResizing(f)){return}if(f.hasClass("cal-event")){e.eventMouseover(f.data("calEvent"),f,g)}}).mouseout(function(g){var f=c(g.target);if(d._isDraggingOrResizing(f)){return}if(f.hasClass("cal-event")){if(f.data("sizing")){return}e.eventMouseout(f.data("calEvent"),f,g)}})},_isDraggingOrResizing:function(d){return d.hasClass("ui-draggable-dragging")||d.hasClass("ui-resizable-resizing")},_renderCalendar:function(){var m,s,p,l,n;var o=this;var q=this.options;m=c('<div class="week-calendar">').appendTo(o.element);if(q.buttons){s='<div class="calendar-nav"> <button class="today">'+q.buttonText.today+'</button> <button class="prev">'+q.buttonText.lastWeek+'</button> <button class="next">'+q.buttonText.nextWeek+"</button> </div>";c(s).appendTo(m);m.find(".calendar-nav .today").click(function(){o.element.weekCalendar("today");return false});m.find(".calendar-nav .prev").click(function(){o.element.weekCalendar("prevWeek");return false});m.find(".calendar-nav .next").click(function(){o.element.weekCalendar("nextWeek");return false})}p='<table class="week-calendar-header"><tbody><tr><td class="time-column-header"></td>';for(var k=1;k<=7;k++){p+='<td class="day-column-header day-'+k+'"></td>'}p+='<td class="scrollbar-shim"></td></tr></tbody></table>';l='<div class="calendar-scrollable-grid"> <table class="week-calendar-time-slots"> <tbody> <tr> <td class="grid-timeslot-header"></td> <td colspan="7"> <div class="time-slot-wrapper"> <div class="time-slots">';var e=q.businessHours.limitDisplay?q.businessHours.start:0;var f=q.businessHours.limitDisplay?q.businessHours.end:24;for(var k=e;k<f;k++){for(var g=0;g<q.timeslotsPerHour-1;g++){l+='<div class="time-slot"></div>'}l+='<div class="time-slot hour-end"></div>'}l+='</div></div></td></tr><tr><td class="grid-timeslot-header">';for(var k=e;k<f;k++){var d=(q.businessHours.start<=k&&q.businessHours.end>k)?"business-hours":"";l+='<div class="hour-header '+d+'">';if(q.use24Hour){l+='<div class="time-header-cell">'+o._24HourForIndex(k)+"</div>"}else{l+='<div class="time-header-cell">'+o._hourForIndex(k)+'<span class="am-pm">'+o._amOrPm(k)+"</span></div>"}l+="</div>"}l+="</td>";for(var k=1;k<=7;k++){l+='<td class="day-column day-'+k+'"><div class="day-column-inner"></div></td>'}l+="</tr></tbody></table></div>";c(p+l).appendTo(m);n=m.find(".day-column-inner");n.each(function(j,t){c(this).height(q.timeslotHeight*q.timeslotsPerDay);if(!q.readonly){o._addDroppableToWeekDay(c(this));o._setupEventCreationForWeekDay(c(this))}});m.find(".time-slot").height(q.timeslotHeight-1);m.find(".time-header-cell").css({height:(q.timeslotHeight*q.timeslotsPerHour)-11,padding:5})},_setupEventCreationForWeekDay:function(d){var e=this;var f=this.options;d.mousedown(function(m){var g=c(m.target);if(g.hasClass("day-column-inner")){var k=c('<div class="cal-event new-cal-event new-cal-event-creating"></div>');k.css({lineHeight:(f.timeslotHeight-2)+"px",fontSize:(f.timeslotHeight/2)+"px"});g.append(k);var l=g.offset().top;var n=m.pageY-l;var i=(n-(n%f.timeslotHeight))/f.timeslotHeight;var j=i*f.timeslotHeight;k.css({top:j});g.bind("mousemove.newevent",function(q){k.show();k.addClass("ui-resizable-resizing");var o=Math.round(q.pageY-l-j);var s=o%f.timeslotHeight;if(s<(o/2)){var p=o-s;k.css("height",p<f.timeslotHeight?f.timeslotHeight:p)}else{k.css("height",o+(f.timeslotHeight-s))}}).mouseup(function(){g.unbind("mousemove.newevent");k.addClass("ui-corner-all")})}}).mouseup(function(n){var i=c(n.target);var g=i.closest(".day-column-inner");var m=g.find(".new-cal-event-creating");if(m.length){if(!m.hasClass("ui-resizable-resizing")){m.css({height:f.timeslotHeight*f.defaultEventLength}).show()}var o=parseInt(m.css("top"));var k=e._getEventDurationFromPositionedEventElement(g,m,o);m.remove();var l={start:k.start,end:k.end,title:f.newEventText};var j=e._renderEvent(l,g);if(!f.allowCalEventOverlap){e._adjustForEventCollisions(g,j,l,l);e._positionEvent(g,j)}else{e._adjustOverlappingEvents(g)}f.eventNew(k,j)}})},_loadCalEvents:function(j){var i,d,k,e;var f=this;var g=this.options;i=j||g.date;d=f._dateFirstDayOfWeek(i);weekEndDate=f._dateLastMilliOfWeek(i);g.calendarBeforeLoad(f.element);f.element.data("startDate",d);f.element.data("endDate",weekEndDate);e=f.element.find(".day-column-inner");f._updateDayColumnHeader(e);if(typeof g.data=="string"){if(g.loading){g.loading(true)}var l={};l[g.startParam||"start"]=Math.round(d.getTime()/1000);l[g.endParam||"end"]=Math.round(weekEndDate.getTime()/1000);c.getJSON(g.data,l,function(m){f._renderEvents(m,e);if(g.loading){g.loading(false)}})}else{if(c.isFunction(g.data)){g.data(d,weekEndDate,function(m){f._renderEvents(m,e)})}else{if(g.data){f._renderEvents(g.data,e)}}}f._disableTextSelect(e)},_updateDayColumnHeader:function(d){var e=this;var f=this.options;var g=e._cloneDate(e.element.data("startDate"));e.element.find(".week-calendar-header td.day-column-header").each(function(k,l){var j=f.useShortDayNames?f.shortDays[g.getDay()]:f.longDays[g.getDay()];c(this).html(j+"<br/>"+e._formatDate(g,f.dateFormat));if(e._isToday(g)){c(this).addClass("today")}else{c(this).removeClass("today")}g=e._addDays(g,1)});g=e._dateFirstDayOfWeek(e._cloneDate(e.element.data("startDate")));d.each(function(j,k){c(this).data("startDate",e._cloneDate(g));c(this).data("endDate",new Date(g.getTime()+(a-1)));if(e._isToday(g)){c(this).parent().addClass("today")}else{c(this).parent().removeClass("today")}g=e._addDays(g,1)})},_renderEvents:function(i,d){var e=this;var g=this.options;var f;if(c.isArray(i)){f=e._cleanEvents(i)}else{if(i.events){f=e._cleanEvents(i.events)}}if(i.options){var j=false;c.each(i.options,function(k,l){if(l!==g[k]){g[k]=l;j=true}});e._computeOptions();if(j){e.element.empty();e._renderCalendar();d=e.element.find(".week-calendar-time-slots .day-column-inner");e._updateDayColumnHeader(d);e._resizeCalendar()}}c.each(f,function(l,m){var k=e._findWeekDayForEvent(m,d);if(k){e._renderEvent(m,k)}});d.each(function(){e._adjustOverlappingEvents(c(this))});g.calendarAfterLoad(e.element);if(!f.length){g.noEvents()}},_renderEvent:function(l,d){var e=this;var g=this.options;if(l.start.getTime()>l.end.getTime()){return}var j,f,i,k;j=l.id?"cal-event":"cal-event new-cal-event";f='<div class="'+j+' ui-corner-all"> <div class="time ui-corner-all"></div> <div class="title"></div></div>';i=c(f);k=g.eventRender(l,i);i=k?k.appendTo(d):i.appendTo(d);i.css({lineHeight:(g.timeslotHeight-2)+"px",fontSize:(g.timeslotHeight/2)+"px"});e._refreshEventDetails(l,i);e._positionEvent(d,i);i.show();if(!g.readonly&&g.resizable(l,i)){e._addResizableToCalEvent(l,i,d)}if(!g.readonly&&g.draggable(l,i)){e._addDraggableToCalEvent(l,i)}g.eventAfterRender(l,i);return i},_adjustOverlappingEvents:function(e){var f=this;if(f.options.allowCalEventOverlap){var d=f._groupOverlappingEventElements(e);c.each(d,function(){var j=this.length;var k=this;if(f.options.overlapEventsSeparate){var g=100/j;var i=g}else{var g=(100-(j*10));var i=(100-g)/(j-1)}c.each(this,function(l){var m=(l*i);if(!f.options.overlapEventsSeparate){c(this).bind("mouseover.z-index",function(){var n=c(this);c.each(k,function(){c(this).css({"z-index":"1"})});n.css({"z-index":"3"})})}c(this).css({width:g+"%",left:m+"%",right:0})})})}},_groupOverlappingEventElements:function(e){var m=this;var j=e.find(".cal-event");var d=j.sort(function(q,p){return c(q).data("calEvent").start.getTime()-c(p).data("calEvent").start.getTime()});var k;var f=[];var l=[];var o;var g=0;var n=0;var i=0;c.each(d,function(){o=c(this);g=o.data("calEvent").start.getTime();n=o.data("calEvent").end.getTime();o.css({width:"100%",left:"0%",right:"","z-index":"1"});o.unbind("mouseover.z-index");if(o.data("calEvent").start.getTime()<i){return}c.each(d,function(){if(o.data("calEvent").id==c(this).data("calEvent").id||g>c(this).data("calEvent").start.getTime()+1||n<c(this).data("calEvent").start.getTime()+1){return}if(c(this).data("calEvent").end.getTime()>n){n=c(this).data("calEvent").end.getTime()}if(c.inArray(c(this),l)==-1){l.push(c(this))}if(c.inArray(o,l)==-1){l.push(o)}});if(l.length){l.sort(function(q,p){if(c(q).data("calEvent").start.getTime()>c(p).data("calEvent").start.getTime()){return 1}else{if(c(q).data("calEvent").start.getTime()<c(p).data("calEvent").start.getTime()){return -1}else{return(c(q).data("calEvent").end.getTime()-c(q).data("calEvent").start.getTime())-(c(p).data("calEvent").end.getTime()-c(p).data("calEvent").start.getTime())}}});f.push(l);l=[];i=n}});return f},_compareGroups:function(e,d){if(e.length!=d.length){return false}for(var f=0;f<e.length;f++){if(e[f].data("calEvent").id!=d[f].data("calEvent").id){return false}}return true},_findWeekDayForEvent:function(f,e){var d;e.each(function(){if(c(this).data("startDate").getTime()<=f.start.getTime()&&c(this).data("endDate").getTime()>=f.end.getTime()){d=c(this);return false}});return d},_updateEventInCalendar:function(g){var e=this;var f=this.options;e._cleanEvent(g);if(g.id){e.element.find(".cal-event").each(function(){if(c(this).data("calEvent").id===g.id||c(this).hasClass("new-cal-event")){c(this).remove();return false}})}var d=e._findWeekDayForEvent(g,e.element.find(".week-calendar-time-slots .day-column-inner"));if(d){e._renderEvent(g,d);e._adjustOverlappingEvents(d)}},_positionEvent:function(f,j){var n=this.options;var m=j.data("calEvent");var k=f.height()/n.millisToDisplay;var g=n.businessHours.limitDisplay?n.businessHours.start:0;var i=m.start.getTime()-new Date(m.start.getFullYear(),m.start.getMonth(),m.start.getDate(),g).getTime();var e=m.end.getTime()-m.start.getTime();var l=k*i;var d=k*e;j.css({top:l,height:d})},_getEventDurationFromPositionedEventElement:function(e,j,i){var g=this.options;var d=g.businessHours.limitDisplay?g.businessHours.start*60*60*1000:0;var k=new Date(e.data("startDate").getTime()+d+Math.round(i/g.timeslotHeight)*g.millisPerTimeslot);var f=new Date(k.getTime()+(j.height()/g.timeslotHeight)*g.millisPerTimeslot);return{start:k,end:f}},_adjustForEventCollisions:function(e,i,j,g,f){var m=this.options;if(m.allowCalEventOverlap){return}var l,d;var k=this;e.find(".cal-event").not(i).each(function(){var n=c(this).data("calEvent");if(j.start.getTime()<n.end.getTime()&&j.end.getTime()>=n.end.getTime()){l=n.end}if(j.end.getTime()>n.start.getTime()&&j.start.getTime()<=n.start.getTime()){d=n.start}if(j.end.getTime()<=n.end.getTime()&&j.start.getTime()>=n.start.getTime()){l=g.start;d=g.end;return false}});j.start=l||j.start;if(l&&f){j.end=new Date(l.getTime()+(g.end.getTime()-g.start.getTime()));k._adjustForEventCollisions(e,i,j,g)}else{j.end=d||j.end}if(j.start.getTime()>=j.end.getTime()){j.start=g.start;j.end=g.end}i.data("calEvent",j)},_addDraggableToCalEvent:function(i,g){var e=this;var f=this.options;var d=e._findWeekDayForEvent(i,e.element.find(".week-calendar-time-slots .day-column-inner"));g.draggable({handle:".time",containment:".calendar-scrollable-grid",revert:"valid",opacity:0.5,grid:[g.outerWidth()+1,f.timeslotHeight],start:function(j,k){var l=k.draggable;f.eventDrag(i,l)}})},_addDroppableToWeekDay:function(d){var e=this;var f=this.options;d.droppable({accept:".cal-event",drop:function(i,n){var k=n.draggable;var m=Math.round(parseInt(n.position.top));var j=e._getEventDurationFromPositionedEventElement(d,k,m);var l=k.data("calEvent");var o=c.extend(true,{start:j.start,end:j.end},l);e._adjustForEventCollisions(d,k,o,l,true);var p=e.element.find(".day-column-inner");var g=e._renderEvent(o,e._findWeekDayForEvent(o,p));k.hide();f.eventDrop(o,l,g);k.data("preventClick",true);setTimeout(function(){var q=e._findWeekDayForEvent(k.data("calEvent"),e.element.find(".week-calendar-time-slots .day-column-inner"));k.remove();if(q.data("startDate")!=d.data("startDate")){e._adjustOverlappingEvents(q)}e._adjustOverlappingEvents(d)},500)}})},_addResizableToCalEvent:function(i,g,d){var e=this;var f=this.options;g.resizable({grid:f.timeslotHeight,containment:d,handles:"s",minHeight:f.timeslotHeight,stop:function(l,m){var n=m.element;var k=new Date(n.data("calEvent").start.getTime()+(n.height()/f.timeslotHeight)*f.millisPerTimeslot);var j=c.extend(true,{start:i.start,end:k},i);e._adjustForEventCollisions(d,n,j,i);e._refreshEventDetails(j,n);e._positionEvent(d,n);f.eventResize(j,i,n);n.data("preventClick",true);setTimeout(function(){n.removeData("preventClick")},500)}})},_refreshEventDetails:function(g,f){var d=this;var e=this.options;f.find(".time").text(d._formatDate(g.start,e.timeFormat)+e.timeSeparator+d._formatDate(g.end,e.timeFormat));f.find(".title").text(g.title);f.data("calEvent",g)},_clearCalendar:function(){this.element.find(".day-column-inner div").remove()},_scrollToHour:function(e){var f=this;var g=this.options;var i=this.element.find(".calendar-scrollable-grid");var j=e;if(f.options.businessHours.limitDisplay){if(e<f.options.businessHours.start){j=0}else{if(e>f.options.businessHours.end){j=f.options.businessHours.end-f.options.businessHours.start-1}}}var d=this.element.find(".grid-timeslot-header .hour-header:eq("+j+")");i.animate({scrollTop:0},0,function(){var l=d.offset().top;var k=l-i.offset().top-d.outerHeight();i.animate({scrollTop:k},g.scrollToHourMillis)})},_hourForIndex:function(d){if(d===0){return 12}else{if(d<13){return d}else{return d-12}}},_24HourForIndex:function(d){if(d===0){return"00:00"}else{if(d<10){return"0"+d+":00"}else{return d+":00"}}},_amOrPm:function(d){return d<12?"AM":"PM"},_isToday:function(e){var f=this._cloneDate(e);this._clearTime(f);var d=new Date();this._clearTime(d);return d.getTime()===f.getTime()},_cleanEvents:function(e){var d=this;c.each(e,function(f,g){d._cleanEvent(g)});return e},_cleanEvent:function(d){if(d.date){d.start=d.date}d.start=this._cleanDate(d.start);d.end=this._cleanDate(d.end);if(!d.end){d.end=this._addDays(this._cloneDate(d.start),1)}},_disableTextSelect:function(d){d.each(function(){if(c.browser.mozilla){c(this).css("MozUserSelect","none")}else{if(c.browser.msie){c(this).bind("selectstart",function(){return false})}else{c(this).mousedown(function(){return false})}}})},_dateFirstDayOfWeek:function(e){var d=this;var f=new Date(e.getFullYear(),e.getMonth(),e.getDate());var g=d._getAdjustedDayIndex(f)*86400000;return new Date(f.getTime()-g)},_dateLastDayOfWeek:function(e){var d=this;var f=new Date(e.getFullYear(),e.getMonth(),e.getDate());var g=(6-d._getAdjustedDayIndex(f))*a;return new Date(f.getTime()+g)},_getAdjustedDayIndex:function(e){var f=new Date(e.getFullYear(),e.getMonth(),e.getDate());var d=f.getDay();var g=[0,1,2,3,4,5,6];this._rotate(g,this.options.firstDayOfWeek);return g[d]},_dateLastMilliOfWeek:function(d){var e=this._dateLastDayOfWeek(d);return new Date(e.getTime()+(a-1))},_clearTime:function(e){e.setHours(0);e.setMinutes(0);e.setSeconds(0);e.setMilliseconds(0);return e},_addDays:function(f,g,e){f.setDate(f.getDate()+g);if(e){return f}return this._clearTime(f)},_rotate:function(f,j){for(var e=f.length,j=(Math.abs(j)>=e&&(j%=e),j<0&&(j+=e),j),g,d;j;j=(Math.ceil(e/j)-1)*j-e+(e=j)){for(g=e;g>j;d=f[--g],f[g]=f[g-j],f[g-j]=d){}}return f},_cloneDate:function(e){return new Date(+e)},_cleanDate:function(e){if(typeof e=="string"){return c.weekCalendar.parseISO8601(e,true)||Date.parse(e)||new Date(parseInt(e))}if(typeof e=="number"){return new Date(e)}return e},_formatDate:function(f,k){var e=this.options;var j="";for(var g=0;g<k.length;g++){var d=k.charAt(g);if(c.isFunction(this._replaceChars[d])){j+=this._replaceChars[d](f,e)}else{j+=d}}return j},_replaceChars:{d:function(d){return(d.getDate()<10?"0":"")+d.getDate()},D:function(e,d){return d.shortDays[e.getDay()]},j:function(d){return d.getDate()},l:function(e,d){return d.longDays[e.getDay()]},N:function(d){return d.getDay()+1},S:function(d){return(d.getDate()%10==1&&d.getDate()!=11?"st":(d.getDate()%10==2&&d.getDate()!=12?"nd":(d.getDate()%10==3&&d.getDate()!=13?"rd":"th")))},w:function(d){return d.getDay()},z:function(d){return"Not Yet Supported"},W:function(d){return"Not Yet Supported"},F:function(e,d){return d.longMonths[e.getMonth()]},m:function(d){return(d.getMonth()<9?"0":"")+(d.getMonth()+1)},M:function(e,d){return d.shortMonths[e.getMonth()]},n:function(d){return d.getMonth()+1},t:function(d){return"Not Yet Supported"},L:function(d){return"Not Yet Supported"},o:function(d){return"Not Supported"},Y:function(d){return d.getFullYear()},y:function(d){return(""+d.getFullYear()).substr(2)},a:function(d){return d.getHours()<12?"am":"pm"},A:function(d){return d.getHours()<12?"AM":"PM"},B:function(d){return"Not Yet Supported"},g:function(d){return d.getHours()%12||12},G:function(d){return d.getHours()},h:function(d){return((d.getHours()%12||12)<10?"0":"")+(d.getHours()%12||12)},H:function(d){return(d.getHours()<10?"0":"")+d.getHours()},i:function(d){return(d.getMinutes()<10?"0":"")+d.getMinutes()},s:function(d){return(d.getSeconds()<10?"0":"")+d.getSeconds()},e:function(d){return"Not Yet Supported"},I:function(d){return"Not Supported"},O:function(d){return(d.getTimezoneOffset()<0?"-":"+")+(d.getTimezoneOffset()/60<10?"0":"")+(d.getTimezoneOffset()/60)+"00"},T:function(d){return"Not Yet Supported"},Z:function(d){return d.getTimezoneOffset()*60},c:function(d){return"Not Yet Supported"},r:function(d){return d.toString()},U:function(d){return d.getTime()/1000}}});c.extend(c.ui.weekCalendar,{version:"1.2.1",getter:["getTimeslotTimes","getData","formatDate","formatTime"],defaults:{date:new Date(),timeFormat:"h:i a",dateFormat:"M d, Y",use24Hour:false,firstDayOfWeek:0,useShortDayNames:false,timeSeparator:" to ",startParam:"start",endParam:"end",businessHours:{start:8,end:18,limitDisplay:false},newEventText:"New Event",timeslotHeight:20,defaultEventLength:2,timeslotsPerHour:4,buttons:true,buttonText:{today:"today",lastWeek:" < ",nextWeek:" > "},scrollToHourMillis:500,allowCalEventOverlap:false,overlapEventsSeparate:false,readonly:false,draggable:function(e,d){return true},resizable:function(e,d){return true},eventClick:function(){},eventRender:function(e,d){return d},eventAfterRender:function(e,d){return d},eventDrag:function(e,d){},eventDrop:function(e,d){},eventResize:function(e,d){},eventNew:function(e,d){},eventMouseover:function(e,d){},eventMouseout:function(e,d){},calendarBeforeLoad:function(d){},calendarAfterLoad:function(d){},noEvents:function(){},shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longMonths:["January","February","March","April","May","June","July","August","September","October","November","December"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]}});var a=86400000;var b=a*7;c.weekCalendar=function(){return{parseISO8601:function(g,e){var i="([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?";var k=g.match(new RegExp(i));if(!k){return null}var j=0;var f=new Date(k[1],0,1);if(k[3]){f.setMonth(k[3]-1)}if(k[5]){f.setDate(k[5])}if(k[7]){f.setHours(k[7])}if(k[8]){f.setMinutes(k[8])}if(k[10]){f.setSeconds(k[10])}if(k[12]){f.setMilliseconds(Number("0."+k[12])*1000)}if(!e){if(k[14]){j=(Number(k[16])*60)+Number(k[17]);j*=((k[15]=="-")?1:-1)}j-=f.getTimezoneOffset()}return new Date(Number(f)+(j*60*1000))}}}()})(jQuery);
-/*
-* Title: jMonthCalendar 1.3.2-beta2
-* Dependencies: jQuery 1.3.0 +
-* Author: Kyle LeNeau
-* Email: kyle.leneau@gmail.com
-* Project Hompage: http://www.bytecyclist.com/projects/jmonthcalendar
-* Source: http://code.google.com/p/jmonthcalendar
-*
-*/
+(function(c){c.widget("ui.weekCalendar",{_init:function(){var d=this;d._computeOptions();d._setupEventDelegation();d._renderCalendar();d._loadCalEvents();d._resizeCalendar();d._scrollToHour(d.options.date.getHours());c(window).unbind("resize.weekcalendar");c(window).bind("resize.weekcalendar",function(){d._resizeCalendar()})},refresh:function(){this._clearCalendar();this._loadCalEvents(this.element.data("startDate"))},clear:function(){this._clearCalendar()},today:function(){this._clearCalendar();this._loadCalEvents(new Date())},prevWeek:function(){var d=new Date(this.element.data("startDate").getTime()-(b/6));this._clearCalendar();this._loadCalEvents(d)},nextWeek:function(){var d=new Date(this.element.data("startDate").getTime()+b+(b/7));this._clearCalendar();this._loadCalEvents(d)},gotoWeek:function(d){this._clearCalendar();this._loadCalEvents(d)},removeEvent:function(d){this.element.find(".cal-event").each(function(){if(c(this).data("calEvent").id===d){c(this).fadeOut(function(){c(this).remove()});return false}})},removeUnsavedEvents:function(){this.element.find(".new-cal-event").fadeOut(function(){c(this).remove()})},updateEvent:function(d){this._updateEventInCalendar(d)},getTimeslotTimes:function(g){var f=this.options;var e=f.businessHours.limitDisplay?f.businessHours.start:0;var d=new Date(g.getFullYear(),g.getMonth(),g.getDate(),e);var m=[];var k=d.getTime();for(var j=0;j<f.timeslotsPerDay;j++){var l=k+f.millisPerTimeslot;m[j]={start:new Date(k),startFormatted:this._formatDate(new Date(k),f.timeFormat),end:new Date(l),endFormatted:this._formatDate(new Date(l),f.timeFormat)};k=l}return m},formatDate:function(d,e){if(e){return this._formatDate(d,e)}else{return this._formatDate(d,this.options.dateFormat)}},formatTime:function(d,e){if(e){return this._formatDate(d,e)}else{return this._formatDate(d,this.options.timeFormat)}},getData:function(d){return this._getData(d)},_computeOptions:function(){var d=this.options;if(d.businessHours.limitDisplay){d.timeslotsPerDay=d.timeslotsPerHour*(d.businessHours.end-d.businessHours.start);d.millisToDisplay=(d.businessHours.end-d.businessHours.start)*60*60*1000;d.millisPerTimeslot=d.millisToDisplay/d.timeslotsPerDay}else{d.timeslotsPerDay=d.timeslotsPerHour*24;d.millisToDisplay=a;d.millisPerTimeslot=a/d.timeslotsPerDay}},_resizeCalendar:function(){var e=this.options;if(e&&c.isFunction(e.height)){var g=e.height(this.element);var d=this.element.find(".week-calendar-header").outerHeight();var f=this.element.find(".calendar-nav").outerHeight();this.element.find(".calendar-scrollable-grid").height(g-f-d)}},_setupEventDelegation:function(){var d=this;var e=this.options;this.element.click(function(g){var f=c(g.target);if(f.data("preventClick")){return}if(f.hasClass("cal-event")){e.eventClick(f.data("calEvent"),f,g)}else{if(f.parent().hasClass("cal-event")){e.eventClick(f.parent().data("calEvent"),f.parent(),g)}}}).mouseover(function(g){var f=c(g.target);if(d._isDraggingOrResizing(f)){return}if(f.hasClass("cal-event")){e.eventMouseover(f.data("calEvent"),f,g)}}).mouseout(function(g){var f=c(g.target);if(d._isDraggingOrResizing(f)){return}if(f.hasClass("cal-event")){if(f.data("sizing")){return}e.eventMouseout(f.data("calEvent"),f,g)}})},_isDraggingOrResizing:function(d){return d.hasClass("ui-draggable-dragging")||d.hasClass("ui-resizable-resizing")},_renderCalendar:function(){var m,s,p,l,n;var o=this;var q=this.options;m=c('<div class="week-calendar">').appendTo(o.element);if(q.buttons){s='<div class="calendar-nav"> <button class="today">'+q.buttonText.today+'</button> <button class="prev">'+q.buttonText.lastWeek+'</button> <button class="next">'+q.buttonText.nextWeek+"</button> </div>";c(s).appendTo(m);m.find(".calendar-nav .today").click(function(){o.element.weekCalendar("today");return false});m.find(".calendar-nav .prev").click(function(){o.element.weekCalendar("prevWeek");return false});m.find(".calendar-nav .next").click(function(){o.element.weekCalendar("nextWeek");return false})}p='<table class="week-calendar-header"><tbody><tr><td class="time-column-header"></td>';for(var k=1;k<=7;k++){p+='<td class="day-column-header day-'+k+'"></td>'}p+='<td class="scrollbar-shim"></td></tr></tbody></table>';l='<div class="calendar-scrollable-grid"> <table class="week-calendar-time-slots"> <tbody> <tr> <td class="grid-timeslot-header"></td> <td colspan="7"> <div class="time-slot-wrapper"> <div class="time-slots">';var e=q.businessHours.limitDisplay?q.businessHours.start:0;var f=q.businessHours.limitDisplay?q.businessHours.end:24;for(var k=e;k<f;k++){for(var g=0;g<q.timeslotsPerHour-1;g++){l+='<div class="time-slot"></div>'}l+='<div class="time-slot hour-end"></div>'}l+='</div></div></td></tr><tr><td class="grid-timeslot-header">';for(var k=e;k<f;k++){var d=(q.businessHours.start<=k&&q.businessHours.end>k)?"business-hours":"";l+='<div class="hour-header '+d+'">';if(q.use24Hour){l+='<div class="time-header-cell">'+o._24HourForIndex(k)+"</div>"}else{l+='<div class="time-header-cell">'+o._hourForIndex(k)+'<span class="am-pm">'+o._amOrPm(k)+"</span></div>"}l+="</div>"}l+="</td>";for(var k=1;k<=7;k++){l+='<td class="day-column day-'+k+'"><div class="day-column-inner"></div></td>'}l+="</tr></tbody></table></div>";c(p+l).appendTo(m);n=m.find(".day-column-inner");n.each(function(j,t){c(this).height(q.timeslotHeight*q.timeslotsPerDay);if(!q.readonly){o._addDroppableToWeekDay(c(this));o._setupEventCreationForWeekDay(c(this))}});m.find(".time-slot").height(q.timeslotHeight-1);m.find(".time-header-cell").css({height:(q.timeslotHeight*q.timeslotsPerHour)-11,padding:5})},_setupEventCreationForWeekDay:function(d){var e=this;var f=this.options;d.mousedown(function(m){var g=c(m.target);if(g.hasClass("day-column-inner")){var k=c('<div class="cal-event new-cal-event new-cal-event-creating"></div>');k.css({lineHeight:(f.timeslotHeight-2)+"px",fontSize:(f.timeslotHeight/2)+"px"});g.append(k);var l=g.offset().top;var n=m.pageY-l;var i=(n-(n%f.timeslotHeight))/f.timeslotHeight;var j=i*f.timeslotHeight;k.css({top:j});g.bind("mousemove.newevent",function(q){k.show();k.addClass("ui-resizable-resizing");var o=Math.round(q.pageY-l-j);var s=o%f.timeslotHeight;if(s<(o/2)){var p=o-s;k.css("height",p<f.timeslotHeight?f.timeslotHeight:p)}else{k.css("height",o+(f.timeslotHeight-s))}}).mouseup(function(){g.unbind("mousemove.newevent");k.addClass("ui-corner-all")})}}).mouseup(function(n){var i=c(n.target);var g=i.closest(".day-column-inner");var m=g.find(".new-cal-event-creating");if(m.length){if(!m.hasClass("ui-resizable-resizing")){m.css({height:f.timeslotHeight*f.defaultEventLength}).show()}var o=parseInt(m.css("top"));var k=e._getEventDurationFromPositionedEventElement(g,m,o);m.remove();var l={start:k.start,end:k.end,title:f.newEventText};var j=e._renderEvent(l,g);if(!f.allowCalEventOverlap){e._adjustForEventCollisions(g,j,l,l);e._positionEvent(g,j)}else{e._adjustOverlappingEvents(g)}f.eventNew(k,j)}})},_loadCalEvents:function(j){var i,d,k,e;var f=this;var g=this.options;i=j||g.date;d=f._dateFirstDayOfWeek(i);weekEndDate=f._dateLastMilliOfWeek(i);g.calendarBeforeLoad(f.element);f.element.data("startDate",d);f.element.data("endDate",weekEndDate);e=f.element.find(".day-column-inner");f._updateDayColumnHeader(e);if(typeof g.data=="string"){if(g.loading){g.loading(true)}var l={};l[g.startParam||"start"]=Math.round(d.getTime()/1000);l[g.endParam||"end"]=Math.round(weekEndDate.getTime()/1000);c.getJSON(g.data,l,function(m){f._renderEvents(m,e);if(g.loading){g.loading(false)}})}else{if(c.isFunction(g.data)){g.data(d,weekEndDate,function(m){f._renderEvents(m,e)})}else{if(g.data){f._renderEvents(g.data,e)}}}f._disableTextSelect(e)},_updateDayColumnHeader:function(d){var e=this;var f=this.options;var g=e._cloneDate(e.element.data("startDate"));e.element.find(".week-calendar-header td.day-column-header").each(function(k,l){var j=f.useShortDayNames?f.shortDays[g.getDay()]:f.longDays[g.getDay()];c(this).html(j+"<br/>"+e._formatDate(g,f.dateFormat));if(e._isToday(g)){c(this).addClass("today")}else{c(this).removeClass("today")}g=e._addDays(g,1)});g=e._dateFirstDayOfWeek(e._cloneDate(e.element.data("startDate")));d.each(function(j,k){c(this).data("startDate",e._cloneDate(g));c(this).data("endDate",new Date(g.getTime()+(a-1)));if(e._isToday(g)){c(this).parent().addClass("today")}else{c(this).parent().removeClass("today")}g=e._addDays(g,1)})},_renderEvents:function(i,d){var e=this;var g=this.options;var f;if(c.isArray(i)){f=e._cleanEvents(i)}else{if(i.events){f=e._cleanEvents(i.events)}}if(i.options){var j=false;c.each(i.options,function(k,l){if(l!==g[k]){g[k]=l;j=true}});e._computeOptions();if(j){e.element.empty();e._renderCalendar();d=e.element.find(".week-calendar-time-slots .day-column-inner");e._updateDayColumnHeader(d);e._resizeCalendar()}}c.each(f,function(l,m){var k=e._findWeekDayForEvent(m,d);if(k){e._renderEvent(m,k)}});d.each(function(){e._adjustOverlappingEvents(c(this))});g.calendarAfterLoad(e.element);if(!f.length){g.noEvents()}},_renderEvent:function(l,d){var e=this;var g=this.options;if(l.start.getTime()>l.end.getTime()){return}var j,f,i,k;j=l.id?"cal-event":"cal-event new-cal-event";f='<div class="'+j+' ui-corner-all"> <div class="time ui-corner-all"></div> <div class="title"></div></div>';i=c(f);k=g.eventRender(l,i);i=k?k.appendTo(d):i.appendTo(d);i.css({lineHeight:(g.timeslotHeight-2)+"px",fontSize:(g.timeslotHeight/2)+"px"});e._refreshEventDetails(l,i);e._positionEvent(d,i);i.show();if(!g.readonly&&g.resizable(l,i)){e._addResizableToCalEvent(l,i,d)}if(!g.readonly&&g.draggable(l,i)){e._addDraggableToCalEvent(l,i)}g.eventAfterRender(l,i);return i},_adjustOverlappingEvents:function(e){var f=this;if(f.options.allowCalEventOverlap){var d=f._groupOverlappingEventElements(e);c.each(d,function(){var j=this.length;var k=this;if(f.options.overlapEventsSeparate){var g=100/j;var i=g}else{var g=(100-(j*10));var i=(100-g)/(j-1)}c.each(this,function(l){var m=(l*i);if(!f.options.overlapEventsSeparate){c(this).bind("mouseover.z-index",function(){var n=c(this);c.each(k,function(){c(this).css({"z-index":"1"})});n.css({"z-index":"3"})})}c(this).css({width:g+"%",left:m+"%",right:0})})})}},_groupOverlappingEventElements:function(e){var m=this;var j=e.find(".cal-event");var d=j.sort(function(q,p){return c(q).data("calEvent").start.getTime()-c(p).data("calEvent").start.getTime()});var k;var f=[];var l=[];var o;var g=0;var n=0;var i=0;c.each(d,function(){o=c(this);g=o.data("calEvent").start.getTime();n=o.data("calEvent").end.getTime();o.css({width:"100%",left:"0%",right:"","z-index":"1"});o.unbind("mouseover.z-index");if(o.data("calEvent").start.getTime()<i){return}c.each(d,function(){if(o.data("calEvent").id==c(this).data("calEvent").id||g>c(this).data("calEvent").start.getTime()+1||n<c(this).data("calEvent").start.getTime()+1){return}if(c(this).data("calEvent").end.getTime()>n){n=c(this).data("calEvent").end.getTime()}if(c.inArray(c(this),l)==-1){l.push(c(this))}if(c.inArray(o,l)==-1){l.push(o)}});if(l.length){l.sort(function(q,p){if(c(q).data("calEvent").start.getTime()>c(p).data("calEvent").start.getTime()){return 1}else{if(c(q).data("calEvent").start.getTime()<c(p).data("calEvent").start.getTime()){return -1}else{return(c(q).data("calEvent").end.getTime()-c(q).data("calEvent").start.getTime())-(c(p).data("calEvent").end.getTime()-c(p).data("calEvent").start.getTime())}}});f.push(l);l=[];i=n}});return f},_compareGroups:function(e,d){if(e.length!=d.length){return false}for(var f=0;f<e.length;f++){if(e[f].data("calEvent").id!=d[f].data("calEvent").id){return false}}return true},_findWeekDayForEvent:function(f,e){var d;e.each(function(){if(c(this).data("startDate").getTime()<=f.start.getTime()&&c(this).data("endDate").getTime()>=f.end.getTime()){d=c(this);return false}});return d},_updateEventInCalendar:function(g){var e=this;var f=this.options;e._cleanEvent(g);if(g.id){e.element.find(".cal-event").each(function(){if(c(this).data("calEvent").id===g.id||c(this).hasClass("new-cal-event")){c(this).remove();return false}})}var d=e._findWeekDayForEvent(g,e.element.find(".week-calendar-time-slots .day-column-inner"));if(d){e._renderEvent(g,d);e._adjustOverlappingEvents(d)}},_positionEvent:function(f,j){var n=this.options;var m=j.data("calEvent");var k=f.height()/n.millisToDisplay;var g=n.businessHours.limitDisplay?n.businessHours.start:0;var i=m.start.getTime()-new Date(m.start.getFullYear(),m.start.getMonth(),m.start.getDate(),g).getTime();var e=m.end.getTime()-m.start.getTime();var l=k*i;var d=k*e;j.css({top:l,height:d})},_getEventDurationFromPositionedEventElement:function(e,j,i){var g=this.options;var d=g.businessHours.limitDisplay?g.businessHours.start*60*60*1000:0;var k=new Date(e.data("startDate").getTime()+d+Math.round(i/g.timeslotHeight)*g.millisPerTimeslot);var f=new Date(k.getTime()+(j.height()/g.timeslotHeight)*g.millisPerTimeslot);return{start:k,end:f}},_adjustForEventCollisions:function(e,i,j,g,f){var m=this.options;if(m.allowCalEventOverlap){return}var l,d;var k=this;e.find(".cal-event").not(i).each(function(){var n=c(this).data("calEvent");if(j.start.getTime()<n.end.getTime()&&j.end.getTime()>=n.end.getTime()){l=n.end}if(j.end.getTime()>n.start.getTime()&&j.start.getTime()<=n.start.getTime()){d=n.start}if(j.end.getTime()<=n.end.getTime()&&j.start.getTime()>=n.start.getTime()){l=g.start;d=g.end;return false}});j.start=l||j.start;if(l&&f){j.end=new Date(l.getTime()+(g.end.getTime()-g.start.getTime()));k._adjustForEventCollisions(e,i,j,g)}else{j.end=d||j.end}if(j.start.getTime()>=j.end.getTime()){j.start=g.start;j.end=g.end}i.data("calEvent",j)},_addDraggableToCalEvent:function(i,g){var e=this;var f=this.options;var d=e._findWeekDayForEvent(i,e.element.find(".week-calendar-time-slots .day-column-inner"));g.draggable({handle:".time",containment:".calendar-scrollable-grid",revert:"valid",opacity:0.5,grid:[g.outerWidth()+1,f.timeslotHeight],start:function(j,k){var l=k.draggable;f.eventDrag(i,l)}})},_addDroppableToWeekDay:function(d){var e=this;var f=this.options;d.droppable({accept:".cal-event",drop:function(i,n){var k=n.draggable;var m=Math.round(parseInt(n.position.top));var j=e._getEventDurationFromPositionedEventElement(d,k,m);var l=k.data("calEvent");var o=c.extend(true,{start:j.start,end:j.end},l);e._adjustForEventCollisions(d,k,o,l,true);var p=e.element.find(".day-column-inner");var g=e._renderEvent(o,e._findWeekDayForEvent(o,p));k.hide();f.eventDrop(o,l,g);k.data("preventClick",true);setTimeout(function(){var q=e._findWeekDayForEvent(k.data("calEvent"),e.element.find(".week-calendar-time-slots .day-column-inner"));k.remove();if(q.data("startDate")!=d.data("startDate")){e._adjustOverlappingEvents(q)}e._adjustOverlappingEvents(d)},500)}})},_addResizableToCalEvent:function(i,g,d){var e=this;var f=this.options;g.resizable({grid:f.timeslotHeight,containment:d,handles:"s",minHeight:f.timeslotHeight,stop:function(l,m){var n=m.element;var k=new Date(n.data("calEvent").start.getTime()+(n.height()/f.timeslotHeight)*f.millisPerTimeslot);var j=c.extend(true,{start:i.start,end:k},i);e._adjustForEventCollisions(d,n,j,i);e._refreshEventDetails(j,n);e._positionEvent(d,n);f.eventResize(j,i,n);n.data("preventClick",true);setTimeout(function(){n.removeData("preventClick")},500)}})},_refreshEventDetails:function(g,f){var d=this;var e=this.options;f.find(".time").text(d._formatDate(g.start,e.timeFormat)+e.timeSeparator+d._formatDate(g.end,e.timeFormat));f.find(".title").text(g.title);f.data("calEvent",g)},_clearCalendar:function(){this.element.find(".day-column-inner div").remove()},_scrollToHour:function(e){var f=this;var g=this.options;var i=this.element.find(".calendar-scrollable-grid");var j=e;if(f.options.businessHours.limitDisplay){if(e<f.options.businessHours.start){j=0}else{if(e>f.options.businessHours.end){j=f.options.businessHours.end-f.options.businessHours.start-1}}}var d=this.element.find(".grid-timeslot-header .hour-header:eq("+j+")");i.animate({scrollTop:0},0,function(){var l=d.offset().top;var k=l-i.offset().top-d.outerHeight();i.animate({scrollTop:k},g.scrollToHourMillis)})},_hourForIndex:function(d){if(d===0){return 12}else{if(d<13){return d}else{return d-12}}},_24HourForIndex:function(d){if(d===0){return"00:00"}else{if(d<10){return"0"+d+":00"}else{return d+":00"}}},_amOrPm:function(d){return d<12?"AM":"PM"},_isToday:function(e){var f=this._cloneDate(e);this._clearTime(f);var d=new Date();this._clearTime(d);return d.getTime()===f.getTime()},_cleanEvents:function(e){var d=this;c.each(e,function(f,g){d._cleanEvent(g)});return e},_cleanEvent:function(d){if(d.date){d.start=d.date}d.start=this._cleanDate(d.start);d.end=this._cleanDate(d.end);if(!d.end){d.end=this._addDays(this._cloneDate(d.start),1)}},_disableTextSelect:function(d){d.each(function(){if(c.browser.mozilla){c(this).css("MozUserSelect","none")}else{if(c.browser.msie){c(this).bind("selectstart",function(){return false})}else{c(this).mousedown(function(){return false})}}})},_dateFirstDayOfWeek:function(e){var d=this;var f=new Date(e.getFullYear(),e.getMonth(),e.getDate());var g=d._getAdjustedDayIndex(f)*86400000;return new Date(f.getTime()-g)},_dateLastDayOfWeek:function(e){var d=this;var f=new Date(e.getFullYear(),e.getMonth(),e.getDate());var g=(6-d._getAdjustedDayIndex(f))*a;return new Date(f.getTime()+g)},_getAdjustedDayIndex:function(e){var f=new Date(e.getFullYear(),e.getMonth(),e.getDate());var d=f.getDay();var g=[0,1,2,3,4,5,6];this._rotate(g,this.options.firstDayOfWeek);return g[d]},_dateLastMilliOfWeek:function(d){var e=this._dateLastDayOfWeek(d);return new Date(e.getTime()+(a-1))},_clearTime:function(e){e.setHours(0);e.setMinutes(0);e.setSeconds(0);e.setMilliseconds(0);return e},_addDays:function(f,g,e){f.setDate(f.getDate()+g);if(e){return f}return this._clearTime(f)},_rotate:function(f,j){for(var e=f.length,j=(Math.abs(j)>=e&&(j%=e),j<0&&(j+=e),j),g,d;j;j=(Math.ceil(e/j)-1)*j-e+(e=j)){for(g=e;g>j;d=f[--g],f[g]=f[g-j],f[g-j]=d){}}return f},_cloneDate:function(e){return new Date(+e)},_cleanDate:function(e){if(typeof e=="string"){return c.weekCalendar.parseISO8601(e,true)||Date.parse(e)||new Date(parseInt(e))}if(typeof e=="number"){return new Date(e)}return e},_formatDate:function(f,k){var e=this.options;var j="";for(var g=0;g<k.length;g++){var d=k.charAt(g);if(c.isFunction(this._replaceChars[d])){j+=this._replaceChars[d](f,e)}else{j+=d}}return j},_replaceChars:{d:function(d){return(d.getDate()<10?"0":"")+d.getDate()},D:function(e,d){return d.shortDays[e.getDay()]},j:function(d){return d.getDate()},l:function(e,d){return d.longDays[e.getDay()]},N:function(d){return d.getDay()+1},S:function(d){return(d.getDate()%10==1&&d.getDate()!=11?"st":(d.getDate()%10==2&&d.getDate()!=12?"nd":(d.getDate()%10==3&&d.getDate()!=13?"rd":"th")))},w:function(d){return d.getDay()},z:function(d){return"Not Yet Supported"},W:function(d){return"Not Yet Supported"},F:function(e,d){return d.longMonths[e.getMonth()]},m:function(d){return(d.getMonth()<9?"0":"")+(d.getMonth()+1)},M:function(e,d){return d.shortMonths[e.getMonth()]},n:function(d){return d.getMonth()+1},t:function(d){return"Not Yet Supported"},L:function(d){return"Not Yet Supported"},o:function(d){return"Not Supported"},Y:function(d){return d.getFullYear()},y:function(d){return(""+d.getFullYear()).substr(2)},a:function(d){return d.getHours()<12?"am":"pm"},A:function(d){return d.getHours()<12?"AM":"PM"},B:function(d){return"Not Yet Supported"},g:function(d){return d.getHours()%12||12},G:function(d){return d.getHours()},h:function(d){return((d.getHours()%12||12)<10?"0":"")+(d.getHours()%12||12)},H:function(d){return(d.getHours()<10?"0":"")+d.getHours()},i:function(d){return(d.getMinutes()<10?"0":"")+d.getMinutes()},s:function(d){return(d.getSeconds()<10?"0":"")+d.getSeconds()},e:function(d){return"Not Yet Supported"},I:function(d){return"Not Supported"},O:function(d){return(d.getTimezoneOffset()<0?"-":"+")+(d.getTimezoneOffset()/60<10?"0":"")+(d.getTimezoneOffset()/60)+"00"},T:function(d){return"Not Yet Supported"},Z:function(d){return d.getTimezoneOffset()*60},c:function(d){return"Not Yet Supported"},r:function(d){return d.toString()},U:function(d){return d.getTime()/1000}}});c.extend(c.ui.weekCalendar,{version:"1.2.1",getter:["getTimeslotTimes","getData","formatDate","formatTime"],defaults:{date:new Date(),timeFormat:"h:i a",dateFormat:"M d, Y",use24Hour:false,firstDayOfWeek:0,useShortDayNames:false,timeSeparator:" to ",startParam:"start",endParam:"end",businessHours:{start:8,end:18,limitDisplay:false},newEventText:"New Event",timeslotHeight:20,defaultEventLength:2,timeslotsPerHour:4,buttons:true,buttonText:{today:"today",lastWeek:" < ",nextWeek:" > "},scrollToHourMillis:500,allowCalEventOverlap:false,overlapEventsSeparate:false,readonly:false,draggable:function(e,d){return true},resizable:function(e,d){return true},eventClick:function(){},eventRender:function(e,d){return d},eventAfterRender:function(e,d){return d},eventDrag:function(e,d){},eventDrop:function(e,d){},eventResize:function(e,d){},eventNew:function(e,d){},eventMouseover:function(e,d){},eventMouseout:function(e,d){},calendarBeforeLoad:function(d){},calendarAfterLoad:function(d){},noEvents:function(){},shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longMonths:["January","February","March","April","May","June","July","August","September","October","November","December"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]}});var a=86400000;var b=a*7;c.weekCalendar=function(){return{parseISO8601:function(g,e){var i="([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?";var k=g.match(new RegExp(i));if(!k){return null}var j=0;var f=new Date(k[1],0,1);if(k[3]){f.setMonth(k[3]-1)}if(k[5]){f.setDate(k[5])}if(k[7]){f.setHours(k[7])}if(k[8]){f.setMinutes(k[8])}if(k[10]){f.setSeconds(k[10])}if(k[12]){f.setMilliseconds(Number("0."+k[12])*1000)}if(!e){if(k[14]){j=(Number(k[16])*60)+Number(k[17]);j*=((k[15]=="-")?1:-1)}j-=f.getTimezoneOffset()}return new Date(Number(f)+(j*60*1000))}}}()})(jQuery);
+/*
+* Title: jMonthCalendar 1.3.2-beta2
+* Dependencies: jQuery 1.3.0 +
+* Author: Kyle LeNeau
+* Email: kyle.leneau@gmail.com
+* Project Hompage: http://www.bytecyclist.com/projects/jmonthcalendar
+* Source: http://code.google.com/p/jmonthcalendar
+*
+*/
(function($){var _boxes=[];var _eventObj={};var _workingDate=null;var _daysInMonth=0;var _firstOfMonth=null;var _lastOfMonth=null;var _gridOffset=0;var _totalDates=0;var _gridRows=0;var _totalBoxes=0;var _dateRange={startDate:null,endDate:null};var cEvents=[];var def={containerId:"#jMonthCalendar",headerHeight:50,firstDayOfWeek:0,calendarStartDate:new Date(),dragableEvents:true,dragHoverClass:"DateBoxOver",navLinks:{enableToday:true,enableNextYear:true,enablePrevYear:true,p:"‹ Prev",n:"Next ›",t:"Today",showMore:"Show More"},onMonthChanging:function(){},onMonthChanged:function(){},onEventLinkClick:function(){},onEventBlockClick:function(){},onEventBlockOver:function(){},onEventBlockOut:function(){},onDayLinkClick:function(){},onDayCellClick:function(){},onDayCellDblClick:function(){},onEventDropped:function(){},onShowMoreClick:function(){}};$.jMonthCalendar=$.J=function(){};var _getJSONDate=function(dateStr){var tDt,k;if(typeof dateStr=="string"){var isoRegPlus=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{7})$/;var isoReg=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})$/;var yyyyMMdd=/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;var newReg=/^new/;var stdReg=/^\\\/Date\(([0-9]{13})-([0-9]{4})\)\\\/$/;if(k=dateStr.match(isoRegPlus)){return new Date(k[1],k[2]-1,k[3],k[4],k[5],k[6])}else{if(k=dateStr.match(isoReg)){return new Date(k[1],k[2]-1,k[3],k[4],k[5],k[6])}else{if(k=dateStr.match(yyyyMMdd)){return new Date(k[1],k[2]-1,k[3])}}}if(k=dateStr.match(stdReg)){return new Date(k[1])}if(k=dateStr.match(newReg)){return eval("("+dateStr+")")}return tDt}};var _filterEventCollection=function(){if(cEvents&&cEvents.length>0){var multi=[];var single=[];$.each(cEvents,function(){var ev=this;if(ev.StartDateTime){if(typeof ev.StartDateTime=="object"&&ev.StartDateTime.getDate){this.StartDateTime=ev.StartDateTime}if(typeof ev.StartDateTime=="string"&&ev.StartDateTime.split){this.StartDateTime=_getJSONDate(ev.StartDateTime)}}else{if(ev.Date){if(typeof ev.Date=="object"&&ev.Date.getDate){this.StartDateTime=ev.Date}if(typeof ev.Date=="string"&&ev.Date.split){this.StartDateTime=_getJSONDate(ev.Date)}}else{return}}if(ev.EndDateTime){if(typeof ev.EndDateTime=="object"&&ev.EndDateTime.getDate){this.EndDateTime=ev.EndDateTime}if(typeof ev.EndDateTime=="string"&&ev.EndDateTime.split){this.EndDateTime=_getJSONDate(ev.EndDateTime)}}else{this.EndDateTime=this.StartDateTime.clone()}if(this.StartDateTime.clone().clearTime().compareTo(this.EndDateTime.clone().clearTime())==0){single.push(this)}else{if(this.StartDateTime.clone().clearTime().compareTo(this.EndDateTime.clone().clearTime())==-1){multi.push(this)}}});multi.sort(_eventSort);single.sort(_eventSort);cEvents=[];$.merge(cEvents,multi);$.merge(cEvents,single)}};var _eventSort=function(a,b){return a.StartDateTime.compareTo(b.StartDateTime)};var _clearBoxes=function(){_clearBoxEvents();_boxes=[]};var _clearBoxEvents=function(){for(var i=0;i<_boxes.length;i++){_boxes[i].clear()}_eventObj={}};var _initDates=function(dateIn){var today=def.calendarStartDate;if(dateIn==undefined){_workingDate=new Date(today.getFullYear(),today.getMonth(),1)}else{_workingDate=dateIn;_workingDate.setDate(1)}_daysInMonth=_workingDate.getDaysInMonth();_firstOfMonth=_workingDate.clone().moveToFirstDayOfMonth();_lastOfMonth=_workingDate.clone().moveToLastDayOfMonth();_gridOffset=_firstOfMonth.getDay()-def.firstDayOfWeek;_totalDates=_gridOffset+_daysInMonth;_gridRows=Math.ceil(_totalDates/7);_totalBoxes=_gridRows*7;_dateRange.startDate=_firstOfMonth.clone().addDays((-1)*_gridOffset);_dateRange.endDate=_lastOfMonth.clone().addDays(_totalBoxes-(_daysInMonth+_gridOffset))};var _initHeaders=function(){var prevMonth=_workingDate.clone().addMonths(-1);var prevMLink=$('<div class="MonthNavPrev"><a class="link-prev">'+def.navLinks.p+"</a></div>").click(function(){$.J.ChangeMonth(prevMonth);return false});var nextMonth=_workingDate.clone().addMonths(1);var nextMLink=$('<div class="MonthNavNext"><a class="link-next">'+def.navLinks.n+"</a></div>").click(function(){$.J.ChangeMonth(nextMonth);return false});var prevYear=_workingDate.clone().addYears(-1);var prevYLink;if(def.navLinks.enablePrevYear){prevYLink=$('<div class="YearNavPrev"><a>'+prevYear.getFullYear()+"</a></div>").click(function(){$.J.ChangeMonth(prevYear);return false})}var nextYear=_workingDate.clone().addYears(1);var nextYLink;if(def.navLinks.enableNextYear){nextYLink=$('<div class="YearNavNext"><a>'+nextYear.getFullYear()+"</a></div>").click(function(){$.J.ChangeMonth(nextYear);return false})}var todayLink;if(def.navLinks.enableToday){todayLink=$('<div class="TodayLink"><a class="link-today">'+def.navLinks.t+"</a></div>").click(function(){$.J.ChangeMonth(new Date());return false})}var navRow=$('<tr><td colspan="7"><div class="FormHeader MonthNavigation"></div></td></tr>');var navHead=$(".MonthNavigation",navRow);navHead.append(prevMLink,nextMLink);if(def.navLinks.enableToday){navHead.append(todayLink)}navHead.append($('<div class="MonthName"></div>').append(Date.CultureInfo.monthNames[_workingDate.getMonth()]+" "+_workingDate.getFullYear()));if(def.navLinks.enablePrevYear){navHead.append(prevYLink)}if(def.navLinks.enableNextYear){navHead.append(nextYLink)}var headRow=$("<tr></tr>");for(var i=def.firstDayOfWeek;i<def.firstDayOfWeek+7;i++){var weekday=i%7;var wordday=Date.CultureInfo.dayNames[weekday];headRow.append('<th title="'+wordday+'" class="DateHeader'+(weekday==0||weekday==6?" Weekend":"")+'"><span>'+wordday+"</span></th>")}headRow=$('<thead id="CalendarHead"></thead>').css({height:def.headerHeight+"px"}).append(headRow);headRow=headRow.prepend(navRow);return headRow};$.J.DrawCalendar=function(dateIn){var now=new Date();now.clearTime();var today=def.calendarStartDate;_clearBoxes();_initDates(dateIn);var headerRow=_initHeaders();var isCurrentMonth=(_workingDate.getMonth()==today.getMonth()&&_workingDate.getFullYear()==today.getFullYear());var containerHeight=$(def.containerId).outerHeight();var rowHeight=(containerHeight-def.headerHeight)/_gridRows;var row=null;var tBody=$('<tbody id="CalendarBody"></tbody>');for(var i=0;i<_totalBoxes;i++){var currentDate=_dateRange.startDate.clone().addDays(i);if(i%7==0||i==0){row=$("<tr></tr>");row.css({height:rowHeight+"px"});tBody.append(row)}var weekday=(def.firstDayOfWeek+i)%7;var atts={"class":"DateBox"+(weekday==0||weekday==6?" Weekend ":""),date:currentDate.toString("M/d/yyyy")};if(currentDate.compareTo(_firstOfMonth)==-1||currentDate.compareTo(_lastOfMonth)==1){atts["class"]+=" Inactive"}if(currentDate.compareTo(now)==0){atts["class"]+=" Today"}var dateLink=$('<div class="DateLabel"><a>'+currentDate.getDate()+"</a></div>");dateLink.bind("click",{Date:currentDate.clone()},def.onDayLinkClick);var dateBox=$("<td></td>").attr(atts).append(dateLink);dateBox.bind("dblclick",{Date:currentDate.clone()},def.onDayCellDblClick);dateBox.bind("click",{Date:currentDate.clone()},def.onDayCellClick);if(def.dragableEvents){dateBox.droppable({hoverClass:def.dragHoverClass,tolerance:"pointer",drop:function(ev,ui){var eventId=ui.draggable.attr("eventid");var newDate=new Date($(this).attr("date")).clearTime();var event;$.each(cEvents,function(){if(this.EventID==eventId){var days=new TimeSpan(newDate-this.StartDateTime).days;this.StartDateTime.addDays(days);this.EndDateTime.addDays(days);event=this}});$.J.ClearEventsOnCalendar();_drawEventsOnCalendar();def.onEventDropped.call(this,event,newDate)}})}_boxes.push(new CalendarBox(i,currentDate,dateBox,dateLink));row.append(dateBox)}tBody.append(row);var a=$(def.containerId);var cal=$('<table class="MonthlyCalendar" cellpadding="0" tablespacing="0"></table>').append(headerRow,tBody);a.hide();a.html(cal);a.fadeIn("normal");_drawEventsOnCalendar()};var _drawEventsOnCalendar=function(){_filterEventCollection();_clearBoxEvents();if(cEvents&&cEvents.length>0){var container=$(def.containerId);$.each(cEvents,function(){var ev=this;var tempStartDT=ev.StartDateTime.clone().clearTime();var tempEndDT=ev.EndDateTime.clone().clearTime();var startI=new TimeSpan(tempStartDT-_dateRange.startDate).days;var endI=new TimeSpan(tempEndDT-_dateRange.startDate).days;var istart=(startI<0)?0:startI;var iend=(endI>_boxes.length-1)?_boxes.length-1:endI;for(var i=istart;i<=iend;i++){var b=_boxes[i];var startBoxCompare=tempStartDT.compareTo(b.date);var endBoxCompare=tempEndDT.compareTo(b.date);var continueEvent=((i!=0&&startBoxCompare==-1&&endBoxCompare>=0&&b.weekNumber!=_boxes[i-1].weekNumber)||(i==0&&startBoxCompare==-1));var toManyEvents=(startBoxCompare==0||(i==0&&startBoxCompare==-1)||continueEvent||(startBoxCompare==-1&&endBoxCompare>=0))&&b.vOffset>=(b.getCellBox().height()-b.getLabelHeight()-32);if(toManyEvents){if(!b.isTooManySet){var moreDiv=$('<div class="MoreEvents" id="ME_'+i+'">'+def.navLinks.showMore+"</div>");var pos=b.getCellPosition();var index=i;moreDiv.css({top:(pos.top+(b.getCellBox().height()-b.getLabelHeight())),left:pos.left,width:(b.getLabelWidth()-7),position:"absolute"});moreDiv.click(function(e){_showMoreClick(e,index)});_eventObj[moreDiv.attr("id")]=moreDiv;b.isTooManySet=true}b.events.push(ev)}else{if(startBoxCompare==0||(i==0&&startBoxCompare==-1)||continueEvent){var block=_buildEventBlock(ev,b.weekNumber);var pos=b.getCellPosition();block.css({top:(pos.top+b.getLabelHeight()+b.vOffset),left:pos.left,width:(b.getLabelWidth()-7),position:"absolute"});b.vOffset+=19;if(continueEvent){block.prepend($("<span />").addClass("ui-icon").addClass("ui-icon-triangle-1-w"));var e=_eventObj["Event_"+ev.EventID+"_"+(b.weekNumber-1)];if(e){e.prepend($("<span />").addClass("ui-icon").addClass("ui-icon-triangle-1-e"))}}_eventObj[block.attr("id")]=block;b.events.push(ev)}else{if(startBoxCompare==-1&&endBoxCompare>=0){var e=_eventObj["Event_"+ev.EventID+"_"+b.weekNumber];if(e){var w=e.css("width");e.css({width:(parseInt(w)+b.getLabelWidth()+1)});b.vOffset+=19;b.events.push(ev)}}}}if(i==iend&&endBoxCompare>0){var e=_eventObj["Event_"+ev.EventID+"_"+b.weekNumber];if(e){e.prepend($("<span />").addClass("ui-icon").addClass("ui-icon-triangle-1-e"))}}}});for(var o in _eventObj){_eventObj[o].hide();container.append(_eventObj[o]);_eventObj[o].show()}}};var _buildEventBlock=function(ev,weekNumber){var block=$('<div class="Event" id="Event_'+ev.EventID+"_"+weekNumber+'" eventid="'+ev.EventID+'"></div>');if(ev.CssClass){block.addClass(ev.CssClass)}block.bind("click",{Event:ev},def.onEventBlockClick);block.bind("mouseover",{Event:ev},def.onEventBlockOver);block.bind("mouseout",{Event:ev},def.onEventBlockOut);if(def.dragableEvents){_dragableEvent(ev,block,weekNumber)}var link;if(ev.URL&&ev.URL.length>0){link=$('<a href="'+ev.URL+'">'+ev.Title+"</a>")}else{link=$("<a>"+ev.Title+"</a>")}link.bind("click",{Event:ev},def.onEventLinkClick);block.append(link);return block};var _dragableEvent=function(event,block,weekNumber){block.draggable({zIndex:4,delay:50,opacity:0.5,revertDuration:1000,cursorAt:{left:5},start:function(ev,ui){for(var i=0;i<=_gridRows;i++){if(i==weekNumber){continue}var e=_eventObj["Event_"+event.EventID+"_"+i];if(e){e.hide()}}}})};var _showMoreClick=function(e,boxIndex){var box=_boxes[boxIndex];def.onShowMoreClick.call(this,box.events);e.stopPropagation()};$.J.ClearEventsOnCalendar=function(){_clearBoxEvents();$(".Event",$(def.containerId)).remove();$(".MoreEvents",$(def.containerId)).remove()};$.J.AddEvents=function(eventCollection){if(eventCollection){if(eventCollection.length>0){$.merge(cEvents,eventCollection)}else{cEvents.push(eventCollection)}$.J.ClearEventsOnCalendar();_drawEventsOnCalendar()}};$.J.ReplaceEventCollection=function(eventCollection){if(eventCollection){cEvents=[];cEvents=eventCollection}$.J.ClearEventsOnCalendar();_drawEventsOnCalendar()};$.J.ChangeMonth=function(dateIn){var returned=def.onMonthChanging.call(this,dateIn);if(!returned){$.J.DrawCalendar(dateIn);def.onMonthChanged.call(this,dateIn)}};$.J.Initialize=function(options,events){var today=new Date();options=$.extend(def,options);if(events){$.J.ClearEventsOnCalendar();cEvents=events}$.J.DrawCalendar()};function CalendarBox(id,boxDate,cell,label){this.id=id;this.date=boxDate;this.cell=cell;this.label=label;this.weekNumber=Math.floor(id/7);this.events=[];this.isTooManySet=false;this.vOffset=0;this.echo=function(){alert("Date: "+this.date+" WeekNumber: "+this.weekNumber+" ID: "+this.id)};this.clear=function(){this.events=[];this.isTooManySet=false;this.vOffset=0};this.getCellPosition=function(){if(this.cell){return this.cell.position()}return};this.getCellBox=function(){if(this.cell){return this.cell}return};this.getLabelWidth=function(){if(this.label){return this.label.innerWidth()}return};this.getLabelHeight=function(){if(this.label){return this.label.height()}return};this.getDate=function(){return this.date}}})(jQuery);Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};Date.getMonthNumberFromName=function(b){var e=Date.CultureInfo.monthNames,a=Date.CultureInfo.abbreviatedMonthNames,d=b.toLowerCase();for(var c=0;c<e.length;c++){if(e[c].toLowerCase()==d||a[c].toLowerCase()==d){return c}}return -1};Date.getDayNumberFromName=function(b){var f=Date.CultureInfo.dayNames,a=Date.CultureInfo.abbreviatedDayNames,e=Date.CultureInfo.shortestDayNames,d=b.toLowerCase();for(var c=0;c<f.length;c++){if(f[c].toLowerCase()==d||a[c].toLowerCase()==d){return c}}return -1};Date.isLeapYear=function(a){return(((a%4===0)&&(a%100!==0))||(a%400===0))};Date.getDaysInMonth=function(a,b){return[31,(Date.isLeapYear(a)?29:28),31,30,31,30,31,31,30,31,30,31][b]};Date.getTimezoneOffset=function(a,b){return(b||false)?Date.CultureInfo.abbreviatedTimeZoneDST[a.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[a.toUpperCase()]};Date.getTimezoneAbbreviation=function(b,d){var c=(d||false)?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,a;for(a in c){if(c[a]===b){return a}}return null};Date.prototype.clone=function(){return new Date(this.getTime())};Date.prototype.compareTo=function(a){if(isNaN(this)){throw new Error(this)}if(a instanceof Date&&!isNaN(a)){return(this>a)?1:(this<a)?-1:0}else{throw new TypeError(a)}};Date.prototype.equals=function(a){return(this.compareTo(a)===0)};Date.prototype.between=function(c,a){var b=this.getTime();return b>=c.getTime()&&b<=a.getTime()};Date.prototype.addMilliseconds=function(a){this.setMilliseconds(this.getMilliseconds()+a);return this};Date.prototype.addSeconds=function(a){return this.addMilliseconds(a*1000)};Date.prototype.addMinutes=function(a){return this.addMilliseconds(a*60000)};Date.prototype.addHours=function(a){return this.addMilliseconds(a*3600000)};Date.prototype.addDays=function(a){return this.addMilliseconds(a*86400000)};Date.prototype.addWeeks=function(a){return this.addMilliseconds(a*604800000)};Date.prototype.addMonths=function(a){var b=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+a);this.setDate(Math.min(b,this.getDaysInMonth()));return this};Date.prototype.addYears=function(a){return this.addMonths(a*12)};Date.prototype.add=function(b){if(typeof b=="number"){this._orient=b;return this}var a=b;if(a.millisecond||a.milliseconds){this.addMilliseconds(a.millisecond||a.milliseconds)}if(a.second||a.seconds){this.addSeconds(a.second||a.seconds)}if(a.minute||a.minutes){this.addMinutes(a.minute||a.minutes)}if(a.hour||a.hours){this.addHours(a.hour||a.hours)}if(a.month||a.months){this.addMonths(a.month||a.months)}if(a.year||a.years){this.addYears(a.year||a.years)}if(a.day||a.days){this.addDays(a.day||a.days)}return this};Date._validate=function(d,c,a,b){if(typeof d!="number"){throw new TypeError(d+" is not a Number.")}else{if(d<c||d>a){throw new RangeError(d+" is not a valid value for "+b+".")}}return true};Date.validateMillisecond=function(a){return Date._validate(a,0,999,"milliseconds")};Date.validateSecond=function(a){return Date._validate(a,0,59,"seconds")};Date.validateMinute=function(a){return Date._validate(a,0,59,"minutes")};Date.validateHour=function(a){return Date._validate(a,0,23,"hours")};Date.validateDay=function(c,a,b){return Date._validate(c,1,Date.getDaysInMonth(a,b),"days")};Date.validateMonth=function(a){return Date._validate(a,0,11,"months")};Date.validateYear=function(a){return Date._validate(a,1,9999,"seconds")};Date.prototype.set=function(b){var a=b;if(!a.millisecond&&a.millisecond!==0){a.millisecond=-1}if(!a.second&&a.second!==0){a.second=-1}if(!a.minute&&a.minute!==0){a.minute=-1}if(!a.hour&&a.hour!==0){a.hour=-1}if(!a.day&&a.day!==0){a.day=-1}if(!a.month&&a.month!==0){a.month=-1}if(!a.year&&a.year!==0){a.year=-1}if(a.millisecond!=-1&&Date.validateMillisecond(a.millisecond)){this.addMilliseconds(a.millisecond-this.getMilliseconds())}if(a.second!=-1&&Date.validateSecond(a.second)){this.addSeconds(a.second-this.getSeconds())}if(a.minute!=-1&&Date.validateMinute(a.minute)){this.addMinutes(a.minute-this.getMinutes())}if(a.hour!=-1&&Date.validateHour(a.hour)){this.addHours(a.hour-this.getHours())}if(a.month!==-1&&Date.validateMonth(a.month)){this.addMonths(a.month-this.getMonth())}if(a.year!=-1&&Date.validateYear(a.year)){this.addYears(a.year-this.getFullYear())}if(a.day!=-1&&Date.validateDay(a.day,this.getFullYear(),this.getMonth())){this.addDays(a.day-this.getDate())}if(a.timezone){this.setTimezone(a.timezone)}if(a.timezoneOffset){this.setTimezoneOffset(a.timezoneOffset)}return this};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};Date.prototype.isLeapYear=function(){var a=this.getFullYear();return(((a%4===0)&&(a%100!==0))||(a%400===0))};Date.prototype.isWeekday=function(){return !(this.is().sat()||this.is().sun())};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth())};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1})};Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()})};Date.prototype.moveToDayOfWeek=function(a,b){var c=(a-this.getDay()+7*(b||+1))%7;return this.addDays((c===0)?c+=7*(b||+1):c)};Date.prototype.moveToMonth=function(c,a){var b=(c-this.getMonth()+12*(a||+1))%12;return this.addMonths((b===0)?b+=12*(a||+1):b)};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000)};Date.prototype.getWeekOfYear=function(a){var i=this.getFullYear(),c=this.getMonth(),f=this.getDate();var k=a||Date.CultureInfo.firstDayOfWeek;var e=7+1-new Date(i,0,1).getDay();if(e==8){e=1}var b=((Date.UTC(i,c,f,0,0,0)-Date.UTC(i,0,1,0,0,0))/86400000)+1;var j=Math.floor((b-e+7)/7);if(j===k){i--;var g=7+1-new Date(i,0,1).getDay();if(g==2||g==8){j=53}else{j=52}}return j};Date.prototype.isDST=function(){console.log("isDST");return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D"};Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST())};Date.prototype.setTimezoneOffset=function(b){var a=this.getTimezoneOffset(),c=Number(b)*-6/10;this.addMinutes(c-a);return this};Date.prototype.setTimezone=function(a){return this.setTimezoneOffset(Date.getTimezoneOffset(a))};Date.prototype.getUTCOffset=function(){var b=this.getTimezoneOffset()*-10/6,a;if(b<0){a=(b-10000).toString();return a[0]+a.substr(2)}else{a=(b+10000).toString();return"+"+a.substr(1)}};Date.prototype.getDayName=function(a){return a?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()]};Date.prototype.getMonthName=function(a){return a?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()]};Date.prototype._toString=Date.prototype.toString;Date.prototype.toString=function(c){var a=this;var b=function b(d){return(d.toString().length==1)?"0"+d:d};return c?c.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(d){switch(d){case"hh":return b(a.getHours()<13?a.getHours():(a.getHours()-12));case"h":return a.getHours()<13?a.getHours():(a.getHours()-12);case"HH":return b(a.getHours());case"H":return a.getHours();case"mm":return b(a.getMinutes());case"m":return a.getMinutes();case"ss":return b(a.getSeconds());case"s":return a.getSeconds();case"yyyy":return a.getFullYear();case"yy":return a.getFullYear().toString().substring(2,4);case"dddd":return a.getDayName();case"ddd":return a.getDayName(true);case"dd":return b(a.getDate());case"d":return a.getDate().toString();case"MMMM":return a.getMonthName();case"MMM":return a.getMonthName(true);case"MM":return b((a.getMonth()+1));case"M":return a.getMonth()+1;case"t":return a.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return a.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return""}}):this._toString()};Date.now=function(){return new Date()};Date.today=function(){return Date.now().clearTime()};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var a={};a[this._dateElement]=this;return Date.now().add(a)};Number.prototype.ago=function(){var a={};a[this._dateElement]=this*-1;return Date.now().add(a)};(function(){var g=Date.prototype,a=Number.prototype;var q=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),p=("january february march april may june july august september october november december").split(/\s/),o=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),n;var m=function(i){return function(){if(this._is){this._is=false;return this.getDay()==i}return this.moveToDayOfWeek(i,this._orient)}};for(var f=0;f<q.length;f++){g[q[f]]=g[q[f].substring(0,3)]=m(f)}var l=function(i){return function(){if(this._is){this._is=false;return this.getMonth()===i}return this.moveToMonth(i,this._orient)}};for(var d=0;d<p.length;d++){g[p[d]]=g[p[d].substring(0,3)]=l(d)}var e=function(i){return function(){if(i.substring(i.length-1)!="s"){i+="s"}return this["add"+i](this._orient)}};var b=function(i){return function(){this._dateElement=i;return this}};for(var c=0;c<o.length;c++){n=o[c].toLowerCase();g[n]=g[n+"s"]=e(o[c]);a[n]=a[n+"s"]=b(n)}}());Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ")};Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern)};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern)};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern)};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern)};Date.prototype.getOrdinal=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"}};(function(){Date.Parsing={Exception:function(i){this.message="Parse error at '"+i.substring(0,10)+" ...'"}};var a=Date.Parsing;var c=a.Operators={rtoken:function(i){return function(j){var l=j.match(i);if(l){return([l[0],j.substring(l[0].length)])}else{throw new a.Exception(j)}}},token:function(i){return function(j){return c.rtoken(new RegExp("^s*"+j+"s*"))(j)}},stoken:function(i){return c.rtoken(new RegExp("^"+i))},until:function(i){return function(j){var l=[],n=null;while(j.length){try{n=i.call(this,j)}catch(m){l.push(n[0]);j=n[1];continue}break}return[l,j]}},many:function(i){return function(j){var n=[],l=null;while(j.length){try{l=i.call(this,j)}catch(m){return[n,j]}n.push(l[0]);j=l[1]}return[n,j]}},optional:function(i){return function(j){var l=null;try{l=i.call(this,j)}catch(m){return[null,j]}return[l[0],l[1]]}},not:function(i){return function(j){try{i.call(this,j)}catch(l){return[null,j]}throw new a.Exception(j)}},ignore:function(i){return i?function(j){var l=null;l=i.call(this,j);return[null,l[1]]}:null},product:function(){var l=arguments[0],m=Array.prototype.slice.call(arguments,1),n=[];for(var j=0;j<l.length;j++){n.push(c.each(l[j],m))}return n},cache:function(l){var i={},j=null;return function(m){try{j=i[m]=(i[m]||l.call(this,m))}catch(n){j=i[m]=n}if(j instanceof a.Exception){throw j}else{return j}}},any:function(){var i=arguments;return function(l){var m=null;for(var j=0;j<i.length;j++){if(i[j]==null){continue}try{m=(i[j].call(this,l))}catch(n){m=null}if(m){return m}}throw new a.Exception(l)}},each:function(){var i=arguments;return function(l){var o=[],m=null;for(var j=0;j<i.length;j++){if(i[j]==null){continue}try{m=(i[j].call(this,l))}catch(n){throw new a.Exception(l)}o.push(m[0]);l=m[1]}return[o,l]}},all:function(){var j=arguments,i=i;return i.each(i.optional(j))},sequence:function(i,j,l){j=j||c.rtoken(/^\s*/);l=l||null;if(i.length==1){return i[0]}return function(p){var t=null,u=null;var w=[];for(var o=0;o<i.length;o++){try{t=i[o].call(this,p)}catch(v){break}w.push(t[0]);try{u=j.call(this,t[1])}catch(n){u=null;break}p=u[1]}if(!t){throw new a.Exception(p)}if(u){throw new a.Exception(u[1])}if(l){try{t=l.call(this,t[1])}catch(m){throw new a.Exception(t[1])}}return[w,(t?t[1]:p)]}},between:function(j,l,i){i=i||j;var m=c.each(c.ignore(j),l,c.ignore(i));return function(n){var o=m.call(this,n);return[[o[0][0],r[0][2]],o[1]]}},list:function(i,j,l){j=j||c.rtoken(/^\s*/);l=l||null;return(i instanceof Array?c.each(c.product(i.slice(0,-1),c.ignore(j)),i.slice(-1),c.ignore(l)):c.each(c.many(c.each(i,c.ignore(j))),px,c.ignore(l)))},set:function(i,j,l){j=j||c.rtoken(/^\s*/);l=l||null;return function(C){var m=null,o=null,n=null,t=null,u=[[],C],B=false;for(var w=0;w<i.length;w++){n=null;o=null;m=null;B=(i.length==1);try{m=i[w].call(this,C)}catch(z){continue}t=[[m[0]],m[1]];if(m[1].length>0&&!B){try{n=j.call(this,m[1])}catch(A){B=true}}else{B=true}if(!B&&n[1].length===0){B=true}if(!B){var x=[];for(var v=0;v<i.length;v++){if(w!=v){x.push(i[v])}}o=c.set(x,j).call(this,n[1]);if(o[0].length>0){t[0]=t[0].concat(o[0]);t[1]=o[1]}}if(t[1].length<u[1].length){u=t}if(u[1].length===0){break}}if(u[0].length===0){return u}if(l){try{n=l.call(this,u[1])}catch(y){throw new a.Exception(u[1])}u[1]=n[1]}return u}},forward:function(i,j){return function(l){return i[j].call(this,l)}},replace:function(j,i){return function(l){var m=j.call(this,l);return[i,m[1]]}},process:function(j,i){return function(l){var m=j.call(this,l);return[i.call(this,m[0]),m[1]]}},min:function(i,j){return function(l){var m=j.call(this,l);if(m[0].length<i){throw new a.Exception(l)}return m}}};var k=function(i){return function(){var j=null,n=[];if(arguments.length>1){j=Array.prototype.slice.call(arguments)}else{if(arguments[0] instanceof Array){j=arguments[0]}}if(j){for(var m=0,l=j.shift();m<l.length;m++){j.unshift(l[m]);n.push(i.apply(null,j));j.shift();return n}}else{return i.apply(null,arguments)}}};var g="optional not ignore cache".split(/\s/);for(var d=0;d<g.length;d++){c[g[d]]=k(c[g[d]])}var f=function(i){return function(){if(arguments[0] instanceof Array){return i.apply(null,arguments[0])}else{return i.apply(null,arguments)}}};var e="each any all".split(/\s/);for(var b=0;b<e.length;b++){c[e[b]]=f(c[e[b]])}}());(function(){var f=function(k){var l=[];for(var g=0;g<k.length;g++){if(k[g] instanceof Array){l=l.concat(f(k[g]))}else{if(k[g]){l.push(k[g])}}}return l};Date.Grammar={};Date.Translator={hour:function(g){return function(){this.hour=Number(g)}},minute:function(g){return function(){this.minute=Number(g)}},second:function(g){return function(){this.second=Number(g)}},meridian:function(g){return function(){this.meridian=g.slice(0,1).toLowerCase()}},timezone:function(g){return function(){var k=g.replace(/[^\d\+\-]/g,"");if(k.length){this.timezoneOffset=Number(k)}else{this.timezone=g.toLowerCase()}}},day:function(g){var k=g[0];return function(){this.day=Number(k.match(/\d+/)[0])}},month:function(g){return function(){this.month=((g.length==3)?Date.getMonthNumberFromName(g):(Number(g)-1))}},year:function(g){return function(){var k=Number(g);this.year=((g.length>2)?k:(k+(((k+2000)<Date.CultureInfo.twoDigitYearMax)?2000:1900)))}},rday:function(g){return function(){switch(g){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break}}},finishExact:function(g){g=(g instanceof Array)?g:[g];var k=new Date();this.year=k.getFullYear();this.month=k.getMonth();this.day=1;this.hour=0;this.minute=0;this.second=0;for(var l=0;l<g.length;l++){if(g[l]){g[l].call(this)}}this.hour=(this.meridian=="p"&&this.hour<13)?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.")}var m=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){m.set({timezone:this.timezone})}else{if(this.timezoneOffset){m.set({timezoneOffset:this.timezoneOffset})}}return m},finish:function(g){g=(g instanceof Array)?f(g):[g];if(g.length===0){return null}for(var n=0;n<g.length;n++){if(typeof g[n]=="function"){g[n].call(this)}}if(this.now){return new Date()}var k=Date.today();var q=null;var o=!!(this.days!=null||this.orient||this.operator);if(o){var p,m,l;l=((this.orient=="past"||this.operator=="subtract")?-1:1);if(this.weekday){this.unit="day";p=(Date.getDayNumberFromName(this.weekday)-k.getDay());m=7;this.days=p?((p+(l*m))%m):(l*m)}if(this.month){this.unit="month";p=(this.month-k.getMonth());m=12;this.months=p?((p+(l*m))%m):(l*m);this.month=null}if(!this.unit){this.unit="day"}if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value){this.value=1}if(this.unit=="week"){this.unit="day";this.value=this.value*7}this[this.unit+"s"]=this.value*l}return k.add(this)}else{if(this.meridian&&this.hour){this.hour=(this.hour<13&&this.meridian=="p")?this.hour+12:this.hour}if(this.weekday&&!this.day){this.day=(k.addDays((Date.getDayNumberFromName(this.weekday)-k.getDay()))).getDate()}if(this.month&&!this.day){this.day=1}return k.set(this)}}};var b=Date.Parsing.Operators,e=Date.Grammar,d=Date.Translator,j;e.datePartDelimiter=b.rtoken(/^([\s\-\.\,\/\x27]+)/);e.timePartDelimiter=b.stoken(":");e.whiteSpace=b.rtoken(/^\s*/);e.generalDelimiter=b.rtoken(/^(([\s\,]|at|on)+)/);var a={};e.ctoken=function(n){var m=a[n];if(!m){var o=Date.CultureInfo.regexPatterns;var l=n.split(/\s+/),k=[];for(var g=0;g<l.length;g++){k.push(b.replace(b.rtoken(o[l[g]]),l[g]))}m=a[n]=b.any.apply(null,k)}return m};e.ctoken2=function(g){return b.rtoken(Date.CultureInfo.regexPatterns[g])};e.h=b.cache(b.process(b.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),d.hour));e.hh=b.cache(b.process(b.rtoken(/^(0[0-9]|1[0-2])/),d.hour));e.H=b.cache(b.process(b.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),d.hour));e.HH=b.cache(b.process(b.rtoken(/^([0-1][0-9]|2[0-3])/),d.hour));e.m=b.cache(b.process(b.rtoken(/^([0-5][0-9]|[0-9])/),d.minute));e.mm=b.cache(b.process(b.rtoken(/^[0-5][0-9]/),d.minute));e.s=b.cache(b.process(b.rtoken(/^([0-5][0-9]|[0-9])/),d.second));e.ss=b.cache(b.process(b.rtoken(/^[0-5][0-9]/),d.second));e.hms=b.cache(b.sequence([e.H,e.mm,e.ss],e.timePartDelimiter));e.t=b.cache(b.process(e.ctoken2("shortMeridian"),d.meridian));e.tt=b.cache(b.process(e.ctoken2("longMeridian"),d.meridian));e.z=b.cache(b.process(b.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),d.timezone));e.zz=b.cache(b.process(b.rtoken(/^(\+|\-)\s*\d\d\d\d/),d.timezone));e.zzz=b.cache(b.process(e.ctoken2("timezone"),d.timezone));e.timeSuffix=b.each(b.ignore(e.whiteSpace),b.set([e.tt,e.zzz]));e.time=b.each(b.optional(b.ignore(b.stoken("T"))),e.hms,e.timeSuffix);e.d=b.cache(b.process(b.each(b.rtoken(/^([0-2]\d|3[0-1]|\d)/),b.optional(e.ctoken2("ordinalSuffix"))),d.day));e.dd=b.cache(b.process(b.each(b.rtoken(/^([0-2]\d|3[0-1])/),b.optional(e.ctoken2("ordinalSuffix"))),d.day));e.ddd=e.dddd=b.cache(b.process(e.ctoken("sun mon tue wed thu fri sat"),function(g){return function(){this.weekday=g}}));e.M=b.cache(b.process(b.rtoken(/^(1[0-2]|0\d|\d)/),d.month));e.MM=b.cache(b.process(b.rtoken(/^(1[0-2]|0\d)/),d.month));e.MMM=e.MMMM=b.cache(b.process(e.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),d.month));e.y=b.cache(b.process(b.rtoken(/^(\d\d?)/),d.year));e.yy=b.cache(b.process(b.rtoken(/^(\d\d)/),d.year));e.yyy=b.cache(b.process(b.rtoken(/^(\d\d?\d?\d?)/),d.year));e.yyyy=b.cache(b.process(b.rtoken(/^(\d\d\d\d)/),d.year));j=function(){return b.each(b.any.apply(null,arguments),b.not(e.ctoken2("timeContext")))};e.day=j(e.d,e.dd);e.month=j(e.M,e.MMM);e.year=j(e.yyyy,e.yy);e.orientation=b.process(e.ctoken("past future"),function(g){return function(){this.orient=g}});e.operator=b.process(e.ctoken("add subtract"),function(g){return function(){this.operator=g}});e.rday=b.process(e.ctoken("yesterday tomorrow today now"),d.rday);e.unit=b.process(e.ctoken("minute hour day week month year"),function(g){return function(){this.unit=g}});e.value=b.process(b.rtoken(/^\d\d?(st|nd|rd|th)?/),function(g){return function(){this.value=g.replace(/\D/g,"")}});e.expression=b.set([e.rday,e.operator,e.value,e.unit,e.orientation,e.ddd,e.MMM]);j=function(){return b.set(arguments,e.datePartDelimiter)};e.mdy=j(e.ddd,e.month,e.day,e.year);e.ymd=j(e.ddd,e.year,e.month,e.day);e.dmy=j(e.ddd,e.day,e.month,e.year);e.date=function(g){return((e[Date.CultureInfo.dateElementOrder]||e.mdy).call(this,g))};e.format=b.process(b.many(b.any(b.process(b.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(g){if(e[g]){return e[g]}else{throw Date.Parsing.Exception(g)}}),b.process(b.rtoken(/^[^dMyhHmstz]+/),function(g){return b.ignore(b.stoken(g))}))),function(g){return b.process(b.each.apply(null,g),d.finishExact)});var i={};var c=function(g){return i[g]=(i[g]||e.format(g)[0])};e.formats=function(k){if(k instanceof Array){var l=[];for(var g=0;g<k.length;g++){l.push(c(k[g]))}return b.any.apply(null,l)}else{return c(k)}};e._formats=e.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","d"]);e._start=b.process(b.set([e.date,e.time,e.expression],e.generalDelimiter,e.whiteSpace),d.finish);e.start=function(g){try{var k=e._formats.call({},g);if(k[1].length===0){return k}}catch(l){}return e._start.call({},g)}}());Date._parse=Date.parse;Date.parse=function(a){var b=null;if(!a){return null}try{b=Date.Grammar.start.call({},a)}catch(c){return null}return((b[1].length===0)?b[0]:null)};Date.getParseFunction=function(b){var a=Date.Grammar.formats(b);return function(c){var d=null;try{d=a.call({},c)}catch(f){return null}return((d[1].length===0)?d[0]:null)}};Date.parseExact=function(a,b){return Date.getParseFunction(b)(a)};TimeSpan=function(f,a,d,e,c){this.days=0;this.hours=0;this.minutes=0;this.seconds=0;this.milliseconds=0;if(arguments.length==5){this.days=f;this.hours=a;this.minutes=d;this.seconds=e;this.milliseconds=c}else{if(arguments.length==1&&typeof f=="number"){var b=(f<0)?-1:+1;this.milliseconds=Math.abs(f);this.days=Math.floor(this.milliseconds/(24*60*60*1000))*b;this.milliseconds=this.milliseconds%(24*60*60*1000);this.hours=Math.floor(this.milliseconds/(60*60*1000))*b;this.milliseconds=this.milliseconds%(60*60*1000);this.minutes=Math.floor(this.milliseconds/(60*1000))*b;this.milliseconds=this.milliseconds%(60*1000);this.seconds=Math.floor(this.milliseconds/1000)*b;this.milliseconds=this.milliseconds%1000;this.milliseconds=this.milliseconds*b;return this}else{return null}}};TimeSpan.prototype.compare=function(c){var b=new Date(1970,1,1,this.hours(),this.minutes(),this.seconds()),a;if(c===null){a=new Date(1970,1,1,0,0,0)}else{a=new Date(1970,1,1,c.hours(),c.minutes(),c.seconds())}return(b>a)?1:(b<a)?-1:0};TimeSpan.prototype.add=function(a){return(a===null)?this:this.addSeconds(a.getTotalMilliseconds()/1000)};TimeSpan.prototype.subtract=function(a){return(a===null)?this:this.addSeconds(-a.getTotalMilliseconds()/1000)};TimeSpan.prototype.addDays=function(a){return new TimeSpan(this.getTotalMilliseconds()+(a*24*60*60*1000))};TimeSpan.prototype.addHours=function(a){return new TimeSpan(this.getTotalMilliseconds()+(a*60*60*1000))};TimeSpan.prototype.addMinutes=function(a){return new TimeSpan(this.getTotalMilliseconds()+(a*60*1000))};TimeSpan.prototype.addSeconds=function(a){return new TimeSpan(this.getTotalMilliseconds()+(a*1000))};TimeSpan.prototype.addMilliseconds=function(a){return new TimeSpan(this.getTotalMilliseconds()+a)};TimeSpan.prototype.getTotalMilliseconds=function(){return(this.days()*(24*60*60*1000))+(this.hours()*(60*60*1000))+(this.minutes()*(60*1000))+(this.seconds()*(1000))};TimeSpan.prototype.get12HourHour=function(){return((h=this.hours()%12)?h:12)};TimeSpan.prototype.getDesignator=function(){return(this.hours()<12)?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator};TimeSpan.prototype.toString=function(c){function d(){if(this.days()!==null&&this.days()>0){return this.days()+"."+this.hours()+":"+b(this.minutes())+":"+b(this.seconds())}else{return this.hours()+":"+b(this.minutes())+":"+b(this.seconds())}}function b(e){return(e.toString().length<2)?"0"+e:e}var a=this;return c?c.replace(/d|dd|HH|H|hh|h|mm|m|ss|s|tt|t/g,function(e){switch(e){case"d":return a.days();case"dd":return b(a.days());case"H":return a.hours();case"HH":return b(a.hours());case"h":return a.get12HourHour();case"hh":return b(a.get12HourHour());case"m":return a.minutes();case"mm":return b(a.minutes());case"s":return a.seconds();case"ss":return b(a.seconds());case"t":return((this.hours()<12)?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator).substring(0,1);case"tt":return(this.hours()<12)?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator}}):this._toString()};var TimePeriod=function(e,a,m,g,c,j,b){this.years=0;this.months=0;this.days=0;this.hours=0;this.minutes=0;this.seconds=0;this.milliseconds=0;if(arguments.length==2&&arguments[0] instanceof Date&&arguments[1] instanceof Date){var n=e.clone();var l=a.clone();var k=n.clone();var d=(n>l)?-1:+1;this.years=l.getFullYear()-n.getFullYear();k.addYears(this.years);if(d==+1){if(k>l){if(this.years!==0){this.years--}}}else{if(k<l){if(this.years!==0){this.years++}}}n.addYears(this.years);if(d==+1){while(n<l&&n.clone().addDays(n.getDaysInMonth())<l){n.addMonths(1);this.months++}}else{while(n>l&&n.clone().addDays(-n.getDaysInMonth())>l){n.addMonths(-1);this.months--}}var i=l-n;if(i!==0){var f=new TimeSpan(i);this.days=f.days;this.hours=f.hours;this.minutes=f.minutes;this.seconds=f.seconds;this.milliseconds=f.milliseconds}return this}};
\ No newline at end of file