templates/calendar/jquery.calendar.min.js in compass-jquery-plugin-0.2.5.3 vs templates/calendar/jquery.calendar.min.js in compass-jquery-plugin-0.2.5.4
- old
+ new
@@ -1,118 +1,11 @@
-var a;
-(function(c){c.widget("ui.weekCalendar",{_init:function(){var b=this;b._computeOptions();b._setupEventDelegation();b._renderCalendar();b._loadCalEvents();b._resizeCalendar();b._scrollToHour(b.options.date.getHours());c(window).unbind("resize.weekcalendar");c(window).bind("resize.weekcalendar",function(){b._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 b=new Date(this.element.data("startDate").getTime()-k/6);this._clearCalendar();this._loadCalEvents(b)},nextWeek:function(){var b=new Date(this.element.data("startDate").getTime()+k+k/7);this._clearCalendar();this._loadCalEvents(b)},gotoWeek:function(b){this._clearCalendar();this._loadCalEvents(b)},removeEvent:function(b){this.element.find(".cal-event").each(function(){if(c(this).data("calEvent").id===b){c(this).fadeOut(function(){c(this).remove()});return false}})},removeUnsavedEvents:function(){this.element.find(".new-cal-event").fadeOut(function(){c(this).remove()})},
-updateEvent:function(b){this._updateEventInCalendar(b)},getTimeslotTimes:function(b){var i=this.options,e=i.businessHours.limitDisplay?i.businessHours.start:0,d=[];b=(new Date(b.getFullYear(),b.getMonth(),b.getDate(),e)).getTime();for(e=0;e<i.timeslotsPerDay;e++){var j=b+i.millisPerTimeslot;d[e]={start:new Date(b),startFormatted:this._formatDate(new Date(b),i.timeFormat),end:new Date(j),endFormatted:this._formatDate(new Date(j),i.timeFormat)};b=j}return d},formatDate:function(b,i){return i?this._formatDate(b,
-i):this._formatDate(b,this.options.dateFormat)},formatTime:function(b,i){return i?this._formatDate(b,i):this._formatDate(b,this.options.timeFormat)},getData:function(b){return this._getData(b)},_computeOptions:function(){var b=this.options;if(b.businessHours.limitDisplay){b.timeslotsPerDay=b.timeslotsPerHour*(b.businessHours.end-b.businessHours.start);b.millisToDisplay=(b.businessHours.end-b.businessHours.start)*60*60*1E3;b.millisPerTimeslot=b.millisToDisplay/b.timeslotsPerDay}else{b.timeslotsPerDay=
-b.timeslotsPerHour*24;b.millisToDisplay=f;b.millisPerTimeslot=f/b.timeslotsPerDay}},_resizeCalendar:function(){var b=this.options;if(b&&c.isFunction(b.height)){b=b.height(this.element);var i=this.element.find(".week-calendar-header").outerHeight(),e=this.element.find(".calendar-nav").outerHeight();this.element.find(".calendar-scrollable-grid").height(b-e-i)}},_setupEventDelegation:function(){var b=this,i=this.options;this.element.click(function(e){var d=c(e.target);if(!d.data("preventClick"))if(d.hasClass("cal-event"))i.eventClick(d.data("calEvent"),
-d,e);else d.parent().hasClass("cal-event")&&i.eventClick(d.parent().data("calEvent"),d.parent(),e)}).mouseover(function(e){var d=c(e.target);b._isDraggingOrResizing(d)||d.hasClass("cal-event")&&i.eventMouseover(d.data("calEvent"),d,e)}).mouseout(function(e){var d=c(e.target);if(!b._isDraggingOrResizing(d))if(d.hasClass("cal-event"))d.data("sizing")||i.eventMouseout(d.data("calEvent"),d,e)})},_isDraggingOrResizing:function(b){return b.hasClass("ui-draggable-dragging")||b.hasClass("ui-resizable-resizing")},
-_renderCalendar:function(){var b,i,e,d=this,j=this.options;b=c('<div class="week-calendar">').appendTo(d.element);if(j.buttons){i='<div class="calendar-nav"> <button class="today">'+j.buttonText.today+'</button> <button class="prev">'+j.buttonText.lastWeek+'</button> <button class="next">'+j.buttonText.nextWeek+"</button> </div>";c(i).appendTo(b);b.find(".calendar-nav .today").click(function(){d.element.weekCalendar("today");
-return false});b.find(".calendar-nav .prev").click(function(){d.element.weekCalendar("prevWeek");return false});b.find(".calendar-nav .next").click(function(){d.element.weekCalendar("nextWeek");return false})}i='<table class="week-calendar-header"><tbody><tr><td class="time-column-header"></td>';for(var g=1;g<=7;g++)i+='<td class="day-column-header day-'+g+'"></td>';i+='<td class="scrollbar-shim"></td></tr></tbody></table>';e='<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 l=j.businessHours.limitDisplay?j.businessHours.start:0,m=j.businessHours.limitDisplay?j.businessHours.end:24;for(g=l;g<m;g++){for(var q=0;q<j.timeslotsPerHour-1;q++)e+='<div class="time-slot"></div>';e+='<div class="time-slot hour-end"></div>'}e+='</div></div></td></tr><tr><td class="grid-timeslot-header">';for(g=l;g<m;g++){e+='<div class="hour-header '+(j.businessHours.start<=g&&j.businessHours.end>g?"business-hours":"")+'">';e+=j.use24Hour?'<div class="time-header-cell">'+d._24HourForIndex(g)+
-"</div>":'<div class="time-header-cell">'+d._hourForIndex(g)+'<span class="am-pm">'+d._amOrPm(g)+"</span></div>";e+="</div>"}e+="</td>";for(g=1;g<=7;g++)e+='<td class="day-column day-'+g+'"><div class="day-column-inner"></div></td>';e+="</tr></tbody></table></div>";c(i+e).appendTo(b);b.find(".day-column-inner").each(function(){c(this).height(j.timeslotHeight*j.timeslotsPerDay);if(!j.readonly){d._addDroppableToWeekDay(c(this));d._setupEventCreationForWeekDay(c(this))}});b.find(".time-slot").height(j.timeslotHeight-
-1);b.find(".time-header-cell").css({height:j.timeslotHeight*j.timeslotsPerHour-11,padding:5})},_setupEventCreationForWeekDay:function(b){var i=this,e=this.options;b.mousedown(function(d){var j=c(d.target);if(j.hasClass("day-column-inner")){var g=c('<div class="cal-event new-cal-event new-cal-event-creating"></div>');g.css({lineHeight:e.timeslotHeight-2+"px",fontSize:e.timeslotHeight/2+"px"});j.append(g);var l=j.offset().top;d=d.pageY-l;var m=(d-d%e.timeslotHeight)/e.timeslotHeight*e.timeslotHeight;
-g.css({top:m});j.bind("mousemove.newevent",function(q){g.show();g.addClass("ui-resizable-resizing");q=Math.round(q.pageY-l-m);var u=q%e.timeslotHeight;if(u<q/2){q=q-u;g.css("height",q<e.timeslotHeight?e.timeslotHeight:q)}else g.css("height",q+(e.timeslotHeight-u))}).mouseup(function(){j.unbind("mousemove.newevent");g.addClass("ui-corner-all")})}}).mouseup(function(d){d=c(d.target).closest(".day-column-inner");var j=d.find(".new-cal-event-creating");if(j.length){j.hasClass("ui-resizable-resizing")||
-j.css({height:e.timeslotHeight*e.defaultEventLength}).show();var g=parseInt(j.css("top"));g=i._getEventDurationFromPositionedEventElement(d,j,g);j.remove();j={start:g.start,end:g.end,title:e.newEventText};var l=i._renderEvent(j,d);if(e.allowCalEventOverlap)i._adjustOverlappingEvents(d);else{i._adjustForEventCollisions(d,l,j,j);i._positionEvent(d,l)}e.eventNew(g,l)}})},_loadCalEvents:function(b){var i,e,d=this,j=this.options;i=b||j.date;b=d._dateFirstDayOfWeek(i);weekEndDate=d._dateLastMilliOfWeek(i);
-j.calendarBeforeLoad(d.element);d.element.data("startDate",b);d.element.data("endDate",weekEndDate);e=d.element.find(".day-column-inner");d._updateDayColumnHeader(e);if(typeof j.data=="string"){j.loading&&j.loading(true);i={};i[j.startParam||"start"]=Math.round(b.getTime()/1E3);i[j.endParam||"end"]=Math.round(weekEndDate.getTime()/1E3);c.getJSON(j.data,i,function(g){d._renderEvents(g,e);j.loading&&j.loading(false)})}else if(c.isFunction(j.data))j.data(b,weekEndDate,function(g){d._renderEvents(g,e)});
-else j.data&&d._renderEvents(j.data,e);d._disableTextSelect(e)},_updateDayColumnHeader:function(b){var i=this,e=this.options,d=i._cloneDate(i.element.data("startDate"));i.element.find(".week-calendar-header td.day-column-header").each(function(){var j=e.useShortDayNames?e.shortDays[d.getDay()]:e.longDays[d.getDay()];c(this).html(j+"<br/>"+i._formatDate(d,e.dateFormat));i._isToday(d)?c(this).addClass("today"):c(this).removeClass("today");d=i._addDays(d,1)});d=i._dateFirstDayOfWeek(i._cloneDate(i.element.data("startDate")));
-b.each(function(){c(this).data("startDate",i._cloneDate(d));c(this).data("endDate",new Date(d.getTime()+(f-1)));i._isToday(d)?c(this).parent().addClass("today"):c(this).parent().removeClass("today");d=i._addDays(d,1)})},_renderEvents:function(b,i){var e=this,d=this.options,j;if(c.isArray(b))j=e._cleanEvents(b);else if(b.events)j=e._cleanEvents(b.events);if(b.options){var g=false;c.each(b.options,function(l,m){if(m!==d[l]){d[l]=m;g=true}});e._computeOptions();if(g){e.element.empty();e._renderCalendar();
-i=e.element.find(".week-calendar-time-slots .day-column-inner");e._updateDayColumnHeader(i);e._resizeCalendar()}}c.each(j,function(l,m){(l=e._findWeekDayForEvent(m,i))&&e._renderEvent(m,l)});i.each(function(){e._adjustOverlappingEvents(c(this))});d.calendarAfterLoad(e.element);j.length||d.noEvents()},_renderEvent:function(b,i){var e=this,d=this.options;if(!(b.start.getTime()>b.end.getTime())){var j,g;j=c('<div class="'+(b.id?"cal-event":"cal-event new-cal-event")+' ui-corner-all"> <div class="time ui-corner-all"></div> <div class="title"></div></div>');
-j=(g=d.eventRender(b,j))?g.appendTo(i):j.appendTo(i);j.css({lineHeight:d.timeslotHeight-2+"px",fontSize:d.timeslotHeight/2+"px"});e._refreshEventDetails(b,j);e._positionEvent(i,j);j.show();!d.readonly&&d.resizable(b,j)&&e._addResizableToCalEvent(b,j,i);!d.readonly&&d.draggable(b,j)&&e._addDraggableToCalEvent(b,j);d.eventAfterRender(b,j);return j}},_adjustOverlappingEvents:function(b){var i=this;if(i.options.allowCalEventOverlap){b=i._groupOverlappingEventElements(b);c.each(b,function(){var e=this.length,
-d=this;if(i.options.overlapEventsSeparate)var j=100/e,g=j;else{j=100-e*10;g=(100-j)/(e-1)}c.each(this,function(l){l=l*g;i.options.overlapEventsSeparate||c(this).bind("mouseover.z-index",function(){var m=c(this);c.each(d,function(){c(this).css({"z-index":"1"})});m.css({"z-index":"3"})});c(this).css({width:j+"%",left:l+"%",right:0})})})}},_groupOverlappingEventElements:function(b){var i=b.find(".cal-event").sort(function(q,u){return c(q).data("calEvent").start.getTime()-c(u).data("calEvent").start.getTime()}),
-e=[],d=[],j,g=0,l=0,m=0;c.each(i,function(){j=c(this);g=j.data("calEvent").start.getTime();l=j.data("calEvent").end.getTime();j.css({width:"100%",left:"0%",right:"","z-index":"1"});j.unbind("mouseover.z-index");if(!(j.data("calEvent").start.getTime()<m)){c.each(i,function(){if(!(j.data("calEvent").id==c(this).data("calEvent").id||g>c(this).data("calEvent").start.getTime()+1||l<c(this).data("calEvent").start.getTime()+1)){if(c(this).data("calEvent").end.getTime()>l)l=c(this).data("calEvent").end.getTime();
-c.inArray(c(this),d)==-1&&d.push(c(this));c.inArray(j,d)==-1&&d.push(j)}});if(d.length){d.sort(function(q,u){return c(q).data("calEvent").start.getTime()>c(u).data("calEvent").start.getTime()?1:c(q).data("calEvent").start.getTime()<c(u).data("calEvent").start.getTime()?-1:c(q).data("calEvent").end.getTime()-c(q).data("calEvent").start.getTime()-(c(u).data("calEvent").end.getTime()-c(u).data("calEvent").start.getTime())});e.push(d);d=[];m=l}}});return e},_compareGroups:function(b,i){if(b.length!=i.length)return false;
-for(var e=0;e<b.length;e++)if(b[e].data("calEvent").id!=i[e].data("calEvent").id)return false;return true},_findWeekDayForEvent:function(b,i){var e;i.each(function(){if(c(this).data("startDate").getTime()<=b.start.getTime()&&c(this).data("endDate").getTime()>=b.end.getTime()){e=c(this);return false}});return e},_updateEventInCalendar:function(b){var i=this;i._cleanEvent(b);b.id&&i.element.find(".cal-event").each(function(){if(c(this).data("calEvent").id===b.id||c(this).hasClass("new-cal-event")){c(this).remove();
-return false}});var e=i._findWeekDayForEvent(b,i.element.find(".week-calendar-time-slots .day-column-inner"));if(e){i._renderEvent(b,e);i._adjustOverlappingEvents(e)}},_positionEvent:function(b,i){var e=this.options,d=i.data("calEvent");b=b.height()/e.millisToDisplay;e=e.businessHours.limitDisplay?e.businessHours.start:0;e=d.start.getTime()-(new Date(d.start.getFullYear(),d.start.getMonth(),d.start.getDate(),e)).getTime();d=d.end.getTime()-d.start.getTime();i.css({top:b*e,height:b*d})},_getEventDurationFromPositionedEventElement:function(b,
-i,e){var d=this.options,j=d.businessHours.limitDisplay?d.businessHours.start*60*60*1E3:0;b=new Date(b.data("startDate").getTime()+j+Math.round(e/d.timeslotHeight)*d.millisPerTimeslot);i=new Date(b.getTime()+i.height()/d.timeslotHeight*d.millisPerTimeslot);return{start:b,end:i}},_adjustForEventCollisions:function(b,i,e,d,j){if(!this.options.allowCalEventOverlap){var g,l,m=this;b.find(".cal-event").not(i).each(function(){var q=c(this).data("calEvent");if(e.start.getTime()<q.end.getTime()&&e.end.getTime()>=
-q.end.getTime())g=q.end;if(e.end.getTime()>q.start.getTime()&&e.start.getTime()<=q.start.getTime())l=q.start;if(e.end.getTime()<=q.end.getTime()&&e.start.getTime()>=q.start.getTime()){g=d.start;l=d.end;return false}});e.start=g||e.start;if(g&&j){e.end=new Date(g.getTime()+(d.end.getTime()-d.start.getTime()));m._adjustForEventCollisions(b,i,e,d)}else e.end=l||e.end;if(e.start.getTime()>=e.end.getTime()){e.start=d.start;e.end=d.end}i.data("calEvent",e)}},_addDraggableToCalEvent:function(b,i){var e=
-this,d=this.options;e._findWeekDayForEvent(b,e.element.find(".week-calendar-time-slots .day-column-inner"));i.draggable({handle:".time",containment:".calendar-scrollable-grid",revert:"valid",opacity:0.5,grid:[i.outerWidth()+1,d.timeslotHeight],start:function(j,g){d.eventDrag(b,g.draggable)}})},_addDroppableToWeekDay:function(b){var i=this,e=this.options;b.droppable({accept:".cal-event",drop:function(d,j){var g=j.draggable;d=Math.round(parseInt(j.position.top));j=i._getEventDurationFromPositionedEventElement(b,
-g,d);d=g.data("calEvent");j=c.extend(true,{start:j.start,end:j.end},d);i._adjustForEventCollisions(b,g,j,d,true);var l=i.element.find(".day-column-inner");l=i._renderEvent(j,i._findWeekDayForEvent(j,l));g.hide();e.eventDrop(j,d,l);g.data("preventClick",true);setTimeout(function(){var m=i._findWeekDayForEvent(g.data("calEvent"),i.element.find(".week-calendar-time-slots .day-column-inner"));g.remove();m.data("startDate")!=b.data("startDate")&&i._adjustOverlappingEvents(m);i._adjustOverlappingEvents(b)},
-500)}})},_addResizableToCalEvent:function(b,i,e){var d=this,j=this.options;i.resizable({grid:j.timeslotHeight,containment:e,handles:"s",minHeight:j.timeslotHeight,stop:function(g,l){var m=l.element;g=new Date(m.data("calEvent").start.getTime()+m.height()/j.timeslotHeight*j.millisPerTimeslot);g=c.extend(true,{start:b.start,end:g},b);d._adjustForEventCollisions(e,m,g,b);d._refreshEventDetails(g,m);d._positionEvent(e,m);j.eventResize(g,b,m);m.data("preventClick",true);setTimeout(function(){m.removeData("preventClick")},
-500)}})},_refreshEventDetails:function(b,i){var e=this,d=this.options;i.find(".time").text(e._formatDate(b.start,d.timeFormat)+d.timeSeparator+e._formatDate(b.end,d.timeFormat));i.find(".title").text(b.title);i.data("calEvent",b)},_clearCalendar:function(){this.element.find(".day-column-inner div").remove()},_scrollToHour:function(b){var i=this,e=this.options,d=this.element.find(".calendar-scrollable-grid"),j=b;if(i.options.businessHours.limitDisplay)if(b<i.options.businessHours.start)j=0;else if(b>
-i.options.businessHours.end)j=i.options.businessHours.end-i.options.businessHours.start-1;var g=this.element.find(".grid-timeslot-header .hour-header:eq("+j+")");d.animate({scrollTop:0},0,function(){var l=g.offset().top-d.offset().top-g.outerHeight();d.animate({scrollTop:l},e.scrollToHourMillis)})},_hourForIndex:function(b){return b===0?12:b<13?b:b-12},_24HourForIndex:function(b){return b===0?"00:00":b<10?"0"+b+":00":b+":00"},_amOrPm:function(b){return b<12?"AM":"PM"},_isToday:function(b){b=this._cloneDate(b);
-this._clearTime(b);var i=new Date;this._clearTime(i);return i.getTime()===b.getTime()},_cleanEvents:function(b){var i=this;c.each(b,function(e,d){i._cleanEvent(d)});return b},_cleanEvent:function(b){if(b.date)b.start=b.date;b.start=this._cleanDate(b.start);b.end=this._cleanDate(b.end);if(!b.end)b.end=this._addDays(this._cloneDate(b.start),1)},_disableTextSelect:function(b){b.each(function(){if(c.browser.mozilla)c(this).css("MozUserSelect","none");else c.browser.msie?c(this).bind("selectstart",function(){return false}):
-c(this).mousedown(function(){return false})})},_dateFirstDayOfWeek:function(b){var i=this;b=new Date(b.getFullYear(),b.getMonth(),b.getDate());i=i._getAdjustedDayIndex(b)*864E5;return new Date(b.getTime()-i)},_dateLastDayOfWeek:function(b){var i=this;b=new Date(b.getFullYear(),b.getMonth(),b.getDate());i=(6-i._getAdjustedDayIndex(b))*f;return new Date(b.getTime()+i)},_getAdjustedDayIndex:function(b){b=(new Date(b.getFullYear(),b.getMonth(),b.getDate())).getDay();var i=[0,1,2,3,4,5,6];this._rotate(i,
-this.options.firstDayOfWeek);return i[b]},_dateLastMilliOfWeek:function(b){b=this._dateLastDayOfWeek(b);return new Date(b.getTime()+(f-1))},_clearTime:function(b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0);return b},_addDays:function(b,i,e){b.setDate(b.getDate()+i);if(e)return b;return this._clearTime(b)},_rotate:function(b,i){var e=b.length;i=(Math.abs(i)>=e&&(i%=e),i<0&&(i+=e),i);for(var d,j;i;i=(Math.ceil(e/i)-1)*i-e+(e=i))for(d=e;d>i;j=b[--d],b[d]=b[d-i],b[d-i]=j);return b},
-_cloneDate:function(b){return new Date(+b)},_cleanDate:function(b){if(typeof b=="string")return c.weekCalendar.parseISO8601(b,true)||Date.parse(b)||new Date(parseInt(b));if(typeof b=="number")return new Date(b);return b},_formatDate:function(b,i){for(var e=this.options,d="",j=0;j<i.length;j++){var g=i.charAt(j);d+=c.isFunction(this._replaceChars[g])?this._replaceChars[g](b,e):g}return d},_replaceChars:{d:function(b){return(b.getDate()<10?"0":"")+b.getDate()},D:function(b,i){return i.shortDays[b.getDay()]},
-j:function(b){return b.getDate()},l:function(b,i){return i.longDays[b.getDay()]},N:function(b){return b.getDay()+1},S:function(b){return b.getDate()%10==1&&b.getDate()!=11?"st":b.getDate()%10==2&&b.getDate()!=12?"nd":b.getDate()%10==3&&b.getDate()!=13?"rd":"th"},w:function(b){return b.getDay()},z:function(){return"Not Yet Supported"},W:function(){return"Not Yet Supported"},F:function(b,i){return i.longMonths[b.getMonth()]},m:function(b){return(b.getMonth()<9?"0":"")+(b.getMonth()+1)},M:function(b,
-i){return i.shortMonths[b.getMonth()]},n:function(b){return b.getMonth()+1},t:function(){return"Not Yet Supported"},L:function(){return"Not Yet Supported"},o:function(){return"Not Supported"},Y:function(b){return b.getFullYear()},y:function(b){return(""+b.getFullYear()).substr(2)},a:function(b){return b.getHours()<12?"am":"pm"},A:function(b){return b.getHours()<12?"AM":"PM"},B:function(){return"Not Yet Supported"},g:function(b){return b.getHours()%12||12},G:function(b){return b.getHours()},h:function(b){return((b.getHours()%
-12||12)<10?"0":"")+(b.getHours()%12||12)},H:function(b){return(b.getHours()<10?"0":"")+b.getHours()},i:function(b){return(b.getMinutes()<10?"0":"")+b.getMinutes()},s:function(b){return(b.getSeconds()<10?"0":"")+b.getSeconds()},e:function(){return"Not Yet Supported"},I:function(){return"Not Supported"},O:function(b){return(b.getTimezoneOffset()<0?"-":"+")+(b.getTimezoneOffset()/60<10?"0":"")+b.getTimezoneOffset()/60+"00"},T:function(){return"Not Yet Supported"},Z:function(b){return b.getTimezoneOffset()*
-60},c:function(){return"Not Yet Supported"},r:function(b){return b.toString()},U:function(b){return b.getTime()/1E3}}});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(){return true},resizable:function(){return true},eventClick:function(){},eventRender:function(b,i){return i},eventAfterRender:function(b,i){return i},eventDrag:function(){},eventDrop:function(){},eventResize:function(){},eventNew:function(){},eventMouseover:function(){},eventMouseout:function(){},
-calendarBeforeLoad:function(){},calendarAfterLoad:function(){},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 f=864E5,k=f*7;c.weekCalendar=function(){return{parseISO8601:function(b,
-i){b=b.match(new RegExp("([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})))?)?)?)?"));if(!b)return null;var e=0,d=new Date(b[1],0,1);b[3]&&d.setMonth(b[3]-1);b[5]&&d.setDate(b[5]);b[7]&&d.setHours(b[7]);b[8]&&d.setMinutes(b[8]);b[10]&&d.setSeconds(b[10]);b[12]&&d.setMilliseconds(Number("0."+b[12])*1E3);if(!i){if(b[14]){e=Number(b[16])*60+Number(b[17]);e*=b[15]=="-"?1:-1}e-=d.getTimezoneOffset()}return new Date(Number(d)+e*60*1E3)}}}()})(jQuery);
-(function(c){function f(n,o,p,z){this.id=n;this.date=o;this.cell=p;this.label=z;this.weekNumber=Math.floor(n/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()};this.getCellBox=function(){if(this.cell)return this.cell};this.getLabelWidth=function(){if(this.label)return this.label.innerWidth()};
-this.getLabelHeight=function(){if(this.label)return this.label.height()};this.getDate=function(){return this.date}}var k=[],b={},i=null,e=0,d=null,j=null,g=0,l=0,m=0,q=0,u={startDate:null,endDate:null},v=[],s={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(){}};c.jMonthCalendar=c.J=function(){};var E=function(n){var o;if(typeof n=="string"){var p=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})$/,z=/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;if(o=n.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{7})$/))return new Date(o[1],
-o[2]-1,o[3],o[4],o[5],o[6]);else if(o=n.match(p))return new Date(o[1],o[2]-1,o[3],o[4],o[5],o[6]);else if(o=n.match(z))return new Date(o[1],o[2]-1,o[3]);if(o=n.match(/^\\\/Date\(([0-9]{13})-([0-9]{4})\)\\\/$/))return new Date(o[1]);if(n.match(/^new/))return eval("("+n+")")}},K=function(){if(v&&v.length>0){var n=[],o=[];c.each(v,function(){var p=this;if(p.StartDateTime){if(typeof p.StartDateTime=="object"&&p.StartDateTime.getDate)this.StartDateTime=p.StartDateTime;if(typeof p.StartDateTime=="string"&&
-p.StartDateTime.split)this.StartDateTime=E(p.StartDateTime)}else if(p.Date){if(typeof p.Date=="object"&&p.Date.getDate)this.StartDateTime=p.Date;if(typeof p.Date=="string"&&p.Date.split)this.StartDateTime=E(p.Date)}else return;if(p.EndDateTime){if(typeof p.EndDateTime=="object"&&p.EndDateTime.getDate)this.EndDateTime=p.EndDateTime;if(typeof p.EndDateTime=="string"&&p.EndDateTime.split)this.EndDateTime=E(p.EndDateTime)}else this.EndDateTime=this.StartDateTime.clone();if(this.StartDateTime.clone().clearTime().compareTo(this.EndDateTime.clone().clearTime())==
-0)o.push(this);else this.StartDateTime.clone().clearTime().compareTo(this.EndDateTime.clone().clearTime())==-1&&n.push(this)});n.sort(H);o.sort(H);v=[];c.merge(v,n);c.merge(v,o)}},H=function(n,o){return n.StartDateTime.compareTo(o.StartDateTime)},M=function(){I();k=[]},I=function(){for(var n=0;n<k.length;n++)k[n].clear();b={}},N=function(n){var o=s.calendarStartDate;if(n==undefined)i=new Date(o.getFullYear(),o.getMonth(),1);else{i=n;i.setDate(1)}e=i.getDaysInMonth();d=i.clone().moveToFirstDayOfMonth();
-j=i.clone().moveToLastDayOfMonth();g=d.getDay()-s.firstDayOfWeek;l=g+e;m=Math.ceil(l/7);q=m*7;u.startDate=d.clone().addDays(-1*g);u.endDate=j.clone().addDays(q-(e+g))},O=function(){var n=i.clone().addMonths(-1),o=c('<div class="MonthNavPrev"><a class="link-prev">'+s.navLinks.p+"</a></div>").click(function(){c.J.ChangeMonth(n);return false}),p=i.clone().addMonths(1),z=c('<div class="MonthNavNext"><a class="link-next">'+s.navLinks.n+"</a></div>").click(function(){c.J.ChangeMonth(p);return false}),B=
-i.clone().addYears(-1),w;if(s.navLinks.enablePrevYear)w=c('<div class="YearNavPrev"><a>'+B.getFullYear()+"</a></div>").click(function(){c.J.ChangeMonth(B);return false});var A=i.clone().addYears(1),t;if(s.navLinks.enableNextYear)t=c('<div class="YearNavNext"><a>'+A.getFullYear()+"</a></div>").click(function(){c.J.ChangeMonth(A);return false});var x;if(s.navLinks.enableToday)x=c('<div class="TodayLink"><a class="link-today">'+s.navLinks.t+"</a></div>").click(function(){c.J.ChangeMonth(new Date);return false});
-var C=c('<tr><td colspan="7"><div class="FormHeader MonthNavigation"></div></td></tr>'),y=c(".MonthNavigation",C);y.append(o,z);s.navLinks.enableToday&&y.append(x);y.append(c('<div class="MonthName"></div>').append(Date.CultureInfo.monthNames[i.getMonth()]+" "+i.getFullYear()));s.navLinks.enablePrevYear&&y.append(w);s.navLinks.enableNextYear&&y.append(t);o=c("<tr></tr>");for(z=s.firstDayOfWeek;z<s.firstDayOfWeek+7;z++){w=z%7;t=Date.CultureInfo.dayNames[w];o.append('<th title="'+t+'" class="DateHeader'+
-(w==0||w==6?" Weekend":"")+'"><span>'+t+"</span></th>")}o=c('<thead id="CalendarHead"></thead>').css({height:s.headerHeight+"px"}).append(o);return o=o.prepend(C)};c.J.DrawCalendar=function(n){var o=new Date;o.clearTime();var p=s.calendarStartDate;M();N(n);n=O();i.getMonth()==p.getMonth()&&(i.getFullYear(),p.getFullYear());var z=(c(s.containerId).outerHeight()-s.headerHeight)/m,B=null;p=c('<tbody id="CalendarBody"></tbody>');for(var w=0;w<q;w++){var A=u.startDate.clone().addDays(w);if(w%7==0||w==
-0){B=c("<tr></tr>");B.css({height:z+"px"});p.append(B)}var t=(s.firstDayOfWeek+w)%7,x={"class":"DateBox"+(t==0||t==6?" Weekend ":""),date:A.toString("M/d/yyyy")};if(A.compareTo(d)==-1||A.compareTo(j)==1)x["class"]+=" Inactive";if(A.compareTo(o)==0)x["class"]+=" Today";t=c('<div class="DateLabel"><a>'+A.getDate()+"</a></div>");t.bind("click",{Date:A.clone()},s.onDayLinkClick);x=c("<td></td>").attr(x).append(t);x.bind("dblclick",{Date:A.clone()},s.onDayCellDblClick);x.bind("click",{Date:A.clone()},
-s.onDayCellClick);s.dragableEvents&&x.droppable({hoverClass:s.dragHoverClass,tolerance:"pointer",drop:function(C,y){var J=y.draggable.attr("eventid"),D=(new Date(c(this).attr("date"))).clearTime(),F;c.each(v,function(){if(this.EventID==J){var L=(new TimeSpan(D-this.StartDateTime)).days;this.StartDateTime.addDays(L);this.EndDateTime.addDays(L);F=this}});c.J.ClearEventsOnCalendar();G();s.onEventDropped.call(this,F,D)}});k.push(new f(w,A,x,t));B.append(x)}p.append(B);o=c(s.containerId);n=c('<table class="MonthlyCalendar" cellpadding="0" tablespacing="0"></table>').append(n,
-p);o.hide();o.html(n);o.fadeIn("normal");G()};var G=function(){K();I();if(v&&v.length>0){var n=c(s.containerId);c.each(v,function(){var p=this,z=p.StartDateTime.clone().clearTime(),B=p.EndDateTime.clone().clearTime(),w=(new TimeSpan(z-u.startDate)).days,A=(new TimeSpan(B-u.startDate)).days;A=A>k.length-1?k.length-1:A;for(w=w<0?0:w;w<=A;w++){var t=k[w],x=z.compareTo(t.date),C=B.compareTo(t.date),y=w!=0&&x==-1&&C>=0&&t.weekNumber!=k[w-1].weekNumber||w==0&&x==-1;if((x==0||w==0&&x==-1||y||x==-1&&C>=0)&&
-t.vOffset>=t.getCellBox().height()-t.getLabelHeight()-32){if(!t.isTooManySet){y=c('<div class="MoreEvents" id="ME_'+w+'">'+s.navLinks.showMore+"</div>");x=t.getCellPosition();var J=w;y.css({top:x.top+(t.getCellBox().height()-t.getLabelHeight()),left:x.left,width:t.getLabelWidth()-7,position:"absolute"});y.click(function(F){P(F,J)});b[y.attr("id")]=y;t.isTooManySet=true}t.events.push(p)}else if(x==0||w==0&&x==-1||y){var D=Q(p,t.weekNumber);x=t.getCellPosition();D.css({top:x.top+t.getLabelHeight()+
-t.vOffset,left:x.left,width:t.getLabelWidth()-7,position:"absolute"});t.vOffset+=19;if(y){D.prepend(c("<span />").addClass("ui-icon").addClass("ui-icon-triangle-1-w"));(y=b["Event_"+p.EventID+"_"+(t.weekNumber-1)])&&y.prepend(c("<span />").addClass("ui-icon").addClass("ui-icon-triangle-1-e"))}b[D.attr("id")]=D;t.events.push(p)}else if(x==-1&&C>=0)if(y=b["Event_"+p.EventID+"_"+t.weekNumber]){x=y.css("width");y.css({width:parseInt(x)+t.getLabelWidth()+1});t.vOffset+=19;t.events.push(p)}if(w==A&&C>0)(y=
-b["Event_"+p.EventID+"_"+t.weekNumber])&&y.prepend(c("<span />").addClass("ui-icon").addClass("ui-icon-triangle-1-e"))}});for(var o in b){b[o].hide();n.append(b[o]);b[o].show()}}},Q=function(n,o){var p=c('<div class="Event" id="Event_'+n.EventID+"_"+o+'" eventid="'+n.EventID+'"></div>');n.CssClass&&p.addClass(n.CssClass);p.bind("click",{Event:n},s.onEventBlockClick);p.bind("mouseover",{Event:n},s.onEventBlockOver);p.bind("mouseout",{Event:n},s.onEventBlockOut);s.dragableEvents&&R(n,p,o);o=n.URL&&
-n.URL.length>0?c('<a href="'+n.URL+'">'+n.Title+"</a>"):c("<a>"+n.Title+"</a>");o.bind("click",{Event:n},s.onEventLinkClick);p.append(o);return p},R=function(n,o,p){o.draggable({zIndex:4,delay:50,opacity:0.5,revertDuration:1E3,cursorAt:{left:5},start:function(){for(var z=0;z<=m;z++)if(z!=p){var B=b["Event_"+n.EventID+"_"+z];B&&B.hide()}}})},P=function(n,o){s.onShowMoreClick.call(this,k[o].events);n.stopPropagation()};c.J.ClearEventsOnCalendar=function(){I();c(".Event",c(s.containerId)).remove();c(".MoreEvents",
-c(s.containerId)).remove()};c.J.AddEvents=function(n){if(n){n.length>0?c.merge(v,n):v.push(n);c.J.ClearEventsOnCalendar();G()}};c.J.ReplaceEventCollection=function(n){if(n){v=[];v=n}c.J.ClearEventsOnCalendar();G()};c.J.ChangeMonth=function(n){if(!s.onMonthChanging.call(this,n)){c.J.DrawCalendar(n);s.onMonthChanged.call(this,n)}};c.J.Initialize=function(n,o){c.extend(s,n);if(o){c.J.ClearEventsOnCalendar();v=o}c.J.DrawCalendar()}})(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(c){var f=Date.CultureInfo.monthNames,k=Date.CultureInfo.abbreviatedMonthNames;c=c.toLowerCase();for(var b=0;b<f.length;b++)if(f[b].toLowerCase()==c||k[b].toLowerCase()==c)return b;return-1};
-Date.getDayNumberFromName=function(c){var f=Date.CultureInfo.dayNames,k=Date.CultureInfo.abbreviatedDayNames;c=c.toLowerCase();for(var b=0;b<f.length;b++)if(f[b].toLowerCase()==c||k[b].toLowerCase()==c)return b;return-1};Date.isLeapYear=function(c){return c%4===0&&c%100!==0||c%400===0};Date.getDaysInMonth=function(c,f){return[31,Date.isLeapYear(c)?29:28,31,30,31,30,31,31,30,31,30,31][f]};Date.getTimezoneOffset=function(c,f){return f?Date.CultureInfo.abbreviatedTimeZoneDST[c.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[c.toUpperCase()]};
-Date.getTimezoneAbbreviation=function(c,f){f=f?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard;var k;for(k in f)if(f[k]===c)return k;return null};a=Date.prototype;a.clone=function(){return new Date(this.getTime())};a.compareTo=function(c){if(isNaN(this))throw new Error(this);if(c instanceof Date&&!isNaN(c))return this>c?1:this<c?-1:0;else throw new TypeError(c);};a.equals=function(c){return this.compareTo(c)===0};
-a.between=function(c,f){var k=this.getTime();return k>=c.getTime()&&k<=f.getTime()};a.addMilliseconds=function(c){this.setMilliseconds(this.getMilliseconds()+c);return this};a.addSeconds=function(c){return this.addMilliseconds(c*1E3)};a.addMinutes=function(c){return this.addMilliseconds(c*6E4)};a.addHours=function(c){return this.addMilliseconds(c*36E5)};a.addDays=function(c){return this.addMilliseconds(c*864E5)};a.addWeeks=function(c){return this.addMilliseconds(c*6048E5)};
-a.addMonths=function(c){var f=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+c);this.setDate(Math.min(f,this.getDaysInMonth()));return this};a.addYears=function(c){return this.addMonths(c*12)};
-a.add=function(c){if(typeof c=="number"){this._orient=c;return this}if(c.millisecond||c.milliseconds)this.addMilliseconds(c.millisecond||c.milliseconds);if(c.second||c.seconds)this.addSeconds(c.second||c.seconds);if(c.minute||c.minutes)this.addMinutes(c.minute||c.minutes);if(c.hour||c.hours)this.addHours(c.hour||c.hours);if(c.month||c.months)this.addMonths(c.month||c.months);if(c.year||c.years)this.addYears(c.year||c.years);if(c.day||c.days)this.addDays(c.day||c.days);return this};
-Date._validate=function(c,f,k,b){if(typeof c!="number")throw new TypeError(c+" is not a Number.");else if(c<f||c>k)throw new RangeError(c+" is not a valid value for "+b+".");return true};Date.validateMillisecond=function(c){return Date._validate(c,0,999,"milliseconds")};Date.validateSecond=function(c){return Date._validate(c,0,59,"seconds")};Date.validateMinute=function(c){return Date._validate(c,0,59,"minutes")};Date.validateHour=function(c){return Date._validate(c,0,23,"hours")};
-Date.validateDay=function(c,f,k){return Date._validate(c,1,Date.getDaysInMonth(f,k),"days")};Date.validateMonth=function(c){return Date._validate(c,0,11,"months")};Date.validateYear=function(c){return Date._validate(c,1,9999,"seconds")};a=Date.prototype;
-a.set=function(c){if(!c.millisecond&&c.millisecond!==0)c.millisecond=-1;if(!c.second&&c.second!==0)c.second=-1;if(!c.minute&&c.minute!==0)c.minute=-1;if(!c.hour&&c.hour!==0)c.hour=-1;if(!c.day&&c.day!==0)c.day=-1;if(!c.month&&c.month!==0)c.month=-1;if(!c.year&&c.year!==0)c.year=-1;c.millisecond!=-1&&Date.validateMillisecond(c.millisecond)&&this.addMilliseconds(c.millisecond-this.getMilliseconds());c.second!=-1&&Date.validateSecond(c.second)&&this.addSeconds(c.second-this.getSeconds());c.minute!=-1&&
-Date.validateMinute(c.minute)&&this.addMinutes(c.minute-this.getMinutes());c.hour!=-1&&Date.validateHour(c.hour)&&this.addHours(c.hour-this.getHours());c.month!==-1&&Date.validateMonth(c.month)&&this.addMonths(c.month-this.getMonth());c.year!=-1&&Date.validateYear(c.year)&&this.addYears(c.year-this.getFullYear());c.day!=-1&&Date.validateDay(c.day,this.getFullYear(),this.getMonth())&&this.addDays(c.day-this.getDate());c.timezone&&this.setTimezone(c.timezone);c.timezoneOffset&&this.setTimezoneOffset(c.timezoneOffset);
-return this};a.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};a.isLeapYear=function(){var c=this.getFullYear();return c%4===0&&c%100!==0||c%400===0};a.isWeekday=function(){return!(this.is().sat()||this.is().sun())};a.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth())};a.moveToFirstDayOfMonth=function(){return this.set({day:1})};a.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()})};
-a.moveToDayOfWeek=function(c,f){c=(c-this.getDay()+7*(f||+1))%7;return this.addDays(c===0?(c+=7*(f||+1)):c)};a.moveToMonth=function(c,f){c=(c-this.getMonth()+12*(f||+1))%12;return this.addMonths(c===0?(c+=12*(f||+1)):c)};a.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/864E5)};
-a.getWeekOfYear=function(c){var f=this.getFullYear(),k=this.getMonth(),b=this.getDate();c=c||Date.CultureInfo.firstDayOfWeek;var i=8-(new Date(f,0,1)).getDay();if(i==8)i=1;k=(Date.UTC(f,k,b,0,0,0)-Date.UTC(f,0,1,0,0,0))/864E5+1;k=Math.floor((k-i+7)/7);if(k===c){f--;f=8-(new Date(f,0,1)).getDay();k=f==2||f==8?53:52}return k};a.isDST=function(){console.log("isDST");return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D"};
-a.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST())};a.setTimezoneOffset=function(c){var f=this.getTimezoneOffset();this.addMinutes(Number(c)*-6/10-f);return this};a.setTimezone=function(c){return this.setTimezoneOffset(Date.getTimezoneOffset(c))};a.getUTCOffset=function(){var c=this.getTimezoneOffset()*-10/6;if(c<0){c=(c-1E4).toString();return c[0]+c.substr(2)}else{c=(c+1E4).toString();return"+"+c.substr(1)}};
-a.getDayName=function(c){return c?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()]};a.getMonthName=function(c){return c?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()]};a._toString=Date.prototype.toString;
-a.toString=function(c){var f=this,k=function(b){return b.toString().length==1?"0"+b:b};return c?c.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(b){switch(b){case "hh":return k(f.getHours()<13?f.getHours():f.getHours()-12);case "h":return f.getHours()<13?f.getHours():f.getHours()-12;case "HH":return k(f.getHours());case "H":return f.getHours();case "mm":return k(f.getMinutes());case "m":return f.getMinutes();case "ss":return k(f.getSeconds());case "s":return f.getSeconds();
-case "yyyy":return f.getFullYear();case "yy":return f.getFullYear().toString().substring(2,4);case "dddd":return f.getDayName();case "ddd":return f.getDayName(true);case "dd":return k(f.getDate());case "d":return f.getDate().toString();case "MMMM":return f.getMonthName();case "MMM":return f.getMonthName(true);case "MM":return k(f.getMonth()+1);case "M":return f.getMonth()+1;case "t":return f.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case "tt":return f.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()};a=Date.prototype;a._orient=+1;a.next=function(){this._orient=+1;return this};a.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this};a._is=false;a.is=function(){this._is=true;return this};Number.prototype._dateElement="day";
-Number.prototype.fromNow=function(){var c={};c[this._dateElement]=this;return Date.now().add(c)};Number.prototype.ago=function(){var c={};c[this._dateElement]=this*-1;return Date.now().add(c)};
-(function(){for(var c=Date.prototype,f=Number.prototype,k="sunday monday tuesday wednesday thursday friday saturday".split(/\s/),b="january february march april may june july august september october november december".split(/\s/),i="Millisecond Second Minute Hour Day Week Month Year".split(/\s/),e=function(j){return function(){if(this._is){this._is=false;return this.getDay()==j}return this.moveToDayOfWeek(j,this._orient)}},d=0;d<k.length;d++)c[k[d]]=c[k[d].substring(0,3)]=e(d);k=function(j){return function(){if(this._is){this._is=
-false;return this.getMonth()===j}return this.moveToMonth(j,this._orient)}};for(e=0;e<b.length;e++)c[b[e]]=c[b[e].substring(0,3)]=k(e);k=function(j){return function(){if(j.substring(j.length-1)!="s")j+="s";return this["add"+j](this._orient)}};e=function(j){return function(){this._dateElement=j;return this}};for(d=0;d<i.length;d++){b=i[d].toLowerCase();c[b]=c[b+"s"]=k(i[d]);f[b]=f[b+"s"]=e(b)}})();a=Date.prototype;a.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ")};
-a.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern)};a.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern)};a.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern)};a.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern)};
-a.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(e){this.message="Parse error at '"+e.substring(0,10)+" ...'"}};for(var c=Date.Parsing,f=c.Operators={rtoken:function(e){return function(d){var j=d.match(e);if(j)return[j[0],d.substring(j[0].length)];else throw new c.Exception(d);}},token:function(){return function(e){return f.rtoken(new RegExp("^s*"+e+"s*"))(e)}},stoken:function(e){return f.rtoken(new RegExp("^"+e))},until:function(e){return function(d){for(var j=[],g=null;d.length;){try{g=e.call(this,
-d)}catch(l){j.push(g[0]);d=g[1];continue}break}return[j,d]}},many:function(e){return function(d){for(var j=[],g=null;d.length;){try{g=e.call(this,d)}catch(l){return[j,d]}j.push(g[0]);d=g[1]}return[j,d]}},optional:function(e){return function(d){var j=null;try{j=e.call(this,d)}catch(g){return[null,d]}return[j[0],j[1]]}},not:function(e){return function(d){try{e.call(this,d)}catch(j){return[null,d]}throw new c.Exception(d);}},ignore:function(e){return e?function(d){var j=null;j=e.call(this,d);return[null,
-j[1]]}:null},product:function(){for(var e=arguments[0],d=Array.prototype.slice.call(arguments,1),j=[],g=0;g<e.length;g++)j.push(f.each(e[g],d));return j},cache:function(e){var d={},j=null;return function(g){try{j=d[g]=d[g]||e.call(this,g)}catch(l){j=d[g]=l}if(j instanceof c.Exception)throw j;else return j}},any:function(){var e=arguments;return function(d){for(var j=null,g=0;g<e.length;g++)if(e[g]!=null){try{j=e[g].call(this,d)}catch(l){j=null}if(j)return j}throw new c.Exception(d);}},each:function(){var e=
-arguments;return function(d){for(var j=[],g=null,l=0;l<e.length;l++)if(e[l]!=null){try{g=e[l].call(this,d)}catch(m){throw new c.Exception(d);}j.push(g[0]);d=g[1]}return[j,d]}},all:function(){var e=e;return e.each(e.optional(arguments))},sequence:function(e,d,j){d=d||f.rtoken(/^\s*/);j=j||null;if(e.length==1)return e[0];return function(g){for(var l=null,m=null,q=[],u=0;u<e.length;u++){try{l=e[u].call(this,g)}catch(v){break}q.push(l[0]);try{m=d.call(this,l[1])}catch(s){m=null;break}g=m[1]}if(!l)throw new c.Exception(g);
-if(m)throw new c.Exception(m[1]);if(j)try{l=j.call(this,l[1])}catch(E){throw new c.Exception(l[1]);}return[q,l?l[1]:g]}},between:function(e,d,j){j=j||e;var g=f.each(f.ignore(e),d,f.ignore(j));return function(l){l=g.call(this,l);return[[l[0][0],r[0][2]],l[1]]}},list:function(e,d,j){d=d||f.rtoken(/^\s*/);j=j||null;return e instanceof Array?f.each(f.product(e.slice(0,-1),f.ignore(d)),e.slice(-1),f.ignore(j)):f.each(f.many(f.each(e,f.ignore(d))),px,f.ignore(j))},set:function(e,d,j){d=d||f.rtoken(/^\s*/);
-j=j||null;return function(g){var l=null;for(var m=l=null,q=null,u=[[],g],v=false,s=0;s<e.length;s++){l=m=null;v=e.length==1;try{l=e[s].call(this,g)}catch(E){continue}q=[[l[0]],l[1]];if(l[1].length>0&&!v)try{m=d.call(this,l[1])}catch(K){v=true}else v=true;if(!v&&m[1].length===0)v=true;if(!v){l=[];for(v=0;v<e.length;v++)s!=v&&l.push(e[v]);l=f.set(l,d).call(this,m[1]);if(l[0].length>0){q[0]=q[0].concat(l[0]);q[1]=l[1]}}if(q[1].length<u[1].length)u=q;if(u[1].length===0)break}if(u[0].length===0)return u;
-if(j){try{m=j.call(this,u[1])}catch(H){throw new c.Exception(u[1]);}u[1]=m[1]}return u}},forward:function(e,d){return function(j){return e[d].call(this,j)}},replace:function(e,d){return function(j){j=e.call(this,j);return[d,j[1]]}},process:function(e,d){return function(j){j=e.call(this,j);return[d.call(this,j[0]),j[1]]}},min:function(e,d){return function(j){var g=d.call(this,j);if(g[0].length<e)throw new c.Exception(j);return g}}},k=function(e){return function(){var d=null,j=[];if(arguments.length>
-1)d=Array.prototype.slice.call(arguments);else if(arguments[0]instanceof Array)d=arguments[0];if(d)for(var g=d.shift();0<g.length;){d.unshift(g[0]);j.push(e.apply(null,d));d.shift();return j}else return e.apply(null,arguments)}},b="optional not ignore cache".split(/\s/),i=0;i<b.length;i++)f[b[i]]=k(f[b[i]]);k=function(e){return function(){return arguments[0]instanceof Array?e.apply(null,arguments[0]):e.apply(null,arguments)}};b="each any all".split(/\s/);for(i=0;i<b.length;i++)f[b[i]]=k(f[b[i]])})();
-(function(){var c=function(g){for(var l=[],m=0;m<g.length;m++)if(g[m]instanceof Array)l=l.concat(c(g[m]));else g[m]&&l.push(g[m]);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 l=g.replace(/[^\d\+\-]/g,
-"");if(l.length)this.timezoneOffset=Number(l);else this.timezone=g.toLowerCase()}},day:function(g){var l=g[0];return function(){this.day=Number(l.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 l=Number(g);this.year=g.length>2?l:l+(l+2E3<Date.CultureInfo.twoDigitYearMax?2E3: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 l=new Date;this.year=l.getFullYear();this.month=l.getMonth();this.day=1;for(l=this.second=this.minute=this.hour=0;l<g.length;l++)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.");g=new Date(this.year,this.month,
-this.day,this.hour,this.minute,this.second);if(this.timezone)g.set({timezone:this.timezone});else this.timezoneOffset&&g.set({timezoneOffset:this.timezoneOffset});return g},finish:function(g){g=g instanceof Array?c(g):[g];if(g.length===0)return null;for(var l=0;l<g.length;l++)typeof g[l]=="function"&&g[l].call(this);if(this.now)return new Date;g=Date.today();if(this.days!=null||this.orient||this.operator){var m,q;q=this.orient=="past"||this.operator=="subtract"?-1:1;if(this.weekday){this.unit="day";
-l=Date.getDayNumberFromName(this.weekday)-g.getDay();m=7;this.days=l?(l+q*m)%m:q*m}if(this.month){this.unit="month";l=this.month-g.getMonth();m=12;this.months=l?(l+q*m)%m:q*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*=7}this[this.unit+"s"]=this.value*q}return g.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=g.addDays(Date.getDayNumberFromName(this.weekday)-g.getDay()).getDate();if(this.month&&!this.day)this.day=1;return g.set(this)}}};var f=Date.Parsing.Operators,k=Date.Grammar,b=Date.Translator,i;k.datePartDelimiter=f.rtoken(/^([\s\-\.\,\/\x27]+)/);k.timePartDelimiter=f.stoken(":");k.whiteSpace=f.rtoken(/^\s*/);k.generalDelimiter=f.rtoken(/^(([\s\,]|at|on)+)/);var e={};k.ctoken=function(g){var l=e[g];if(!l){l=Date.CultureInfo.regexPatterns;for(var m=g.split(/\s+/),
-q=[],u=0;u<m.length;u++)q.push(f.replace(f.rtoken(l[m[u]]),m[u]));l=e[g]=f.any.apply(null,q)}return l};k.ctoken2=function(g){return f.rtoken(Date.CultureInfo.regexPatterns[g])};k.h=f.cache(f.process(f.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),b.hour));k.hh=f.cache(f.process(f.rtoken(/^(0[0-9]|1[0-2])/),b.hour));k.H=f.cache(f.process(f.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),b.hour));k.HH=f.cache(f.process(f.rtoken(/^([0-1][0-9]|2[0-3])/),b.hour));k.m=f.cache(f.process(f.rtoken(/^([0-5][0-9]|[0-9])/),b.minute));
-k.mm=f.cache(f.process(f.rtoken(/^[0-5][0-9]/),b.minute));k.s=f.cache(f.process(f.rtoken(/^([0-5][0-9]|[0-9])/),b.second));k.ss=f.cache(f.process(f.rtoken(/^[0-5][0-9]/),b.second));k.hms=f.cache(f.sequence([k.H,k.mm,k.ss],k.timePartDelimiter));k.t=f.cache(f.process(k.ctoken2("shortMeridian"),b.meridian));k.tt=f.cache(f.process(k.ctoken2("longMeridian"),b.meridian));k.z=f.cache(f.process(f.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),b.timezone));k.zz=f.cache(f.process(f.rtoken(/^(\+|\-)\s*\d\d\d\d/),b.timezone));
-k.zzz=f.cache(f.process(k.ctoken2("timezone"),b.timezone));k.timeSuffix=f.each(f.ignore(k.whiteSpace),f.set([k.tt,k.zzz]));k.time=f.each(f.optional(f.ignore(f.stoken("T"))),k.hms,k.timeSuffix);k.d=f.cache(f.process(f.each(f.rtoken(/^([0-2]\d|3[0-1]|\d)/),f.optional(k.ctoken2("ordinalSuffix"))),b.day));k.dd=f.cache(f.process(f.each(f.rtoken(/^([0-2]\d|3[0-1])/),f.optional(k.ctoken2("ordinalSuffix"))),b.day));k.ddd=k.dddd=f.cache(f.process(k.ctoken("sun mon tue wed thu fri sat"),function(g){return function(){this.weekday=
-g}}));k.M=f.cache(f.process(f.rtoken(/^(1[0-2]|0\d|\d)/),b.month));k.MM=f.cache(f.process(f.rtoken(/^(1[0-2]|0\d)/),b.month));k.MMM=k.MMMM=f.cache(f.process(k.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),b.month));k.y=f.cache(f.process(f.rtoken(/^(\d\d?)/),b.year));k.yy=f.cache(f.process(f.rtoken(/^(\d\d)/),b.year));k.yyy=f.cache(f.process(f.rtoken(/^(\d\d?\d?\d?)/),b.year));k.yyyy=f.cache(f.process(f.rtoken(/^(\d\d\d\d)/),b.year));i=function(){return f.each(f.any.apply(null,arguments),
-f.not(k.ctoken2("timeContext")))};k.day=i(k.d,k.dd);k.month=i(k.M,k.MMM);k.year=i(k.yyyy,k.yy);k.orientation=f.process(k.ctoken("past future"),function(g){return function(){this.orient=g}});k.operator=f.process(k.ctoken("add subtract"),function(g){return function(){this.operator=g}});k.rday=f.process(k.ctoken("yesterday tomorrow today now"),b.rday);k.unit=f.process(k.ctoken("minute hour day week month year"),function(g){return function(){this.unit=g}});k.value=f.process(f.rtoken(/^\d\d?(st|nd|rd|th)?/),
-function(g){return function(){this.value=g.replace(/\D/g,"")}});k.expression=f.set([k.rday,k.operator,k.value,k.unit,k.orientation,k.ddd,k.MMM]);i=function(){return f.set(arguments,k.datePartDelimiter)};k.mdy=i(k.ddd,k.month,k.day,k.year);k.ymd=i(k.ddd,k.year,k.month,k.day);k.dmy=i(k.ddd,k.day,k.month,k.year);k.date=function(g){return(k[Date.CultureInfo.dateElementOrder]||k.mdy).call(this,g)};k.format=f.process(f.many(f.any(f.process(f.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),
-function(g){if(k[g])return k[g];else throw Date.Parsing.Exception(g);}),f.process(f.rtoken(/^[^dMyhHmstz]+/),function(g){return f.ignore(f.stoken(g))}))),function(g){return f.process(f.each.apply(null,g),b.finishExact)});var d={},j=function(g){return d[g]=d[g]||k.format(g)[0]};k.formats=function(g){if(g instanceof Array){for(var l=[],m=0;m<g.length;m++)l.push(j(g[m]));return f.any.apply(null,l)}else return j(g)};k._formats=k.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz",
-"d"]);k._start=f.process(f.set([k.date,k.time,k.expression],k.generalDelimiter,k.whiteSpace),b.finish);k.start=function(g){try{var l=k._formats.call({},g);if(l[1].length===0)return l}catch(m){}return k._start.call({},g)}})();Date._parse=Date.parse;Date.parse=function(c){var f=null;if(!c)return null;try{f=Date.Grammar.start.call({},c)}catch(k){return null}return f[1].length===0?f[0]:null};
-Date.getParseFunction=function(c){var f=Date.Grammar.formats(c);return function(k){var b=null;try{b=f.call({},k)}catch(i){return null}return b[1].length===0?b[0]:null}};Date.parseExact=function(c,f){return Date.getParseFunction(f)(c)};
-TimeSpan=function(c,f,k,b,i){this.milliseconds=this.seconds=this.minutes=this.hours=this.days=0;if(arguments.length==5){this.days=c;this.hours=f;this.minutes=k;this.seconds=b;this.milliseconds=i}else if(arguments.length==1&&typeof c=="number"){var e=c<0?-1:+1;this.milliseconds=Math.abs(c);this.days=Math.floor(this.milliseconds/864E5)*e;this.milliseconds%=864E5;this.hours=Math.floor(this.milliseconds/36E5)*e;this.milliseconds%=36E5;this.minutes=Math.floor(this.milliseconds/6E4)*e;this.milliseconds%=
-6E4;this.seconds=Math.floor(this.milliseconds/1E3)*e;this.milliseconds%=1E3;this.milliseconds*=e;return this}else return null};a=TimeSpan.prototype;a.compare=function(c){var f=new Date(1970,1,1,this.hours(),this.minutes(),this.seconds());c=c===null?new Date(1970,1,1,0,0,0):new Date(1970,1,1,c.hours(),c.minutes(),c.seconds());return f>c?1:f<c?-1:0};a.add=function(c){return c===null?this:this.addSeconds(c.getTotalMilliseconds()/1E3)};
-a.subtract=function(c){return c===null?this:this.addSeconds(-c.getTotalMilliseconds()/1E3)};a.addDays=function(c){return new TimeSpan(this.getTotalMilliseconds()+c*24*60*60*1E3)};a.addHours=function(c){return new TimeSpan(this.getTotalMilliseconds()+c*60*60*1E3)};a.addMinutes=function(c){return new TimeSpan(this.getTotalMilliseconds()+c*60*1E3)};a.addSeconds=function(c){return new TimeSpan(this.getTotalMilliseconds()+c*1E3)};
-a.addMilliseconds=function(c){return new TimeSpan(this.getTotalMilliseconds()+c)};a.getTotalMilliseconds=function(){return this.days()*864E5+this.hours()*36E5+this.minutes()*6E4+this.seconds()*1E3};a.get12HourHour=function(){return(h=this.hours()%12)?h:12};a.getDesignator=function(){return this.hours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator};
-a.toString=function(c){function f(b){return b.toString().length<2?"0"+b:b}var k=this;return c?c.replace(/d|dd|HH|H|hh|h|mm|m|ss|s|tt|t/g,function(b){switch(b){case "d":return k.days();case "dd":return f(k.days());case "H":return k.hours();case "HH":return f(k.hours());case "h":return k.get12HourHour();case "hh":return f(k.get12HourHour());case "m":return k.minutes();case "mm":return f(k.minutes());case "s":return k.seconds();case "ss":return f(k.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(c,f){this.milliseconds=this.seconds=this.minutes=this.hours=this.days=this.months=this.years=0;if(arguments.length==2&&arguments[0]instanceof Date&&arguments[1]instanceof Date){var k=c.clone(),b=f.clone(),i=k.clone(),e=k>b?-1:+1;this.years=b.getFullYear()-k.getFullYear();i.addYears(this.years);if(e==+1)i>b&&this.years!==0&&this.years--;else i<b&&this.years!==0&&this.years++;k.addYears(this.years);if(e==+1)for(;k<b&&k.clone().addDays(k.getDaysInMonth())<b;){k.addMonths(1);this.months++}else for(;k>
-b&&k.clone().addDays(-k.getDaysInMonth())>b;){k.addMonths(-1);this.months--}k=b-k;if(k!==0){k=new TimeSpan(k);this.days=k.days;this.hours=k.hours;this.minutes=k.minutes;this.seconds=k.seconds;this.milliseconds=k.milliseconds}return this}};
+(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