(function(f,A){function J(a){f.extend(!0,xa,a)}function y(a,c,b){function d(){setTimeout(function(){!q.start&&f("body").is(":visible")&&w()},0)}function e(){return a.is(":visible")}function h(a){q&&a==q.name||(p++,q&&(da("viewDestroy",q,q,q.element),k(),q.triggerEventDestroy(),B(),q.element.remove(),L.deactivateButton(q.name)),L.activateButton(a),q=new ha[a](f("<div class='fc-view fc-view-"+a+"' style='position:relative'/>").appendTo(H),n),w(),y(),p--)}function w(a){(!q.start||a||z<q.start||z>=q.end)&&
e()&&r(a)}function r(a){p++;q.start&&(da("viewDestroy",q,q,q.element),k(),u());B();q.render(z,a||0);t();y();(q.afterRender||pb)();L.updateTitle(q.title);a=new Date;a>=q.start&&a<q.end?L.disableButton("today"):L.enableButton("today");da("viewRender",q,q,q.element);q.trigger("viewDisplay",S);p--;!c.lazyFetching||I(q.visStart,q.visEnd)?ya(q.visStart,q.visEnd):g()}function F(){e()&&(k(),u(),m(),t(),g())}function m(){O=c.contentHeight?c.contentHeight:c.height?c.height-(K?K.height():0)-ra(H):Math.round(H.width()/
Math.max(c.aspectRatio,0.5))}function t(){O===A&&m();p++;q.setHeight(O);q.setWidth(H.width());p--;a.outerWidth()}function l(){p||(q.start?(++P,setTimeout(function(){!p&&e()&&(p++,F(),q.trigger("windowResize",S),p--)},200)):d())}function Z(a){u();g(a)}function g(a){e()&&(q.setEventData(Q),q.renderEvents(Q,a),q.trigger("eventAfterAllRender"))}function u(){q.triggerEventDestroy();q.clearEvents();q.clearEventData()}function k(){q&&q.unselect()}function B(){H.css({width:"100%",height:H.height(),overflow:"hidden"})}
function y(){H.css({width:"",height:"",overflow:""})}function da(a,b){if(c[a])return c[a].apply(b||S,Array.prototype.slice.call(arguments,2))}var n=this;n.options=c;n.render=function(b){H?e()&&(m(),r(b)):(a.addClass("fc"),c.isRTL?a.addClass("fc-rtl"):a.addClass("fc-ltr"),c.theme&&a.addClass("ui-widget"),H=f("<div class='fc-content' style='position:relative'/>").prependTo(a),L=new U(n,c),(K=L.render())&&a.prepend(K),h(c.defaultView),c.handleWindowResize&&f(window).resize(l),f("body").is(":visible")||
d())};n.destroy=function(){q&&(da("viewDestroy",q,q,q.element),q.triggerEventDestroy());f(window).unbind("resize",l);L.destroy();H.remove();a.removeClass("fc fc-rtl ui-widget")};n.refetchEvents=function(){u();ya(q.visStart,q.visEnd)};n.reportEvents=function(a){Q=a;g()};n.reportEventChange=function(a){Z(a)};n.rerenderEvents=Z;n.changeView=h;n.select=function(a,c,b){q.select(a,c,b===A?!0:b)};n.unselect=k;n.prev=function(){w(-1)};n.next=function(){w(1)};n.prevYear=function(){Ha(z,-1);w()};n.nextYear=
function(){Ha(z,1);w()};n.today=function(){z=new Date;w()};n.gotoDate=function(a,b,c){a instanceof Date?z=s(a):Ya(z,a,b,c);w()};n.incrementDate=function(a,b,c){a!==A&&Ha(z,a);b!==A&&Ia(z,b);c!==A&&D(z,c);w()};n.formatDate=function(a,b){return ja(a,b,c)};n.formatDates=function(a,b,d){return Ja(a,b,d,c)};n.getDate=function(){return s(z)};n.getView=function(){return q};n.option=function(a,b){if(b===A)return c[a];if("height"==a||"contentHeight"==a||"aspectRatio"==a)c[a]=b,F()};n.trigger=da;ma.call(n,
c,b);var I=n.isFetchNeeded,ya=n.fetchEvents,S=a[0],L,K,H,q,O,P=0,p=0,z=new Date,Q=[],G;Ya(z,c.year,c.month,c.date);c.droppable&&f(document).bind("dragstart",function(a,b){var d=a.target,e=f(d);if(!e.parents(".fc").length){var p=c.dropAccept;if(f.isFunction(p)?p.call(d,e):e.is(p))G=d,q.dragStart(G,a,b)}}).bind("dragstop",function(a,b){G&&(q.dragStop(G,a,b),G=null)})}function U(a,c){function b(b){var d=f("<td class='fc-header-"+b+"'/>");(b=c.header[b])&&f.each(b.split(" "),function(b){0<b&&d.append("<span class='fc-header-space'/>");
var h;f.each(this.split(","),function(b,r){if("title"==r)d.append("<span class='fc-header-title'><h2>&nbsp;</h2></span>"),h&&h.addClass(e+"-corner-right"),h=null;else{var l;a[r]?l=a[r]:ha[r]&&(l=function(){u.removeClass(e+"-state-hover");a.changeView(r)});if(l){var s=c.theme?Ka(c.buttonIcons,r):null,g=Ka(c.buttonText,r);"today"==g&&(g=NextWay.Localization.today);var u=f("<span class='fc-button fc-button-"+r+" "+e+"-state-default'>"+(s?"<span class='fc-icon-wrap'><span class='ui-icon ui-icon-"+s+"'/></span>":
g)+"</span>").click(function(){u.hasClass(e+"-state-disabled")||l()}).mousedown(function(){u.not("."+e+"-state-active").not("."+e+"-state-disabled").addClass(e+"-state-down")}).mouseup(function(){u.removeClass(e+"-state-down")}).hover(function(){u.not("."+e+"-state-active").not("."+e+"-state-disabled").addClass(e+"-state-hover")},function(){u.removeClass(e+"-state-hover").removeClass(e+"-state-down")}).appendTo(d);za(u);h||u.addClass(e+"-corner-left");h=u}}});h&&h.addClass(e+"-corner-right")});return d}
this.render=function(){e=c.theme?"ui":"fc";if(c.header)return d=f("<table class='fc-header' style='width:100%'/>").append(f("<tr/>").append(b("left")).append(b("center")).append(b("right")))};this.destroy=function(){d.remove()};this.updateTitle=function(a){d.find("h2").html(a)};this.activateButton=function(a){d.find("span.fc-button-"+a).addClass(e+"-state-active")};this.deactivateButton=function(a){d.find("span.fc-button-"+a).removeClass(e+"-state-active")};this.disableButton=function(a){d.find("span.fc-button-"+
a).addClass(e+"-state-disabled")};this.enableButton=function(a){d.find("span.fc-button-"+a).removeClass(e+"-state-disabled")};var d=f([]),e}function ma(a,c){function b(b,c){d(b,function(d){if(c==B){if(d){a.eventDataTransform&&(d=f.map(d,a.eventDataTransform));b.eventDataTransform&&(d=f.map(d,b.eventDataTransform));for(var e=0;e<d.length;e++)d[e].source=b,r(d[e]);n=n.concat(d)}D--;D||l(n)}})}function d(b,c){var e,l=M.sourceFetchers,g;for(e=0;e<l.length;e++){g=l[e](b,u,k,c);if(!0===g)return;if("object"==
typeof g){d(g,c);return}}if(e=b.events)f.isFunction(e)?(h(),e(s(u),s(k),function(a){c(a);w()})):f.isArray(e)?c(e):c();else if(b.url){var r=b.success,m=b.error,n=b.complete;e=f.isFunction(b.data)?b.data():b.data;e=f.extend({},e||{});l=ka(b.startParam,a.startParam);g=ka(b.endParam,a.endParam);l&&(e[l]=Math.round(+u/1E3));g&&(e[g]=Math.round(+k/1E3));h();f.ajax(f.extend({},qb,b,{data:e,success:function(a){a=a||[];var b=Aa(r,this,arguments);f.isArray(b)&&(a=b);c(a)},error:function(){Aa(m,this,arguments);
c()},complete:function(){Aa(n,this,arguments);w()}}))}else c()}function e(a){f.isFunction(a)||f.isArray(a)?a={events:a}:"string"==typeof a&&(a={url:a});if("object"==typeof a){var b=a;b.className?"string"==typeof b.className&&(b.className=b.className.split(/\s+/)):b.className=[];for(var c=M.sourceNormalizers,d=0;d<c.length;d++)c[d](b);g.push(a);return a}}function h(){y++||m("loading",null,!0,t())}function w(){--y||m("loading",null,!1,t())}function r(b){var c=b.source||{},d=ka(c.ignoreTimezone,a.ignoreTimezone);
b._id=b._id||(b.id===A?"_fc"+rb++:b.id+"");b.date&&(b.start||(b.start=b.date),delete b.date);b._start=s(b.start=La(b.start,d));b.end=La(b.end,d);b.end&&b.end<=b.start&&(b.end=null);b._end=b.end?s(b.end):null;b.allDay===A&&(b.allDay=ka(c.allDayDefault,a.allDayDefault));b.className?"string"==typeof b.className&&(b.className=b.className.split(/\s+/)):b.className=[]}function F(a){return("object"==typeof a?a.events||a.url:"")||a}this.isFetchNeeded=function(a,b){return!u||a<u||b>k};this.fetchEvents=function(a,
c){u=a;k=c;n=[];var d=++B,e=g.length;D=e;for(var h=0;h<e;h++)b(g[h],d)};this.addEventSource=function(a){if(a=e(a))D++,b(a,B)};this.removeEventSource=function(a){g=f.grep(g,function(b){return!(b&&a&&F(b)==F(a))});n=f.grep(n,function(b){return!(b.source&&a&&F(b.source)==F(a))});l(n)};this.updateEvent=function(a){var b,c=n.length,d,e=t().defaultEventEnd,h=a.start-a._start,f=a.end?a.end-(a._end||e(a)):0;for(b=0;b<c;b++)d=n[b],d._id==a._id&&d!=a&&(d.start=new Date(+d.start+h),d.end=a.end?d.end?new Date(+d.end+
f):new Date(+e(d)+f):null,d.title=a.title,d.url=a.url,d.allDay=a.allDay,d.className=a.className,d.editable=a.editable,d.color=a.color,d.backgroundColor=a.backgroundColor,d.borderColor=a.borderColor,d.textColor=a.textColor,r(d));r(a);l(n)};this.renderEvent=function(a,b){r(a);a.source||(b&&(Z.events.push(a),a.source=Z),n.push(a));l(n)};this.removeEvents=function(a){if(a){if(!f.isFunction(a)){var b=a+"";a=function(a){return a._id==b}}n=f.grep(n,a,!0);for(c=0;c<g.length;c++)f.isArray(g[c].events)&&(g[c].events=
f.grep(g[c].events,a,!0))}else{n=[];for(var c=0;c<g.length;c++)f.isArray(g[c].events)&&(g[c].events=[])}l(n)};this.clientEvents=function(a){return f.isFunction(a)?f.grep(n,a):a?(a+="",f.grep(n,function(b){return b._id==a})):n};this.normalizeEvent=r;for(var m=this.trigger,t=this.getView,l=this.reportEvents,Z={events:[]},g=[Z],u,k,B=0,D=0,y=0,n=[],I=0;I<c.length;I++)e(c[I])}function Ha(a,c,b){a.setFullYear(a.getFullYear()+c);b||pa(a);return a}function Ia(a,c,b){if(+a){c=a.getMonth()+c;var d=s(a);d.setDate(1);
d.setMonth(c);a.setMonth(c);for(b||pa(a);a.getMonth()!=d.getMonth();)a.setDate(a.getDate()+(a<d?1:-1))}return a}function D(a,c,b){if(+a){c=a.getDate()+c;var d=s(a);d.setHours(9);d.setDate(c);a.setDate(c);b||pa(a);Ma(a,d)}return a}function Ma(a,c){if(+a)for(;a.getDate()!=c.getDate();)a.setTime(+a+(a<c?1:-1)*sb)}function I(a,c){a.setMinutes(a.getMinutes()+c);return a}function pa(a){a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0);return a}function s(a,c){return c?pa(new Date(+a)):
new Date(+a)}function Za(){var a=0,c;do c=new Date(1970,a++,1);while(c.getHours());return c}function ua(a,c){return Math.round((s(a,!0)-s(c,!0))/tb)}function Ya(a,c,b,d){c!==A&&c!=a.getFullYear()&&(a.setDate(1),a.setMonth(0),a.setFullYear(c));b!==A&&b!=a.getMonth()&&(a.setDate(1),a.setMonth(b));d!==A&&a.setDate(d)}function La(a,c){if("object"==typeof a)return a;if("number"==typeof a)return new Date(1E3*a);if("string"==typeof a){if(a.match(/^\d+(\.\d+)?$/))return new Date(1E3*parseFloat(a));c===A&&
(c=!0);return Na(a,c)||(a?new Date(a):null)}return null}function Na(a,c){var b=a.match(/^([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 d=new Date(b[1],0,1);if(c||!b[13]){var e=new Date(b[1],0,1,9,0);b[3]&&(d.setMonth(b[3]-1),e.setMonth(b[3]-1));b[5]&&(d.setDate(b[5]),e.setDate(b[5]));Ma(d,e);b[7]&&d.setHours(b[7]);b[8]&&d.setMinutes(b[8]);b[10]&&d.setSeconds(b[10]);b[12]&&d.setMilliseconds(1E3*
Number("0."+b[12]));Ma(d,e)}else d.setUTCFullYear(b[1],b[3]?b[3]-1:0,b[5]||1),d.setUTCHours(b[7]||0,b[8]||0,b[10]||0,b[12]?1E3*Number("0."+b[12]):0),b[14]&&(e=60*Number(b[16])+(b[18]?Number(b[18]):0),e*="-"==b[15]?1:-1,d=new Date(+d+6E4*e));return d}function Oa(a){if("number"==typeof a)return 60*a;if("object"==typeof a)return 60*a.getHours()+a.getMinutes();if(a=a.match(/(\d+)(?::(\d+))?\s*(\w+)?/)){var c=parseInt(a[1],10);a[3]&&(c%=12,"p"==a[3].toLowerCase().charAt(0)&&(c+=12));return 60*c+(a[2]?
parseInt(a[2],10):0)}}function ja(a,c,b){return Ja(a,null,c,b)}function Ja(a,c,b,d){d=d||xa;var e=a,h=c,f,r=b.length,s,m,t,l="";for(f=0;f<r;f++)if(s=b.charAt(f),"'"==s)for(m=f+1;m<r;m++){if("'"==b.charAt(m)){e&&(l=m==f+1?l+"'":l+b.substring(f+1,m),f=m);break}}else if("("==s)for(m=f+1;m<r;m++){if(")"==b.charAt(m)){f=ja(e,b.substring(f+1,m),d);parseInt(f.replace(/\D/,""),10)&&(l+=f);f=m;break}}else if("["==s)for(m=f+1;m<r;m++){if("]"==b.charAt(m)){s=b.substring(f+1,m);f=ja(e,s,d);f!=ja(h,s,d)&&(l+=
f);f=m;break}}else if("{"==s)e=c,h=a;else if("}"==s)e=a,h=c;else{for(m=r;m>f;m--)if(t=$a[b.substring(f,m)]){e&&(l+=t(e,d));f=m-1;break}m==f&&e&&(l+=s)}return l}function va(a){if(a.end){var c=a.end;a=a.allDay;c=s(c);return a||c.getHours()||c.getMinutes()?D(c,1):pa(c)}return D(s(a.start),1)}function ab(a,c,b){a.unbind("mouseover").mouseover(function(a){for(var e=a.target,h;e!=this;)h=e,e=e.parentNode;(e=h._fci)!==A&&(h._fci=A,h=c[e],b(h.event,h.element,h),f(a.target).trigger(a));a.stopPropagation()})}
function wa(a,c,b){for(var d=0,e;d<a.length;d++)e=f(a[d]),e.width(Math.max(0,c-(Pa(e)+Qa(e)+(b?Ra(e):0))))}function bb(a,c,b){for(var d=0,e;d<a.length;d++)e=f(a[d]),e.height(Math.max(0,c-ra(e,b)))}function Pa(a){return(parseFloat(f.css(a[0],"paddingLeft",!0))||0)+(parseFloat(f.css(a[0],"paddingRight",!0))||0)}function Ra(a){return(parseFloat(f.css(a[0],"marginLeft",!0))||0)+(parseFloat(f.css(a[0],"marginRight",!0))||0)}function Qa(a){return(parseFloat(f.css(a[0],"borderLeftWidth",!0))||0)+(parseFloat(f.css(a[0],
"borderRightWidth",!0))||0)}function ra(a,c){return(parseFloat(f.css(a[0],"paddingTop",!0))||0)+(parseFloat(f.css(a[0],"paddingBottom",!0))||0)+((parseFloat(f.css(a[0],"borderTopWidth",!0))||0)+(parseFloat(f.css(a[0],"borderBottomWidth",!0))||0))+(c?(parseFloat(f.css(a[0],"marginTop",!0))||0)+(parseFloat(f.css(a[0],"marginBottom",!0))||0):0)}function pb(){}function cb(a,c){return a-c}function sa(a){return(10>a?"0":"")+a}function Ka(a,c){if(a[c]!==A)return a[c];for(var b=c.split(/(?=[A-Z])/),d=b.length-
1,e;0<=d;d--)if(e=a[b[d].toLowerCase()],e!==A)return e;return a[""]}function ba(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#039;").replace(/"/g,"&quot;").replace(/\n/g,"<br />")}function za(a){a.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return!1})}function Ba(a){a.children().removeClass("fc-first fc-last").filter(":first-child").addClass("fc-first").end().filter(":last-child").addClass("fc-last")}function db(a,
c){var b=a.source||{},d=a.color,e=b.color,f=c("eventColor"),w=a.backgroundColor||d||b.backgroundColor||e||c("eventBackgroundColor")||f,d=a.borderColor||d||b.borderColor||e||c("eventBorderColor")||f,b=a.textColor||b.textColor||c("eventTextColor"),e=[];w&&e.push("background-color:"+w);d&&e.push("border-color:"+d);b&&e.push("color:"+b);return e.join(";")}function Aa(a,c,b){f.isFunction(a)&&(a=[a]);if(a){var d,e;for(d=0;d<a.length;d++)e=a[d].apply(c,b)||e;return e}}function ka(){for(var a=0;a<arguments.length;a++)if(arguments[a]!==
A)return arguments[a]}function Sa(a,c,b){function d(){var b=e();L&&L.remove();L=f(b).appendTo(a);K=L.find("thead");H=K.find(".fc-day-header");q=L.find("tbody");O=q.find("tr");P=q.find(".fc-day");p=O.find("td:first-child");z=O.eq(0).find(".fc-day > div");Q=O.eq(0).find(".fc-day-content > div");Ba(K.add(K.find("tr")));Ba(O);O.eq(0).addClass("fc-first");O.filter(":last").addClass("fc-last");P.each(function(a,b){var c=n(Math.floor(a/T),a%T);k("dayRender",g,c,f(b))});h(P)}function e(){var a=Y+"-widget-header",
b,c,d;b="<thead><tr>";x&&(b+="<th class='fc-week-number "+a+"'>"+ba(la)+"</th>");for(c=0;c<T;c++)d=n(0,c),b+="<th class='fc-day-header fc-"+Ca[d.getDay()]+" "+a+"'>"+ba(S(d,E))+"</th>";a="<table class='fc-border-separate' style='width:100%' cellspacing='0'>"+(b+"</tr></thead>");b=Y+"-widget-content";var e,f;e="<tbody>";for(c=0;c<R;c++){e+="<tr class='fc-week'>";x&&(f=n(c,0),e+="<td class='fc-week-number "+b+"'><div>"+ba(S(f,C))+"</div></td>");for(d=0;d<T;d++){f=n(c,d);var p=Y+"-widget-content",h=
g.start.getMonth(),N=pa(new Date),v="",p=["fc-day","fc-"+Ca[f.getDay()],p];f.getMonth()!=h&&p.push("fc-other-month");+f==+N?p.push("fc-today",Y+"-state-highlight"):f<N?p.push("fc-past"):p.push("fc-future");v+="<td class='"+p.join(" ")+"' data-date='"+S(f,"MM/dd/yyyy")+"'><div>";v+="<div class='fc-day-content'><div style='position:relative'>&nbsp;</div></div>";ca&&(v+="<div class='fc-day-number'>"+f.getDate()+"</div>");v+="</div></td>";e+=v}e+="</tr>"}return a+(e+"</tbody>")+"</table>"}function h(a){a.click(w).mousedown(A).hover(F,
t).click(m).mouseover().mouseout()}function w(a){if(!u("selectable")){var b=Na(f(this).data("date"));k("dayClick",this,b,!0,a)}}function r(a){var b=a.getDate();10>b&&(b="0"+b);var c=a.getMonth(),c=c+1;10>c&&(c="0"+c);return"date"+a.getFullYear()+c+b}function F(){var a=new Date(f(this).attr("data-date"));k("eventMouseover",this,r(a))}function m(){var a=new Date(f(this).attr("data-date"));k("eventClick",this,r(a))}function t(){k("eventMouseout",this)}function l(a,b,c){c&&ga.build();a=M(a,b);for(b=0;b<
a.length;b++)c=a[b],h(Z(c.row,c.leftCol,c.row,c.rightCol))}function Z(b,c,d,e){b=ga.rect(b,c,d,e,a);return B(b,a)}var g=this;g.renderBasic=function(b,c,e){R=b;T=c;ca=e;Y=u("theme")?"ui":"fc";E=u("columnFormat");x=u("weekNumbers");la=u("weekNumberTitle");C="iso"!=u("weekNumberCalculation")?"w":"W";q||(G=f("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(a));d()};g.setHeight=function(a){aa=a;a=aa-K.height();var b,c,d;"variable"==u("weekMode")?b=c=Math.floor(a/
(1==R?2:6)):(b=Math.floor(a/R),c=a-b*(R-1));p.each(function(a,e){a<R&&(d=f(e),d.find("> div").css("min-height",(a==R-1?c:b)-ra(d)),d.find("div.fc-day-content").css("min-height",(a==R-1?c:b)-ra(d)-19))})};g.setWidth=function(a){X=a;N.clear();v.clear();fa=0;x&&(fa=K.find("th.fc-week-number").outerWidth());ea=Math.floor((X-fa)/T);wa(H.slice(0,-1),ea)};g.renderDayOverlay=l;g.defaultSelectionEnd=function(a,b){return s(a)};g.renderSelection=function(a,b,c){l(a,D(s(b),1),!0)};g.clearSelection=function(){y()};
g.reportDayClick=function(a,b,c){var d=I(a);k("dayClick",P[d.row*T+d.col],a,b,c)};g.dragStart=function(a,b,c){W.start(function(a){y();a&&Z(a.row,a.col,a.row,a.col)},b)};g.dragStop=function(a,b,c){var d=W.stop();y();d&&(d=n(d),k("drop",a,d,!0,b,c))};g.defaultEventEnd=function(a){return s(a.start)};g.getHoverListener=function(){return W};g.colLeft=function(a){return N.left(a)};g.colRight=function(a){return N.right(a)};g.colContentLeft=function(a){return v.left(a)};g.colContentRight=function(a){return v.right(a)};
g.getIsCellAllDay=function(){return!0};g.allDayRow=function(a){return O.eq(a)};g.getRowCnt=function(){return R};g.getColCnt=function(){return T};g.getColWidth=function(){return ea};g.getDaySegmentContainer=function(){return G};fb.call(g,a,c,b);gb.call(g);hb.call(g);ub.call(g);var u=g.opt,k=g.trigger,B=g.renderOverlay,y=g.clearOverlays,A=g.daySelectionMousedown,n=g.cellToDate,I=g.dateToCell,M=g.rangeToSegments,S=c.formatDate,L,K,H,q,O,P,p,z,Q,G,X,aa,ea,fa,R,T,ca,ga,W,N,v,Y,E,x,la,C;za(a.addClass("fc-grid"));
ga=new ib(function(a,b){var c,d,e;H.each(function(a,p){c=f(p);d=c.offset().left;a&&(e[1]=d);e=[d];b[a]=e});e[1]=d+c.outerWidth();O.each(function(b,p){b<R&&(c=f(p),d=c.offset().top,b&&(e[1]=d),e=[d],a[b]=e)});e[1]=d+c.outerHeight()});W=new jb(ga);N=new Fa(function(a){return z.eq(a)});v=new Fa(function(a){return Q.eq(a)})}function ub(){var a=this;a.renderEvents=function(c,b){a.renderDayEvents(c,b)};a.clearEvents=function(){a.getDaySegmentContainer().empty()};kb.call(a)}function lb(a,c,b){function d(){var b;
b=qa+"-widget-header";var c,d,e;d="<thead><tr>";ja?(c=K(0,0),c=O(c,ka),c=U?c+ma:ma+c,d+="<th class='fc-agenda-axis fc-week-number "+b+"'>"+ba(c)+"</th>"):d+="<th class='fc-agenda-axis "+b+"'>&nbsp;</th>";for(e=0;e<na;e++)c=K(0,e),d+="<th class='fc-"+Ca[c.getDay()]+" fc-col"+e+" "+b+"'>"+ba(O(c,ha))+"</th>";b="<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'>"+(d+("<th class='fc-agenda-gutter "+b+"'>&nbsp;</th></tr></thead>"));e=qa+"-widget-header";d=qa+"-widget-content";
var h;c=pa(new Date);var N,x,v;v=""+("<tbody><tr><th class='fc-agenda-axis "+e+"'>&nbsp;</th>");N="";for(e=0;e<na;e++)h=K(0,e),x=["fc-col"+e,"fc-"+Ca[h.getDay()],d],+h==+c?x.push(qa+"-state-highlight","fc-today"):h<c?x.push("fc-past"):x.push("fc-future"),h="<td class='"+x.join(" ")+"'><div><div class='fc-day-content'><div style='position:relative'>&nbsp;</div></div></div></td>",N+=h;v=v+N+("<td class='fc-agenda-gutter "+d+"'>&nbsp;</td></tr></tbody>");b=b+v+"</table>";P&&P.remove();P=f(b).appendTo(a);
p=P.find("thead");z=p.find("th").slice(1,-1);Q=P.find("tbody");G=Q.find("td").slice(0,-1);X=G.find("> div");aa=G.find(".fc-day-content > div");ea=G.eq(0);fa=X.eq(0);Ba(p.add(p.find("tr")));Ba(Q.add(Q.find("tr")))}function e(){function a(){W.scrollTop(d)}var b=Za(),c=s(b);c.setHours(B("firstHour"));var d=l(b,c)+1;a();setTimeout(a,0)}function h(a){if(!B("selectable")){var b=Math.min(na-1,Math.floor((a.pageX-P.offset().left-la)/C)),c=K(0,b),d=this.parentNode.className.match(/fc-slot(\d+)/);d?(d=parseInt(d[1])*
B("slotMinutes"),c.setHours(Math.floor(d/60)),c.setMinutes(d%60+J),y("dayClick",G[b],c,!1,a)):y("dayClick",G[b],c,!0,a)}}function w(a,b,c){c&&oa.build();a=q(a,b);for(b=0;b<a.length;b++)c=a[b],r(c.row,c.leftCol,c.row,c.rightCol).click(h).mousedown(S)}function r(a,b,c,d){a=oa.rect(a,b,c,d,R);return da(a,R)}function F(a,b){for(var c=0;c<na;c++){var d=K(0,c),e=D(s(d),1),f=new Date(Math.max(d,a)),p=new Date(Math.min(e,b));f<p&&(e=oa.rect(0,c,0,c,N),f=l(d,f),d=l(d,p),e.top=f,e.height=d-f,da(e,N).click(h).mousedown(u))}}
function m(a){return B("allDaySlot")&&!a.row}function t(a){var b=K(0,a.col);a=a.row;B("allDaySlot")&&a--;0<=a&&I(b,J+a*ia);return b}function l(a,b){a=s(a,!0);if(b<I(s(a),J))return 0;if(b>=I(s(a),V))return Y.height();var c=B("slotMinutes"),d=60*b.getHours()+b.getMinutes()-J,e=Math.floor(d/c),f=Wa[e];f===A&&(f=Wa[e]=Y.find("tr").eq(e).find("td div")[0].offsetTop);return Math.max(0,Math.round(f-1+d%c/c*Ta))}function Z(a,b){var c=B("selectHelper");oa.build();if(c){var d=H(a).col;if(0<=d&&d<na){var d=
oa.rect(0,d,0,d,N),e=l(a,a),p=l(a,b);if(p>e){d.top=e;d.height=p-e;d.left+=2;d.width-=5;if(f.isFunction(c)){if(c=c(a,b))d.position="absolute",E=f(c).css(d).appendTo(N)}else d.isStart=!0,d.isEnd=!0,E=f(L({title:"",start:a,end:b,className:["fc-select-helper"],editable:!1},d)),E.css("opacity",B("dragOpacity"));E&&(E.click(h).mousedown(u),N.append(E),wa(E,d.width,!0),bb(E,d.height,!0))}}}else F(a,b)}function g(){n();E&&(E.remove(),E=null)}function u(a){if(1==a.which&&B("selectable")){ya(a);var b;ta.start(function(a,
c){g();if(a&&a.col==c.col&&!m(a)){var d=t(c),e=t(a);b=[d,I(s(d),ia),e,I(s(e),ia)].sort(cb);Z(b[0],b[3])}else b=null},a);f(document).one("mouseup",function(a){ta.stop();b&&(+b[0]==+b[1]&&k(b[0],!1,a),M(b[0],b[3],!1,a))})}}function k(a,b,c){y("dayClick",G[H(a).col],a,b,c)}this.renderAgenda=function(b){na=b;qa=B("theme")?"ui":"fc";U=B("isRTL");J=Oa(B("minTime"));V=Oa(B("maxTime"));ha=B("columnFormat");ja=B("weekNumbers");ma=B("weekNumberTitle");ka="iso"!=B("weekNumberCalculation")?"w":"W";ia=B("snapMinutes")||
B("slotMinutes");if(P)d();else{b=qa+"-widget-header";var c=qa+"-widget-content",e,p,x,C,E,z=0==B("slotMinutes")%15;d();R=f("<div style='position:absolute;z-index:2;left:0;width:100%'/>").appendTo(a);B("allDaySlot")?(T=f("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(R),e="<table style='width:100%' class='fc-agenda-allday' cellspacing='0'><tr><th class='"+b+" fc-agenda-axis'>"+B("allDayText")+"</th><td><div class='fc-day-content'><div style='position:relative'/></div></td><th class='"+
b+" fc-agenda-gutter'>&nbsp;</th></tr></table>",ca=f(e).appendTo(R),ga=ca.find("tr"),ga.find("td").click(h).mousedown(S),R.append("<div class='fc-agenda-divider "+b+"'><div class='fc-agenda-divider-inner'/></div>")):T=f([]);W=f("<div style='position:absolute;width:100%;overflow-x:hidden;overflow-y:auto'/>").appendTo(R);N=f("<div style='position:relative;width:100%;overflow:hidden'/>").appendTo(W);v=f("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(N);
e="<table class='fc-agenda-slots' style='width:100%' cellspacing='0'><tbody>";p=Za();C=I(s(p),V);I(p,J);for(x=Va=0;p<C;x++)E=p.getMinutes(),e+="<tr class='fc-slot"+x+" "+(E?"fc-minor":"")+"'><th class='fc-agenda-axis "+b+"'>"+(z&&E?"&nbsp;":O(p,B("axisFormat")))+"</th><td class='"+c+"'><div style='position:relative'>&nbsp;</div></td></tr>",I(p,B("slotMinutes")),Va++;Y=f(e+"</tbody></table>").appendTo(N);Y.find("td").click(h).mousedown(u)}};this.setWidth=function(a){Ea.clear();Ga.clear();a=p.find("th:first");
ca&&(a=a.add(ca.find("th:first")));a=a.add(Y.find("th:first"));la=0;wa(a.width("").each(function(a,b){la=Math.max(la,f(b).outerWidth())}),la);a=P.find(".fc-agenda-gutter");ca&&(a=a.add(ca.find("th.fc-agenda-gutter")));var b=W[0].clientWidth;(eb=W.width()-b)?(wa(a,eb),a.show().prev().removeClass("fc-last")):a.hide().prev().addClass("fc-last");C=Math.floor((b-la)/na);wa(z.slice(0,-1),C)};this.setHeight=function(a){a===A&&(a=x);x=a;Wa={};var b=Q.position().top,c=W.position().top;a=Math.min(a-b,Y.height()+
c+1);fa.height(a-ra(ea));R.css("top",b);W.height(a-c-1);Ta=Y.find("tr:first").height()+1;Ua=B("slotMinutes")/ia;Da=Ta/Ua};this.afterRender=function(){e()};this.defaultEventEnd=function(a){var b=s(a.start);return a.allDay?b:I(b,B("defaultEventMinutes"))};this.timePosition=l;this.getIsCellAllDay=m;this.allDayRow=function(a){return ga};this.getCoordinateGrid=function(){return oa};this.getHoverListener=function(){return ta};this.colLeft=function(a){return Ea.left(a)};this.colRight=function(a){return Ea.right(a)};
this.colContentLeft=function(a){return Ga.left(a)};this.colContentRight=function(a){return Ga.right(a)};this.getDaySegmentContainer=function(){return T};this.getSlotSegmentContainer=function(){return v};this.getMinMinute=function(){return J};this.getMaxMinute=function(){return V};this.getSlotContainer=function(){return N};this.getRowCnt=function(){return 1};this.getColCnt=function(){return na};this.getColWidth=function(){return C};this.getSnapHeight=function(){return Da};this.getSnapMinutes=function(){return ia};
this.defaultSelectionEnd=function(a,b){return b?s(a):I(s(a),B("slotMinutes"))};this.renderDayOverlay=w;this.renderSelection=function(a,b,c){c?B("allDaySlot")&&w(a,D(s(b),1),!0):Z(a,b)};this.clearSelection=g;this.reportDayClick=k;this.dragStart=function(a,b,c){ta.start(function(a){n();if(a)if(m(a))r(a.row,a.col,a.row,a.col);else{a=t(a);var b=I(s(a),B("defaultEventMinutes"));F(a,b)}},b)};this.dragStop=function(a,b,c){var d=ta.stop();n();d&&y("drop",a,t(d),m(d),b,c)};fb.call(this,a,c,b);gb.call(this);
hb.call(this);vb.call(this);var B=this.opt,y=this.trigger,da=this.renderOverlay,n=this.clearOverlays,M=this.reportSelection,ya=this.unselect,S=this.daySelectionMousedown,L=this.slotSegHtml,K=this.cellToDate,H=this.dateToCell,q=this.rangeToSegments,O=c.formatDate,P,p,z,Q,G,X,aa,ea,fa,R,T,ca,ga,W,N,v,Y,E,x,la,C,eb,Ta,ia,Ua,Da,na,Va,oa,ta,Ea,Ga,Wa={},qa,U,J,V,ha,ja,ma,ka;za(a.addClass("fc-agenda"));oa=new ib(function(a,b){var c,d,e;z.each(function(a,p){c=f(p);d=c.offset().left;a&&(e[1]=d);e=[d];b[a]=
e});e[1]=d+c.outerWidth();B("allDaySlot")&&(c=ga,d=c.offset().top,a[0]=[d,d+c.outerHeight()]);for(var p=N.offset().top,h=W.offset().top,x=h+W.outerHeight(),v=0;v<Va*Ua;v++)a.push([Math.max(h,Math.min(x,p+Da*v)),Math.max(h,Math.min(x,p+Da*(v+1)))])});ta=new jb(oa);Ea=new Fa(function(a){return X.eq(a)});Ga=new Fa(function(a){return aa.eq(a)})}function vb(){function a(a){return a.end?s(a.end):I(s(a.start),w("defaultEventMinutes"))}function c(a,b){var c="<",d=a.url,e=db(a,w),f=["fc-event","fc-event-vert"];
F(a)&&f.push("fc-event-draggable");b.isStart&&f.push("fc-event-start");b.isEnd&&f.push("fc-event-end");f=f.concat(a.className);a.source&&(f=f.concat(a.source.className||[]));c=d?c+("a href='"+ba(a.url)+"'"):c+"div";c+=" class='"+f.join(" ")+"' style='position:absolute;top:"+b.top+"px;left:"+b.left+"px;"+e+"'><div class='fc-event-inner'><div class='fc-event-time'>"+ba(T(a.start,a.end,w("timeFormat")))+"</div><div class='fc-event-title'>"+ba(a.title||"")+"</div></div><div class='fc-event-bg'></div>";
b.isEnd&&m(a)&&(c+="<div class='ui-resizable-handle ui-resizable-s'>=</div>");return c+("</"+(d?"a":"div")+">")}function b(a,b,c){var f=b.find("div.fc-event-time");F(a)&&d(a,b,f);c.isEnd&&m(a)&&e(a,b,f);l(a,b)}function d(a,b,c){function d(){aa();if(m)if(k)c.hide(),b.draggable("option","grid",null),X(D(s(a.start),F),D(va(a),F));else{var e=y,f=I(s(a.start),e),p;a.end&&(p=I(s(a.end),e));c.text(T(f,p,w("timeFormat")));c.css("display","");b.draggable("option","grid",[E,x])}}var e=h.getCoordinateGrid(),
f=L(),E=K(),x=H(),l=q(),C,g,m,ia,k,u,t,G,F,y,B;b.draggable({scroll:!1,grid:[E,x],axis:1==f?"y":!1,opacity:w("dragOpacity"),revertDuration:w("dragRevertDuration"),start:function(c,d){r("eventDragStart",b,a,c,d);z(a,b);e.build();C=b.position();g=e.cell(c.pageX,c.pageY);m=ia=!0;k=u=n(g);y=B=F=t=G=0},drag:function(a,c){var p=e.cell(a.pageX,a.pageY);if(m=!!p){k=n(p);t=Math.round((c.position.left-C.left)/E);if(t!=G){var p=S(0,g.col),h=g.col+t,h=Math.max(0,h),h=Math.min(f-1,h),h=S(0,h);F=ua(h,p)}k||(y=Math.round((c.position.top-
C.top)/x)*l)}if(m!=ia||k!=u||t!=G||y!=B)d(),ia=m,u=k,G=t,B=y;b.draggable("option","revert",!m)},stop:function(c,e){aa();r("eventDragStop",b,a,c,e);m&&(k||F||y)?Q(this,a,F,k?0:y,k,c,e):(m=!0,k=!1,y=F=t=0,d(),b.css("filter",""),b.css(C),p(a,b))}})}function e(a,b,c){var d,e,f=H(),h=q();b.resizable({handles:{s:".ui-resizable-handle"},grid:f,start:function(c,f){d=e=0;z(a,b);r("eventResizeStart",this,a,c,f)},resize:function(p,z){d=Math.round((Math.max(f,b.height())-z.originalSize.height)/f);d!=e&&(c.text(T(a.start,
d||a.end?I(t(a),h*d):null,w("timeFormat"))),e=d)},stop:function(c,e){r("eventResizeStop",this,a,c,e);d?G(this,a,0,h*d,c,e):p(a,b)}})}var h=this;h.renderEvents=function(d,e){var p,h=d.length,v=[],z=[];for(p=0;p<h;p++)d[p].allDay?v.push(d[p]):z.push(d[p]);w("allDaySlot")&&(ea(v,e),y());var h=L(),v=M(),E=B(),x,l=f.map(z,a),C,g,m,k;p=[];for(C=0;C<h;C++){x=S(0,C);I(x,v);g=z;m=l;k=x;x=I(s(x),E-v);for(var n=[],q=void 0,t=g.length,G=void 0,F=void 0,Q=void 0,D=Q=F=void 0,X=void 0,q=0;q<t;q++)G=g[q],F=G.start,
Q=m[q],Q>k&&F<x&&(F<k?(F=s(k),D=!1):D=!0,Q>x?(Q=s(x),X=!1):X=!0,n.push({event:G,start:F,end:Q,isStart:D,isEnd:X}));m=k=n.sort(mb);g=void 0;g=[];n=x=k=void 0;for(k=0;k<m.length;k++){x=m[k];for(n=0;n<g.length&&nb(x,g[n]).length;n++);(g[n]||(g[n]=[])).push(x)}m=g[0];t=q=n=x=k=k=void 0;for(k=0;k<g.length;k++)for(x=g[k],n=0;n<x.length;n++)for(q=x[n],q.forwardSegs=[],t=k+1;t<g.length;t++)nb(q,g[t],q.forwardSegs);if(m){for(k=0;k<m.length;k++)ob(m[k]);for(k=0;k<m.length;k++)Xa(m[k],0,0)}m=[];n=x=k=void 0;
for(k=0;k<g.length;k++)for(x=g[k],n=0;n<x.length;n++)m.push(x[n]);k=m;for(g=0;g<k.length;g++)m=k[g],m.col=C,p.push(m)}h=p.length;n="";l=u();q=w("isRTL");for(z=0;z<h;z++)v=p[z],E=v.event,C=da(v.start,v.start),g=da(v.start,v.end),m=J(v.col),k=U(v.col),t=k-m,k-=0.025*t,t=k-m,x=t*(v.forwardCoord-v.backwardCoord),w("slotEventOverlap")&&(x=Math.max(2*(x-10),x)),q?(G=k-v.backwardCoord*t,t=G-x):(t=m+v.backwardCoord*t,G=t+x),t=Math.max(t,m),G=Math.min(G,k),x=G-t,v.top=C,v.left=t,v.outerWidth=x,v.outerHeight=
g-C,n+=c(E,v);l[0].innerHTML=n;g=l.children();for(z=0;z<h;z++)v=p[z],E=v.event,C=f(g[z]),m=r("eventRender",E,E,C),!1===m?C.remove():(m&&!0!==m&&(C.remove(),C=f(m).css({position:"absolute",top:v.top,left:v.left}).appendTo(l)),v.element=C,E._id===e?b(E,C,v):C[0]._fci=z,P(E,C));ab(l,p,b);for(z=0;z<h;z++)if(v=p[z],C=v.element)v.vsides=ra(C,!0),v.hsides=Pa(C)+Qa(C)+Ra(C),E=C.find(".fc-event-title"),E.length&&(v.contentTop=E[0].offsetTop);for(z=0;z<h;z++)if(v=p[z],C=v.element)C[0].style.width=Math.max(0,
v.outerWidth-v.hsides)+"px",l=Math.max(0,v.outerHeight-v.vsides),C[0].style.height=l+"px",E=v.event,v.contentTop!==A&&10>l-v.contentTop&&(C.find("div.fc-event-time").text(R(E.start,w("timeFormat"))+" - "+E.title),C.find("div.fc-event-title").remove()),r("eventAfterRender",E,E,C)};h.clearEvents=function(){g().empty();u().empty()};h.slotSegHtml=c;kb.call(h);var w=h.opt,r=h.trigger,F=h.isEventDraggable,m=h.isEventResizable,t=h.eventEnd,l=h.eventElementHandlers,y=h.setHeight,g=h.getDaySegmentContainer,
u=h.getSlotSegmentContainer,k=h.getHoverListener,B=h.getMaxMinute,M=h.getMinMinute,da=h.timePosition,n=h.getIsCellAllDay,J=h.colContentLeft,U=h.colContentRight,S=h.cellToDate,L=h.getColCnt,K=h.getColWidth,H=h.getSnapHeight,q=h.getSnapMinutes,O=h.getSlotContainer,P=h.reportEventElement,p=h.showEvents,z=h.hideEvents,Q=h.eventDrop,G=h.eventResize,X=h.renderDayOverlay,aa=h.clearOverlays,ea=h.renderDayEvents,fa=h.calendar,R=fa.formatDate,T=fa.formatDates;h.draggableDayEvent=function(a,b,c){function d(){x||
(b.width(f).height("").draggable("option","grid",null),x=!0)}var e=c.isStart,f,h,x=!0,g,m=k(),l=K(),n=H(),t=q(),u=M();b.draggable({opacity:w("dragOpacity","month"),revertDuration:w("dragRevertDuration"),start:function(c,p){r("eventDragStart",b,a,c,p);z(a,b);f=b.width();m.start(function(c,f){aa();if(c){h=!1;var p=S(0,f.col),k=S(0,c.col);g=ua(k,p);c.row?e?x&&(b.width(l-10),bb(b,n*Math.round((a.end?(a.end-a.start)/wb:w("defaultEventMinutes"))/t)),b.draggable("option","grid",[l,1]),x=!1):h=!0:(X(D(s(a.start),
g),D(va(a),g)),d());h=h||x&&!g}else d(),h=!0;b.draggable("option","revert",h)},c,"drag")},stop:function(c,e){m.stop();aa();r("eventDragStop",b,a,c,e);if(h)d(),b.css("filter",""),p(a,b);else{var f=0;x||(f=Math.round((b.offset().top-O().offset().top)/n)*t+u-(60*a.start.getHours()+a.start.getMinutes()));Q(this,a,g,f,x,c,e)}}})}}function ob(a){var c=a.forwardSegs,b=0,d,e;if(a.forwardPressure===A){for(d=0;d<c.length;d++)e=c[d],ob(e),b=Math.max(b,1+e.forwardPressure);a.forwardPressure=b}}function Xa(a,
c,b){var d=a.forwardSegs;if(a.forwardCoord===A)for(d.length?(d.sort(xb),Xa(d[0],c+1,b),a.forwardCoord=d[0].backwardCoord):a.forwardCoord=1,a.backwardCoord=a.forwardCoord-(a.forwardCoord-b)/(c+1),c=0;c<d.length;c++)Xa(d[c],0,a.forwardCoord)}function nb(a,c,b){b=b||[];for(var d=0;d<c.length;d++)a.end>c[d].start&&a.start<c[d].end&&b.push(c[d]);return b}function xb(a,c){return c.forwardPressure-a.forwardPressure||(a.backwardCoord||0)-(c.backwardCoord||0)||mb(a,c)}function mb(a,c){return a.start-c.start||
c.end-c.start-(a.end-a.start)||(a.event.title||"").localeCompare(c.event.title)}function fb(a,c,b){function d(a,c){var d=S[a];return f.isPlainObject(d)?Ka(d,c||b):d}function e(a,b){return c.trigger.apply(c,[a,b||k].concat(Array.prototype.slice.call(arguments,2),[k]))}function h(a){return a.end?s(a.end):B(a)}function w(a,b,c){a=U[a._id];var d,e=a.length;for(d=0;d<e;d++)if(!b||a[d][0]!=b[0])a[d][c]()}function r(a,b,c,d){c=c||0;for(var e,f=a.length,h=0;h<f;h++)e=a[h],d!==A&&(e.allDay=d),I(D(e.start,
b,!0),c),e.end&&(e.end=I(D(e.end,b,!0),c)),M(e,S)}function F(a,b,c){c=c||0;for(var d,e=a.length,f=0;f<e;f++)d=a[f],d.end=I(D(h(d),b,!0),c),M(d,S)}function m(a,b){var c=k.getColCnt(),d=P?-1:1,e=P?c-1:0;"object"==typeof a&&(b=a.col,a=a.row);return a*c+(b*d+e)}function t(a){var b=k.visStart.getDay();a+=q[b];return 7*Math.floor(a/H)+O[(a%H+H)%H]-b}function l(a){var b=s(k.visStart);D(b,a);return b}function y(a){return ua(a,k.visStart)}function g(a){var b=k.visStart.getDay();a+=b;return Math.floor(a/7)*
H+q[(a%7+7)%7]-q[b]}function u(a){var b=k.getColCnt();return{row:Math.floor(a/b),col:(a%b+b)%b*(P?-1:1)+(P?b-1:0)}}var k=this;k.element=a;k.calendar=c;k.name=b;k.opt=d;k.trigger=e;k.isEventDraggable=function(a){var b=a.source||{};return ka(a.startEditable,b.startEditable,d("eventStartEditable"),a.editable,b.editable,d("editable"))&&!d("disableDragging")};k.isEventResizable=function(a){var b=a.source||{};return ka(a.durationEditable,b.durationEditable,d("eventDurationEditable"),a.editable,b.editable,
d("editable"))&&!d("disableResizing")};k.setEventData=function(a){n={};var b,c=a.length,d;for(b=0;b<c;b++)d=a[b],n[d._id]?n[d._id].push(d):n[d._id]=[d]};k.clearEventData=function(){n={};U={};V=[]};k.eventEnd=h;k.reportEventElement=function(a,b){V.push({event:a,element:b});U[a._id]?U[a._id].push(b):U[a._id]=[b]};k.triggerEventDestroy=function(){f.each(V,function(a,b){k.trigger("eventDestroy",b.event,b.event,b.element)})};k.eventElementHandlers=function(a,b){b.click(function(c){if(!b.hasClass("ui-draggable-dragging")&&
!b.hasClass("ui-resizable-resizing"))return e("eventClick",this,a,c)}).hover(function(b){e("eventMouseover",this,a,b)},function(b){e("eventMouseout",this,a,b)}).mouseover().mouseout()};k.showEvents=function(a,b){w(a,b,"show")};k.hideEvents=function(a,b){w(a,b,"hide")};k.eventDrop=function(a,b,c,d,f,h,g){var k=b.allDay,m=b._id;r(n[m],c,d,f);e("eventDrop",a,b,c,d,f,function(){r(n[m],-c,-d,k);J(m)},h,g);J(m)};k.eventResize=function(a,b,c,d,f,h){var g=b._id;F(n[g],c,d);e("eventResize",a,b,c,d,function(){F(n[g],
-c,-d);J(g)},f,h);J(g)};var B=k.defaultEventEnd,M=c.normalizeEvent,J=c.reportEventChange,n={},U={},V=[],S=c.options;k.isHiddenDay=function(a){"object"==typeof a&&(a=a.getDay());return K[a]};k.skipHiddenDays=function(a,b,c){for(b=b||1;K[(a.getDay()+(c?b:0)+7)%7];)D(a,b)};k.getCellsPerWeek=function(){return H};k.dateToCell=function(a){a=y(a);a=g(a);return u(a)};k.dateToDayOffset=y;k.dayOffsetToCellOffset=g;k.cellOffsetToCell=u;k.cellToDate=function(){var a=m.apply(null,arguments),a=t(a);return l(a)};
k.cellToCellOffset=m;k.cellOffsetToDayOffset=t;k.dayOffsetToDate=l;k.rangeToSegments=function(a,b){for(var c=k.getRowCnt(),d=k.getColCnt(),e=[],f=y(a),h=y(b),m=g(f),l=g(h)-1,n=0;n<c;n++){var r=n*d,q=r+d-1,r=Math.max(m,r),q=Math.min(l,q);if(r<=q){var w=u(r),N=u(q),w=[w.col,N.col].sort(),r=t(r)==f,q=t(q)+1==h;e.push({row:n,leftCol:w[0],rightCol:w[1],isStart:r,isEnd:q})}}return e};var L=d("hiddenDays")||[],K=[],H,q=[],O=[],P=d("isRTL");(function(){!1===d("weekends")&&L.push(0,6);for(var a=0,b=0;7>a;a++)q[a]=
b,K[a]=-1!=f.inArray(a,L),K[a]||(O[b]=a,b++);H=b;if(!H)throw"invalid hiddenDays";})()}function kb(){function a(a,b,d){a=c([a],!0,!1);var e=[];V(a,function(a,c){a.row===b&&c.css("top",d);e.push(c[0])});return e}function c(a,c,g){var k=z(),m=c?f("<div/>"):k;a=b(a);var l;d(a);l=e(a);f(m[0]).html(l);m=m.children();c&&k.append(m);h(a,m);V(a,function(a,b){a.hsides=Pa(b)+Qa(b)+Ra(b)});V(a,function(a,b){b.width(Math.max(0,a.outerWidth-a.hsides))});V(a,function(a,b){a.outerHeight=b.outerHeight(!0)});w(a,g);
return a}function b(a){for(var b=[],c=0;c<a.length;c++){for(var d=a[c],e=d.start,f=va(d),e=fa(e,f),f=0;f<e.length;f++)e[f].event=d;b.push.apply(b,e)}return b}function d(a){for(var b=y("isRTL"),c=0;c<a.length;c++){var d=a[c],e=(b?d.isStart:d.isEnd)?p:O,f=((b?d.isEnd:d.isStart)?P:q)(d.leftCol),e=e(d.rightCol);d.left=f;d.outerWidth=e-f}}function e(a){for(var b="",c=0;c<a.length;c++){var d=a[c],e="",h=y("isRTL"),g=d.event,m=g.url,l=g.type,n=["fc-event","fc-event-hori"];u(g)&&n.push("fc-event-draggable");
d.isStart&&n.push("fc-event-start");d.isEnd&&n.push("fc-event-end");n=n.concat(g.className);g.source&&(n=n.concat(g.source.className||[]));var r=db(g,y),q=new Date,p=q.getDate(),w=q.getMonth()+1,q=q.getFullYear(),q=p+"-"+w+"-"+q,p=g.start.getDate(),w=g.start.getMonth()+1,t=g.start.getFullYear(),s=p+"-"+w+"-"+t,F="hoverdate"+t+w+p,e=m?e+("<a href='"+ba(m)+"'"):e+("<div id='"+F+"'"),e=e+(" class='"+n.join(" ")+"' style='position:absolute;left:"+d.left+"px;"+r+"'><div class='fc-event-inner'>");!g.allDay&&
d.isStart&&(e+="<span class='fc-event-time'>"+ba(Q(g.start,g.end,y("timeFormat")))+"</span>");n="";">"==g.title[0]?(n="imageBeginning",g.title=g.title.substring(1)):"<"==g.title[0]&&">"!=g.title[1]?(n="imageEnd",g.title=g.title.substring(1)):"<"==g.title[0]&&">"==g.title[1]&&(n="imageBeginEnd",g.title=g.title.substring(2));e=q==s?e+("<span class='fc-event-title "+n+" fc-event-today'>"+ba(g.title||"")+"</span></div>"):e+("<span class='fc-event-title "+n+"'>"+ba(g.title||"")+"</span></div>");d.isEnd&&
k(g)&&(e+="<div class='ui-resizable-handle ui-resizable-"+(h?"w":"e")+"'>&nbsp;&nbsp;&nbsp;</div>");e+="</"+(m?"a":"div")+">";1==l&&(d=GetCurrentTdId(p,t,w),f("#"+d+"").addClass("holiday"));b+=e}return b}function h(a,b){for(var c=0;c<a.length;c++){var d=a[c],e=d.event,h=b.eq(c),e=g("eventRender",e,e,h);!1===e?h.remove():(e&&!0!==e&&(e=f(e).css({position:"absolute",left:d.left}),h.replaceWith(e),h=e),d.element=h)}}function w(a,b){var c=r(a),d=F(),e=[];if(b)for(var f=0;f<d.length;f++)d[f].height(c[f]);
for(f=0;f<d.length;f++)e.push(d[f].position().top);V(a,function(a,b){b.css("top",e[a.row]+a.top)})}function r(a){var b=L(),c=K(),d=[],e=L(),f=[],h,g,m;for(h=0;h<a.length;h++)g=a[h],m=g.row,g.element&&(f[m]?f[m].push(g):f[m]=[g]);for(m=0;m<e;m++){a=f;h=m;g=[];var k;k=f[m]||[];k.sort(yb);for(var l=[],n=0;n<k.length;n++){for(var q=k[n],r=0;r<l.length;r++){var p;a:{p=l[r];for(var w=0;w<p.length;w++){var t=p[w];if(t.leftCol<=q.rightCol&&t.rightCol>=q.leftCol){p=!0;break a}}p=!1}if(!p)break}l[r]?l[r].push(q):
l[r]=[q]}k=l;for(l=0;l<k.length;l++)g.push.apply(g,k[l]);a[h]=g}for(e=0;e<b;e++){m=f[e];a=[];for(k=0;k<c;k++)a.push(0);for(h=0;h<m.length;h++)for(k=g=m[h],l=a.slice(g.leftCol,g.rightCol+1),l=Math.max.apply(Math,l),k.top=l,k=g.leftCol;k<=g.rightCol;k++)a[k]=g.top+g.outerHeight;d.push(Math.max.apply(Math,a))}return d}function F(){var a,b=L(),c=[];for(a=0;a<b;a++)c[a]=H(a).find("div.fc-day-content > div");return c}function m(a,b){var c=z();V(a,function(a,c,d){var e=a.event;e._id===b?t(e,c,a):c[0]._fci=
d});ab(c,a,t)}function t(a,b,c){u(a)&&l.draggableDayEvent(a,b,c);c.isEnd&&k(a)&&l.resizableDayEvent(a,b,c);I(a,b)}var l=this;l.renderDayEvents=function(a,b){var d=c(a,!1,!0);V(d,function(a,b){A(a.event,b)});m(d,b);V(d,function(a,b){g("eventAfterRender",a.event,a.event,b)})};l.draggableDayEvent=function(a,b){var c=ea(),d;b.draggable({delay:50,opacity:y("dragOpacity"),revertDuration:y("dragRevertDuration"),start:function(e,f){g("eventDragStart",b,a,e,f);J(a,b);c.start(function(c,e,f,h){b.draggable("option",
"revert",!c||!f&&!h);U();c?(e=R(e),c=R(c),d=ua(c,e),G(D(s(a.start),d),D(va(a),d))):d=0},e,"drag")},stop:function(e,f){c.stop();U();g("eventDragStop",b,a,e,f);d?M(this,a,d,0,a.allDay,e,f):(b.css("filter",""),n(a,b))}})};l.resizableDayEvent=function(b,c,d){var e=y("isRTL")?"w":"e",h=c.find(".ui-resizable-"+e),k=!1;za(c);c.mousedown(function(a){a.preventDefault()}).click(function(a){k&&(a.preventDefault(),a.stopImmediatePropagation())});h.mousedown(function(h){function m(a){g("eventResizeStop",this,
b,a);f("body").css("cursor","");l.stop();U();r&&S(this,b,r,0,a);setTimeout(function(){k=!1},0)}if(1==h.which){k=!0;var l=ea();L();K();var q=c.css("top"),r,p,w=f.extend({},b),t=W(ga(b.start));aa();f("body").css("cursor",e+"-resize").one("mouseup",m);g("eventResizeStart",this,b,h);l.start(function(c,h){if(c){var g=T(h),k=T(c),k=Math.max(k,t);(r=ca(k)-ca(g))?(w.end=D(B(b),r,!0),g=p,p=a(w,d.row,q),p=f(p),p.find("*").css("cursor",e+"-resize"),g&&g.remove(),J(b)):p&&(n(b),p.remove(),p=null);U();G(b.start,
D(va(b),r))}},h)}})};var y=l.opt,g=l.trigger,u=l.isEventDraggable,k=l.isEventResizable,B=l.eventEnd,A=l.reportEventElement,I=l.eventElementHandlers,n=l.showEvents,J=l.hideEvents,M=l.eventDrop,S=l.eventResize,L=l.getRowCnt,K=l.getColCnt,H=l.allDayRow,q=l.colLeft,O=l.colRight,P=l.colContentLeft,p=l.colContentRight,z=l.getDaySegmentContainer,Q=l.calendar.formatDates,G=l.renderDayOverlay,U=l.clearOverlays,aa=l.clearSelection,ea=l.getHoverListener,fa=l.rangeToSegments,R=l.cellToDate,T=l.cellToCellOffset,
ca=l.cellOffsetToDayOffset,ga=l.dateToDayOffset,W=l.dayOffsetToCellOffset}function V(a,c){for(var b=0;b<a.length;b++){var d=a[b],e=d.element;e&&c(d,e,b)}}function yb(a,c){return c.rightCol-c.leftCol-(a.rightCol-a.leftCol)||c.event.allDay-a.event.allDay||a.event.start-c.event.start||(a.event.title||"").localeCompare(c.event.title)}function hb(){function a(a){s&&(s=!1,r(),e("unselect",null,a))}function c(a,b,c,d){s=!0;e("select",null,a,b,c,d)}var b=this;b.select=function(b,d,e){a();d||(d=h(b,e));w(b,
d,e);c(b,d,e)};b.unselect=a;b.reportSelection=c;b.daySelectionMousedown=function(e){var h=b.cellToDate,l=b.getIsCellAllDay,s=b.getHoverListener(),g=b.reportDayClick;if(1==e.which&&d("selectable")){a(e);var u;s.start(function(a,b){r();a&&l(a)?(u=[h(b),h(a)].sort(cb),w(u[0],u[1],!0)):u=null},e);f(document).one("mouseup",function(a){s.stop();u&&(+u[0]==+u[1]&&g(u[0],!0,a),c(u[0],u[1],!0,a))})}};var d=b.opt,e=b.trigger,h=b.defaultSelectionEnd,w=b.renderSelection,r=b.clearSelection,s=!1;d("selectable")&&
d("unselectAuto")&&f(document).mousedown(function(b){var c=d("unselectCancel");c&&f(b.target).parents(c).length||a(b)})}function gb(){this.renderOverlay=function(b,d){var e=c.shift();e||(e=f("<div class='fc-cell-overlay' style='position:absolute;z-index:3'/>"));e[0].parentNode!=d[0]&&e.appendTo(d);a.push(e.css(b).show());return e};this.clearOverlays=function(){for(var b;b=a.shift();)c.push(b.hide().unbind())};var a=[],c=[]}function ib(a){var c,b;this.build=function(){c=[];b=[];a(c,b)};this.cell=function(a,
e){var f=c.length,w=b.length,r,s=-1,m=-1;for(r=0;r<f;r++)if(e>=c[r][0]&&e<c[r][1]){s=r;break}for(r=0;r<w;r++)if(a>=b[r][0]&&a<b[r][1]){m=r;break}return 0<=s&&0<=m?{row:s,col:m}:null};this.rect=function(a,e,f,w,r){r=r.offset();return{top:c[a][0]-r.top,left:b[e][0]-r.left,width:b[w][1]-b[e][0],height:c[f][1]-c[a][0]}}}function jb(a){function c(b){b.pageX===A&&(b.pageX=b.originalEvent.pageX,b.pageY=b.originalEvent.pageY);b=a.cell(b.pageX,b.pageY);if(!b!=!h||b&&(b.row!=h.row||b.col!=h.col))b?(e||(e=b),
d(b,e,b.row-e.row,b.col-e.col)):d(b,e),h=b}var b,d,e,h;this.start=function(s,r,y){d=s;e=h=null;a.build();c(r);b=y||"mousemove";f(document).bind(b,c)};this.stop=function(){f(document).unbind(b,c);return h}}function Fa(a){var c=this,b={},d={},e={};c.left=function(c){return d[c]=d[c]===A?(b[c]=b[c]||a(c)).position().left:d[c]};c.right=function(d){return e[d]=e[d]===A?c.left(d)+(b[d]=b[d]||a(d)).width():e[d]};c.clear=function(){b={};d={};e={}}}var xa={defaultView:"month",aspectRatio:1.35,header:{left:"title",
center:"prev,next",right:" today"},weekends:!0,weekNumbers:!1,weekNumberCalculation:"iso",weekNumberTitle:"W",allDayDefault:!0,ignoreTimezone:!0,lazyFetching:!0,startParam:"start",endParam:"end",titleFormat:{month:"MMMM yyyy",week:"MMM d[ yyyy]{ '&#8212;'[ MMM] d yyyy}",day:"dddd, MMM d, yyyy"},columnFormat:{month:"ddd",week:"ddd M/d",day:"dddd M/d"},timeFormat:{"":"h(:mm)t"},isRTL:!1,firstDay:0,buttonText:{prev:"<span class='fc-text-arrow'>&nbsp;</span>",next:"<span class='fc-text-arrow'>&nbsp;</span>",
prevYear:"<span class='fc-text-arrow'>&laquo;</span>",nextYear:"<span class='fc-text-arrow'>&raquo;</span>",today:"today",month:"month",week:"week",day:"day"},theme:!1,buttonIcons:{prev:"circle-triangle-w",next:"circle-triangle-e"},unselectAuto:!0,dropAccept:"*",handleWindowResize:!0},zb={header:{left:"next,prev today",center:"",right:"title"},buttonText:{prev:"<span class='fc-text-arrow'>&nbsp;</span>",next:"<span class='fc-text-arrow'>&nbsp;</span>",prevYear:"<span class='fc-text-arrow'>&raquo;</span>",
nextYear:"<span class='fc-text-arrow'>&laquo;</span>"},buttonIcons:{prev:"circle-triangle-e",next:"circle-triangle-w"}},M=f.fullCalendar={version:"1.6.4"},ha=M.views={};f.fn.fullCalendar=function(a){if("string"==typeof a){var c=Array.prototype.slice.call(arguments,1),b;this.each(function(){var d=f.data(this,"fullCalendar");d&&f.isFunction(d[a])&&(d=d[a].apply(d,c),b===A&&(b=d),"destroy"==a&&f.removeData(this,"fullCalendar"))});return b!==A?b:this}a=a||{};var d=a.eventSources||[];delete a.eventSources;
a.events&&(d.push(a.events),delete a.events);a=f.extend(!0,{},xa,a.isRTL||a.isRTL===A&&xa.isRTL?zb:{},a);this.each(function(b,c){var s=f(c),r=new y(s,a,d);s.data("fullCalendar",r);r.render()});return this};M.sourceNormalizers=[];M.sourceFetchers=[];var qb={dataType:"json",cache:!1},rb=1;M.addDays=D;M.cloneDate=s;M.parseDate=La;M.parseISO8601=Na;M.parseTime=Oa;M.formatDate=ja;M.formatDates=Ja;var Ca="sun mon tue wed thu fri sat".split(" "),tb=864E5,sb=36E5,wb=6E4,$a={s:function(a){return a.getSeconds()},
ss:function(a){return sa(a.getSeconds())},m:function(a){return a.getMinutes()},mm:function(a){return sa(a.getMinutes())},h:function(a){return a.getHours()%12||12},hh:function(a){return sa(a.getHours()%12||12)},H:function(a){return a.getHours()},HH:function(a){return sa(a.getHours())},d:function(a){return a.getDate()},dd:function(a){return sa(a.getDate())},ddd:function(a,c){return NextWay.Localization.dayNamesShort[a.getDay()]},dddd:function(a,c){return NextWay.Localization.dayNames[a.getDay()]},M:function(a){return a.getMonth()+
1},MM:function(a){return sa(a.getMonth()+1)},MMM:function(a,c){return NextWay.Localization.monthNamesShort[a.getMonth()]},MMMM:function(a,c){return NextWay.Localization.monthNames[a.getMonth()]},yy:function(a){return(a.getFullYear()+"").substring(2)},yyyy:function(a){return a.getFullYear()},t:function(a){return 12>a.getHours()?"a":"p"},tt:function(a){return 12>a.getHours()?"am":"pm"},T:function(a){return 12>a.getHours()?"A":"P"},TT:function(a){return 12>a.getHours()?"AM":"PM"},u:function(a){return ja(a,
"yyyy-MM-dd'T'HH:mm:ss'Z'")},S:function(a){a=a.getDate();return 10<a&&20>a?"th":["st","nd","rd"][a%10-1]||"th"},w:function(a,c){return c.weekNumberCalculation(a)},W:function(a){var c=new Date(a.getTime());c.setDate(c.getDate()+4-(c.getDay()||7));a=c.getTime();c.setMonth(0);c.setDate(1);return Math.floor(Math.round((a-c)/864E5)/7)+1}};M.dateFormatters=$a;M.applyAll=Aa;ha.month=function(a,c){var b=this;b.render=function(a,c){c&&(Ia(a,c),a.setDate(1));var t=d("firstDay"),l=s(a,!0);l.setDate(1);var y=
Ia(s(l),1),g=s(l);D(g,-((g.getDay()-t+7)%7));f(g);var u=s(y);D(u,(7-u.getDay()+t)%7);f(u,-1,!0);var t=w(),k=Math.round(ua(u,g)/7);"fixed"==d("weekMode")&&(D(u,7*(6-k)),k=6);b.title=r(l,d("titleFormat"));b.start=l;b.end=y;b.visStart=g;b.visEnd=u;e(k,t,!0)};Sa.call(b,a,c,"month");var d=b.opt,e=b.renderBasic,f=b.skipHiddenDays,w=b.getCellsPerWeek,r=c.formatDate};ha.basicWeek=function(a,c){var b=this;b.render=function(a,c){c&&D(a,7*c);var t=D(s(a),-((a.getDay()-d("firstDay")+7)%7)),l=D(s(t),7),y=s(t);
f(y);var g=s(l);f(g,-1,!0);var u=w();b.start=t;b.end=l;b.visStart=y;b.visEnd=g;b.title=r(y,D(s(g),-1),d("titleFormat"));e(1,u,!1)};Sa.call(b,a,c,"basicWeek");var d=b.opt,e=b.renderBasic,f=b.skipHiddenDays,w=b.getCellsPerWeek,r=c.formatDates};ha.basicDay=function(a,c){var b=this;b.render=function(a,c){c&&D(a,c);f(a,0>c?-1:1);var m=s(a,!0),t=D(s(m),1);b.title=y(a,d("titleFormat"));b.start=b.visStart=m;b.end=b.visEnd=t;e(1,1,!1)};Sa.call(b,a,c,"basicDay");var d=b.opt,e=b.renderBasic,f=b.skipHiddenDays,
y=c.formatDate};J({weekMode:"fixed"});ha.agendaWeek=function(a,c){var b=this;b.render=function(a,c){c&&D(a,7*c);var t=D(s(a),-((a.getDay()-d("firstDay")+7)%7)),l=D(s(t),7),A=s(t);f(A);var g=s(l);f(g,-1,!0);var u=y();b.title=r(A,D(s(g),-1),d("titleFormat"));b.start=t;b.end=l;b.visStart=A;b.visEnd=g;e(u)};lb.call(b,a,c,"agendaWeek");var d=b.opt,e=b.renderAgenda,f=b.skipHiddenDays,y=b.getCellsPerWeek,r=c.formatDates};ha.agendaDay=function(a,c){var b=this;b.render=function(a,c){c&&D(a,c);f(a,0>c?-1:1);
var m=s(a,!0),t=D(s(m),1);b.title=y(a,d("titleFormat"));b.start=b.visStart=m;b.end=b.visEnd=t;e(1)};lb.call(b,a,c,"agendaDay");var d=b.opt,e=b.renderAgenda,f=b.skipHiddenDays,y=c.formatDate};J({allDaySlot:!0,allDayText:"all-day",firstHour:6,slotMinutes:30,defaultEventMinutes:120,axisFormat:"h(:mm)tt",timeFormat:{agenda:"h:mm{ - h:mm}"},dragOpacity:{agenda:0.5},minTime:0,maxTime:24,slotEventOverlap:!0})})(jQuery);
initScheduleSummaryCalendar=function(f,A,J){$(".PageContainer").ready(function(){$("#"+f).fullCalendar({events:A,eventMouseover:function(f,A,ma){A=null==f.url?f:f.url.substring(f.url.lastIndexOf("&BeginningDateTo=")+17,f.url.length);1==f.type?(A=f.start.getDate(),ma=f.start.getMonth()+1,f=f.start.getFullYear(),f=GetCurrentTdId(A,f,ma),A=f.substring(5,f.length)):f="hover"+A;$(this).attr("id",f);$("#"+f+".fc-day").addClass("fc-day-hover");quickPreview(f,J+A,null)},eventMouseout:function(f,A,J){$(".fc-day").removeClass("fc-day-hover")},
eventClick:function(f,A,J){f=f.replace("date","");f=f.substring(0,4)+"-"+f.substring(4,6)+"-"+f.substring(6);window.location.href=$("#hdnManagementURL").attr("value").replace("token",f).replace("token",f)}})})};function GetCurrentTdId(f,A,J){1==f.toString().length&&(f="0"+f);1==J.toString().length&&(J="0"+J);return"hoverdate"+A+J+f};
