(function(n,t){function vt(t){n.extend(!0,nt,t)}function vi(u,f,e){function ri(n){a?b()&&(ft(),yt(n)):ui()}function ui(){er=f.theme?"ui":"fc";u.addClass("fc");f.isRTL?u.addClass("fc-rtl"):u.addClass("fc-ltr");f.theme&&u.addClass("ui-widget");a=n("<div class='fc-content' style='position:relative'/>").prependTo(u);p=new yi(s,f);d=p.render();d&&u.prepend(d);vt(f.defaultView);f.handleWindowResize&&n(window).resize(kt);at()||lt()}function lt(){setTimeout(function(){!o.start&&at()&&y()},0)}function fi(){o&&(k("viewDestroy",o,o,o.element),o.triggerEventDestroy());n(window).unbind("resize",kt);p.destroy();a.remove();u.removeClass("fc fc-rtl ui-widget")}function b(){return u.is(":visible")}function at(){return n("body").is(":visible")}function vt(n){o&&n==o.name||ei(n)}function ei(t){v++;o&&(k("viewDestroy",o,o,o.element),ut(),o.triggerEventDestroy(),ni(),o.element.remove(),p.deactivateButton(o.name));p.activateButton(t);o=new h[t](n("<div class='fc-view fc-view-"+t+"' style='position:relative'/>").appendTo(a),s);y();ti();v--}function y(n){(!o.start||n||o.start>l||l>=o.end)&&b()&&yt(n)}function yt(n){v++;o.start&&(k("viewDestroy",o,o,o.element),ut(),tt());ni();o.render(l,n||0);bt();ti();(o.afterRender||rr)();li();ai();k("viewRender",o,o,o.element);o.trigger("viewDisplay",ht);v--;si()}function wt(){b()&&(ut(),tt(),ft(),bt(),nt())}function ft(){ot=f.contentHeight?f.contentHeight:f.height?f.height-(d?d.height():0)-w(a):Math.round(a.width()/Math.max(f.aspectRatio,.5))}function bt(){ot===t&&ft();v++;o.setHeight(ot);o.setWidth(a.width());v--;et=u.outerWidth()}function kt(){if(!v)if(o.start){var n=++ii;setTimeout(function(){n==ii&&!v&&b()&&et!=(et=u.outerWidth())&&(v++,wt(),o.trigger("windowResize",ht),v--)},200)}else lt()}function oi(){tt();gt()}function dt(n){tt();nt(n)}function nt(n){b()&&(o.setEventData(ct),o.renderEvents(ct,n),o.trigger("eventAfterAllRender"))}function tt(){o.triggerEventDestroy();o.clearEvents();o.clearEventData()}function si(){!f.lazyFetching||or(o.visStart,o.visEnd)?gt():nt()}function gt(){sr(o.visStart,o.visEnd)}function hi(n){ct=n;nt()}function ci(n){dt(n)}function li(){p.updateTitle(o.title)}function ai(){var n=new Date;n>=o.start&&o.end>n?p.disableButton("today"):p.enableButton("today")}function vi(n,i,r){o.select(n,i,r===t?!0:r)}function ut(){o&&o.unselect()}function wi(){y(-1)}function bi(){y(1)}function ki(){it(l,-1);y()}function di(){it(l,1);y()}function gi(){l=new Date;y()}function nr(n,t,r){n instanceof Date?l=i(n):pt(l,n,t,r);y()}function tr(n,i,u){n!==t&&it(l,n);i!==t&&rt(l,i);u!==t&&r(l,u);y()}function ir(){return i(l)}function ni(){a.css({width:"100%",height:a.height(),overflow:"hidden"})}function ti(){a.css({width:"",height:"",overflow:""})}function ur(){return o}function fr(n,i){return i===t?f[n]:(("height"==n||"contentHeight"==n||"aspectRatio"==n)&&(f[n]=i,wt()),t)}function k(n,i){return f[n]?f[n].apply(i||ht,Array.prototype.slice.call(arguments,2)):t}var s=this;s.options=f;s.render=ri;s.destroy=fi;s.refetchEvents=oi;s.reportEvents=hi;s.reportEventChange=ci;s.rerenderEvents=dt;s.changeView=vt;s.select=vi;s.unselect=ut;s.prev=wi;s.next=bi;s.prevYear=ki;s.nextYear=di;s.today=gi;s.gotoDate=nr;s.incrementDate=tr;s.formatDate=function(n,t){return c(n,t,f)};s.formatDates=function(n,t,i){return st(n,t,i,f)};s.getDate=ir;s.getView=ur;s.option=fr;s.trigger=k;pi.call(s,f,e);var p,d,a,er,o,et,ot,g,or=s.isFetchNeeded,sr=s.fetchEvents,ht=u[0],ii=0,v=0,l=new Date,ct=[];pt(l,f.year,f.month,f.date);f.droppable&&n(document).bind("dragstart",function(t,i){var u=t.target,e=n(u),r;e.parents(".fc").length||(r=f.dropAccept,(n.isFunction(r)?r.call(u,e):e.is(r))&&(g=u,o.dragStart(g,t,i)))}).bind("dragstop",function(n,t){g&&(o.dragStop(g,n,t),g=null)})}function yi(i,r){function s(){u=r.theme?"ui":"fc";var i=r.header;return i?f=n("<table class='fc-header' style='width:100%'/>").append(n("<tr/>").append(o("left")).append(o("center")).append(o("right"))):t}function c(){f.remove()}function o(t){var f=n("<td class='fc-header-"+t+"'/>"),e=r.header[t];return e&&n.each(e.split(" "),function(t){t>0&&f.append("<span class='fc-header-space'/>");var e;n.each(this.split(","),function(t,o){var c;if("title"==o)f.append("<span class='fc-header-title'><h2>&nbsp;<\/h2><\/span>"),e&&e.addClass(u+"-corner-right"),e=null;else if(i[o]?c=i[o]:h[o]&&(c=function(){s.removeClass(u+"-state-hover");i.changeView(o)}),c){var l=r.theme?ct(r.buttonIcons,o):null,a=ct(r.buttonText,o),s=n("<span class='fc-button fc-button-"+o+" "+u+"-state-default'>"+(l?"<span class='fc-icon-wrap'><span class='ui-icon ui-icon-"+l+"'/><\/span>":a)+"<\/span>").click(function(){s.hasClass(u+"-state-disabled")||c()}).mousedown(function(){s.not("."+u+"-state-active").not("."+u+"-state-disabled").addClass(u+"-state-down")}).mouseup(function(){s.removeClass(u+"-state-down")}).hover(function(){s.not("."+u+"-state-active").not("."+u+"-state-disabled").addClass(u+"-state-hover")},function(){s.removeClass(u+"-state-hover").removeClass(u+"-state-down")}).appendTo(f);b(s);e||s.addClass(u+"-corner-left");e=s}});e&&e.addClass(u+"-corner-right")}),f}function l(n){f.find("h2").html(n)}function a(n){f.find("span.fc-button-"+n).addClass(u+"-state-active")}function v(n){f.find("span.fc-button-"+n).removeClass(u+"-state-active")}function y(n){f.find("span.fc-button-"+n).addClass(u+"-state-disabled")}function p(n){f.find("span.fc-button-"+n).removeClass(u+"-state-disabled")}var e=this,u,f;e.render=s;e.destroy=c;e.updateTitle=l;e.activateButton=a;e.deactivateButton=v;e.disableButton=y;e.enableButton=p;f=n([])}function pi(r,u){function ht(n,t){return!h||h>n||t>l}function ct(n,t){var u,r,i;for(h=n,l=t,e=[],u=++b,r=s.length,y=r,i=0;r>i;i++)g(s[i],u)}function g(t,i){nt(t,function(u){if(i==b){if(u){r.eventDataTransform&&(u=n.map(u,r.eventDataTransform));t.eventDataTransform&&(u=n.map(u,t.eventDataTransform));for(var f=0;u.length>f;f++)u[f].source=t,c(u[f]);e=e.concat(u)}y--;y||v(e)}})}function nt(u,e){for(var c,y=f.sourceFetchers,o,p,s=0;y.length>s;s++){if(c=y[s](u,h,l,e),c===!0)return;if("object"==typeof c)return nt(c,e),t}if(o=u.events,o)n.isFunction(o)?(it(),o(i(h),i(l),function(n){e(n);rt()})):n.isArray(o)?e(o):e();else if(p=u.url,p){var w,g=u.success,tt=u.error,ut=u.complete;w=n.isFunction(u.data)?u.data():u.data;var v=n.extend({},w||{}),b=a(u.startParam,r.startParam),k=a(u.endParam,r.endParam);b&&(v[b]=Math.round(+h/1e3));k&&(v[k]=Math.round(+l/1e3));it();n.ajax(n.extend({},ci,u,{data:v,success:function(t){t=t||[];var i=d(g,this,arguments);n.isArray(i)&&(t=i);e(t)},error:function(){d(tt,this,arguments);e()},complete:function(){d(ut,this,arguments);rt()}}))}else e()}function lt(n){n=tt(n);n&&(y++,g(n,b))}function tt(i){return n.isFunction(i)||n.isArray(i)?i={events:i}:"string"==typeof i&&(i={url:i}),"object"==typeof i?(bt(i),s.push(i),i):t}function at(t){s=n.grep(s,function(n){return!ut(n,t)});e=n.grep(e,function(n){return!ut(n.source,t)});v(e)}function vt(n){for(var t,f=e.length,r=p().defaultEventEnd,o=n.start-n._start,u=n.end?n.end-(n._end||r(n)):0,i=0;f>i;i++)t=e[i],t._id==n._id&&t!=n&&(t.start=new Date(+t.start+o),t.end=n.end?t.end?new Date(+t.end+u):new Date(+r(t)+u):null,t.title=n.title,t.url=n.url,t.allDay=n.allDay,t.className=n.className,t.editable=n.editable,t.color=n.color,t.backgroundColor=n.backgroundColor,t.borderColor=n.borderColor,t.textColor=n.textColor,c(t));c(n);v(e)}function yt(n,t){c(n);n.source||(t&&(w.events.push(n),n.source=w),e.push(n));v(e)}function pt(t){var r,i;if(t)for(n.isFunction(t)||(r=t+"",t=function(n){return n._id==r}),e=n.grep(e,t,!0),i=0;s.length>i;i++)n.isArray(s[i].events)&&(s[i].events=n.grep(s[i].events,t,!0));else for(e=[],i=0;s.length>i;i++)n.isArray(s[i].events)&&(s[i].events=[]);v(e)}function wt(t){return n.isFunction(t)?n.grep(e,t):t?(t+="",n.grep(e,function(n){return n._id==t})):e}function it(){st++||ot("loading",null,!0,p())}function rt(){--st||ot("loading",null,!1,p())}function c(n){var u=n.source||{},f=a(u.ignoreTimezone,r.ignoreTimezone);n._id=n._id||(n.id===t?"_fc"+li++:n.id+"");n.date&&(n.start||(n.start=n.date),delete n.date);n._start=i(n.start=ft(n.start,f));n.end=ft(n.end,f);n.end&&n.end<=n.start&&(n.end=null);n._end=n.end?i(n.end):null;n.allDay===t&&(n.allDay=a(u.allDayDefault,r.allDayDefault));n.className?"string"==typeof n.className&&(n.className=n.className.split(/\s+/)):n.className=[]}function bt(n){n.className?"string"==typeof n.className&&(n.className=n.className.split(/\s+/)):n.className=[];for(var i=f.sourceNormalizers,t=0;i.length>t;t++)i[t](n)}function ut(n,t){return n&&t&&et(n)==et(t)}function et(n){return("object"==typeof n?n.events||n.url:"")||n}var o=this;o.isFetchNeeded=ht;o.fetchEvents=ct;o.addEventSource=lt;o.removeEventSource=at;o.updateEvent=vt;o.renderEvent=yt;o.removeEvents=pt;o.clientEvents=wt;o.normalizeEvent=c;for(var h,l,ot=o.trigger,p=o.getView,v=o.reportEvents,w={events:[]},s=[w],b=0,y=0,st=0,e=[],k=0;u.length>k;k++)tt(u[k])}function it(n,t,i){return n.setFullYear(n.getFullYear()+t),i||s(n),n}function rt(n,t,r){if(+n){var f=n.getMonth()+t,u=i(n);for(u.setDate(1),u.setMonth(f),n.setMonth(f),r||s(n);n.getMonth()!=u.getMonth();)n.setDate(n.getDate()+(u>n?1:-1))}return n}function r(n,t,r){if(+n){var f=n.getDate()+t,u=i(n);u.setHours(9);u.setDate(f);n.setDate(f);r||s(n);ut(n,u)}return n}function ut(n,t){if(+n)for(;n.getDate()!=t.getDate();)n.setTime(+n+(t>n?1:-1)*tu)}function u(n,t){return n.setMinutes(n.getMinutes()+t),n}function s(n){return n.setHours(0),n.setMinutes(0),n.setSeconds(0),n.setMilliseconds(0),n}function i(n,t){return t?s(new Date(+n)):new Date(+n)}function yt(){var n,t=0;do n=new Date(1970,t++,1);while(n.getHours());return n}function v(n,t){return Math.round((i(n,!0)-i(t,!0))/nu)}function pt(n,i,r,u){i!==t&&i!=n.getFullYear()&&(n.setDate(1),n.setMonth(0),n.setFullYear(i));r!==t&&r!=n.getMonth()&&(n.setDate(1),n.setMonth(r));u!==t&&n.setDate(u)}function ft(n,i){return"object"==typeof n?n:"number"==typeof n?new Date(1e3*n):"string"==typeof n?n.match(/^\d+(\.\d+)?$/)?new Date(1e3*parseFloat(n)):(i===t&&(i=!0),et(n,i)||(n?new Date(n):null)):null}function et(n,t){var i=n.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}))?))?)?)?)?$/),r,u,f;return i?(r=new Date(i[1],0,1),t||!i[13]?(u=new Date(i[1],0,1,9,0),i[3]&&(r.setMonth(i[3]-1),u.setMonth(i[3]-1)),i[5]&&(r.setDate(i[5]),u.setDate(i[5])),ut(r,u),i[7]&&r.setHours(i[7]),i[8]&&r.setMinutes(i[8]),i[10]&&r.setSeconds(i[10]),i[12]&&r.setMilliseconds(1e3*Number("0."+i[12])),ut(r,u)):(r.setUTCFullYear(i[1],i[3]?i[3]-1:0,i[5]||1),r.setUTCHours(i[7]||0,i[8]||0,i[10]||0,i[12]?1e3*Number("0."+i[12]):0),i[14])&&(f=60*Number(i[16])+(i[18]?Number(i[18]):0),f*="-"==i[15]?1:-1,r=new Date(+r+6e4*f)),r):null}function ot(n){var t,i;return"number"==typeof n?60*n:"object"==typeof n?60*n.getHours()+n.getMinutes():(t=n.match(/(\d+)(?::(\d+))?\s*(\w+)?/),t?(i=parseInt(t[1],10),t[3]&&(i%=12,"p"==t[3].toLowerCase().charAt(0)&&(i+=12)),60*i+(t[2]?parseInt(t[2],10):0)):void 0)}function c(n,t,i){return st(n,null,t,i)}function st(n,t,i,r){var v,s;r=r||nt;for(var o,u,y,e=n,a=t,l=i.length,h="",f=0;l>f;f++)if(o=i.charAt(f),"'"==o){for(u=f+1;l>u;u++)if("'"==i.charAt(u)){e&&(h+=u==f+1?"'":i.substring(f+1,u),f=u);break}}else if("("==o){for(u=f+1;l>u;u++)if(")"==i.charAt(u)){s=c(e,i.substring(f+1,u),r);parseInt(s.replace(/\D/,""),10)&&(h+=s);f=u;break}}else if("["==o){for(u=f+1;l>u;u++)if("]"==i.charAt(u)){v=i.substring(f+1,u);s=c(e,v,r);s!=c(a,v,r)&&(h+=s);f=u;break}}else if("{"==o)e=t,a=n;else if("}"==o)e=n,a=t;else{for(u=l;u>f;u--)if(y=ai[i.substring(f,u)]){e&&(h+=y(e,r));f=u-1;break}u==f&&e&&(h+=o)}return h}function wi(n){var i,t=new Date(n.getTime());return t.setDate(t.getDate()+4-(t.getDay()||7)),i=t.getTime(),t.setMonth(0),t.setDate(1),Math.floor(Math.round((i-t)/864e5)/7)+1}function y(n){return n.end?bi(n.end,n.allDay):r(i(n.start),1)}function bi(n,t){return n=i(n),t||n.getHours()||n.getMinutes()?r(n,1):s(n)}function wt(i,r,u){i.unbind("mouseover").mouseover(function(i){for(var o,s,f,e=i.target;e!=this;)o=e,e=e.parentNode;(s=o._fci)!==t&&(o._fci=t,f=r[s],u(f.event,f.element,f),n(i.target).trigger(i));i.stopPropagation()})}function p(t,i,r){for(var u,f=0;t.length>f;f++)u=n(t[f]),u.width(Math.max(0,i-ht(u,r)))}function bt(t,i,r){for(var u,f=0;t.length>f;f++)u=n(t[f]),u.height(Math.max(0,i-w(u,r)))}function ht(n,t){return ki(n)+gi(n)+(t?di(n):0)}function ki(t){return(parseFloat(n.css(t[0],"paddingLeft",!0))||0)+(parseFloat(n.css(t[0],"paddingRight",!0))||0)}function di(t){return(parseFloat(n.css(t[0],"marginLeft",!0))||0)+(parseFloat(n.css(t[0],"marginRight",!0))||0)}function gi(t){return(parseFloat(n.css(t[0],"borderLeftWidth",!0))||0)+(parseFloat(n.css(t[0],"borderRightWidth",!0))||0)}function w(n,t){return nr(n)+ir(n)+(t?tr(n):0)}function nr(t){return(parseFloat(n.css(t[0],"paddingTop",!0))||0)+(parseFloat(n.css(t[0],"paddingBottom",!0))||0)}function tr(t){return(parseFloat(n.css(t[0],"marginTop",!0))||0)+(parseFloat(n.css(t[0],"marginBottom",!0))||0)}function ir(t){return(parseFloat(n.css(t[0],"borderTopWidth",!0))||0)+(parseFloat(n.css(t[0],"borderBottomWidth",!0))||0)}function rr(){}function kt(n,t){return n-t}function dt(n){return Math.max.apply(Math,n)}function l(n){return(10>n?"0":"")+n}function ct(n,i){if(n[i]!==t)return n[i];for(var r,f=i.split(/(?=[A-Z])/),u=f.length-1;u>=0;u--)if(r=n[f[u].toLowerCase()],r!==t)return r;return n[""]}function e(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#039;").replace(/"/g,"&quot;").replace(/\n/g,"<br />")}function b(n){n.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return!1})}function k(n){n.children().removeClass("fc-first fc-last").filter(":first-child").addClass("fc-first").end().filter(":last-child").addClass("fc-last")}function gt(n,t){var i=n.source||{},u=n.color,f=i.color,e=t("eventColor"),o=n.backgroundColor||u||i.backgroundColor||f||t("eventBackgroundColor")||e,s=n.borderColor||u||i.borderColor||f||t("eventBorderColor")||e,h=n.textColor||i.textColor||t("eventTextColor"),r=[];return o&&r.push("background-color:"+o),s&&r.push("border-color:"+s),h&&r.push("color:"+h),r.join(";")}function d(t,i,r){if(n.isFunction(t)&&(t=[t]),t){for(var f,u=0;t.length>u;u++)f=t[u].apply(i,r)||f;return f}}function a(){for(var n=0;arguments.length>n;n++)if(arguments[n]!==t)return arguments[n]}function ur(n,t){function o(n,t){var p,l,w,a,o,b,y;t&&(rt(n,t),n.setDate(1));p=f("firstDay");l=i(n,!0);l.setDate(1);w=rt(i(l),1);a=i(l);r(a,-((a.getDay()-p+7)%7));e(a);o=i(w);r(o,(7-o.getDay()+p)%7);e(o,-1,!0);b=h();y=Math.round(v(o,a)/7);"fixed"==f("weekMode")&&(r(o,7*(6-y)),y=6);u.title=c(l,f("titleFormat"));u.start=l;u.end=w;u.visStart=a;u.visEnd=o;s(y,b,!0)}var u=this;u.render=o;lt.call(u,n,t,"month");var f=u.opt,s=u.renderBasic,e=u.skipHiddenDays,h=u.getCellsPerWeek,c=t.formatDate}function fr(n,t){function o(n,t){var o,y;t&&r(n,7*t);var l=r(i(n),-((n.getDay()-f("firstDay")+7)%7)),v=r(i(l),7),a=i(l);e(a);o=i(v);e(o,-1,!0);y=h();u.start=l;u.end=v;u.visStart=a;u.visEnd=o;u.title=c(a,r(i(o),-1),f("titleFormat"));s(1,y,!1)}var u=this;u.render=o;lt.call(u,n,t,"basicWeek");var f=u.opt,s=u.renderBasic,e=u.skipHiddenDays,h=u.getCellsPerWeek,c=t.formatDates}function er(n,t){function f(n,t){t&&r(n,t);s(n,0>t?-1:1);var f=i(n,!0),c=r(i(f),1);u.title=h(n,e("titleFormat"));u.start=u.visStart=f;u.end=u.visEnd=c;o(1,1,!1)}var u=this;u.render=f;lt.call(u,n,t,"basicDay");var e=u.opt,o=u.renderBasic,s=u.skipHiddenDays,h=t.formatDate}function lt(t,u,f){function vi(n,t,i){c=n;l=t;fi=i;yi();it||pi();wi()}function yi(){d=a("theme")?"ui":"fc";ci=a("columnFormat");ht=a("weekNumbers");li=a("weekNumberTitle");ai="iso"!=a("weekNumberCalculation")?"w":"W"}function pi(){ti=n("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(t)}function wi(){var i=bi();y&&y.remove();y=n(i).appendTo(t);v=y.find("thead");lt=v.find(".fc-day-header");it=y.find("tbody");h=it.find("tr");rt=it.find(".fc-day");dt=h.find("td:first-child");gt=h.eq(0).find(".fc-day > div");ni=h.eq(0).find(".fc-day-content > div");k(v.add(v.find("tr")));k(h);h.eq(0).addClass("fc-first");h.filter(":last").addClass("fc-last");rt.each(function(t,i){var r=nt(Math.floor(t/l),t%l);ct("dayRender",o,r,n(i))});wt(rt)}function bi(){return"<table class='fc-border-separate' style='width:100%' cellspacing='0'>"+ki()+di()+"<\/table>"}function ki(){var n,i,r=d+"-widget-header",t="";for(t+="<thead><tr>",ht&&(t+="<th class='fc-week-number "+r+"'>"+e(li)+"<\/th>"),n=0;l>n;n++)i=nt(0,n),t+="<th class='fc-day-header fc-"+tt[i.getDay()]+" "+r+"'>"+e(pt(i,ci))+"<\/th>";return t+"<\/tr><\/thead>"}function di(){var t,i,r,u=d+"-widget-content",n="";for(n+="<tbody>",t=0;c>t;t++){for(n+="<tr class='fc-week'>",ht&&(r=nt(t,0),n+="<td class='fc-week-number "+u+"'><div>"+e(pt(r,ai))+"<\/div><\/td>"),i=0;l>i;i++)r=nt(t,i),n+=gi(r);n+="<\/tr>"}return n+"<\/tbody>"}function gi(n){var u=d+"-widget-content",f=o.start.getMonth(),r=s(new Date),i="",t=["fc-day","fc-"+tt[n.getDay()],u];return n.getMonth()!=f&&t.push("fc-other-month"),+n==+r?t.push("fc-today",d+"-state-highlight"):r>n?t.push("fc-past"):t.push("fc-future"),i+="<td class='"+t.join(" ")+"' data-date='"+pt(n,"yyyy-MM-dd")+"'><div>",fi&&(i+="<div class='fc-day-number'>"+n.getDate()+"<\/div>"),i+"<div class='fc-day-content'><div style='position:relative'>&nbsp;<\/div><\/div><\/div><\/td>"}function nr(t){ri=t;var i,r,u,f=ri-v.height();"variable"==a("weekMode")?i=r=Math.floor(f/(1==c?2:6)):(i=Math.floor(f/c),r=f-i*(c-1));dt.each(function(t,f){c>t&&(u=n(f),u.find("> div").css("min-height",(t==c-1?r:i)-w(u)))})}function tr(n){ii=n;ot.clear();st.clear();vt=0;ht&&(vt=v.find("th.fc-week-number").outerWidth());at=Math.floor((ii-vt)/l);p(lt.slice(0,-1),at)}function wt(n){n.click(ir).mousedown(br)}function ir(t){if(!a("selectable")){var i=et(n(this).data("date"));ct("dayClick",this,i,!0,t)}}function bt(n,t,i){var f,u,r;for(i&&ut.build(),f=dr(n,t),u=0;f.length>u;u++)r=f[u],wt(kt(r.row,r.leftCol,r.row,r.rightCol))}function kt(n,i,r,u){var f=ut.rect(n,i,r,u,t);return wr(f,t)}function rr(n){return i(n)}function ur(n,t){bt(n,r(i(t),1),!0)}function fr(){yt()}function er(n,t,i){var r=kr(n),u=rt[r.row*l+r.col];ct("dayClick",u,n,t,i)}function sr(n,t){ft.start(function(n){yt();n&&kt(n.row,n.col,n.row,n.col)},t)}function hr(n,t,i){var r=ft.stop(),u;(yt(),r)&&(u=nt(r),ct("drop",n,u,!0,t,i))}function cr(n){return i(n.start)}function lr(n){return ot.left(n)}function ar(n){return ot.right(n)}function vr(n){return st.left(n)}function yr(n){return st.right(n)}function pr(n){return h.eq(n)}var o=this;o.renderBasic=vi;o.setHeight=nr;o.setWidth=tr;o.renderDayOverlay=bt;o.defaultSelectionEnd=rr;o.renderSelection=ur;o.clearSelection=fr;o.reportDayClick=er;o.dragStart=sr;o.dragStop=hr;o.defaultEventEnd=cr;o.getHoverListener=function(){return ft};o.colLeft=lr;o.colRight=ar;o.colContentLeft=vr;o.colContentRight=yr;o.getIsCellAllDay=function(){return!0};o.allDayRow=pr;o.getRowCnt=function(){return c};o.getColCnt=function(){return l};o.getColWidth=function(){return at};o.getDaySegmentContainer=function(){return ti};ui.call(o,t,u,f);oi.call(o);ei.call(o);or.call(o);var y,v,lt,it,h,rt,dt,gt,ni,ti,ii,ri,at,vt,c,l,fi,ut,ft,ot,st,d,ci,ht,li,ai,a=o.opt,ct=o.trigger,wr=o.renderOverlay,yt=o.clearOverlays,br=o.daySelectionMousedown,nt=o.cellToDate,kr=o.dateToCell,dr=o.rangeToSegments,pt=u.formatDate;b(t.addClass("fc-grid"));ut=new si(function(t,i){var f,r,u;lt.each(function(t,e){f=n(e);r=f.offset().left;t&&(u[1]=r);u=[r];i[t]=u});u[1]=r+f.outerWidth();h.each(function(i,e){c>i&&(f=n(e),r=f.offset().top,i&&(u[1]=r),u=[r],t[i]=u)});u[1]=r+f.outerHeight()});ft=new hi(ut);ot=new g(function(n){return gt.eq(n)});st=new g(function(n){return ni.eq(n)})}function or(){function t(t,i){n.renderDayEvents(t,i)}function i(){n.getDaySegmentContainer().empty()}var n=this;n.renderEvents=t;n.clearEvents=i;fi.call(n)}function sr(n,t){function o(n,t){var o,y;t&&r(n,7*t);var l=r(i(n),-((n.getDay()-f("firstDay")+7)%7)),v=r(i(l),7),a=i(l);e(a);o=i(v);e(o,-1,!0);y=h();u.title=c(a,r(i(o),-1),f("titleFormat"));u.start=l;u.end=v;u.visStart=a;u.visEnd=o;s(y)}var u=this;u.render=o;ni.call(u,n,t,"agendaWeek");var f=u.opt,s=u.renderAgenda,e=u.skipHiddenDays,h=u.getCellsPerWeek,c=t.formatDates}function hr(n,t){function f(n,t){t&&r(n,t);s(n,0>t?-1:1);var f=i(n,!0),c=r(i(f),1);u.title=h(n,e("titleFormat"));u.start=u.visStart=f;u.end=u.visEnd=c;o(1)}var u=this;u.render=f;ni.call(u,n,t,"agendaDay");var e=u.opt,o=u.renderAgenda,s=u.skipHiddenDays,h=t.formatDate}function ni(f,o,h){function uu(n){it=n;fu();d?ur():eu()}function fu(){et=l("theme")?"ui":"fc";dr=l("isRTL");st=ot(l("minTime"));li=ot(l("maxTime"));gr=l("columnFormat");nu=l("weekNumbers");nr=l("weekNumberTitle");tu="iso"!=l("weekNumberCalculation")?"w":"W";at=l("snapMinutes")||l("slotMinutes")}function eu(){var r,t,o,h,s,e=et+"-widget-header",c=et+"-widget-content",a=0==l("slotMinutes")%15;for(ur(),nt=n("<div style='position:absolute;z-index:2;left:0;width:100%'/>").appendTo(f),l("allDaySlot")?(wi=n("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(nt),r="<table style='width:100%' class='fc-agenda-allday' cellspacing='0'><tr><th class='"+e+" fc-agenda-axis'>"+l("allDayText")+"<\/th><td><div class='fc-day-content'><div style='position:relative'/><\/div><\/td><th class='"+e+" fc-agenda-gutter'>&nbsp;<\/th><\/tr><\/table>",ct=n(r).appendTo(nt),ti=ct.find("tr"),fr(ti.find("td")),nt.append("<div class='fc-agenda-divider "+e+"'><div class='fc-agenda-divider-inner'/><\/div>")):wi=n([]),y=n("<div style='position:absolute;width:100%;overflow-x:hidden;overflow-y:auto'/>").appendTo(nt),v=n("<div style='position:relative;width:100%;overflow:hidden'/>").appendTo(y),br=n("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(v),r="<table class='fc-agenda-slots' style='width:100%' cellspacing='0'><tbody>",t=yt(),h=u(i(t),li),u(t,st),gi=0,o=0;h>t;o++)s=t.getMinutes(),r+="<tr class='fc-slot"+o+" "+(s?"fc-minor":"")+"'><th class='fc-agenda-axis "+e+"'>"+(a&&s?"&nbsp;":ir(t,l("axisFormat")))+"<\/th><td class='"+c+"'><div style='position:relative'>&nbsp;<\/div><\/td><\/tr>",u(t,l("slotMinutes")),gi++;r+="<\/tbody><\/table>";ft=n(r).appendTo(v);vi(ft.find("td"))}function ur(){var t=ou();d&&d.remove();d=n(t).appendTo(f);wt=d.find("thead");yi=wt.find("th").slice(1,-1);dt=d.find("tbody");ut=dt.find("td").slice(0,-1);pi=ut.find("> div");yr=ut.find(".fc-day-content > div");pr=ut.eq(0);wr=pi.eq(0);k(wt.add(wt.find("tr")));k(dt.add(dt.find("tr")))}function ou(){return"<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'>"+su()+hu()+"<\/table>"}function su(){var n,t,i,u=et+"-widget-header",r="";for(r+="<thead><tr>",nu?(n=pt(0,0),t=ir(n,tu),dr?t+=nr:t=nr+t,r+="<th class='fc-agenda-axis fc-week-number "+u+"'>"+e(t)+"<\/th>"):r+="<th class='fc-agenda-axis "+u+"'>&nbsp;<\/th>",i=0;it>i;i++)n=pt(0,i),r+="<th class='fc-"+tt[n.getDay()]+" fc-col"+i+" "+u+"'>"+e(ir(n,gr))+"<\/th>";return r+("<th class='fc-agenda-gutter "+u+"'>&nbsp;<\/th><\/tr><\/thead>")}function hu(){var i,n,r,f,t,h=et+"-widget-header",e=et+"-widget-content",o=s(new Date),u="";for(u+="<tbody><tr><th class='fc-agenda-axis "+h+"'>&nbsp;<\/th>",r="",n=0;it>n;n++)i=pt(0,n),t=["fc-col"+n,"fc-"+tt[i.getDay()],e],+i==+o?t.push(et+"-state-highlight","fc-today"):o>i?t.push("fc-past"):t.push("fc-future"),f="<td class='"+t.join(" ")+"'><div><div class='fc-day-content'><div style='position:relative'>&nbsp;<\/div><\/div><\/div><\/td>",r+=f;return u+=r,u+("<td class='fc-agenda-gutter "+e+"'>&nbsp;<\/td><\/tr><\/tbody>")}function cu(n){n===t&&(n=kr);kr=n;rr={};var i=dt.position().top,r=y.position().top,u=Math.min(n-i,ft.height()+r+1);wr.height(u-w(pr));nt.css("top",i);y.height(u-r-1);ki=ft.find("tr:first").height()+1;di=l("slotMinutes")/at;ri=ki/di}function lu(t){var i,r,u;ff=t;fi.clear();ci.clear();i=wt.find("th:first");ct&&(i=i.add(ct.find("th:first")));i=i.add(ft.find("th:first"));lt=0;p(i.width("").each(function(t,i){lt=Math.max(lt,n(i).outerWidth())}),lt);r=d.find(".fc-agenda-gutter");ct&&(r=r.add(ct.find("th.fc-agenda-gutter")));u=y[0].clientWidth;bi=y.width()-u;bi?(p(r,bi),r.show().prev().removeClass("fc-last")):r.hide().prev().addClass("fc-last");ii=Math.floor((u-lt)/it);p(yi.slice(0,-1),ii)}function au(){function n(){y.scrollTop(u)}var t=yt(),r=i(t),u;r.setHours(l("firstHour"));u=ht(t,r)+1;n();setTimeout(n,0)}function vu(){au()}function fr(n){n.click(er).mousedown(sf)}function vi(n){n.click(er).mousedown(tf)}function er(n){var r,f;if(!l("selectable")){var i=Math.min(it-1,Math.floor((n.pageX-d.offset().left-lt)/ii)),t=pt(0,i),u=this.parentNode.className.match(/fc-slot(\d+)/);u?(r=parseInt(u[1])*l("slotMinutes"),f=Math.floor(r/60),t.setHours(f),t.setMinutes(r%60+st),ai("dayClick",ut[i],t,!1,n)):ai("dayClick",ut[i],t,!0,n)}}function or(n,t,i){var f,u,r;for(i&&rt.build(),f=cf(n,t),u=0;f.length>u;u++)r=f[u],fr(sr(r.row,r.leftCol,r.row,r.rightCol))}function sr(n,t,i,r){var u=rt.rect(n,t,i,r,nt);return iu(u,nt)}function hr(n,t){for(var u=0;it>u;u++){var f=pt(0,u),c=r(i(f),1),o=new Date(Math.max(f,n)),s=new Date(Math.min(c,t));if(s>o){var e=rt.rect(0,u,0,u,v),h=ht(f,o),l=ht(f,s);e.top=h;e.height=l-h;vi(iu(e,v))}}}function yu(n){return fi.left(n)}function pu(n){return ci.left(n)}function wu(n){return fi.right(n)}function bu(n){return ci.right(n)}function gt(n){return l("allDaySlot")&&!n.row}function ni(n){var i=pt(0,n.col),t=n.row;return l("allDaySlot")&&t--,t>=0&&u(i,st+t*at),i}function ht(n,r){if(n=i(n,!0),u(i(n),st)>r)return 0;if(r>=u(i(n),li))return ft.height();var f=l("slotMinutes"),s=60*r.getHours()+r.getMinutes()-st,e=Math.floor(s/f),o=rr[e];return o===t&&(o=rr[e]=ft.find("tr").eq(e).find("td div")[0].offsetTop),Math.max(0,Math.round(o-1+ki*(s%f/f)))}function ku(){return ti}function du(n){var t=i(n.start);return n.allDay?t:u(t,l("defaultEventMinutes"))}function gu(n,t){return t?i(n):u(i(n),l("slotMinutes"))}function nf(n,t,u){u?l("allDaySlot")&&or(n,r(i(t),1),!0):lr(n,t)}function lr(t,i){var f=l("selectHelper"),u,o;if(rt.build(),f){if(u=ru(t).col,u>=0&&it>u){var r=rt.rect(0,u,0,u,v),e=ht(t,t),s=ht(t,i);s>e&&((r.top=e,r.height=s-e,r.left+=2,r.width-=5,n.isFunction(f))?(o=f(t,i),o&&(r.position="absolute",a=n(o).css(r).appendTo(v))):(r.isStart=!0,r.isEnd=!0,a=n(hf({title:"",start:t,end:i,className:["fc-select-helper"],editable:!1},r)),a.css("opacity",l("dragOpacity"))),a&&(vi(a),v.append(a),p(a,r.width,!0),bt(a,r.height,!0)))}}else hr(t,i)}function ar(){tr();a&&(a.remove(),a=null)}function tf(t){if(1==t.which&&l("selectable")){of(t);var r;vt.start(function(n,t){if(ar(),n&&n.col==t.col&&!gt(n)){var f=ni(t),e=ni(n);r=[f,u(i(f),at),e,u(i(e),at)].sort(kt);lr(r[0],r[3])}else r=null},t);n(document).one("mouseup",function(n){vt.stop();r&&(+r[0]==+r[1]&&vr(r[0],!1,n),ef(r[0],r[3],!1,n))})}}function vr(n,t,i){ai("dayClick",ut[ru(n).col],n,t,i)}function rf(n,t){vt.start(function(n){if(tr(),n)if(gt(n))sr(n.row,n.col,n.row,n.col);else{var t=ni(n),r=u(i(t),l("defaultEventMinutes"));hr(t,r)}},t)}function uf(n,t,i){var r=vt.stop();tr();r&&ai("drop",n,ni(r),gt(r),t,i)}var c=this;c.renderAgenda=uu;c.setWidth=lu;c.setHeight=cu;c.afterRender=vu;c.defaultEventEnd=du;c.timePosition=ht;c.getIsCellAllDay=gt;c.allDayRow=ku;c.getCoordinateGrid=function(){return rt};c.getHoverListener=function(){return vt};c.colLeft=yu;c.colRight=wu;c.colContentLeft=pu;c.colContentRight=bu;c.getDaySegmentContainer=function(){return wi};c.getSlotSegmentContainer=function(){return br};c.getMinMinute=function(){return st};c.getMaxMinute=function(){return li};c.getSlotContainer=function(){return v};c.getRowCnt=function(){return 1};c.getColCnt=function(){return it};c.getColWidth=function(){return ii};c.getSnapHeight=function(){return ri};c.getSnapMinutes=function(){return at};c.defaultSelectionEnd=gu;c.renderDayOverlay=or;c.renderSelection=nf;c.clearSelection=ar;c.reportDayClick=vr;c.dragStart=rf;c.dragStop=uf;ui.call(c,f,o,h);oi.call(c);ei.call(c);cr.call(c);var d,wt,yi,dt,ut,pi,yr,pr,wr,nt,wi,ct,ti,y,v,br,ft,a,ff,kr,lt,ii,bi,ki,at,di,ri,it,gi,rt,vt,fi,ci,et,dr,st,li,gr,nu,nr,tu,l=c.opt,ai=c.trigger,iu=c.renderOverlay,tr=c.clearOverlays,ef=c.reportSelection,of=c.unselect,sf=c.daySelectionMousedown,hf=c.slotSegHtml,pt=c.cellToDate,ru=c.dateToCell,cf=c.rangeToSegments,ir=o.formatDate,rr={};b(f.addClass("fc-agenda"));rt=new si(function(t,i){function o(n){return Math.max(h,Math.min(c,n))}var u,r,f;yi.each(function(t,e){u=n(e);r=u.offset().left;t&&(f[1]=r);f=[r];i[t]=f});f[1]=r+u.outerWidth();l("allDaySlot")&&(u=ti,r=u.offset().top,t[0]=[r,r+u.outerHeight()]);for(var s=v.offset().top,h=y.offset().top,c=h+y.outerHeight(),e=0;gi*di>e;e++)t.push([o(s+ri*e),o(s+ri*(e+1))])});vt=new hi(rt);fi=new g(function(n){return pi.eq(n)});ci=new g(function(n){return yr.eq(n)})}function cr(){function at(n,t){for(var f=n.length,r=[],u=[],i=0;f>i;i++)n[i].allDay?r.push(n[i]):u.push(n[i]);o("allDaySlot")&&(wi(r,t),oi());dt(yt(u),t)}function vt(){si().empty();it().empty()}function yt(t){for(var e,o,s,f,a=et(),c=rt(),v=ci(),y=n.map(t,kt),l=[],r=0;a>r;r++)for(e=h(0,r),u(e,c),f=pt(t,y,e,u(i(e),v-c)),f=lr(f),o=0;f.length>o;o++)s=f[o],s.col=r,l.push(s);return l}function pt(n,t,r,u){for(var s,e,o,h,c,l,a,v=[],y=n.length,f=0;y>f;f++)s=n[f],e=s.start,o=t[f],o>r&&u>e&&(r>e?(h=i(r),l=!1):(h=e,l=!0),o>u?(c=i(u),a=!1):(c=o,a=!0),v.push({event:s,start:h,end:c,isStart:l,isEnd:a}));return v.sort(ri)}function kt(n){return n.end?i(n.end):u(i(n.start),o("defaultEventMinutes"))}function dt(i,r){for(var u,h,tt,et,p,a,v,c,l,y,ot,f,b,rt,ft,k=i.length,st="",nt=it(),ct=o("isRTL"),e=0;k>e;e++)u=i[e],h=u.event,tt=ut(u.start,u.start),et=ut(u.start,u.end),p=li(u.col),a=ai(u.col),v=a-p,a-=.025*v,v=a-p,c=v*(u.forwardCoord-u.backwardCoord),o("slotEventOverlap")&&(c=Math.max(2*(c-10),c)),ct?(y=a-u.backwardCoord*v,l=y-c):(l=p+u.backwardCoord*v,y=l+c),l=Math.max(l,p),y=Math.min(y,a),c=y-l,u.top=tt,u.left=l,u.outerWidth=c,u.outerHeight=et-tt,st+=d(h,u);for(nt[0].innerHTML=st,ot=nt.children(),e=0;k>e;e++)u=i[e],h=u.event,f=n(ot[e]),b=s("eventRender",h,h,f),b===!1?f.remove():(b&&b!==!0&&(f.remove(),f=n(b).css({position:"absolute",top:u.top,left:u.left}).appendTo(nt)),u.element=f,h._id===r?g(h,f,u):f[0]._fci=e,yi(h,f));for(wt(nt,i,g),e=0;k>e;e++)u=i[e],(f=u.element)&&(u.vsides=w(f,!0),u.hsides=ht(f,!0),rt=f.find(".fc-event-title"),rt.length&&(u.contentTop=rt[0].offsetTop));for(e=0;k>e;e++)u=i[e],(f=u.element)&&(f[0].style.width=Math.max(0,u.outerWidth-u.hsides)+"px",ft=Math.max(0,u.outerHeight-u.vsides),f[0].style.height=ft+"px",h=u.event,u.contentTop!==t&&10>ft-u.contentTop&&(f.find("div.fc-event-time").text(bi(h.start,o("timeFormat"))+" - "+h.title),f.find("div.fc-event-title").remove()),s("eventAfterRender",h,h,f))}function d(n,t){var r="<",u=n.url,f=gt(n,o),i=["fc-event","fc-event-vert"];return nt(n)&&i.push("fc-event-draggable"),t.isStart&&i.push("fc-event-start"),t.isEnd&&i.push("fc-event-end"),i=i.concat(n.className),n.source&&(i=i.concat(n.source.className||[])),r+=u?"a href='"+e(n.url)+"'":"div",r+=" class='"+i.join(" ")+"' style='position:absolute;top:"+t.top+"px;left:"+t.left+"px;"+f+"'><div class='fc-event-inner'><div class='fc-event-time'>"+e(k(n.start,n.end,o("timeFormat")))+"<\/div><div class='fc-event-title'>"+e(n.title||"")+"<\/div><\/div><div class='fc-event-bg'><\/div>",t.isEnd&&tt(n)&&(r+="<div class='ui-resizable-handle ui-resizable-s'>=<\/div>"),r+("<\/"+(u?"a":"div")+">")}function g(n,t,i){var r=t.find("div.fc-event-time");nt(n)&&ti(n,t,r);i.isEnd&&tt(n)&&ii(n,t,r);ei(n,t)}function ni(n,t,u){function k(){e||(t.width(d).height("").draggable("option","grid",null),e=!0)}var d,f,w,ut=u.isStart,e=!0,g=hi(),nt=ot(),tt=l(),it=a(),ft=rt();t.draggable({opacity:o("dragOpacity","month"),revertDuration:o("dragRevertDuration"),start:function(u,l){s("eventDragStart",t,n,u,l);b(n,t);d=t.width();g.start(function(u,s){if(c(),u){f=!1;var l=h(0,s.col),a=h(0,u.col);w=v(a,l);u.row?ut?e&&(t.width(nt-10),bt(t,tt*Math.round((n.end?(n.end-n.start)/iu:o("defaultEventMinutes"))/it)),t.draggable("option","grid",[nt,1]),e=!1):f=!0:(ct(r(i(n.start),w),r(y(n),w)),k());f=f||e&&!w}else k(),f=!0;t.draggable("option","revert",f)},u,"drag")},stop:function(i,r){if(g.stop(),c(),s("eventDragStop",t,n,i,r),f)k(),t.css("filter",""),p(n,t);else{var u=0;e||(u=Math.round((t.offset().top-vi().offset().top)/tt)*it+ft-(60*n.start.getHours()+n.start.getMinutes()));st(this,n,w,u,e,i,r)}}})}function ti(n,t,e){function wt(){c();d&&(w?(e.hide(),t.draggable("option","grid",null),ct(r(i(n.start),tt),r(y(n),tt))):(kt(g),e.css("display",""),t.draggable("option","grid",[yt,pt])))}function kt(t){var r,f=u(i(n.start),t);n.end&&(r=u(i(n.end),t));e.text(k(f,r,o("timeFormat")))}var it,rt,d,ht,w,lt,nt,ut,tt,g,at,vt=f.getCoordinateGrid(),bt=et(),yt=ot(),pt=l(),dt=a();t.draggable({scroll:!1,grid:[yt,pt],axis:1==bt?"y":!1,opacity:o("dragOpacity"),revertDuration:o("dragRevertDuration"),start:function(i,r){s("eventDragStart",t,n,i,r);b(n,t);vt.build();it=t.position();rt=vt.cell(i.pageX,i.pageY);d=ht=!0;w=lt=ft(rt);nt=ut=0;tt=0;g=at=0},drag:function(n,i){var u=vt.cell(n.pageX,n.pageY),f,r,e;(d=!!u)&&((w=ft(u),nt=Math.round((i.position.left-it.left)/yt),nt!=ut)&&(f=h(0,rt.col),r=rt.col+nt,r=Math.max(0,r),r=Math.min(bt-1,r),e=h(0,r),tt=v(e,f)),w||(g=Math.round((i.position.top-it.top)/pt)*dt));(d!=ht||w!=lt||nt!=ut||g!=at)&&(wt(),ht=d,lt=w,ut=nt,at=g);t.draggable("option","revert",!d)},stop:function(i,r){c();s("eventDragStop",t,n,i,r);d&&(w||tt||g)?st(this,n,tt,w?0:g,w,i,r):(d=!0,w=!1,nt=0,tt=0,g=0,wt(),t.css("filter",""),t.css(it),p(n,t))}})}function ii(n,t,i){var r,f,e=l(),h=a();t.resizable({handles:{s:".ui-resizable-handle"},grid:e,start:function(i,u){r=f=0;b(n,t);s("eventResizeStart",this,n,i,u)},resize:function(s,c){r=Math.round((Math.max(e,t.height())-c.originalSize.height)/e);r!=f&&(i.text(k(n.start,r||n.end?u(ui(n),h*r):null,o("timeFormat"))),f=r)},stop:function(i,u){s("eventResizeStop",this,n,i,u);r?pi(this,n,0,h*r,i,u):p(n,t)}})}var f=this;f.renderEvents=at;f.clearEvents=vt;f.slotSegHtml=d;fi.call(f);var o=f.opt,s=f.trigger,nt=f.isEventDraggable,tt=f.isEventResizable,ui=f.eventEnd,ei=f.eventElementHandlers,oi=f.setHeight,si=f.getDaySegmentContainer,it=f.getSlotSegmentContainer,hi=f.getHoverListener,ci=f.getMaxMinute,rt=f.getMinMinute,ut=f.timePosition,ft=f.getIsCellAllDay,li=f.colContentLeft,ai=f.colContentRight,h=f.cellToDate,et=f.getColCnt,ot=f.getColWidth,l=f.getSnapHeight,a=f.getSnapMinutes,vi=f.getSlotContainer,yi=f.reportEventElement,p=f.showEvents,b=f.hideEvents,st=f.eventDrop,pi=f.eventResize,ct=f.renderDayOverlay,c=f.clearOverlays,wi=f.renderDayEvents,lt=f.calendar,bi=lt.formatDate,k=lt.formatDates;f.draggableDayEvent=ni}function lr(n){var t,r=ar(n),i=r[0];if(vr(r),i){for(t=0;i.length>t;t++)ti(i[t]);for(t=0;i.length>t;t++)at(i[t],0,0)}return yr(r)}function ar(n){for(var u,t,i=[],r=0;n.length>r;r++){for(u=n[r],t=0;i.length>t&&ii(u,i[t]).length;t++);(i[t]||(i[t]=[])).push(u)}return i}function vr(n){for(var f,i,r,u,t=0;n.length>t;t++)for(f=n[t],i=0;f.length>i;i++)for(r=f[i],r.forwardSegs=[],u=t+1;n.length>u;u++)ii(r,n[u],r.forwardSegs)}function ti(n){var i,r,f=n.forwardSegs,u=0;if(n.forwardPressure===t){for(i=0;f.length>i;i++)r=f[i],ti(r),u=Math.max(u,1+r.forwardPressure);n.forwardPressure=u}}function at(n,i,r){var f,u=n.forwardSegs;if(n.forwardCoord===t)for(u.length?(u.sort(wr),at(u[0],i+1,r),n.forwardCoord=u[0].backwardCoord):n.forwardCoord=1,n.backwardCoord=n.forwardCoord-(n.forwardCoord-r)/(i+1),f=0;u.length>f;f++)at(u[f],0,n.forwardCoord)}function yr(n){for(var r,i,u=[],t=0;n.length>t;t++)for(r=n[t],i=0;r.length>i;i++)u.push(r[i]);return u}function ii(n,t,i){i=i||[];for(var r=0;t.length>r;r++)pr(n,t[r])&&i.push(t[r]);return i}function pr(n,t){return n.end>t.start&&n.start<t.end}function wr(n,t){return t.forwardPressure-n.forwardPressure||(n.backwardCoord||0)-(t.backwardCoord||0)||ri(n,t)}function ri(n,t){return n.start-t.start||t.end-t.start-(n.end-n.start)||(n.event.title||"").localeCompare(t.event.title)}function ui(f,e,o){function h(t,i){var r=ut[t];return n.isPlainObject(r)?ct(r,i||o):r}function y(n,t){return e.trigger.apply(e,[n,t||s].concat(Array.prototype.slice.call(arguments,2),[s]))}function pt(n){var t=n.source||{};return a(n.startEditable,t.startEditable,h("eventStartEditable"),n.editable,t.editable,h("editable"))&&!h("disableDragging")}function wt(n){var t=n.source||{};return a(n.durationEditable,t.durationEditable,h("eventDurationEditable"),n.editable,t.editable,h("editable"))&&!h("disableResizing")}function bt(n){c={};for(var t,r=n.length,i=0;r>i;i++)t=n[i],c[t._id]?c[t._id].push(t):c[t._id]=[t]}function kt(){c={};p={};rt=[]}function ft(n){return n.end?i(n.end):li(n)}function dt(n,t){rt.push({event:n,element:t});p[n._id]?p[n._id].push(t):p[n._id]=[t]}function gt(){n.each(rt,function(n,t){s.trigger("eventDestroy",t.event,t.event,t.element)})}function ni(n,i){i.click(function(r){return i.hasClass("ui-draggable-dragging")||i.hasClass("ui-resizable-resizing")?t:y("eventClick",this,n,r)}).hover(function(t){y("eventMouseover",this,n,t)},function(t){y("eventMouseout",this,n,t)})}function ti(n,t){et(n,t,"show")}function ii(n,t){et(n,t,"hide")}function et(n,t,i){for(var u=p[n._id],f=u.length,r=0;f>r;r++)t&&u[r][0]==t[0]||u[r][i]()}function ri(n,t,i,r,u,f,e){var s=t.allDay,o=t._id;ot(c[o],i,r,u);y("eventDrop",n,t,i,r,u,function(){ot(c[o],-i,-r,s);g(o)},f,e);g(o)}function ui(n,t,i,r,u,f){var e=t._id;st(c[e],i,r);y("eventResize",n,t,i,r,function(){st(c[e],-i,-r);g(e)},u,f);g(e)}function ot(n,i,f,e){f=f||0;for(var o,h=n.length,s=0;h>s;s++)o=n[s],e!==t&&(o.allDay=e),u(r(o.start,i,!0),f),o.end&&(o.end=u(r(o.end,i,!0),f)),at(o,ut)}function st(n,t,i){i=i||0;for(var f,o=n.length,e=0;o>e;e++)f=n[e],f.end=u(r(ft(f),t,!0),i),at(f,ut)}function fi(n){return"object"==typeof n&&(n=n.getDay()),nt[n]}function ei(){return l}function oi(n,t,i){for(t=t||1;nt[(n.getDay()+(i?t:0)+7)%7];)r(n,t)}function si(){var n=ht.apply(null,arguments),t=w(n);return lt(t)}function ht(n,t){var i=s.getColCnt(),r=it?-1:1,u=it?i-1:0;return"object"==typeof n&&(t=n.col,n=n.row),n*i+(t*r+u)}function w(n){var t=s.visStart.getDay();return n+=tt[t],7*Math.floor(n/l)+yt[(n%l+l)%l]-t}function lt(n){var t=i(s.visStart);return r(t,n),t}function hi(n){var t=b(n),i=k(t);return d(i)}function b(n){return v(n,s.visStart)}function k(n){var t=s.visStart.getDay();return n+=t,Math.floor(n/7)*l+tt[(n%7+7)%7]-tt[t]}function d(n){var t=s.getColCnt(),i=it?-1:1,r=it?t-1:0,u=Math.floor(n/t),f=(n%t+t)%t*i+r;return{row:u,col:f}}function ci(n,t){for(var a=s.getRowCnt(),f=s.getColCnt(),e=[],o=b(n),h=b(t),v=k(o),y=k(h)-1,i=0;a>i;i++){var c=i*f,p=c+f-1,r=Math.max(v,c),u=Math.min(y,p);if(u>=r){var g=d(r),nt=d(u),l=[g.col,nt.col].sort(),tt=w(r)==o,it=w(u)+1==h;e.push({row:i,leftCol:l[0],rightCol:l[1],isStart:tt,isEnd:it})}}return e}var s=this;s.element=f;s.calendar=e;s.name=o;s.opt=h;s.trigger=y;s.isEventDraggable=pt;s.isEventResizable=wt;s.setEventData=bt;s.clearEventData=kt;s.eventEnd=ft;s.reportEventElement=dt;s.triggerEventDestroy=gt;s.eventElementHandlers=ni;s.showEvents=ti;s.hideEvents=ii;s.eventDrop=ri;s.eventResize=ui;var li=s.defaultEventEnd,at=e.normalizeEvent,g=e.reportEventChange,c={},p={},rt=[],ut=e.options;s.isHiddenDay=fi;s.skipHiddenDays=oi;s.getCellsPerWeek=ei;s.dateToCell=hi;s.dateToDayOffset=b;s.dayOffsetToCellOffset=k;s.cellOffsetToCell=d;s.cellToDate=si;s.cellToCellOffset=ht;s.cellOffsetToDayOffset=w;s.dayOffsetToDate=lt;s.rangeToSegments=ci;var l,vt=h("hiddenDays")||[],nt=[],tt=[],yt=[],it=h("isRTL");(function(){h("weekends")===!1&&vt.push(0,6);for(var t=0,i=0;7>t;t++)tt[t]=i,nt[t]=-1!=n.inArray(t,vt),nt[t]||(yt[i]=t,i++);if(l=i,!l)throw"invalid hiddenDays";})()}function fi(){function ft(n,t){var i=c(n,!1,!0);o(i,function(n,t){ei(n.event,t)});ii(i,t);o(i,function(n,t){f("eventAfterRender",n.event,n.event,t)})}function et(n,t,i){var u=c([n],!0,!1),r=[];return o(u,function(n,u){n.row===t&&u.css("top",i);r.push(u[0])}),r}function c(t,i,r){var e,f,s=g(),h=i?n("<div/>"):s,u=ot(t);return ct(u),e=lt(u),h[0].innerHTML=e,f=h.children(),i&&s.append(f),vt(u,f),o(u,function(n,t){n.hsides=ht(t,!0)}),o(u,function(n,t){t.width(Math.max(0,n.outerWidth-n.hsides))}),o(u,function(n,t){n.outerHeight=t.outerHeight(!0)}),yt(u,r),u}function ot(n){for(var r,t=[],i=0;n.length>i;i++)r=st(n[i]),t.push.apply(t,r);return t}function st(n){for(var r=n.start,u=y(n),t=bi(r,u),i=0;t.length>i;i++)t[i].event=n;return t}function ct(n){for(var r=u("isRTL"),i=0;n.length>i;i++){var t=n[i],e=(r?t.isEnd:t.isStart)?vi:li,o=(r?t.isStart:t.isEnd)?yi:ai,f=e(t.leftCol),s=o(t.rightCol);t.left=f;t.outerWidth=s-f}}function lt(n){for(var i="",t=0;n.length>t;t++)i+=at(n[t]);return i}function at(n){var r="",s=u("isRTL"),t=n.event,f=t.url,i=["fc-event","fc-event-hori"],o;return a(t)&&i.push("fc-event-draggable"),n.isStart&&i.push("fc-event-start"),n.isEnd&&i.push("fc-event-end"),i=i.concat(t.className),t.source&&(i=i.concat(t.source.className||[])),o=gt(t,u),r+=f?"<a href='"+e(f)+"'":"<div",r+=" class='"+i.join(" ")+"' style='position:absolute;left:"+n.left+"px;"+o+"'><div class='fc-event-inner'>",!t.allDay&&n.isStart&&(r+="<span class='fc-event-time'>"+e(pi(t.start,t.end,u("timeFormat")))+"<\/span>"),r+="<span class='fc-event-title'>"+e(t.title||"")+"<\/span><\/div>",n.isEnd&&p(t)&&(r+="<div class='ui-resizable-handle ui-resizable-"+(s?"w":"e")+"'>&nbsp;&nbsp;&nbsp;<\/div>"),r+("<\/"+(f?"a":"div")+">")}function vt(t,i){for(var u=0;t.length>u;u++){var o=t[u],s=o.event,e=i.eq(u),r=f("eventRender",s,s,e);r===!1?e.remove():(r&&r!==!0&&(r=n(r).css({position:"absolute",left:o.left}),e.replaceWith(r),e=r),o.element=e)}}function yt(n,t){var f=pt(n),r=ti(),u=[],i;if(t)for(i=0;r.length>i;i++)r[i].height(f[i]);for(i=0;r.length>i;i++)u.push(r[i].position().top);o(n,function(n,t){t.css("top",u[n.row]+n.top)})}function pt(n){for(var u,t,i,h=s(),c=d(),e=[],l=bt(n),f=0;h>f;f++){for(var o=l[f],r=[],i=0;c>i;i++)r.push(0);for(u=0;o.length>u;u++)for(t=o[u],t.top=dt(r.slice(t.leftCol,t.rightCol+1)),i=t.leftCol;t.rightCol>=i;i++)r[i]=t.top+t.outerHeight;e.push(dt(r))}return e}function bt(n){for(var r,t,f=s(),i=[],u=0;n.length>u;u++)r=n[u],t=r.row,r.element&&(i[t]?i[t].push(r):i[t]=[r]);for(t=0;f>t;t++)i[t]=kt(i[t]||[]);return i}function kt(n){for(var t=[],r=ni(n),i=0;r.length>i;i++)t.push.apply(t,r[i]);return t}function ni(n){var t,r,u,i;for(n.sort(kr),t=[],r=0;n.length>r;r++){for(u=n[r],i=0;t.length>i&&br(u,t[i]);i++);t[i]?t[i].push(u):t[i]=[u]}return t}function ti(){for(var i=s(),t=[],n=0;i>n;n++)t[n]=ci(n).find("div.fc-day-content > div");return t}function ii(n,t){var i=g();o(n,function(n,i,r){var u=n.event;u._id===t?l(u,i,n):i[0]._fci=r});wt(i,n,l)}function l(n,i,r){a(n)&&t.draggableDayEvent(n,i,r);r.isEnd&&p(n)&&t.resizableDayEvent(n,i,r);oi(n,i)}function ri(n,t){var e,o=tt();t.draggable({delay:50,opacity:u("dragOpacity"),revertDuration:u("dragRevertDuration"),start:function(u,s){f("eventDragStart",t,n,u,s);k(n,t);o.start(function(u,f,o,s){if(t.draggable("option","revert",!u||!o&&!s),h(),u){var c=it(f),l=it(u);e=v(l,c);nt(r(i(n.start),e),r(y(n),e))}else e=0},u,"drag")},stop:function(i,r){o.stop();h();f("eventDragStop",t,n,i,r);e?si(this,n,e,0,n.allDay,i,r):(t.css("filter",""),w(n,t))}})}function ui(t,i,e){var l=u("isRTL"),o=l?"w":"e",a=i.find(".ui-resizable-"+o),c=!1;b(i);i.mousedown(function(n){n.preventDefault()}).click(function(n){c&&(n.preventDefault(),n.stopImmediatePropagation())});a.mousedown(function(u){function b(i){f("eventResizeStop",this,t,i);n("body").css("cursor","");v.stop();h();a&&hi(this,t,a,0,i);setTimeout(function(){c=!1},0)}var v;if(1==u.which){c=!0;v=tt();s();d();var a,l,g=i.css("top"),p=n.extend({},t),it=di(ki(t.start));wi();n("body").css("cursor",o+"-resize").one("mouseup",b);f("eventResizeStart",this,t,u);v.start(function(i,u){var c,f,s;i&&(c=rt(u),f=rt(i),(f=Math.max(f,it),a=ut(f)-ut(c))?(p.end=r(fi(t),a,!0),s=l,l=et(p,e.row,g),l=n(l),l.find("*").css("cursor",o+"-resize"),s&&s.remove(),k(t)):l&&(w(t),l.remove(),l=null),h(),nt(t.start,r(y(t),a)))},u)}})}var t=this;t.renderDayEvents=ft;t.draggableDayEvent=ri;t.resizableDayEvent=ui;var u=t.opt,f=t.trigger,a=t.isEventDraggable,p=t.isEventResizable,fi=t.eventEnd,ei=t.reportEventElement,oi=t.eventElementHandlers,w=t.showEvents,k=t.hideEvents,si=t.eventDrop,hi=t.eventResize,s=t.getRowCnt,d=t.getColCnt;t.getColWidth;var ci=t.allDayRow,li=t.colLeft,ai=t.colRight,vi=t.colContentLeft,yi=t.colContentRight;t.dateToCell;var g=t.getDaySegmentContainer,pi=t.calendar.formatDates,nt=t.renderDayOverlay,h=t.clearOverlays,wi=t.clearSelection,tt=t.getHoverListener,bi=t.rangeToSegments,it=t.cellToDate,rt=t.cellToCellOffset,ut=t.cellOffsetToDayOffset,ki=t.dateToDayOffset,di=t.dayOffsetToCellOffset}function br(n,t){for(var r,i=0;t.length>i;i++)if(r=t[i],r.leftCol<=n.rightCol&&r.rightCol>=n.leftCol)return!0;return!1}function o(n,t){for(var r,u,i=0;n.length>i;i++)r=n[i],u=r.element,u&&t(r,u,i)}function kr(n,t){return t.rightCol-t.leftCol-(n.rightCol-n.leftCol)||t.event.allDay-n.event.allDay||n.event.start-t.event.start||(n.event.title||"").localeCompare(t.event.title)}function ei(){function h(n,t,r){i();t||(t=l(n,r));o(n,t,r);u(n,t,r)}function i(n){f&&(f=!1,s(),e("unselect",null,n))}function u(n,t,i,r){f=!0;e("select",null,n,t,i,r)}function c(f){var h=t.cellToDate,l=t.getIsCellAllDay,c=t.getHoverListener(),a=t.reportDayClick,e;1==f.which&&r("selectable")&&(i(f),c.start(function(n,t){s();n&&l(n)?(e=[h(t),h(n)].sort(kt),o(e[0],e[1],!0)):e=null},f),n(document).one("mouseup",function(n){c.stop();e&&(+e[0]==+e[1]&&a(e[0],!0,n),u(e[0],e[1],!0,n))}))}var t=this;t.select=h;t.unselect=i;t.reportSelection=u;t.daySelectionMousedown=c;var r=t.opt,e=t.trigger,l=t.defaultSelectionEnd,o=t.renderSelection,s=t.clearSelection,f=!1;r("selectable")&&r("unselectAuto")&&n(document).mousedown(function(t){var u=r("unselectCancel");u&&n(t.target).parents(u).length||i(t)})}function oi(){function u(r,u){var f=i.shift();return f||(f=n("<div class='fc-cell-overlay' style='position:absolute;z-index:3'/>")),f[0].parentNode!=u[0]&&f.appendTo(u),t.push(f.css(r).show()),f}function f(){for(var n;n=t.shift();)i.push(n.hide().unbind())}var r=this,t,i;r.renderOverlay=u;r.clearOverlays=f;t=[];i=[]}function si(n){var t,i,r=this;r.build=function(){t=[];i=[];n(t,i)};r.cell=function(n,r){for(var o=t.length,s=i.length,f=-1,e=-1,u=0;o>u;u++)if(r>=t[u][0]&&t[u][1]>r){f=u;break}for(u=0;s>u;u++)if(n>=i[u][0]&&i[u][1]>n){e=u;break}return f>=0&&e>=0?{row:f,col:e}:null};r.rect=function(n,r,u,f,e){var o=e.offset();return{top:t[n][0]-o.top,left:i[r][0]-o.left,width:i[f][1]-i[r][0],height:t[u][1]-t[n][0]}}}function hi(t){function u(n){dr(n);var u=t.cell(n.pageX,n.pageY);(!u!=!r||u&&(u.row!=r.row||u.col!=r.col))&&(u?(i||(i=u),e(u,i,u.row-i.row,u.col-i.col)):e(u,i),r=u)}var f,e,i,r,o=this;o.start=function(o,s,h){e=o;i=r=null;t.build();u(s);f=h||"mousemove";n(document).bind(f,u)};o.stop=function(){return n(document).unbind(f,u),r}}function dr(n){n.pageX===t&&(n.pageX=n.originalEvent.pageX,n.pageY=n.originalEvent.pageY)}function g(n){function e(t){return f[t]=f[t]||n(t)}var i=this,f={},r={},u={};i.left=function(n){return r[n]=r[n]===t?e(n).position().left:r[n]};i.right=function(n){return u[n]=u[n]===t?i.left(n)+e(n).width():u[n]};i.clear=function(){f={};r={};u={}}}var nt={defaultView:"month",aspectRatio:1.35,header:{left:"title",center:"",right:"today prev,next"},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,monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],buttonText:{prev:"<span class='fc-text-arrow'>&lsaquo;<\/span>",next:"<span class='fc-text-arrow'>&rsaquo;<\/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},gr={header:{left:"next,prev today",center:"",right:"title"},buttonText:{prev:"<span class='fc-text-arrow'>&rsaquo;<\/span>",next:"<span class='fc-text-arrow'>&lsaquo;<\/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"}},f=n.fullCalendar={version:"1.6.4"},h=f.views={},ci,li;n.fn.fullCalendar=function(i){var r,f,u;return"string"==typeof i?(f=Array.prototype.slice.call(arguments,1),this.each(function(){var u=n.data(this,"fullCalendar"),e;u&&n.isFunction(u[i])&&(e=u[i].apply(u,f),r===t&&(r=e),"destroy"==i&&n.removeData(this,"fullCalendar"))}),r!==t?r:this):(i=i||{},u=i.eventSources||[],delete i.eventSources,i.events&&(u.push(i.events),delete i.events),i=n.extend(!0,{},nt,i.isRTL||i.isRTL===t&&nt.isRTL?gr:{},i),this.each(function(t,r){var f=n(r),e=new vi(f,i,u);f.data("fullCalendar",e);e.render()}),this)};f.sourceNormalizers=[];f.sourceFetchers=[];ci={dataType:"json",cache:!1};li=1;f.addDays=r;f.cloneDate=i;f.parseDate=ft;f.parseISO8601=et;f.parseTime=ot;f.formatDate=c;f.formatDates=st;var tt=["sun","mon","tue","wed","thu","fri","sat"],nu=864e5,tu=36e5,iu=6e4,ai={s:function(n){return n.getSeconds()},ss:function(n){return l(n.getSeconds())},m:function(n){return n.getMinutes()},mm:function(n){return l(n.getMinutes())},h:function(n){return n.getHours()%12||12},hh:function(n){return l(n.getHours()%12||12)},H:function(n){return n.getHours()},HH:function(n){return l(n.getHours())},d:function(n){return n.getDate()},dd:function(n){return l(n.getDate())},ddd:function(n,t){return t.dayNamesShort[n.getDay()]},dddd:function(n,t){return t.dayNames[n.getDay()]},M:function(n){return n.getMonth()+1},MM:function(n){return l(n.getMonth()+1)},MMM:function(n,t){return t.monthNamesShort[n.getMonth()]},MMMM:function(n,t){return t.monthNames[n.getMonth()]},yy:function(n){return(n.getFullYear()+"").substring(2)},yyyy:function(n){return n.getFullYear()},t:function(n){return 12>n.getHours()?"a":"p"},tt:function(n){return 12>n.getHours()?"am":"pm"},T:function(n){return 12>n.getHours()?"A":"P"},TT:function(n){return 12>n.getHours()?"AM":"PM"},u:function(n){return c(n,"yyyy-MM-dd'T'HH:mm:ss'Z'")},S:function(n){var t=n.getDate();return t>10&&20>t?"th":["st","nd","rd"][t%10-1]||"th"},w:function(n,t){return t.weekNumberCalculation(n)},W:function(n){return wi(n)}};f.dateFormatters=ai;f.applyAll=d;h.month=ur;h.basicWeek=fr;h.basicDay=er;vt({weekMode:"fixed"});h.agendaWeek=sr;h.agendaDay=hr;vt({allDaySlot:!0,allDayText:"all-day",firstHour:6,slotMinutes:30,defaultEventMinutes:120,axisFormat:"h(:mm)tt",timeFormat:{agenda:"h:mm{ - h:mm}"},dragOpacity:{agenda:.5},minTime:0,maxTime:24,slotEventOverlap:!0})})(jQuery)