Click here to Skip to main content
15,893,190 members
Articles / Web Development / HTML

AJAX Event Calendar (Scheduler) for ASP.NET MVC in 80 Lines of Code

Rate me:
Please Sign up or sign in to vote.
4.89/5 (109 votes)
30 Jan 2017Apache5 min read 511.6K   16.8K   323  
How to build an AJAX Event Calendar (Scheduler) using the open-source DayPilot Lite for ASP.NET MVC library (Apache License 2.0).
/*
DayPilot Lite for ASP.NET MVC
Copyright (c) 2005 - 2013 Annpoint s.r.o.
http://mvc.daypilot.org/lite/
Apache Software License
Version: 396-lite
*/
if(typeof DayPilot==='undefined'){var DayPilot={};};(function(){var $a=function(){};if(typeof DayPilot.Calendar!=='undefined'){return;};var DayPilotCalendar={};DayPilotCalendar.selectedCells=null;DayPilotCalendar.topSelectedCell=null;DayPilotCalendar.bottomSelectedCell=null;DayPilotCalendar.selecting=false;DayPilotCalendar.column=null;DayPilotCalendar.firstSelected=null;DayPilotCalendar.firstMousePos=null;DayPilotCalendar.originalMouse=null;DayPilotCalendar.originalHeight=null;DayPilotCalendar.originalTop=null;DayPilotCalendar.resizing=null;DayPilotCalendar.globalHandlers=false;DayPilotCalendar.moving=null;DayPilotCalendar.register=function($b){if(!DayPilotCalendar.registered){DayPilotCalendar.registered=[];};var r=DayPilotCalendar.registered;for(var i=0;i<r.length;i++){if(r[i]===$b){return;}};r.push($b);};DayPilotCalendar.unregister=function($b){var a=DayPilotCalendar.registered;if(!a){return;};var i=DayPilot.indexOf(a,$b);if(i===-1){return;};a.splice(i,1);};DayPilotCalendar.getCellsAbove=function($c){var $d=[];var c=DayPilotCalendar.getColumn($c);var tr=$c.parentNode;var $e=null;while(tr&&$e!==DayPilotCalendar.firstSelected){$e=tr.getElementsByTagName("td")[c];$d.push($e);tr=tr.previousSibling;while(tr&&tr.tagName!=="TR"){tr=tr.previousSibling;}};return $d;};DayPilotCalendar.getCellsBelow=function($c){var $d=[];var c=DayPilotCalendar.getColumn($c);var tr=$c.parentNode;var $e=null;while(tr&&$e!==DayPilotCalendar.firstSelected){$e=tr.getElementsByTagName("td")[c];$d.push($e);tr=tr.nextSibling;while(tr&&tr.tagName!=="TR"){tr=tr.nextSibling;}};return $d;};DayPilotCalendar.getColumn=function($c){var i=0;while($c.previousSibling){$c=$c.previousSibling;if($c.tagName==="TD"){i++;}};return i;};DayPilotCalendar.gUnload=function(ev){if(!DayPilotCalendar.registered){return;};var r=DayPilotCalendar.registered;for(var i=0;i<r.length;i++){var c=r[i];c.dispose();DayPilotCalendar.unregister(c);}};DayPilotCalendar.gMouseUp=function(e){if(DayPilotCalendar.resizing){if(!DayPilotCalendar.resizingShadow){DayPilotCalendar.resizing.style.cursor='default';document.body.style.cursor='default';DayPilotCalendar.resizing=null;return;};var $f=DayPilotCalendar.resizing.event;var $g=DayPilotCalendar.resizingShadow.clientHeight+4;var top=DayPilotCalendar.resizingShadow.offsetTop;var $h=DayPilotCalendar.resizing.dpBorder;DayPilotCalendar.deleteShadow(DayPilotCalendar.resizingShadow);DayPilotCalendar.resizingShadow=null;DayPilotCalendar.resizing.style.cursor='default';document.body.style.cursor='default';DayPilotCalendar.resizing=null;$f.root.eventResizeDispatch($f,$g,top,$h);}else if(DayPilotCalendar.moving){if(!DayPilotCalendar.movingShadow){DayPilotCalendar.moving=null;document.body.style.cursor='default';return;};var top=DayPilotCalendar.movingShadow.offsetTop;DayPilotCalendar.deleteShadow(DayPilotCalendar.movingShadow);var $f=DayPilotCalendar.moving.event;var $i=DayPilotCalendar.movingShadow.column;DayPilotCalendar.moving=null;DayPilotCalendar.movingShadow=null;document.body.style.cursor='default';var ev=e||window.event;$f.root.eventMoveDispatch($f,$i,top,ev);}};DayPilotCalendar.deleteShadow=function($j){if(!$j){return;};if(!$j.parentNode){return;};$j.parentNode.removeChild($j);};DayPilotCalendar.createShadow=function($k,$l){var $m=$k.parentNode;while($m&&$m.tagName!=="TD"){$m=$m.parentNode;};var $j=document.createElement('div');$j.setAttribute('unselectable','on');$j.style.position='absolute';$j.style.width=($k.offsetWidth-4)+'px';$j.style.height=($k.offsetHeight-4)+'px';$j.style.left=($k.offsetLeft)+'px';$j.style.top=($k.offsetTop)+'px';$j.style.border='2px dotted #666666';$j.style.zIndex=101;$j.style.backgroundColor="#aaaaaa";$j.style.opacity=0.5;$j.style.filter="alpha(opacity=50)";$j.style.border='2px solid #aaaaaa';if($l){$j.style.overflow='hidden';$j.style.fontSize=$k.style.fontSize;$j.style.fontFamily=$k.style.fontFamily;$j.style.color=$k.style.color;$j.innerHTML=$k.data.InnerHTML;};$j.style.MozBorderRadius="5px";$j.style.webkitBorderRadius="5px";$j.style.borderRadius="5px";$m.firstChild.appendChild($j);return $j;};DayPilotCalendar.moveShadow=function($n){var $j=DayPilotCalendar.movingShadow;var parent=$j.parentNode;parent.style.display='none';$j.parentNode.removeChild($j);$n.firstChild.appendChild($j);$j.style.left='0px';parent.style.display='';$j.style.width=(DayPilotCalendar.movingShadow.parentNode.offsetWidth+1)+'px';};DayPilotCalendar.Calendar=function(id){var $o=false;if(this instanceof DayPilotCalendar.Calendar&&!this.$1p){$o=true;this.$1p=true;};if(!$o){throw "DayPilot.Calendar() is a constructor and must be called as 'var c = new DayPilot.Calendar(id);'";};var $b=this;this.uniqueID=null;this.v='396-lite';this.id=id;this.clientName=id;this.cache={};this.cache.pixels={};this.elements={};this.elements.events=[];this.nav={};this.afterRender=function(){};this.fasterDispose=true;this.borderColor="#CED2CE";this.businessBeginsHour=9;this.businessEndsHour=18;this.cellBackColor="#ffffff";this.cellBorderColor="#DEDFDE";this.cellHeight=20;this.columnMarginRight=5;this.cornerBackColor="#F3F3F9";this.days=1;this.eventBackColor='#638EDE';this.eventBorderColor="#2951A5";this.eventFontFamily='Tahoma, Arial, Helvetica, sans-serif';this.eventFontSize='8pt';this.eventFontColor="#ffffff";this.eventHeaderFontSize='8pt';this.eventHeaderFontFamily='Tahoma, Arial, Helvetica, sans-serif';this.eventHeaderFontColor="#ffffff";this.eventHeaderHeight=14;this.eventHeaderVisible=true;this.headerFontSize='10pt';this.headerFontFamily='Tahoma, Arial, Helvetica, sans-serif';this.headerFontColor="#42658C";this.headerHeight=21;this.height=300;this.heightSpec='BusinessHours';this.hideUntilInit=true;this.hourHalfBorderColor="#EBEDEB";this.hourBorderColor="#DEDFDE";this.hourFontColor="#42658C";this.hourFontFamily="Tahoma, Arial, Helvetica, sans-serif";this.hourFontSize="16pt";this.hourNameBackColor="#F3F3F9";this.hourNameBorderColor="#DEDFDE";this.hourWidth=45;this.initScrollPos=0;this.loadingLabelText="Loading...";this.loadingLabelVisible=true;this.loadingLabelBackColor="ff0000";this.loadingLabelFontColor="#ffffff";this.loadingLabelFontFamily="Tahoma, Arial, Helvetica, sans-serif";this.loadingLabelFontSize="10pt";this.selectedColor="#316AC5";this.showToolTip=true;this.startDate=new DayPilot.Date().getDatePart();this.timeFormat='Clock12Hours';this.timeRangeSelectedHandling='Disabled';this.eventClickHandling='Disabled';this.eventResizeHandling='Disabled';this.eventMoveHandling='Disabled';this.onTimeRangeSelected=function($p,end){alert($p+'\n'+end);};this.onEventClick=function(e){alert(e);};this.onEventResize=function(e){alert(e);};this.onEventMove=function(e){alert(e);};this.clearSelection=function(){for(var j=0;j<DayPilotCalendar.selectedCells.length;j++){var $c=DayPilotCalendar.selectedCells[j];if($c){if($c.selected){$c.removeChild($c.selected);$c.firstChild.style.display='';$c.selected=null;}}}};this.ie=(navigator&&navigator.userAgent&&navigator.userAgent.indexOf("MSIE")!==-1);this.ff=(navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox")!==-1);this.opera105=(function(){if(/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)){var v=new Number(RegExp.$1);return v>=10.5;};return false;})();this.webkit522=(function(){if(/AppleWebKit[\/\s](\d+\.\d+)/.test(navigator.userAgent)){var v=new Number(RegExp.$1);return v>=522;};return false;})();this.ie9=(navigator&&navigator.userAgent&&navigator.userAgent.indexOf("MSIE 9")!==-1);this.cleanSelection=this.clearSelection;this.callBack2=function($q,$r,$s){if(this.callbackTimeout){window.clearTimeout(this.callbackTimeout);};this.callbackTimeout=window.setTimeout(function(){$b.loadingStart();},100);var $t={};$t.action=$q;$t.parameters=$s;$t.data=$r;$t.header=this.getCallBackHeader();var $u="JSON"+DayPilot.JSON.stringify($t);if(this.backendUrl){DayPilot.request(this.backendUrl,this.callBackResponse,$u,this.ajaxError);}};this.dispose=function(){var c=$b;c.deleteEvents();c.nav.zoom.onmousemove=null;c.nav.scroll.root=null;DayPilot.pu(c.nav.loading);c.disposeMain();c.disposeHeader();c.nav.select=null;c.nav.cornerRight=null;c.nav.scrollable=null;c.nav.zoom=null;c.nav.loading=null;c.nav.header=null;c.nav.hourTable=null;c.nav.scrolltop=null;c.nav.scroll=null;c.nav.main=null;c.nav.message=null;c.nav.messageClose=null;c.nav.top=null;DayPilotCalendar.unregister(c);};this.registerDispose=function(){var $v=document.getElementById(id);$v.dispose=this.dispose;};this.callBackResponse=function($w){$b.updateView($w.responseText);};this.getCallBackHeader=function(){var h={};h.control="dpc";h.id=this.id;h.v=this.v;h.days=$b.days;h.startDate=$b.startDate;h.heightSpec=$b.heightSpec;h.businessBeginsHour=$b.businessBeginsHour;h.businessEndsHour=$b.businessEndsHour;h.backColor=$b.cellBackColor;h.timeFormat=$b.timeFormat;h.viewType=$b.viewType;h.locale=$b.locale;return h;};this.updateView=function($x,$y){var $x=eval("("+$x+")");if($x.CallBackRedirect){document.location.href=$x.CallBackRedirect;return;};if($x.UpdateType==="None"){$b.loadingStop();$b.show();return;};$b.deleteEvents();if($x.UpdateType==="Full"){$b.columns=$x.Columns;$b.days=$x.Days;$b.startDate=new DayPilot.Date($x.StartDate);$b.heightSpec=$x.HeightSpec?$x.HeightSpec:$b.heightSpec;$b.businessBeginsHour=$x.BusinessBeginsHour?$x.BusinessBeginsHour:$b.businessBeginsHour;$b.businessEndsHour=$x.BusinessEndsHour?$x.BusinessEndsHour:$b.businessEndsHour;$b.viewType=$x.ViewType;$b.backColor=$x.BackColor?$x.BackColor:$b.backColor;$b.eventHeaderVisible=$x.EventHeaderVisible?$x.EventHeaderVisible:$b.eventHeaderVisible;$b.timeFormat=$x.TimeFormat?$x.TimeFormat:$b.timeFormat;$b.locale=$x.Locale?$x.Locale:$b.locale;$b.prepareColumns();};$b.loadEvents($x.Events);$b.updateHeaderHeight();if($x.UpdateType==="Full"){$b.drawHeader();$b.drawMain();$b.drawHourTable();$b.updateHeight();};$b.show();$b.drawEvents();$b.clearSelection();$b.afterRender($x.CallBackData,true);$b.loadingStop();};this.$=function($z){return document.getElementById(id+"_"+$z);};this.durationHours=function(){return 24;};this.businessHoursSpan=function(){if(this.businessBeginsHour>this.businessEndsHour){return 24-this.businessBeginsHour+this.businessEndsHour;}else{return this.businessEndsHour-this.businessBeginsHour;}};this.rowCount=function(){return 48;};this.eventClickCallBack=function(e,$r){this.callBack2('EventClick',$r,e);};this.eventClickDispatch=function(e){var $A=this;var e=$A.event;switch($b.eventClickHandling){case 'CallBack':$b.eventClickCallBack(e);break;case 'JavaScript':$b.onEventClick(e);break;}};this.eventResizeCallBack=function(e,$B,$C,$r){if(!$B)throw 'newStart is null';if(!$C)throw 'newEnd is null';var $D={};$D.e=e;$D.newStart=$B;$D.newEnd=$C;this.callBack2('EventResize',$r,$D);};this.eventResizeDispatch=function(e,$E,$F,$h){var $G=1;var $B=new Date();var $C=new Date();var $p=e.start();var end=e.end();var $H=new Date();var $I=$b.columns[e.div.data.DayIndex].Start;$H=end.getDatePart();var $J=Math.floor(($F+$E-$G)/$b.cellHeight);var $K=$J*30;var ts=$K*60*1000;$B=$p;$C=$I.addTime(ts);switch($b.eventResizeHandling){case 'CallBack':$b.eventResizeCallBack(e,$B,$C);break;case 'JavaScript':$b.onEventResize(e,$B,$C);break;}};this.eventMoveCallBack=function(e,$B,$C,$L,$r){if(!$B)throw 'newStart is null';if(!$C)throw 'newEnd is null';var $D={};$D.e=e;$D.newStart=$B;$D.newEnd=$C;$D.newResource=$L;this.callBack2('EventMove',$r,$D);};this.eventMoveDispatch=function(e,$i,$F,ev){var $G=1;var $J=Math.floor(($F-$G)/$b.cellHeight);var $M=$J*30*60*1000;var $p=e.start();var end=e.end();var $H=new Date();if($p.isDayPilotDate){$p=$p.d;};$H.setTime(Date.UTC($p.getUTCFullYear(),$p.getUTCMonth(),$p.getUTCDate()));var $N=$p.getTime()-($H.getTime()+$p.getUTCHours()*3600*1000+Math.floor($p.getUTCMinutes()/30)*30*60*1000);var length=end.getTime()-$p.getTime();var $O=this.columns[$i];var $P=$O.Start.getTime();var $Q=new Date();$Q.setTime($P+$M+$N);var $B=new DayPilot.Date($Q);var $C=$B.addTime(length);switch($b.eventMoveHandling){case 'CallBack':$b.eventMoveCallBack(e,$B,$C,$O.Value);break;case 'JavaScript':$b.onEventMove(e,$B,$C,$O.Value,false);break;}};this.timeRangeSelectedCallBack=function($p,end,$R,$r){var $S={};$S.start=$p;$S.end=end;$S.resource=$R;this.callBack2('TimeRangeSelected',$r,$S);};this.timeRangeSelectedDispatch=function($p,end,$n){if(!$p.isDayPilotDate){$p=new DayPilot.Date($p);};if(!end.isDayPilotDate){end=new DayPilot.Date(end);};switch($b.timeRangeSelectedHandling){case 'CallBack':$b.timeRangeSelectedCallBack($p,end,$n);break;case 'JavaScript':$b.onTimeRangeSelected($p,end,$n);break;}};this.onCellMousedown=function(ev){if(DayPilotCalendar.selecting){return;};if($b.timeRangeSelectedHandling==="Disabled"){return;};var $T=(window.event)?window.event.button:ev.which;if($T!==1&&$T!==0){return;};DayPilotCalendar.firstMousePos=DayPilot.mc(ev||window.event);DayPilotCalendar.selecting=true;if(DayPilotCalendar.selectedCells){$b.clearSelection();DayPilotCalendar.selectedCells=[];};DayPilotCalendar.column=DayPilotCalendar.getColumn(this);DayPilotCalendar.selectedCells.push(this);DayPilotCalendar.firstSelected=this;DayPilotCalendar.topSelectedCell=this;DayPilotCalendar.bottomSelectedCell=this;$b.activateSelection();};this.activateSelection=function(){var $U=this.getSelection();for(var j=0;j<DayPilotCalendar.selectedCells.length;j++){var $c=DayPilotCalendar.selectedCells[j];if($c&&!$c.selected){var $V=document.createElement("div");$V.style.height=($b.cellHeight-1)+"px";$V.style.backgroundColor=$b.selectedColor;$c.firstChild.style.display="none";$c.insertBefore($V,$c.firstChild);$c.selected=$V;}}};this.mousemove=function(ev){if(typeof(DayPilotCalendar)==='undefined'){return;};if(!DayPilotCalendar.selecting){return;};var $W=DayPilot.mc(ev||window.event);var $X=DayPilotCalendar.getColumn(this);if($X!==DayPilotCalendar.column){return;};$b.clearSelection();if($W.y<DayPilotCalendar.firstMousePos.y){DayPilotCalendar.selectedCells=DayPilotCalendar.getCellsBelow(this);DayPilotCalendar.topSelectedCell=DayPilotCalendar.selectedCells[0];DayPilotCalendar.bottomSelectedCell=DayPilotCalendar.firstSelected;}else{DayPilotCalendar.selectedCells=DayPilotCalendar.getCellsAbove(this);DayPilotCalendar.topSelectedCell=DayPilotCalendar.firstSelected;DayPilotCalendar.bottomSelectedCell=DayPilotCalendar.selectedCells[0];};$b.activateSelection();};this.getSelection=function(){var $p=DayPilotCalendar.topSelectedCell.start;var end=DayPilotCalendar.bottomSelectedCell.end;var $Y=DayPilotCalendar.topSelectedCell.resource;return new DayPilot.Selection($p,end,$Y,$b);};this.mouseup=function(ev){if(DayPilotCalendar.selecting&&DayPilotCalendar.topSelectedCell!==null){DayPilotCalendar.selecting=false;var $Z=$b.getSelection();$b.timeRangeSelectedDispatch($Z.start,$Z.end,$Z.resource);if($b.timeRangeSelectedHandling!=="Hold"&&$b.timeRangeSelectedHandling!=="HoldForever"){$a();}}else{DayPilotCalendar.selecting=false;}};this.prepareColumns=function(){if(!this.columns){this.createDaysViewColumns();};for(var i=0;i<this.columns.length;i++){this.activateColumn(this.columns[i]);}};this.activateColumn=function($n){$n.Start=new DayPilot.Date($n.Start);$n.putIntoBlock=function(ep){for(var i=0;i<this.blocks.length;i++){var $00=this.blocks[i];if($00.overlapsWith(ep.Top,ep.Height)){$00.events.push(ep);$00.min=Math.min($00.min,ep.Top);$00.max=Math.max($00.max,ep.Top+ep.Height);return i;}};var $00=[];$00.lines=[];$00.events=[];$00.overlapsWith=function($p,$01){var end=$p+$01-1;if(!(end<this.min||$p>this.max-1)){return true;};return false;};$00.putIntoLine=function(ep){var $02=this;for(var i=0;i<this.lines.length;i++){var $03=this.lines[i];if($03.isFree(ep.Top,ep.Height)){$03.push(ep);return i;}};var $03=[];$03.isFree=function($p,$01){var end=$p+$01-1;var $04=this.length;for(var i=0;i<$04;i++){var e=this[i];if(!(end<e.Top||$p>e.Top+e.Height-1)){return false;}};return true;};$03.push(ep);this.lines.push($03);return this.lines.length-1;};$00.events.push(ep);$00.min=ep.Top;$00.max=ep.Top+ep.Height;this.blocks.push($00);return this.blocks.length-1;};$n.putIntoLine=function(ep){var $02=this;for(var i=0;i<this.lines.length;i++){var $03=this.lines[i];if($03.isFree(ep.Top,ep.Height)){$03.push(ep);return i;}};var $03=[];$03.isFree=function($p,$01){var end=$p+$01-1;var $04=this.length;for(var i=0;i<$04;i++){var e=this[i];if(!(end<e.Top||$p>e.Top+e.Height-1)){return false;}};return true;};$03.push(ep);this.lines.push($03);return this.lines.length-1;};};this.createDaysViewColumns=function(){this.columns=[];var $p=this.startDate.getDatePart();for(var i=0;i<this.days;i++){var $n={};$n.Start=$p.addDays(i);$n.Name=$n.Start.toString();$n.InnerHTML=DayPilot.Date.toLocal($n.Start.d).toLocaleString();this.columns.push($n);}};this.deleteEvents=function(){if(this.elements.events){for(var i=0;i<this.elements.events.length;i++){var $V=this.elements.events[i];var $k=$V.event;if($k){$k.div=null;$k.root=null;};$V.onclick=null;$V.onclickSave=null;$V.onmouseover=null;$V.onmouseout=null;$V.onmousemove=null;$V.onmousedown=null;if($V.firstChild&&$V.firstChild.firstChild&&$V.firstChild.firstChild.tagName&&$V.firstChild.firstChild.tagName.toUpperCase()==='IMG'){var $05=$V.firstChild.firstChild;$05.onmousedown=null;$05.onmousemove=null;$05.onclick=null;};$V.helper=null;$V.data=null;$V.event=null;DayPilot.de($V);}};this.elements.events=[];};this.drawEvent=function($r){var $06=this.nav.main;var $07=true;var $08=true;var $09=false;var $0a=this.eventBorderColor;var $V=document.createElement("div");$V.data=$r;$V.unselectable='on';$V.style.MozUserSelect='none';$V.style.KhtmlUserSelect='none';$V.style.position='absolute';$V.style.fontFamily=this.eventFontFamily;$V.style.fontSize=this.eventFontSize;$V.style.color=this.eventFontColor;$V.style.left=$r.Left+'%';$V.style.top=($r.Top)+'px';$V.style.width=$r.Width+'%';$V.style.height=Math.max($r.Height,2)+'px';if(!$07){$V.style.backgroundColor=$0a;};$V.style.overflow='hidden';$V.isFirst=$r.PartStart.getTime()===$r.Start.getTime();$V.isLast=$r.PartEnd.getTime()===$r.End.getTime();$V.onclick=this.eventClickDispatch;var $0b=[];$0b.push("<div");if(this.showToolTip){$0b.push(" title='");$0b.push($r.ToolTip.replace(/'/g,"&apos;"));$0b.push("'");};var $g=Math.max($r.Height-2,0);$0b.push(" class='");$0b.push("'");if($09){$0b.push(" style='margin-top:1px;height:");$0b.push($g-2);}else{$0b.push(" style='margin-top:0px;height:");$0b.push($g);};$0b.push("px;background-color:");$0b.push(this.eventBackColor);if($08){$0b.push(";border:1px solid ");$0b.push($0a);$0b.push(";-moz-border-radius:5px;");$0b.push(";-webkit-border-radius:5px;");$0b.push(";border-radius:5px;");}else{$0b.push(";border-left:1px solid ");$0b.push($0a);$0b.push(";border-right:1px solid ");$0b.push($0a);};$0b.push(";");$0b.push("' unselectable='on'>");var $0c=this.eventHeaderVisible?this.eventHeaderHeight:0;if(this.eventHeaderVisible){var $0d="";var $0e=$r.Start.getHours();var am=$0e<12;var $0f=$r.Start.getMinutes();if(this.timeFormat==="Clock12Hours"){$0e=$0e%12;if($0e===0){$0e=12;};$0d=am?"am":"pm";};if($0f<10){$0f="0"+$0f;};var $0g=$0e+":"+$0f+$0d;$0b.push("<div unselectable='on' style='overflow:hidden;height:");$0b.push(this.eventHeaderHeight);$0b.push("px; background-color:");$0b.push($0a);$0b.push(";font-size:");$0b.push(this.eventHeaderFontSize);$0b.push(";color:");$0b.push(this.eventHeaderFontColor);$0b.push("'>");$0b.push($0g);$0b.push("</div>");};$0b.push("<div unselectable='on' style='overflow:hidden;padding-left:2px;height:");$0b.push($g-$0c-1);$0b.push("px;'>");$0b.push($r.InnerHTML);$0b.push("</div></div>");$V.innerHTML=$0b.join('');if($06.rows[0].cells[$r.DayIndex]){var $0h=$06.rows[0].cells[$r.DayIndex].firstChild;$0h.appendChild($V);$b.makeChildrenUnselectable($V);var e=new DayPilotCalendar.Event($V,$b);};$b.elements.events.push($V);};this.makeChildrenUnselectable=function(el){var c=(el&&el.childNodes)?el.childNodes.length:0;for(var i=0;i<c;i++){try{var $0i=el.childNodes[i];if($0i.nodeType===1){$0i.unselectable='on';this.makeChildrenUnselectable($0i);}}catch(e){}}};this.drawEvents=function(){var $p=new Date();for(var i=0;i<this.columns.length;i++){var $0j=this.columns[i];for(var m=0;m<$0j.blocks.length;m++){var $00=$0j.blocks[m];for(var j=0;j<$00.lines.length;j++){var $03=$00.lines[j];for(var k=0;k<$03.length;k++){var e=$03[k];e.Width=100/$00.lines.length;e.Left=e.Width*j;var $0k=(j===$00.lines.length-1);if(!$0k){e.Width=e.Width*1.5;};this.drawEvent(e);}}}};var end=new Date();var $0l=end.getTime()-$p.getTime();};this.drawTop=function(){this.nav.top=document.getElementById(this.id);this.nav.top.innerHTML='';this.nav.top.style.MozUserSelect='none';this.nav.top.style.KhtmlUserSelect='none';this.nav.top.style.position='relative';this.nav.top.style.width=this.width?this.width:'100%';this.nav.top.style.lineHeight="1.2";this.nav.top.style.textAlign="left";if(this.heightSpec==="Parent100Pct"){this.nav.top.style.height="100%";};if(this.hideUntilInit){this.nav.top.style.visibility='hidden';};this.nav.scroll=document.createElement("div");this.nav.scroll.style.height=this.getScrollableHeight()+"px";if(this.heightSpec==='BusinessHours'){this.nav.scroll.style.overflow="auto";}else{this.nav.scroll.style.overflow="hidden";};this.nav.scroll.style.position="relative";this.nav.scroll.style.border="1px solid "+this.borderColor;this.nav.scroll.style.backgroundColor=this.hourNameBackColor;var $0m=this.drawTopHeaderDiv();this.nav.top.appendChild($0m);this.nav.scroll.style.zoom=1;var $0n=this.drawScrollable();this.nav.scrollable=$0n.firstChild;this.nav.scroll.appendChild($0n);this.nav.top.appendChild(this.nav.scroll);this.nav.scrollLayer=document.createElement("div");this.nav.scrollLayer.style.position='absolute';this.nav.scrollLayer.style.top='0px';this.nav.scrollLayer.style.left='0px';this.nav.top.appendChild(this.nav.scrollLayer);this.nav.loading=document.createElement("div");this.nav.loading.style.position='absolute';this.nav.loading.style.top='0px';this.nav.loading.style.left=(this.hourWidth+5)+"px";this.nav.loading.style.backgroundColor=this.loadingLabelBackColor;this.nav.loading.style.fontSize=this.loadingLabelFontSize;this.nav.loading.style.fontFamily=this.loadingLabelFontFamily;this.nav.loading.style.color=this.loadingLabelFontColor;this.nav.loading.style.padding='2px';this.nav.loading.innerHTML=this.loadingLabelText;this.nav.loading.style.display='none';this.nav.top.appendChild(this.nav.loading);};this.drawHourTable=function(){if(!this.fasterDispose)DayPilot.pu(this.nav.hourTable);this.nav.scrollable.rows[0].cells[0].innerHTML='';this.nav.hourTable=this.createHourTable();this.nav.scrollable.rows[0].cells[0].appendChild(this.nav.hourTable);};this.drawScrollable=function(){var $0o=document.createElement("div");$0o.style.zoom=1;$0o.style.position='relative';var $0p=document.createElement("table");$0p.cellSpacing="0";$0p.cellPadding="0";$0p.border="0";$0p.style.border="0px none";$0p.style.width="100%";$0p.style.position='absolute';var r=$0p.insertRow(-1);var c;c=r.insertCell(-1);c.valign="top";c.style.padding='0px';c.style.border='0px none';this.nav.hourTable=this.createHourTable();c.appendChild(this.nav.hourTable);c=r.insertCell(-1);c.valign="top";c.width="100%";c.style.padding='0px';c.style.border='0px none';c.appendChild(this.createEventsAndCells());$0o.appendChild($0p);this.nav.zoom=$0o;return $0o;};this.createEventsAndCells=function(){var $0p=document.createElement("table");$0p.cellPadding="0";$0p.cellSpacing="0";$0p.border="0";$0p.style.width="100%";$0p.style.border="0px none";$0p.style.borderLeft="1px solid "+this.borderColor;this.nav.main=$0p;return $0p;};this.createHourTable=function(){var $0p=document.createElement("table");$0p.cellSpacing="0";$0p.cellPadding="0";$0p.border="0";$0p.style.border='0px none';$0p.style.width=this.hourWidth+"px";$0p.oncontextmenu=function(){return false;};var r=$0p.insertRow(-1);r.style.height="1px";r.style.backgroundColor="white";var c=r.insertCell(-1);c.style.padding='0px';c.style.border='0px none';var $0q=24;for(var i=0;i<$0q;i++){this.createHourRow($0p,i);};return $0p;};this.createHourRow=function($0p,i){var $g=(this.cellHeight*2);var r=$0p.insertRow(-1);r.style.height=$g+"px";var c=r.insertCell(-1);c.valign="bottom";c.unselectable="on";c.style.backgroundColor=this.hourNameBackColor;c.style.cursor="default";c.style.padding='0px';c.style.border='0px none';var $0r=document.createElement("div");$0r.style.width=this.hourWidth+"px";$0r.style.height=($g)+"px";$0r.style.overflow='hidden';$0r.unselectable='on';var $00=document.createElement("div");$00.style.display="block";$00.style.borderBottom="1px solid "+this.hourNameBorderColor;$00.style.height=($g-1)+"px";$00.style.textAlign="right";$00.unselectable="on";var $0g=document.createElement("div");$0g.style.padding="2px";$0g.style.fontFamily=this.hourFontFamily;$0g.style.fontSize=this.hourFontSize;$0g.style.color=this.hourFontColor;$0g.unselectable="on";var $p=this.startDate.addHours(i);var $0e=$p.getHours();var am=$0e<12;if(this.timeFormat==="Clock12Hours"){$0e=$0e%12;if($0e===0){$0e=12;}};$0g.innerHTML=$0e;var $0s=document.createElement("span");$0s.style.fontSize="10px";$0s.style.verticalAlign="super";$0s.unselectable="on";var $0t;if(this.timeFormat==="Clock12Hours"){if(am){$0t="AM";}else{$0t="PM";}}else{$0t="00";};$0s.innerHTML="&nbsp;"+$0t;$0g.appendChild($0s);$00.appendChild($0g);$0r.appendChild($00);c.appendChild($0r);};this.getScrollableHeight=function(){switch(this.heightSpec){case "Full":return(24*2*this.cellHeight);case "BusinessHours":var $0u=this.businessHoursSpan();return $0u*this.cellHeight*2;default:throw "DayPilot.Calendar: Unexpected 'heightSpec' value.";}};this.drawTopHeaderDiv=function(){var $0m=document.createElement("div");$0m.style.borderLeft="1px solid "+this.borderColor;$0m.style.borderRight="1px solid "+this.borderColor;$0m.style.overflow="auto";var $0p=document.createElement("table");$0p.cellPadding="0";$0p.cellSpacing="0";$0p.border="0";$0p.style.width="100%";$0p.style.borderCollapse='separate';$0p.style.border="0px none";var r=$0p.insertRow(-1);var c=r.insertCell(-1);c.style.padding='0px';c.style.border='0px none';var $0v=this.drawCorner();c.appendChild($0v);this.nav.corner=$0v;c=r.insertCell(-1);c.style.width="100%";c.style.backgroundColor=this.hourNameBackColor;c.valign="top";c.style.position='relative';c.style.padding='0px';c.style.border='0px none';this.nav.header=document.createElement("table");this.nav.header.cellPadding="0";this.nav.header.cellSpacing="0";this.nav.header.border="0";this.nav.header.width="100%";this.nav.header.style.borderBottom="0px none #000000";this.nav.header.style.borderRight="0px none #000000";this.nav.header.style.borderLeft="1px solid "+this.borderColor;this.nav.header.style.borderTop="1px solid "+this.borderColor;this.nav.header.oncontextmenu=function(){return false;};var $0w=this.nav.scroll.style.overflow!=='hidden';if($0w){this.nav.header.style.borderRight="1px solid "+this.borderColor;};c.appendChild(this.nav.header);if($0w){c=r.insertCell(-1);c.style.backgroundColor=this.hourNameBackColor;c.style.borderTop="1px solid "+this.borderColor;c.style.borderBottom="0px none";c.style.borderLeft="0px none";c.style.borderRight="0px none";c.style.padding='0px';c.style.verticalAlign='top';c.unselectable="on";c.innerHTML="&nbsp;";var $0b=document.createElement("div");$0b.unselectable="on";$0b.style.width="16px";$0b.style.height="1px";$0b.style.lineHeight="1px";$0b.style.fontSize="1px";c.appendChild($0b);this.nav.cornerRight=$0b;};$0m.appendChild($0p);return $0m;};this.drawCorner=function(){var $0n=document.createElement("div");$0n.style.position='relative';$0n.style.backgroundColor=this.hourNameBackColor;$0n.style.fontFamily=this.headerFontFamily;$0n.style.fontSize=this.headerFontSize;$0n.style.color=this.headerFontColor;$0n.style.width=this.hourWidth+"px";$0n.style.height=this.headerHeight+"px";$0n.style.borderTop="1px solid "+this.borderColor;$0n.oncontextmenu=function(){return false;};var $0v=document.createElement("div");$0v.unselectable="on";$0n.appendChild($0v);return $0n;};this.disposeMain=function(){var $0p=this.nav.main;$0p.root=null;$0p.onmouseup=null;for(var y=0;y<$0p.rows.length;y++){var r=$0p.rows[y];for(var x=0;x<r.cells.length;x++){var c=r.cells[x];c.root=null;c.onmousedown=null;c.onmousemove=null;c.onmouseout=null;c.onmouseup=null;}};if(!this.fasterDispose)DayPilot.pu($0p);};this.drawMain=function(){DayPilotCalendar.selectedCells=[];var $0x=[];var $0y=[];var $0p=this.nav.main;var $J=30*60*1000;var $0z=this.rowCount();var $0A=$b.columns;var $0B=!this.tableCreated||$0A.length!==$0p.rows[0].cells.length||$0z!==$0p.rows.length;if($0p){this.disposeMain();}while($0p&&$0p.rows&&$0p.rows.length>0&&$0B){if(!this.fasterDispose)DayPilot.pu($0p.rows[0]);$0p.deleteRow(0);};this.tableCreated=true;var r=($0B)?$0p.insertRow(-1):$0p.rows[0];if($0B){r.style.backgroundColor='white';};var cl=$0A.length;for(var j=0;j<cl;j++){var c=($0B)?r.insertCell(-1):r.cells[j];if($0B){c.style.padding='0px';c.style.border='0px none';c.style.height='1px';c.style.overflow='visible';if(!$b.rtl){c.style.textAlign='left';};c.style.width=(100.0/$0A.length)+"%";var $V=document.createElement("div");$V.style.display='block';$V.style.marginRight=$b.columnMarginRight+"px";$V.style.position='relative';$V.style.height='1px';$V.style.fontSize='1px';$V.style.lineHeight='1.2';$V.style.marginTop='-1px';c.appendChild($V);}};for(var i=0;i<$0z;i++){var r=($0B)?$0p.insertRow(-1):$0p.rows[i+1];if($0B){r.style.MozUserSelect='none';r.style.KhtmlUserSelect='none';};for(var j=0;j<cl;j++){var $0j=this.columns[j];var c=($0B)?r.insertCell(-1):r.cells[j];c.start=$0j.Start.addTime(i*$J);c.end=c.start.addTime($J);c.resource=$0j.Value;if($0B){c.root=this;c.style.padding='0px';c.style.border='0px none';c.style.verticalAlign='top';c.onmousedown=this.onCellMousedown;c.onmousemove=this.mousemove;c.onmouseup=function(){return false;};c.onclick=function(){return false;};if((!$b.rtl&&j!==cl-1)||$b.rtl){c.style.borderRight='1px solid '+$b.cellBorderColor;};c.style.height=$b.cellHeight+'px';c.style.overflow='hidden';c.unselectable='on';var $V=document.createElement("div");$V.unselectable='on';$V.style.fontSize='1px';$V.style.height='0px';var $0C=(c.end.getMinutes()+c.end.getSeconds()+c.end.getMilliseconds())>0;if($0C){if($b.hourHalfBorderColor!==''){$V.style.borderBottom='1px solid '+$b.hourHalfBorderColor;}}else{if($b.hourBorderColor!==''){$V.style.borderBottom='1px solid '+$b.hourBorderColor;}};var $0D=document.createElement("div");$0D.style.height=($b.cellHeight-1)+"px";$0D.style.overflow='hidden';$0D.unselectable='on';c.appendChild($0D);c.appendChild($V);};c.style.backgroundColor=$b.cellBackColor;$0D=c.firstChild;}};$0p.onmouseup=this.mouseup;$0p.root=this;var scroll=$b.nav.scroll;$b.nav.scrollable.onmousemove=function(ev){ev=ev||window.event;var $0E=$b.nav.scrollable;$b.coords=DayPilot.mo3($0E,ev);var $W=DayPilot.mc(ev);if(DayPilotCalendar.resizing){if(!DayPilotCalendar.resizingShadow){DayPilotCalendar.resizingShadow=DayPilotCalendar.createShadow(DayPilotCalendar.resizing,false,$b.shadow);};var $0F=DayPilotCalendar.resizing.event.root.cellHeight;var $G=1;var $0G=($W.y-DayPilotCalendar.originalMouse.y);if(DayPilotCalendar.resizing.dpBorder==='bottom'){var $0H=Math.floor(((DayPilotCalendar.originalHeight+DayPilotCalendar.originalTop+$0G)+$0F/2) / $0F)*$0F-DayPilotCalendar.originalTop+$G;if($0H<$0F)$0H=$0F;var $04=DayPilotCalendar.resizing.event.root.nav.main.clientHeight;if(DayPilotCalendar.originalTop+$0H>$04)$0H=$04-DayPilotCalendar.originalTop;DayPilotCalendar.resizingShadow.style.height=($0H-4)+'px';}}else if(DayPilotCalendar.moving){if(!DayPilotCalendar.movingShadow){DayPilotCalendar.movingShadow=DayPilotCalendar.createShadow(DayPilotCalendar.moving,!$b.ie,$b.shadow);DayPilotCalendar.movingShadow.style.width=(DayPilotCalendar.movingShadow.parentNode.offsetWidth+1)+'px';};if(!$b.coords){return;};var $0F=$b.cellHeight;var $G=1;var $0I=DayPilotCalendar.moveOffsetY;if(!$0I){$0I=$0F/2;};var $0J=Math.floor((($b.coords.y-$0I-$G)+$0F/2) / $0F)*$0F+$G;if($0J<$G){$0J=$G;};var $06=$b.nav.main;var $04=$06.clientHeight;var $g=parseInt(DayPilotCalendar.movingShadow.style.height);if($0J+$g>$04){$0J=$04-$g;};DayPilotCalendar.movingShadow.parentNode.style.display='none';DayPilotCalendar.movingShadow.style.top=$0J+'px';DayPilotCalendar.movingShadow.parentNode.style.display='';var $0K=$06.clientWidth/$06.rows[0].cells.length;var $n=Math.floor(($b.coords.x-45)/$0K);if($n<0){$n=0;};if($n<$06.rows[0].cells.length&&$n>=0&&DayPilotCalendar.movingShadow.column!==$n){DayPilotCalendar.movingShadow.column=$n;DayPilotCalendar.moveShadow($06.rows[0].cells[$n]);}}};$b.nav.scrollable.style.display='';};this.disposeHeader=function(){var $0p=this.nav.header;if($0p&&$0p.rows){for(var y=0;y<$0p.rows.length;y++){var r=$0p.rows[y];for(var x=0;x<r.cells.length;x++){var c=r.cells[x];c.onclick=null;c.onmousemove=null;c.onmouseout=null;}}};if(!this.fasterDispose)DayPilot.pu($0p);};this.drawHeaderRow=function($0B){var r=($0B)?this.nav.header.insertRow(-1):this.nav.header.rows[0];var $0A=this.columns;var $0L=$0A.length;for(var i=0;i<$0L;i++){var $r=$0A[i];var $c=($0B)?r.insertCell(-1):r.cells[i];$c.data=$r;$c.style.width=(100.0/$0A.length)+"%";$c.style.overflow='hidden';$c.style.padding='0px';$c.style.border='0px none';$c.style.height=(this.headerHeight)+"px";var $V=($0B)?document.createElement("div"):$c.firstChild;if($0B){$V.unselectable='on';$V.style.MozUserSelect='none';$V.style.backgroundColor=$r.BackColor;$V.style.cursor='default';$V.style.position='relative';$V.style.fontFamily=this.headerFontFamily;$V.style.fontSize=this.headerFontSize;$V.style.color=this.headerFontColor;if($b.rtl){if(i===$0L-1){$V.style.borderLeft="1px solid "+$r.BackColor;}else{$V.style.borderLeft="1px solid "+this.borderColor;}}else{if(i===$0L-1){$a();}else{$V.style.borderRight="1px solid "+this.borderColor;}};$V.style.height=this.headerHeight+"px";var $0g=document.createElement("div");$0g.style.position='absolute';$0g.style.left='0px';$0g.style.width='100%';$0g.style.padding="2px";$V.style.textAlign='center';$0g.unselectable='on';$V.appendChild($0g);$c.appendChild($V);};var $0g=$V.firstChild;$0g.innerHTML=$r.InnerHTML;}};this.widthUnit=function(){if(this.width&&this.width.indexOf("px")!=-1){return "Pixel";};return "Percentage";};this.drawHeader=function(){var $0m=this.nav.header;var $0B=true;var $0A=this.columns;var $0L=$0A.length;if(this.headerCreated&&$0m&&$0m.rows&&$0m.rows.length>0){$0B=$0m.rows[$0m.rows.length-1].cells.length!==$0L;}while(this.headerCreated&&$0m&&$0m.rows&&$0m.rows.length>0&&$0B){if(!this.fasterDispose)DayPilot.pu($0m.rows[0]);$0m.deleteRow(0);};this.headerCreated=true;if(!$0B){var $0v=$b.nav.corner;$0v.style.backgroundColor=$b.cornerBackColor;if(!this.fasterDispose)DayPilot.pu($0v.firstChild);};this.drawHeaderRow($0B);};this.loadingStart=function(){if(this.loadingLabelVisible){this.nav.loading.innerHTML=this.loadingLabelText;this.nav.loading.style.top=(this.headerHeight+5)+"px";this.nav.loading.style.display='';}};this.commandCallBack=function($0M,$r){var $D={};$D.command=$0M;this.callBack2('Command',$r,$D);};this.loadingStop=function($0N){if(this.callbackTimeout){window.clearTimeout(this.callbackTimeout);};this.nav.loading.style.display='none';};this.enableScrolling=function(){var $0O=this.nav.scroll;if(!this.initScrollPos)return;$0O.root=this;if($0O.scrollTop===0){$0O.scrollTop=this.initScrollPos;}};this.callbackError=function($x,$y){alert("Error!\r\nResult: "+$x+"\r\nContext:"+$y);};this.fixScrollHeader=function(){var w=DayPilot.sw(this.nav.scroll);var d=this.nav.cornerRight;if(d&&w>0){d.style.width=(w-1)+'px';}};this.registerGlobalHandlers=function(){if(!DayPilotCalendar.globalHandlers){DayPilotCalendar.globalHandlers=true;DayPilot.re(document,'mouseup',DayPilotCalendar.gMouseUp);DayPilot.re(window,'unload',DayPilotCalendar.gUnload);}};this.loadEvents=function($0P){if(!$0P){$0P=this.events;};var length=$0P.length;var $0Q=24*60*60*1000;this.cache.pixels={};var $0R=[];this.scrollLabels=[];this.minStart=10000;this.maxEnd=0;if(!$0P){return;};for(var i=0;i<length;i++){var e=$0P[i];e.Start=new DayPilot.Date(e.Start);e.End=new DayPilot.Date(e.End);};var $0S=this.startDate;var $0T=this.startDate.addDays(this.days);for(var i=0;i<this.columns.length;i++){var scroll={};scroll.minEnd=1000000;scroll.maxStart=-1;this.scrollLabels.push(scroll);var $0j=this.columns[i];$0j.events=[];$0j.lines=[];$0j.blocks=[];var $I=new DayPilot.Date($0j.Start);var $0U=$I.getTime();var $0V=$I.addTime($0Q);var $0W=$0V.getTime();for(var j=0;j<length;j++){if($0R[j]){continue;};var e=$0P[j];var $p=e.Start;var end=e.End;var $0X=$p.getTime();var $0Y=end.getTime();if($0Y<$0X){continue;};var $0Z=!($0Y<=$0U||$0X>=$0W);if($0Z){var ep={};ep.Text=e.Text;ep.Value=e.Value;ep.ToolTip=e.ToolTip?e.ToolTip:e.Text;ep.Start=$p;ep.End=end;ep.DayIndex=i;ep.PartStart=$0U<$0X?ep.Start:$I;ep.PartEnd=$0W>$0Y?ep.End:$0V;ep.InnerHTML=e.InnerHTML?e.InnerHTML:e.Text;var $10=this.getPixels(ep.PartStart,$0j.Start);var $11=this.getPixels(ep.PartEnd,$0j.Start);var top=$10.top;var $12=$11.top;if(top===$12&&($10.cut||$11.cut)){continue;};var $13=$11.boxBottom;ep.Top=Math.floor(top/this.cellHeight)*this.cellHeight+1;ep.Height=Math.max(Math.ceil($13/this.cellHeight)*this.cellHeight-ep.Top,this.cellHeight-1)+1;var $p=ep.Top;var end=ep.Top+ep.Height;if($p>scroll.maxStart){scroll.maxStart=$p;};if(end<scroll.minEnd){scroll.minEnd=end;};if($p<this.minStart){this.minStart=$p;};if(end>this.maxEnd){this.maxEnd=end;};$0j.events.push(ep);if(ep.PartStart.getTime()===$0X&&ep.PartEnd.getTime()===$0Y){$0R[j]=true;}}}};for(var i=0;i<this.columns.length;i++){var $0j=this.columns[i];$0j.events.sort(this.eventComparer);for(var j=0;j<$0j.events.length;j++){var e=$0j.events[j];$0j.putIntoBlock(e);};for(var j=0;j<$0j.blocks.length;j++){var $00=$0j.blocks[j];$00.events.sort(this.eventComparer);for(var k=0;k<$00.events.length;k++){var e=$00.events[k];$00.putIntoLine(e);}}}};this.eventComparer=function(a,b){if(!a||!b||!a.Start||!b.Start){return 0;};var $14=a.Start.getTime()-b.Start.getTime();if($14!==0){return $14;};var $15=b.End.getTime()-a.End.getTime();return $15;};this.debug=function($0N,$16){if(!this.debuggingEnabled){return;};if(!$b.debugMessages){$b.debugMessages=[];};$b.debugMessages.push($0N);if(typeof console!=='undefined'){console.log($0N);}};this.getPixels=function($P,$p){if(!$p)$p=this.startDate;var $0X=$p.getTime();var $17=$P.getTime();var $18=this.cache.pixels[$17+"_"+$0X];if($18){return $18;};$0X=$p.getTime();var $19=30*60*1000;var $1a=$17-$0X;var $1b=$1a%$19;var $1c=$1a-$1b;var $1d=$1c+$19;if($1b===0){$1d=$1c;};var $x={};$x.cut=false;$x.top=this.ticksToPixels($1a);$x.boxTop=this.ticksToPixels($1c);$x.boxBottom=this.ticksToPixels($1d);this.cache.pixels[$17+"_"+$0X]=$x;return $x;};this.ticksToPixels=function($17){return Math.floor((this.cellHeight*$17)/(1000*60*30));};this.prepareVariables=function(){this.startDate=new DayPilot.Date(this.startDate);};this.updateHeaderHeight=function(){if(this.nav.corner){this.nav.corner.style.height=this.headerHeight+"px";}};this.updateHeight=function(){var sh=this.getScrollableHeight();if(this.nav.scroll&&sh>0){this.nav.scroll.style.height=sh+"px";}};this.loadFromServer=function(){return(typeof this.events==='undefined')||!this.events;};this.show=function(){if(this.nav.top.style.visibility=='hidden'){this.nav.top.style.visibility='visible';}};this.initShort=function(){this.prepareVariables();this.prepareColumns();this.drawTop();this.drawHeader();this.drawMain();this.fixScrollHeader();this.enableScrolling();this.registerGlobalHandlers();DayPilotCalendar.register(this);this.callBack2('Init');};this.Init=function(){var $1e=this.loadFromServer();if($1e){this.initShort();return;};this.prepareVariables();this.prepareColumns();if(this.events){this.loadEvents();};this.drawTop();this.drawHeader();this.drawMain();this.show();this.fixScrollHeader();this.enableScrolling();this.registerGlobalHandlers();DayPilotCalendar.register(this);if(this.events){this.updateHeaderHeight();this.drawEvents();};this.afterRender(null,false);};};DayPilotCalendar.Cell=function($p,end,$n){this.start=$p;this.end=end;this.column=function(){};};DayPilotCalendar.Column=function($1f,name,$P){this.value=$1f;this.name=name;this.date=new DayPilot.Date($P);};DayPilotCalendar.Event=function($k,$b){$k.event=this;var ev=this;this.div=$k;this.root=$b;this.calendar=$b;this.value=function(){return $k.data.Value;};this.id=function(){return $k.data.Value;};this.text=function(){return $k.data.Text;};this.start=function(){return $k.data.Start;};this.end=function(){return $k.data.End;};this.partStart=function(){return $k.data.PartStart;};this.partEnd=function(){return $k.data.PartEnd;};this.innerHTML=function(){var c=$k.getElementsByTagName("DIV");return c[c.length-1].innerHTML;};this.toJSON=function($1g){var $1h={};$1h.value=this.value();$1h.text=this.text();$1h.start=this.start();$1h.end=this.end();return $1h;};$k.onmousemove=function(ev){var $1i=5;var $1j=$b.eventHeaderVisible?($b.eventHeaderHeight):10;if(typeof(DayPilotCalendar)==='undefined'){return;};var $0I=DayPilot.mo3($k,ev);if(!$0I){return;};if(DayPilotCalendar.resizing||DayPilotCalendar.moving){return;};var $1k=this.isLast;if($0I.y<=$1j&&$b.eventMoveHandling!=='Disabled'){this.style.cursor="move";}else if(this.offsetHeight-$0I.y<=$1i&&$b.eventResizeHandling!=='Disabled'){if($1k){this.style.cursor="s-resize";this.dpBorder='bottom';}else{this.style.cursor='not-allowed';}}else if(!DayPilotCalendar.resizing&&!DayPilotCalendar.moving){if($b.eventClickHandling!=='Disabled'){this.style.cursor='pointer';}else{this.style.cursor='default';}}};$k.onmousedown=function(ev){ev=ev||window.event;var $T=ev.which||ev.button;if((this.style.cursor==='n-resize'||this.style.cursor==='s-resize')&&$T===1){DayPilotCalendar.resizing=this;DayPilotCalendar.originalMouse=DayPilot.mc(ev);DayPilotCalendar.originalHeight=this.offsetHeight;DayPilotCalendar.originalTop=this.offsetTop;}else if(this.style.cursor==='move'&&$T===1){DayPilotCalendar.moving=this;DayPilotCalendar.moving.event=this.event;var $1l=DayPilotCalendar.moving.helper={};$1l.oldColumn=$b.columns[this.data.DayIndex].Value;DayPilotCalendar.originalMouse=DayPilot.mc(ev);DayPilotCalendar.originalTop=this.offsetTop;var $0I=DayPilot.mo3(this,ev);if($0I){DayPilotCalendar.moveOffsetY=$0I.y;}else{DayPilotCalendar.moveOffsetY=0;};document.body.style.cursor='move';};return false;};};DayPilot.Calendar=DayPilotCalendar.Calendar;if(typeof jQuery==='undefined'){return;};(function($){$.fn.daypilotCalendar=function($1m){var $1n=null;var j=this.each(function(){if(this.daypilot){return;};var $1o=new DayPilot.Calendar(this.id);this.daypilot=$1o;for(name in $1m){$1o[name]=$1m[name];};$1o.Init();if(!$1n){$1n=$1o;}});if(this.length===1){return $1n;}else{return j;}};})(jQuery);})();


if(typeof DayPilot==='undefined'){var DayPilot={};};(function(){if(typeof DayPilot.$!=='undefined'){return;};DayPilot.$=function(id){return document.getElementById(id);};DayPilot.isKhtml=(navigator&&navigator.userAgent&&navigator.userAgent.indexOf("KHTML")!=-1);DayPilot.isIE=(navigator&&navigator.userAgent&&navigator.userAgent.indexOf("MSIE")!=-1);DayPilot.mo2=function($a,ev){ev=ev||window.event;if(typeof(ev.offsetX)!=='undefined'){var $b={x:ev.offsetX+1,y:ev.offsetY+1};if(!$a){return $b;};var $c=ev.srcElement;while($c&&$c!=$a){if($c.tagName!='SPAN'){$b.x+=$c.offsetLeft;if($c.offsetTop>0){$b.y+=$c.offsetTop-$c.scrollTop;}};$c=$c.offsetParent;};if($c){return $b;};return null;};if(typeof(ev.layerX)!=='undefined'){var $b={x:ev.layerX,y:ev.layerY,$d:ev.target};if(!$a){return $b;};var $c=ev.target;while($c&&$c.style.position!='absolute'&&$c.style.position!='relative'){$c=$c.parentNode;if(DayPilot.isKhtml){$b.y+=$c.scrollTop;}}while($c&&$c!=$a){$b.x+=$c.offsetLeft;$b.y+=$c.offsetTop-$c.scrollTop;$c=$c.offsetParent;};if($c){return $b;};return null;};return null;};DayPilot.mo3=function($a,ev,$e){ev=ev||window.event;if(typeof(ev.pageX)!=='undefined'){var $f=DayPilot.abs($a,$e);var $b={x:ev.pageX-$f.x,y:ev.pageY-$f.y};return $b;};return DayPilot.mo2($a,ev);};DayPilot.abs=function(element,$g){if(!element){return null;};var r={x:element.offsetLeft,y:element.offsetTop,w:element.clientWidth,h:element.clientHeight,toString:function(){return "x:"+this.x+" y:"+this.y+" w:"+this.w+" h:"+this.h;}};if(element.getBoundingClientRect){var b=element.getBoundingClientRect();r.x=b.left;r.y=b.top;var d=DayPilot.doc();r.x-=d.clientLeft||0;r.y-=d.clientTop||0;var $h=DayPilot.pageOffset();r.x+=$h.x;r.y+=$h.y;if($g){var $i=DayPilot.absOffsetBased(element,false);var $g=DayPilot.absOffsetBased(element,true);r.x+=$g.x-$i.x;r.y+=$g.y-$i.y;r.w=$g.w;r.h=$g.h;};return r;}else{return DayPilot.absOffsetBased(element,$g);}};DayPilot.absOffsetBased=function(element,$g){var r={x:element.offsetLeft,y:element.offsetTop,w:element.clientWidth,h:element.clientHeight,toString:function(){return "x:"+this.x+" y:"+this.y+" w:"+this.w+" h:"+this.h;}};while(element.offsetParent){element=element.offsetParent;r.x-=element.scrollLeft;r.y-=element.scrollTop;if($g){if(r.x<0){r.w+=r.x;r.x=0;};if(r.y<0){r.h+=r.y;r.y=0;};if(element.scrollLeft>0&&r.x+r.w>element.clientWidth){r.w-=r.x+r.w-element.clientWidth;};if(element.scrollTop&&r.y+r.h>element.clientHeight){r.h-=r.y+r.h-element.clientHeight;}};r.x+=element.offsetLeft;r.y+=element.offsetTop;};var $h=DayPilot.pageOffset();r.x+=$h.x;r.y+=$h.y;return r;};DayPilot.doc=function(){var de=document.documentElement;return(de&&de.clientHeight)?de:document.body;};DayPilot.pageOffset=function(){if(typeof pageXOffset!=='undefined'){return{x:pageXOffset,y:pageYOffset};};var d=DayPilot.doc();return{x:d.scrollLeft,y:d.scrollTop};};DayPilot.indexOf=function($j,$k){if(!$j||!$j.length){return -1;};for(var i=0;i<$j.length;i++){if($j[i]===$k){return i;}};return -1;};DayPilot.mc=function(ev){if(ev.pageX||ev.pageY){return{x:ev.pageX,y:ev.pageY};};return{x:ev.clientX+document.documentElement.scrollLeft,y:ev.clientY+document.documentElement.scrollTop};};DayPilot.re=function(el,ev,$l){if(el.addEventListener){el.addEventListener(ev,$l,false);}else if(el.attachEvent){el.attachEvent("on"+ev,$l);}};DayPilot.pu=function(d){var a=d.attributes,i,l,n;if(a){l=a.length;for(i=0;i<l;i+=1){if(!a[i]){continue;};n=a[i].name;if(typeof d[n]==='function'){d[n]=null;}}};a=d.childNodes;if(a){l=a.length;for(i=0;i<l;i+=1){var $m=DayPilot.pu(d.childNodes[i]);}}};DayPilot.de=function(e){if(!e){return;};if(!e.parentNode){return;};e.parentNode.removeChild(e);};DayPilot.sw=function(element){if(!element){return 0;};return element.offsetWidth-element.clientWidth-2;};DayPilot.Selection=function($n,end,$o,$p){this.type='selection';this.start=$n.isDayPilotDate?$n:new DayPilot.Date($n);this.end=end.isDayPilotDate?end:new DayPilot.Date(end);this.resource=$o;this.root=$p;this.toJSON=function($q){var $r={};$r.start=this.start;$r.end=this.end;$r.resource=this.resource;return $r;};};DayPilot.request=function($s,$t,$u,$v){var $w=DayPilot.createXmlHttp();if(!$w){return;};$w.open("POST",$s,true);$w.setRequestHeader('Content-type','text/plain');$w.onreadystatechange=function(){if($w.readyState!=4)return;if($w.status!=200&&$w.status!=304){if($v){$v($w);}else{alert('HTTP error '+$w.status);};return;};$t($w);};if($w.readyState==4){return;};$w.send($u);};DayPilot.createXmlHttp=function(){var $x;try{$x=new XMLHttpRequest();}catch(e){try{$x=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}};return $x;};DayPilot.Date=function($y,$z){this.isDayPilotDate=true;if(typeof $y==='undefined'){this.d=DayPilot.Date.fromLocal();}else if(typeof $y==="string"){return DayPilot.Date.fromStringSortable($y);}else if($y.isDayPilotDate){return $y;}else if(!$y.getFullYear){throw "date parameter is not a Date object: "+$y;}else if($z){this.d=DayPilot.Date.fromLocal($y);}else{this.d=$y;};this.ticks=this.d.getTime();};DayPilot.Date.prototype.addDays=function($A){return new DayPilot.Date(DayPilot.Date.addDays(this.d,$A));};DayPilot.Date.prototype.addHours=function($B){return this.addTime($B*60*60*1000);};DayPilot.Date.prototype.addMilliseconds=function($C){return this.addTime($C);};DayPilot.Date.prototype.addMinutes=function($D){return this.addTime($D*60*1000);};DayPilot.Date.prototype.addMonths=function($E){return new DayPilot.Date(DayPilot.Date.addMonths(this.d,$E));};DayPilot.Date.prototype.addSeconds=function($F){return this.addTime($F*1000);};DayPilot.Date.prototype.addTime=function($G){return new DayPilot.Date(DayPilot.Date.addTime(this.d,$G));};DayPilot.Date.prototype.addYears=function($H){var n=this.clone();n.d.setUTCFullYear(this.getYear()+$H);return n;};DayPilot.Date.prototype.clone=function(){return new DayPilot.Date(DayPilot.Date.clone(this.d));};DayPilot.Date.prototype.dayOfWeek=function(){return this.d.getUTCDay();};DayPilot.Date.prototype.daysInMonth=function(){return DayPilot.Date.daysInMonth(this.d);};DayPilot.Date.prototype.dayOfYear=function(){return Math.ceil((this.getDatePart().getTime()-this.firstDayOfYear().getTime())/86400000)+1;};DayPilot.Date.prototype.equals=function($I){if($I===null){return false;};if($I.isDayPilotDate){return DayPilot.Date.equals(this.d,$I.d);}else{throw "The parameter must be a DayPilot.Date object (DayPilot.Date.equals())";}};DayPilot.Date.prototype.firstDayOfMonth=function(){var $J=DayPilot.Date.firstDayOfMonth(this.getYear(),this.getMonth()+1);return new DayPilot.Date($J);};DayPilot.Date.prototype.firstDayOfYear=function(){var $K=this.getYear();var d=new Date();d.setUTCFullYear($K,0,1);d.setUTCHours(0);d.setUTCMinutes(0);d.setUTCSeconds(0);d.setUTCMilliseconds(0);return new DayPilot.Date(d);};DayPilot.Date.prototype.firstDayOfWeek=function($L){var $J=DayPilot.Date.firstDayOfWeek(this.d,$L);return new DayPilot.Date($J);};DayPilot.Date.prototype.getDay=function(){return this.d.getUTCDate();};DayPilot.Date.prototype.getDatePart=function(){return new DayPilot.Date(DayPilot.Date.getDate(this.d));};DayPilot.Date.prototype.getYear=function(){return this.d.getUTCFullYear();};DayPilot.Date.prototype.getHours=function(){return this.d.getUTCHours();};DayPilot.Date.prototype.getMilliseconds=function(){return this.d.getUTCMilliseconds();};DayPilot.Date.prototype.getMinutes=function(){return this.d.getUTCMinutes();};DayPilot.Date.prototype.getMonth=function(){return this.d.getUTCMonth();};DayPilot.Date.prototype.getSeconds=function(){return this.d.getUTCSeconds();};DayPilot.Date.prototype.getTotalTicks=function(){return this.getTime();};DayPilot.Date.prototype.getTime=function(){if(typeof this.ticks!=='number'){throw "Uninitialized DayPilot.Date (internal error)";};return this.ticks;};DayPilot.Date.prototype.getTimePart=function(){return DayPilot.Date.getTime(this.d);};DayPilot.Date.prototype.lastDayOfMonth=function(){var $J=DayPilot.Date.lastDayOfMonth(this.getYear(),this.getMonth()+1);return new DayPilot.Date($J);};DayPilot.Date.prototype.weekNumber=function(){var $M=this.firstDayOfYear();var $A=(this.getTime()-$M.getTime())/86400000;return Math.ceil(($A+$M.dayOfWeek()+1)/7);};DayPilot.Date.prototype.weekNumberISO=function(){var $N=false;var $O=this.dayOfYear();var $P=this.firstDayOfYear().dayOfWeek();var $Q=this.firstDayOfYear().addYears(1).addDays(-1).dayOfWeek();if($P==0){$P=7;};if($Q==0){$Q=7;};var $R=8-($P);if($P==4||$Q==4){$N=true;};var $S=Math.ceil(($O-($R))/7.0);var $T=$S;if($R>=4){$T=$T+1;};if($T>52&&!$N){$T=1;};if($T==0){$T=this.firstDayOfYear().addDays(-1).weekNumberISO();};return $T;};DayPilot.Date.prototype.toDateLocal=function(){return DayPilot.Date.toLocal(this.d);};DayPilot.Date.prototype.toJSON=function(){return this.toStringSortable();};DayPilot.Date.prototype.toString=function(){return this.toStringSortable();};DayPilot.Date.prototype.toStringSortable=function(){return DayPilot.Date.toStringSortable(this.d);};DayPilot.Date.fromStringSortable=function($U){var $V=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})$/;var $y=/^(\d{4})-(\d{2})-(\d{2})$/;var $W=$V.test($U);var $X=$y.test($U);var $Y=$W||$X;if(!$Y){throw "Invalid string format (use '2010-01-01' or '2010-01-01T00:00:00'.";};var $Z=$W?$V:$y;var m=$Z.exec($U);var d=new Date();d.setUTCFullYear(m[1],m[2]-1,m[3]);d.setUTCHours(m[4]?m[4]:0);d.setUTCMinutes(m[5]?m[5]:0);d.setUTCSeconds(m[6]?m[6]:0);d.setUTCMilliseconds(0);return new DayPilot.Date(d);};DayPilot.Date.addDays=function($y,$A){var d=new Date();d.setTime($y.getTime()+$A*24*60*60*1000);return d;};DayPilot.Date.addMinutes=function($y,$D){var d=new Date();d.setTime($y.getTime()+$D*60*1000);return d;};DayPilot.Date.addMonths=function($y,$E){if($E==0)return $y;var y=$y.getUTCFullYear();var m=$y.getUTCMonth()+1;if($E>0){while($E>=12){$E-=12;y++;};if($E>12-m){y++;m=$E-(12-m);}else{m+=$E;}}else{while($E<=-12){$E+=12;y--;};if(m<=$E){y--;m=12-($E+m);}else{m=m+$E;}};var d=DayPilot.Date.clone($y);d.setUTCFullYear(y);d.setUTCMonth(m-1);return d;};DayPilot.Date.addTime=function($y,$00){var d=new Date();d.setTime($y.getTime()+$00);return d;};DayPilot.Date.clone=function($01){var d=new Date();return DayPilot.Date.dateFromTicks($01.getTime());};DayPilot.Date.daysDiff=function($M,$02){if($M.getTime()>$02.getTime()){return null;};var i=0;var $03=DayPilot.Date.getDate($M);var $04=DayPilot.Date.getDate($02);while($03<$04){$03=DayPilot.Date.addDays($03,1);i++;};return i;};DayPilot.Date.daysInMonth=function($K,$05){if($K.getUTCFullYear){$05=$K.getUTCMonth()+1;$K=$K.getUTCFullYear();};var m=[31,28,31,30,31,30,31,31,30,31,30,31];if($05!=2)return m[$05-1];if($K%4!=0)return m[1];if($K%100==0&&$K%400!=0)return m[1];return m[1]+1;};DayPilot.Date.daysSpan=function($M,$02){if($M.getTime()==$02.getTime()){return 0;};var $06=DayPilot.Date.daysDiff($M,$02);if(DayPilot.Date.equals($02,DayPilot.Date.getDate($02))){$06--;};return $06;};DayPilot.Date.diff=function($M,$02){if(!($M&&$02&&$M.getTime&&$02.getTime)){throw "Both compared objects must be Date objects (DayPilot.Date.diff).";};return $M.getTime()-$02.getTime();};DayPilot.Date.equals=function($M,$02){return $M.getTime()==$02.getTime();};DayPilot.Date.fromLocal=function($07){if(!$07){$07=new Date();};var d=new Date();d.setUTCFullYear($07.getFullYear(),$07.getMonth(),$07.getDate());d.setUTCHours($07.getHours());d.setUTCMinutes($07.getMinutes());d.setUTCSeconds($07.getSeconds());d.setUTCMilliseconds($07.getMilliseconds());return d;};DayPilot.Date.firstDayOfMonth=function($K,$05){var d=new Date();d.setUTCFullYear($K,$05-1,1);d.setUTCHours(0);d.setUTCMinutes(0);d.setUTCSeconds(0);d.setUTCMilliseconds(0);return d;};DayPilot.Date.firstDayOfWeek=function(d,$L){var $08=d.getUTCDay();while($08!=$L){d=DayPilot.Date.addDays(d,-1);$08=d.getUTCDay();};return d;};DayPilot.Date.dateFromTicks=function($G){var d=new Date();d.setTime($G);return d;};DayPilot.Date.getDate=function($01){var d=DayPilot.Date.clone($01);d.setUTCHours(0);d.setUTCMinutes(0);d.setUTCSeconds(0);d.setUTCMilliseconds(0);return d;};DayPilot.Date.getStart=function($K,$05,$L){var $09=DayPilot.Date.firstDayOfMonth($K,$05);d=DayPilot.Date.firstDayOfWeek($09,$L);return d;};DayPilot.Date.getTime=function($01){var $y=DayPilot.Date.getDate($01);return DayPilot.Date.diff($01,$y);};DayPilot.Date.hours=function($y,$0a){var $0b=$y.getUTCMinutes();if($0b<10)$0b="0"+$0b;var $0c=$y.getUTCHours();if($0a){var am=$0c<12;var $0c=$0c%12;if($0c==0){$0c=12;};var $0d=am?"AM":"PM";return $0c+':'+$0b+' '+$0d;}else{return $0c+':'+$0b;}};DayPilot.Date.lastDayOfMonth=function($K,$05){var d=DayPilot.Date.firstDayOfMonth($K,$05);var length=DayPilot.Date.daysInMonth($K,$05);d.setUTCDate(length);return d;};DayPilot.Date.max=function($M,$02){if($M.getTime()>$02.getTime()){return $M;}else{return $02;}};DayPilot.Date.min=function($M,$02){if($M.getTime()<$02.getTime()){return $M;}else{return $02;}};DayPilot.Date.today=function(){var $0e=new Date();var d=new Date();d.setUTCFullYear($0e.getFullYear());d.setUTCMonth($0e.getMonth());d.setUTCDate($0e.getDate());return d;};DayPilot.Date.toLocal=function($y){if(!$y){$y=new Date();};var d=new Date();d.setFullYear($y.getUTCFullYear(),$y.getUTCMonth(),$y.getUTCDate());d.setHours($y.getUTCHours());d.setMinutes($y.getUTCMinutes());d.setSeconds($y.getUTCSeconds());d.setMilliseconds($y.getUTCMilliseconds());return d;};DayPilot.Date.toStringSortable=function($y){if($y.isDayPilotDate){return $y.toStringSortable();};var d=$y;var $02=d.getUTCSeconds();if($02<10)$02="0"+$02;var $0b=d.getUTCMinutes();if($0b<10)$0b="0"+$0b;var $0c=d.getUTCHours();if($0c<10)$0c="0"+$0c;var $08=d.getUTCDate();if($08<10)$08="0"+$08;var $05=d.getUTCMonth()+1;if($05<10)$05="0"+$05;var $K=d.getUTCFullYear();if($K<=0){throw "The minimum year supported is 1.";};if($K<10){$K="000"+$K;}else if($K<100){$K="00"+$K;}else if($K<1000){$K="0"+$K;};return $K+"-"+$05+"-"+$08+'T'+$0c+":"+$0b+":"+$02;};DayPilot.Locale=function(id,$0f){this.id=id;this.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];this.dayNamesShort=["Su","Mo","Tu","We","Th","Fr","Sa"];this.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];this.datePattern="M/d/yyyy";this.timePattern="H:mm";this.dateTimePattern="M/d/yyyy H:mm";this.timeFormat="Clock12Hours";if($0f){for(var name in $0f){this[name]=$0f[name];}}};DayPilot.Locale.all={};DayPilot.Locale.find=function(id){if(!id){return null;};var $0g=id.toLowerCase();if($0g.length>2){$0g[2]='-';};return DayPilot.Locale.all[$0g];};DayPilot.Locale.register=function($0h){DayPilot.Locale.all[$0h.id]=$0h;};DayPilot.Locale.register(new DayPilot.Locale('en-us',{'dayNames':['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],'dayNamesShort':['Su','Mo','Tu','We','Th','Fr','Sa'],'monthNames':['January','February','March','April','May','June','July','August','September','October','November','December',''],'timePattern':'h:mm tt','datePattern':'M/d/yyyy','dateTimePattern':'M/d/yyyy h:mm tt','timeFormat':'Clock12Hours'}));})();DayPilot.JSON={};(function(){function f(n){return n<10?'0'+n:n;};if(typeof Date.prototype.toJSON2!=='function'){Date.prototype.toJSON2=function($q){return this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'';};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function($q){return this.valueOf();};};var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,$0i=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,$0j,$0k,$0l={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},$0m;function quote($U){$0i.lastIndex=0;return $0i.test($U)?'"'+$U.replace($0i,function(a){var c=$0l[a];if(typeof c==='string'){return c;};return '\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+$U+'"';};function str($q,$0n){var i,k,v,length,$0o=$0j,$0p,$0q=$0n[$q];if($0q&&typeof $0q==='object'&&typeof $0q.toJSON2==='function'){$0q=$0q.toJSON2($q);}else if($0q&&typeof $0q==='object'&&typeof $0q.toJSON==='function'&&!$0q.ignoreToJSON){$0q=$0q.toJSON($q);};if(typeof $0m==='function'){$0q=$0m.call($0n,$q,$0q);};switch(typeof $0q){case 'string':return quote($0q);case 'number':return isFinite($0q)?String($0q):'null';case 'boolean':case 'null':return String($0q);case 'object':if(!$0q){return 'null';};$0j+=$0k;$0p=[];if(typeof $0q.length==='number'&&!$0q.propertyIsEnumerable('length')){length=$0q.length;for(i=0;i<length;i+=1){$0p[i]=str(i,$0q)||'null';};v=$0p.length===0?'[]':$0j?'[\n'+$0j+$0p.join(',\n'+$0j)+'\n'+$0o+']':'['+$0p.join(',')+']';$0j=$0o;return v;};if($0m&&typeof $0m==='object'){length=$0m.length;for(i=0;i<length;i+=1){k=$0m[i];if(typeof k==='string'){v=str(k,$0q);if(v){$0p.push(quote(k)+($0j?': ':':')+v);}}}}else{for(k in $0q){if(Object.hasOwnProperty.call($0q,k)){v=str(k,$0q);if(v){$0p.push(quote(k)+($0j?': ':':')+v);}}}};v=($0p.length===0)?'{\u007D':$0j?'{\n'+$0j+$0p.join(',\n'+$0j)+'\n'+$0o+'\u007D':'{'+$0p.join(',')+'\u007D';$0j=$0o;return v;}};if(typeof DayPilot.JSON.stringify!=='function'){DayPilot.JSON.stringify=function($0q,$0r,$0s){var i;$0j='';$0k='';if(typeof $0s==='number'){for(i=0;i<$0s;i+=1){$0k+=' ';}}else if(typeof $0s==='string'){$0k=$0s;};$0m=$0r;if($0r&&typeof $0r!=='function'&&(typeof $0r!=='object'||typeof $0r.length!=='number')){throw new Error('JSON.stringify');};return str('',{'':$0q});};}})();


if(typeof(DayPilot)==='undefined'){DayPilot={};};(function(){DayPilot.ModalStatic={};DayPilot.ModalStatic.list=[];DayPilot.ModalStatic.hide=function(){if(this.list.length>0){var $a=this.list.pop();if($a){$a.hide();}}};DayPilot.ModalStatic.remove=function($b){var $c=DayPilot.ModalStatic.list;for(var i=0;i<$c.length;i++){if($c[i]===$b){$c.splice(i,1);return;}}};DayPilot.ModalStatic.close=function($d){DayPilot.ModalStatic.result($d);DayPilot.ModalStatic.hide();};DayPilot.ModalStatic.result=function(r){var $c=DayPilot.ModalStatic.list;if($c.length>0){$c[$c.length-1].result=r;}};DayPilot.ModalStatic.displayed=function($b){var $c=DayPilot.ModalStatic.list;for(var i=0;i<$c.length;i++){if($c[i]===$b){return true;}};return false;};var $e=(navigator&&navigator.userAgent&&navigator.userAgent.indexOf("MSIE")!=-1);DayPilot.Modal=function(){this.autoStretch=true;this.autoStretchFirstLoadOnly=false;this.border="1px solid black";this.corners='Rounded';this.className=null;this.dragDrop=true;this.height=200;this.maxHeight=null;this.opacity=30;this.scrollWithPage=true;this.top=20;this.useIframe=true;this.width=300;this.zIndex=null;this.closed=null;var $f=this;this.id='_'+new Date().getTime()+'n'+(Math.random()*10);this.registered=false;this.start=null;this.coords=null;this.showHtml=function($g){if(DayPilot.ModalStatic.displayed(this)){throw "This modal dialog is already displayed.";};if(!this.div){this.create();};this.update();if(this.useIframe){var $h=function(p,$i){return function(){p.setInnerHTML(p.id+"iframe",$i);};};window.setTimeout($h(this,$g),0);}else{this.div.innerHTML=$g;};this.register();};this.rounded=function(){return this.corners&&this.corners.toLowerCase()=='rounded';};this.showUrl=function($j){if(DayPilot.ModalStatic.displayed(this)){throw "This modal dialog is already displayed.";};this.useIframe=true;if(!this.div){this.create();};this.re(this.iframe,"load",this.onIframeLoad);this.iframe.src=$j;this.update();this.register();};this.update=function(){var $k=window;var $l=document;var scrollY=$k.pageYOffset?$k.pageYOffset:(($l.documentElement&&$l.documentElement.scrollTop)?$l.documentElement.scrollTop:$l.body.scrollTop);var $m=function(){return $f.windowRect().y;};this.hideDiv.style.filter="alpha(opacity="+this.opacity+")";this.hideDiv.style.opacity="0."+this.opacity;this.hideDiv.style.backgroundColor="black";if(this.zIndex){this.hideDiv.style.zIndex=this.zIndex;};this.hideDiv.style.display='';this.div.className=this.className;this.div.style.border=this.border;if(this.rounded()){this.div.style.MozBorderRadius="5px";this.div.style.webkitBorderRadius="5px";this.div.style.borderRadius="5px";};this.div.style.marginLeft='-'+Math.floor(this.width/2)+"px";this.div.style.position='absolute';this.div.style.top=(scrollY+this.top)+'px';this.div.style.width=this.width+'px';if(this.zIndex){this.div.style.zIndex=this.zIndex;};if(this.height){this.div.style.height=this.height+'px';};if(this.useIframe&&this.height){this.iframe.style.height=(this.height)+'px';};this.div.style.display='';DayPilot.ModalStatic.list.push(this);};this.onIframeLoad=function(){$f.iframe.contentWindow.modal=$f;if($f.autoStretch){$f.stretch();}};this.stretch=function(){var $m=function(){return $f.windowRect().y;};var $n=this.maxHeight||$m()-2*this.top;for(var h=this.height;h<$n&&this.hasScrollbar();h+=10){this.iframe.style.height=(h)+'px';this.div.style.height=h+'px';};if(this.autoStretchFirstLoadOnly){this.ue(this.iframe,"load",this.onIframeLoad);}};this.hasScrollbar=function(){var document=this.iframe.contentWindow.document;var $o=document.compatMode=='BackCompat'?document.body:document.documentElement;var $p=$o.scrollHeight>$o.clientHeight;var $q=$o.scrollWidth>$o.clientWidth;return $p;};this.windowRect=function(){var $l=document;if($l.compatMode==="CSS1Compat"&&$l.documentElement&&$l.documentElement.clientWidth){var x=$l.documentElement.clientWidth;var y=$l.documentElement.clientHeight;return{x:x,y:y};}else{var x=$l.body.clientWidth;var y=$l.body.clientHeight;return{x:x,y:y};}};this.register=function(){if(this.registered){return;};this.re(window,'resize',this.resize);this.re(window,'scroll',this.resize);if(this.dragDrop){this.re(document,'mousemove',this.drag);this.re(document,'mouseup',this.drop);};this.registered=true;};this.drag=function(e){if(!$f.coords){return;};var e=e||window.event;var $r=$f.mc(e);var x=$r.x-$f.coords.x;var y=$r.y-$f.coords.y;$f.div.style.marginLeft='0px';$f.div.style.top=($f.start.y+y)+"px";$f.div.style.left=($f.start.x+x)+"px";};this.drop=function(e){if(!$f.coords){return;};$f.unmaskIframe();$f.coords=null;};this.maskIframe=function(){if(!this.useIframe){return;};var $s=80;var $t=document.createElement("div");$t.style.backgroundColor="#ffffff";$t.style.filter="alpha(opacity="+$s+")";$t.style.opacity="0."+$s;$t.style.width="100%";$t.style.height=this.height+"px";$t.style.position="absolute";$t.style.left='0px';$t.style.top='0px';this.div.appendChild($t);this.mask=$t;};this.unmaskIframe=function(){if(!this.useIframe){return;};this.div.removeChild(this.mask);this.mask=null;};this.resize=function(){if(!$f.hideDiv){return;};if(!$f.div){return;};if($f.hideDiv.style.display=='none'){return;};if($f.div.style.display=='none'){return;};var scrollY=window.pageYOffset?window.pageYOffset:((document.documentElement&&document.documentElement.scrollTop)?document.documentElement.scrollTop:document.body.scrollTop);if(!$f.scrollWithPage){$f.div.style.top=(scrollY+$f.top)+'px';}};this.re=function(el,ev,$u){if(el.addEventListener){el.addEventListener(ev,$u,false);}else if(el.attachEvent){el.attachEvent("on"+ev,$u);}};this.ue=function(el,ev,$u){if(el.removeEventListener){el.removeEventListener(ev,$u,false);}else if(el.detachEvent){el.detachEvent("on"+ev,$u);}};this.mc=function(ev){if(ev.pageX||ev.pageY){return{x:ev.pageX,y:ev.pageY};};return{x:ev.clientX+document.documentElement.scrollLeft,y:ev.clientY+document.documentElement.scrollTop};};this.abs=function(element){var r={x:element.offsetLeft,y:element.offsetTop};while(element.offsetParent){element=element.offsetParent;r.x+=element.offsetLeft;r.y+=element.offsetTop;};return r;};this.create=function(){var $v=document.createElement("div");$v.id=this.id+"hide";$v.style.position='fixed';$v.style.left="0px";$v.style.top="0px";$v.style.right="0px";$v.style.bottom="0px";$v.style.backgroundColor="black";$v.style.opacity=0.50;$v.onclick=function(){$f.hide();};$v.oncontextmenu=function(){return false;};document.body.appendChild($v);var $w=document.createElement("div");$w.id=this.id+'popup';$w.style.position='fixed';$w.style.left='50%';$w.style.top='0px';$w.style.backgroundColor='white';$w.style.width="50px";$w.style.height="50px";if(this.dragDrop){$w.onmousedown=this.dragStart;};var $x=50;var $y=null;if(this.useIframe){$y=document.createElement("iframe");$y.id=this.id+"iframe";$y.name=this.id+"iframe";$y.frameBorder='0';$y.style.width='100%';$y.style.height='50px';$w.appendChild($y);};document.body.appendChild($w);this.div=$w;this.iframe=$y;this.hideDiv=$v;};this.dragStart=function(e){$f.maskIframe();$f.coords=$f.mc(e||window.event);$f.start={x:$f.div.offsetLeft,y:$f.div.offsetTop};};this.setInnerHTML=function(id,$i){var $z=window.frames[id];var $l=$z.contentWindow||$z.document||$z.contentDocument;if($l.document){$l=$l.document;};$l.body.innerHTML=$i;};this.close=function($d){this.result=$d;this.hide();};this.hide=function(){if(this.div){this.div.style.display='none';this.hideDiv.style.display='none';if(!this.useIframe){this.div.innerHTML=null;}};DayPilot.ModalStatic.remove(this);if(this.closed){this.closed();}};};})();


if(typeof DayPilot==='undefined'){var DayPilot={};};(function(){var $a=function(){};if(typeof DayPilot.Month!=='undefined'){return;};var DayPilotMonth={};DayPilotMonth.Month=function($b){this.v='396-lite';this.nav={};this.nav.top=document.getElementById($b);var $c=this;this.id=$b;this.isMonth=true;this.hideUntilInit=true;this.startDate=new DayPilot.Date();this.width='100%';this.cellHeight=100;this.eventFontColor="#000000";this.eventFontFamily="Tahoma";this.eventFontSize="11px";this.headerBackColor='#F3F3F9';this.headerFontColor='#42658C';this.headerFontFamily="Tahoma";this.headerFontSize="10pt";this.headerHeight=20;this.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];this.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];this.weekStarts=1;this.innerBorderColor='#cccccc';this.borderColor='#CED2CE';this.eventHeight=20;this.cellHeaderHeight=16;this.afterRender=function(){};this.backColor='#ffffff';this.nonBusinessBackColor='#ffffff';this.cellHeaderBackColor='#ffffff';this.cellHeaderFontColor='#42658C';this.cellHeaderFontFamily='Tahoma';this.cellHeaderFontSize='10pt';this.eventBackColor='#2951A5';this.eventBorderColor='#2951A5';this.eventFontColor='#ffffff';this.eventFontFamily='Tahoma';this.eventFontSize='11px';this.eventHeight=16;this.cellWidth=14.285;this.lineSpace=1;this.eventTimeFontColor='gray';this.eventTimeFontFamily='Tahoma';this.eventTimeFontSize='8pt';this.eventClickHandling='Disabled';this.eventMoveHandling='Disabled';this.eventResizeHandling='Disabled';this.timeRangeSelectedHandling='Disabled';this.backendUrl=null;this.cellEvents=[];this.elements={};this.elements.events=[];this.cache={};this.cache.events={};this.updateView=function($d,$e){var $d=eval("("+$d+")");if($d.CallBackRedirect){document.location.href=$d.CallBackRedirect;return;};if($d.UpdateType==="None"){$c.fireAfterRenderDetached($d.CallBackData,true);return;};$c.events=$d.Events;if($d.UpdateType==="Full"){$c.startDate=$d.StartDate;$c.headerBackColor=$d.HeaderBackColor?$d.HeaderBackColor:$c.headerBackColor;$c.backColor=$d.BackColor?$d.BackColor:$c.backColor;$c.nonBusinessBackColor=$d.NonBusinessBackColor?$d.NonBusinessBackColor:$c.nonBusinessBackColor;$c.timeFormat=$d.TimeFormat?$d.TimeFormat:$c.timeFormat;if(typeof $d.WeekStarts!=='undefined'){$c.weekStarts=$d.WeekStarts;};$c.hashes=$d.Hashes;};$c.clearEvents();$c.prepareRows();$c.prepareEvents();if($d.UpdateType==="Full"){$c.clearTable();$c.drawTable();};$c.updateHeight();$c.show();$c.drawEvents();$c.fireAfterRenderDetached($d.CallBackData,true);};this.fireAfterRenderDetached=function($f,$g){var $h=function($f,$i){return function(){if($c.afterRender){$c.afterRender($f,$i);}};};window.setTimeout($h($f,$g),0);};this.lineHeight=function(){return this.eventHeight+this.lineSpace;};this.prepareEvents=function(){for(var x=0;x<this.events.length;x++){var e=this.events[x];e.Start=new DayPilot.Date(e.Start).d;e.End=new DayPilot.Date(e.End).d;if(e.Start.getTime()>e.End.getTime()){continue;};for(var i=0;i<this.rows.length;i++){var $j=this.rows[i];if($j.belongsHere(e)){$j.events.push(e);}}};for(var ri=0;ri<this.rows.length;ri++){var $j=this.rows[ri];$j.events.sort(this.eventComparer);for(var ei=0;ei<this.rows[ri].events.length;ei++){var ev=$j.events[ei];var $k=$j.getStartColumn(ev);var $l=$j.getWidth(ev);var $m=$j.putIntoLine(ev,$k,$l,ri);}}};this.clearEvents=function(){for(var i=0;i<this.elements.events.length;i++){var e=this.elements.events[i];e.event=null;e.click=null;e.parentNode.removeChild(e);};this.elements.events=[];};this.drawEvents=function(){this.cache.events={};this.drawEventsRows();};this.drawEventsRows=function(){this.elements.events=[];for(var ri=0;ri<this.rows.length;ri++){var $j=this.rows[ri];for(var li=0;li<$j.lines.length;li++){var $m=$j.lines[li];for(var pi=0;pi<$m.length;pi++){this.drawEvent($m[pi]);}}}};this.eventComparer=function(a,b){if(!a||!b||!a.Start||!b.Start){return 0;};var $n=a.Start.getTime()-b.Start.getTime();if($n!==0){return $n;};var $o=b.End.getTime()-a.End.getTime();return $o;};this.drawShadow=function(x,y,$m,$p,$q,e){if(!$q){$q=0;};var $r=$p;this.shadow={};this.shadow.list=[];this.shadow.start={x:x,y:y};this.shadow.width=$p;var $s=y*7+x-$q;if($s<0){$r+=$s;x=0;y=0;};var $t=$q;while($t>=7){y--;$t-=7;};if($t>x){var $u=7-this.getColCount();if($t>(x+$u)){y--;x=x+7-$t;}else{$r=$r-$t+x;x=0;}}else{x-=$t;};if(y<0){y=0;x=0;};var $v=null;if(DayPilotMonth.resizingEvent){$v='w-resize';}else if(DayPilotMonth.movingEvent){$v="move";};this.nav.top.style.cursor=$v;while($r>0&&y<this.rows.length){var $w=Math.min(this.getColCount()-x,$r);var $j=this.rows[y];var top=this.getRowTop(y);var $x=$j.getHeight();var $y=document.createElement("div");$y.setAttribute("unselectable","on");$y.style.position='absolute';$y.style.left=(this.getCellWidth()*x)+'%';$y.style.width=(this.getCellWidth()*$w)+'%';$y.style.top=(top)+'px';$y.style.height=($x)+'px';$y.style.cursor=$v;var $z=document.createElement("div");$z.setAttribute("unselectable","on");$y.appendChild($z);$z.style.position="absolute";$z.style.top="0px";$z.style.right="0px";$z.style.left="0px";$z.style.bottom="0px";$z.style.backgroundColor="#aaaaaa";$z.style.opacity=0.5;$z.style.filter="alpha(opacity=50)";if(e&&e.eventPart&&e.eventPart.event){$z.style.overflow='hidden';$z.style.fontSize=this.eventFontSize;$z.style.fontFamily=this.eventFontFamily;$z.style.color=this.eventFontColor;$z.innerHTML=e.eventPart.event.InnerHTML?e.eventPart.event.InnerHTML:e.eventPart.event.Text;};this.nav.top.appendChild($y);this.shadow.list.push($y);$r-=($w+7-this.getColCount());x=0;y++;}};this.clearShadow=function(){if(this.shadow){for(var i=0;i<this.shadow.list.length;i++){this.nav.top.removeChild(this.shadow.list[i]);};this.shadow=null;this.nav.top.style.cursor='';}};this.getEventTop=function($j,$m){var top=this.headerHeight;for(var i=0;i<$j;i++){top+=this.rows[i].getHeight();};top+=this.cellHeaderHeight;top+=$m*this.lineHeight();return top;};this.getDateFromCell=function(x,y){return DayPilot.Date.addDays(this.firstDate,y*7+x);};this.drawEvent=function($A){var ev=$A.event;var $j=$A.row;var $m=$A.line;var $k=$A.colStart;var $l=$A.colWidth;var $B=this.getCellWidth()*($k);var $p=this.getCellWidth()*($l);var top=this.getEventTop($j,$m);var e=document.createElement("div");e.setAttribute("unselectable","on");e.style.height=this.eventHeight+'px';e.style.fontFamily=this.eventFontFamily;var eo=null;var $C=$A.event.Value;if(this.cache.events[$C]){eo=this.cache.events[$C];}else{eo=new DayPilotMonth.Event($c,$A,$j);this.cache.events[$C]=eo;};e.event=eo;e.style.width=$p+'%';e.style.position='absolute';e.style.left=$B+'%';e.style.top=top+'px';if(this.showToolTip&&ev.ToolTip){e.title=ev.ToolTip;};e.onclick=$c.eventClickDispatch;e.onmousedown=function(ev){ev=ev||window.event;var $D=ev.which||ev.button;ev.cancelBubble=true;if(ev.stopPropagation){ev.stopPropagation();};if($D===1){DayPilotMonth.movingEvent=null;if(this.style.cursor==='w-resize'||this.style.cursor==='e-resize'){var $E={};$E.start={};$E.start.x=$k;$E.start.y=$j;$E.event=e.event;$E.width=DayPilot.Date.daysSpan($E.event.start().d,$E.event.end().d)+1;$E.direction=this.style.cursor;DayPilotMonth.resizingEvent=$E;}else if(this.style.cursor==='move'||$c.eventMoveHandling!=='Disabled'){$c.clearShadow();var $F=DayPilot.mo2($c.nav.top,ev);if(!$F){return;};var $G=$c.getCellBelowPoint($F.x,$F.y);var $s=DayPilot.Date.daysDiff($A.event.Start,$c.rows[$j].start);var $q=($G.y*7+$G.x)-($j*7+$k);if($s){$q+=$s;};var $H={};$H.start={};$H.start.x=$k;$H.start.y=$j;$H.start.line=$m;$H.offset=$c.eventMoveToPosition?0:$q;$H.colWidth=$l;$H.event=e.event;$H.coords=$F;DayPilotMonth.movingEvent=$H;}}};e.onmousemove=function(ev){if(typeof(DayPilotMonth)==='undefined'){return;};if(DayPilotMonth.movingEvent||DayPilotMonth.resizingEvent){return;};var $q=DayPilot.mo3(e,ev);if(!$q){return;};var $I=6;if($q.x<=$I&&$c.eventResizeHandling!=='Disabled'){if($A.startsHere){e.style.cursor="w-resize";e.dpBorder='left';}else{e.style.cursor='not-allowed';}}else if(e.clientWidth-$q.x<=$I&&$c.eventResizeHandling!=='Disabled'){if($A.endsHere){e.style.cursor="e-resize";e.dpBorder='right';}else{e.style.cursor='not-allowed';}}else{e.style.cursor='default';}};e.onmouseout=function(ev){e.style.cursor='';};var back=(ev.BackColor)?ev.BackColor:this.eventBackColor;var $J=document.createElement("div");$J.setAttribute("unselectable","on");$J.style.height=(this.eventHeight-2)+'px';$J.style.overflow='hidden';$J.style.position="absolute";$J.style.left="2px";$J.style.right="2px";$J.style.paddingLeft='2px';$J.style.border='1px solid '+$c.eventBorderColor;$J.style.backgroundColor=back;$J.style.fontFamily="";$J.style.MozBorderRadius="5px";$J.style.webkitBorderRadius="5px";$J.style.borderRadius="5px";var $z=[];$z.push("<div unselectable='on' style='");$z.push("font-size:");$z.push(this.eventFontSize);$z.push(";color:");$z.push(this.eventFontColor);$z.push(";font-family:");$z.push(this.eventFontFamily);$z.push(";'>");$z.push(ev.Text);$z.push("</div>");$J.innerHTML=$z.join('');e.appendChild($J);this.elements.events.push(e);this.nav.events.appendChild(e);};this.lastVisibleDayOfMonth=function(){return this.startDate.lastDayOfMonth();};this.prepareRows=function(){if(typeof this.startDate==='string'){this.startDate=DayPilot.Date.fromStringSortable(this.startDate);};this.startDate=this.startDate.firstDayOfMonth();this.firstDate=this.startDate.firstDayOfWeek(this.getWeekStart());var $K=this.startDate;var $L;var $M=this.lastVisibleDayOfMonth().d;var $N=DayPilot.Date.daysDiff(this.firstDate,$M)+1;$L=Math.ceil($N/7);this.days=$L*7;this.rows=[];for(var x=0;x<$L;x++){var r={};r.start=DayPilot.Date.addDays(this.firstDate,x*7);r.end=DayPilot.Date.addDays(r.start,this.getColCount());r.events=[];r.lines=[];r.index=x;r.minHeight=this.cellHeight;r.calendar=this;r.belongsHere=function(ev){if(ev.End.getTime()===ev.Start.getTime()&&ev.Start.getTime()===this.start.getTime()){return true;};return !(ev.End.getTime()<=this.start.getTime()||ev.Start.getTime()>=this.end.getTime());};r.getPartStart=function(ev){return DayPilot.Date.max(this.start,ev.Start);};r.getPartEnd=function(ev){return DayPilot.Date.min(this.end,ev.End);};r.getStartColumn=function(ev){var $O=this.getPartStart(ev);return DayPilot.Date.daysDiff(this.start,$O);};r.getWidth=function(ev){return DayPilot.Date.daysSpan(this.getPartStart(ev),this.getPartEnd(ev))+1;};r.putIntoLine=function(ev,$k,$l,$j){var $P=this;for(var i=0;i<this.lines.length;i++){var $m=this.lines[i];if($m.isFree($k,$l)){$m.addEvent(ev,$k,$l,$j,i);return i;}};var $m=[];$m.isFree=function($k,$l){var $Q=true;for(var i=0;i<this.length;i++){if(!($k+$l-1<this[i].colStart||$k>this[i].colStart+this[i].colWidth-1)){$Q=false;}};return $Q;};$m.addEvent=function(ev,$k,$l,$j,$R){var $A={};$A.event=ev;$A.colStart=$k;$A.colWidth=$l;$A.row=$j;$A.line=$R;$A.startsHere=$P.start.getTime()<=ev.Start.getTime();$A.endsHere=$P.end.getTime()>=ev.End.getTime();this.push($A);};$m.addEvent(ev,$k,$l,$j,this.lines.length);this.lines.push($m);return this.lines.length-1;};r.getStart=function(){var $S=0;for(var i=0;i<$c.rows.length&&i<this.index;i++){$S+=$c.rows[i].getHeight();}};r.getHeight=function(){return Math.max(this.lines.length*$c.lineHeight()+$c.cellHeaderHeight,this.calendar.cellHeight);};this.rows.push(r);};this.endDate=DayPilot.Date.addDays(this.firstDate,$L*7);};this.getHeight=function(){var $x=this.headerHeight;for(var i=0;i<this.rows.length;i++){$x+=this.rows[i].getHeight();};return $x;};this.getWidth=function($S,end){var $T=(end.y*7+end.x)-($S.y*7+$S.x);return $T+1;};this.getMinCoords=function($U,$V){if(($U.y*7+$U.x)<($V.y*7+$V.x)){return $U;}else{return $V;}};this.drawTop=function(){var $W=this.nav.top;$W.setAttribute("unselectable","on");$W.style.MozUserSelect='none';$W.style.KhtmlUserSelect='none';$W.style.WebkitUserSelect='none';$W.style.position='relative';if(this.width){$W.style.width=this.width;};$W.style.height=this.getHeight()+'px';$W.onselectstart=function(e){return false;};$W.style.border="1px solid "+this.borderColor;if(this.hideUntilInit){$W.style.visibility='hidden';};var $X=document.createElement("div");this.nav.cells=$X;$X.style.position="absolute";$X.style.left="0px";$X.style.right="0px";$X.setAttribute("unselectable","on");$W.appendChild($X);var $Y=document.createElement("div");this.nav.events=$Y;$Y.style.position="absolute";$Y.style.left="0px";$Y.style.right="0px";$Y.setAttribute("unselectable","on");$W.appendChild($Y);$W.onmousemove=function(ev){if(DayPilotMonth.resizingEvent){var $F=DayPilot.mo2($c.nav.top,ev);if(!$F){return;};var $G=$c.getCellBelowPoint($F.x,$F.y);$c.clearShadow();var $E=DayPilotMonth.resizingEvent;var $Z=$E.start;var $p,$S;if($E.direction==='w-resize'){$S=$G;var $00=$E.event.end().d;if(DayPilot.Date.getDate($00).getTime()===$00.getTime()){$00=DayPilot.Date.addDays($00,-1);};var end=$c.getCellFromDate($00);$p=$c.getWidth($G,end);}else{$S=$c.getCellFromDate($E.event.start().d);$p=$c.getWidth($S,$G);};if($p<1){$p=1;};$c.drawShadow($S.x,$S.y,0,$p);}else if(DayPilotMonth.movingEvent){var $F=DayPilot.mo2($c.nav.top,ev);if(!$F){return;};if($F.x==DayPilotMonth.movingEvent.coords.x&&$F.y==DayPilotMonth.movingEvent.coords.y){return;};var $G=$c.getCellBelowPoint($F.x,$F.y);$c.clearShadow();var event=DayPilotMonth.movingEvent.event;var $q=DayPilotMonth.movingEvent.offset;var $p=$c.cellMode?1:DayPilot.Date.daysSpan(event.start().d,event.end().d)+1;if($p<1){$p=1;};$c.drawShadow($G.x,$G.y,0,$p,$q,event);}else if(DayPilotMonth.timeRangeSelecting){var $F=DayPilot.mo2($c.nav.top,ev);if(!$F){return;};var $G=$c.getCellBelowPoint($F.x,$F.y);$c.clearShadow();var $S=DayPilotMonth.timeRangeSelecting;var $01=$S.y*7+$S.x;var $02=$G.y*7+$G.x;var $p=Math.abs($02-$01)+1;if($p<1){$p=1;};var $03=$01<$02?$S:$G;DayPilotMonth.timeRangeSelecting.from={x:$03.x,y:$03.y};DayPilotMonth.timeRangeSelecting.width=$p;DayPilotMonth.timeRangeSelecting.moved=true;$c.drawShadow($03.x,$03.y,0,$p,0,null);}};};this.updateHeight=function(){this.nav.top.style.height=this.getHeight()+'px';for(var x=0;x<this.cells.length;x++){for(var y=0;y<this.cells[x].length;y++){this.cells[x][y].style.top=this.getRowTop(y)+'px';this.cells[x][y].style.height=this.rows[y].getHeight()+'px';}}};this.getCellBelowPoint=function(x,y){var $04=Math.floor(this.nav.top.clientWidth/this.getColCount());var $05=Math.min(Math.floor(x/$04),this.getColCount()-1);var $j=null;var $x=this.headerHeight;var $06=0;for(var i=0;i<this.rows.length;i++){var $07=$x;$x+=this.rows[i].getHeight();if(y<$x){$06=y-$07;$j=i;break;}};if($j===null){$j=this.rows.length-1;};var $G={};$G.x=$05;$G.y=$j;$G.relativeY=$06;return $G;};this.getCellFromDate=function($08){var $p=DayPilot.Date.daysDiff(this.firstDate,$08);var $G={x:0,y:0};while($p>=7){$G.y++;$p-=7;};$G.x=$p;return $G;};this.drawTable=function(){var $09=document.createElement("div");$09.oncontextmenu=function(){return false;};this.nav.cells.appendChild($09);this.cells=[];for(var x=0;x<this.getColCount();x++){this.cells[x]=[];var $0a=null;var $0b=document.createElement("div");$0b.setAttribute("unselectable","on");$0b.style.position='absolute';$0b.style.left=(this.getCellWidth()*x)+'%';$0b.style.width=(this.getCellWidth())+'%';$0b.style.top='0px';$0b.style.height=(this.headerHeight)+'px';var $0c=x+this.getWeekStart();if($0c>6){$0c-=7;};var $J=document.createElement("div");$J.setAttribute("unselectable","on");$J.innerHTML=this.dayNames[$0c];$0b.appendChild($J);$J.style.position="absolute";$J.style.top="0px";$J.style.bottom="0px";$J.style.left="0px";$J.style.right="0px";$J.style.backgroundColor=this.headerBackColor;$J.style.fontFamily=this.headerFontFamily;$J.style.fontSize=this.headerFontSize;$J.style.color=this.headerFontColor;$J.style.textAlign='center';$J.style.cursor='default';if(x!==this.getColCount()-1){$J.style.borderRight='1px solid '+this.borderColor;};$J.innerHTML=this.dayNames[$0c];$09.appendChild($0b);for(var y=0;y<this.rows.length;y++){this.drawCell(x,y,$09);}}};this.clearTable=function(){for(var x=0;x<this.cells.length;x++){for(var y=0;y<this.cells[x].length;y++){this.cells[x][y].onclick=null;}};this.nav.cells.innerHTML='';};this.drawCell=function(x,y,$09){var $j=this.rows[y];var d=DayPilot.Date.addDays(this.firstDate,y*7+x);var $0d=this.cellProperties?this.cellProperties[y*this.getColCount()+x]:null;var $G=document.createElement("div");$G.setAttribute("unselectable","on");$G.style.position='absolute';$G.style.cursor='default';$G.style.left=(this.getCellWidth()*x)+'%';$G.style.width=(this.getCellWidth())+'%';$G.style.top=(this.getRowTop(y))+'px';$G.style.height=($j.getHeight())+'px';var $0e=this.startDate.addMonths(-1).getMonth();var $0f=this.startDate.addMonths(1).getMonth();var $0g=this.startDate.getMonth();var $J=document.createElement("div");$J.setAttribute("unselectable","on");$G.appendChild($J);$J.style.position="absolute";$J.style.left="0px";$J.style.right="0px";$J.style.top="0px";$J.style.bottom="0px";$J.style.backgroundColor=this.getCellBackColor(d);if(x!==this.getColCount()-1){$J.style.borderRight='1px solid '+this.innerBorderColor;};if(y===0){$J.style.borderTop='1px solid '+this.borderColor;};$J.style.borderBottom='1px solid '+this.innerBorderColor;$G.onmousedown=function(e){if($c.timeRangeSelectedHandling!=='Disabled'){$c.clearShadow();DayPilotMonth.timeRangeSelecting={"root":$c,"x":x,"y":y,"from":{x:x,y:y},"width":1};}};$G.onclick=function(){var $0h=function(d){var $S=new DayPilot.Date(d);var end=$S.addDays(1);$c.timeRangeSelectedDispatch($S,end);};if($c.timeRangeSelectedHandling!=='Disabled'){$0h(d);return;}};var $0i=document.createElement("div");$0i.setAttribute("unselectable","on");$0i.style.height=this.cellHeaderHeight+"px";if(this.cellHeaderBackColor){$0i.style.backgroundColor=this.cellHeaderBackColor;};$0i.style.paddingRight='2px';$0i.style.textAlign="right";$0i.style.fontFamily=this.cellHeaderFontFamily;$0i.style.fontSize=this.cellHeaderFontSize;$0i.style.color=this.cellHeaderFontColor;var $08=d.getUTCDate();if($08===1){$0i.innerHTML=this.monthNames[d.getUTCMonth()]+' '+$08;}else{$0i.innerHTML=$08;};$J.appendChild($0i);this.cells[x][y]=$G;$09.appendChild($G);};this.getWeekStart=function(){if(this.showWeekend){return this.weekStarts;}else{return 1;}};this.getColCount=function(){return 7;};this.getCellWidth=function(){return 14.285;};this.getCellBackColor=function(d){if(d.getUTCDay()===6||d.getUTCDay()===0){return this.nonBusinessBackColor;};return this.backColor;};this.getRowTop=function($R){var top=this.headerHeight;for(var i=0;i<$R;i++){top+=this.rows[i].getHeight();};return top;};this.callBack2=function($0j,$f,$0k){var $0l={};$0l.action=$0j;$0l.parameters=$0k;$0l.data=$f;$0l.header=this.getCallBackHeader();var $0m="JSON"+DayPilot.JSON.stringify($0l);if(this.backendUrl){DayPilot.request(this.backendUrl,this.callBackResponse,$0m,this.ajaxError);}};this.callBackResponse=function($0n){$c.updateView($0n.responseText);};this.getCallBackHeader=function(){var h={};h.control="dpm";h.id=this.id;h.v=this.v;h.visibleStart=new DayPilot.Date(this.firstDate);h.visibleEnd=h.visibleStart.addDays(this.days);h.startDate=$c.startDate;h.headerBackColor=this.headerBackColor;h.backColor=this.backColor;h.nonBusinessBackColor=this.nonBusinessBackColor;h.timeFormat=this.timeFormat;h.weekStarts=this.weekStarts;return h;};this.eventClickCallBack=function(e,$f){this.callBack2('EventClick',$f,e);};this.eventClickDispatch=function(e){DayPilotMonth.movingEvent=null;DayPilotMonth.resizingEvent=null;var $0o=this;var e=e||window.event;var $0p=e.ctrlKey;e.cancelBubble=true;if(e.stopPropagation){e.stopPropagation();};$c.eventClickSingle($0o,$0p);};this.eventClickSingle=function($0o,$0p){var e=$0o.event;if(!e.clickingAllowed()){return;};switch($c.eventClickHandling){case 'CallBack':$c.eventClickCallBack(e);break;case 'JavaScript':$c.onEventClick(e);break;}};this.eventMoveCallBack=function(e,$0q,$0r,$f,$0s){if(!$0q)throw 'newStart is null';if(!$0r)throw 'newEnd is null';var $0t={};$0t.e=e;$0t.newStart=$0q;$0t.newEnd=$0r;$0t.position=$0s;this.callBack2('EventMove',$f,$0t);};this.eventMoveDispatch=function(e,x,y,$q,ev,$0s){var $0u=DayPilot.Date.getTime(e.start().d);var $00=DayPilot.Date.getDate(e.end().d);if($00.getTime()!==e.end().d.getTime()){$00=DayPilot.Date.addDays($00,1);};var $0v=DayPilot.Date.diff(e.end().d,$00);var $0w=this.getDateFromCell(x,y);$0w=DayPilot.Date.addDays($0w,-$q);var $p=DayPilot.Date.daysSpan(e.start().d,e.end().d)+1;var $0x=DayPilot.Date.addDays($0w,$p);var $0q=new DayPilot.Date(DayPilot.Date.addTime($0w,$0u));var $0r=new DayPilot.Date(DayPilot.Date.addTime($0x,$0v));switch($c.eventMoveHandling){case 'CallBack':$c.eventMoveCallBack(e,$0q,$0r,null,$0s);break;case 'JavaScript':$c.onEventMove(e,$0q,$0r,ev.ctrlKey,ev.shiftKey,$0s);break;}};this.eventResizeCallBack=function(e,$0q,$0r,$f){if(!$0q)throw 'newStart is null';if(!$0r)throw 'newEnd is null';var $0t={};$0t.e=e;$0t.newStart=$0q;$0t.newEnd=$0r;this.callBack2('EventResize',$f,$0t);};this.eventResizeDispatch=function(e,$S,$p){var $0u=DayPilot.Date.getTime(e.start().d);var $00=DayPilot.Date.getDate(e.end().d);if(!DayPilot.Date.equals($00,e.end().d)){$00=DayPilot.Date.addDays($00,1);};var $0v=DayPilot.Date.diff(e.end().d,$00);var $0w=this.getDateFromCell($S.x,$S.y);var $0x=DayPilot.Date.addDays($0w,$p);var $0q=new DayPilot.Date(DayPilot.Date.addTime($0w,$0u));var $0r=new DayPilot.Date(DayPilot.Date.addTime($0x,$0v));switch($c.eventResizeHandling){case 'CallBack':$c.eventResizeCallBack(e,$0q,$0r);break;case 'JavaScript':$c.onEventResize(e,$0q,$0r);break;}};this.timeRangeSelectedCallBack=function($S,end,$f){var $0y={};$0y.start=$S;$0y.end=end;this.callBack2('TimeRangeSelected',$f,$0y);};this.timeRangeSelectedDispatch=function($S,end){switch($c.timeRangeSelectedHandling){case 'CallBack':$c.timeRangeSelectedCallBack($S,end);break;case 'JavaScript':$c.onTimeRangeSelected($S,end);break;}};this.clearSelection=function(){$c.clearShadow();};this.commandCallBack=function($0z,$f){this.stopAutoRefresh();var $0t={};$0t.command=$0z;this.callBack2('Command',$f,$0t);};this.debug=function($0A,$0B){if(!this.debuggingEnabled){return;};if(!$c.debugMessages){$c.debugMessages=[];};$c.debugMessages.push($0A);if(typeof console!=='undefined'){console.log($0A);}};this.registerGlobalHandlers=function(){if(!DayPilotMonth.globalHandlers){DayPilotMonth.globalHandlers=true;DayPilot.re(document,'mouseup',DayPilotMonth.gMouseUp);}};this.loadFromServer=function(){return(typeof this.events==='undefined')||(this.events===null);};this.show=function(){if(this.nav.top.style.visibility=='hidden'){this.nav.top.style.visibility='visible';}};this.initShort=function(){this.prepareRows();this.drawTop();this.drawTable();this.registerGlobalHandlers();this.callBack2('Init');};this.Init=function(){var $0C=this.loadFromServer();if($0C){this.initShort();return;};this.prepareRows();this.prepareEvents();this.drawTop();this.drawTable();this.show();this.drawEvents();this.registerGlobalHandlers();if(this.messageHTML){this.message(this.messageHTML);};this.fireAfterRenderDetached(null,false);};};DayPilotMonth.Event=function($c,$A,$j){this.root=$c;this.calendar=$c;this.eventPart=$A;var ev=this;this.value=function(){return $A.event.Value;};this.text=function(){return $A.event.Text;};this.start=function(){return new DayPilot.Date($A.event.Start);};this.end=function(){return new DayPilot.Date($A.event.End);};this.partStart=function(){return $c.rows[$j].getPartStart($A.event);};this.partEnd=function(){return $c.rows[$j].getPartEnd($A.event);};this.data={};this.clickingAllowed=function(){return true;};this.client={};this.toJSON=function($0D){var $0E={};$0E.value=this.value();$0E.text=this.text();$0E.start=this.start();$0E.end=this.end();$0E.resource=null;$0E.isAllDay=false;$0E.tag={};return $0E;};};DayPilotMonth.gMouseUp=function(ev){if(DayPilotMonth.movingEvent){var $0F=DayPilotMonth.movingEvent;if(!$0F.event){return;};if(!$0F.event.root){return;};if(!$0F.event.root.shadow){return;};if(!$0F.event.root.shadow.start){return;};var $c=DayPilotMonth.movingEvent.event.root;var e=DayPilotMonth.movingEvent.event;var $S=$c.shadow.start;var $0s=$c.shadow.position;var $q=DayPilotMonth.movingEvent.offset;$c.clearShadow();DayPilotMonth.movingEvent=null;var ev=ev||window.event;$c.eventMoveDispatch(e,$S.x,$S.y,$q,ev,$0s);ev.cancelBubble=true;if(ev.stopPropagation){ev.stopPropagation();};DayPilotMonth.movingEvent=null;return false;}else if(DayPilotMonth.resizingEvent){var $0F=DayPilotMonth.resizingEvent;if(!$0F.event){return;};if(!$0F.event.root){return;};if(!$0F.event.root.shadow){return;};if(!$0F.event.root.shadow.start){return;};var $c=DayPilotMonth.resizingEvent.event.root;var e=DayPilotMonth.resizingEvent.event;var $S=$c.shadow.start;var $p=$c.shadow.width;$c.clearShadow();DayPilotMonth.resizingEvent=null;$c.eventResizeDispatch(e,$S,$p);ev.cancelBubble=true;DayPilotMonth.resizingEvent=null;return false;}else if(DayPilotMonth.timeRangeSelecting){if(DayPilotMonth.timeRangeSelecting.moved){var $0G=DayPilotMonth.timeRangeSelecting;var $c=$0G.root;var $S=new DayPilot.Date($c.getDateFromCell($0G.from.x,$0G.from.y));var end=$S.addDays($0G.width);$c.timeRangeSelectedDispatch($S,end);$c.clearShadow();};DayPilotMonth.timeRangeSelecting=null;}};DayPilot.Month=DayPilotMonth.Month;if(typeof jQuery!=='undefined'){(function($){$.fn.daypilotMonth=function($0H){var $U=null;var j=this.each(function(){if(this.daypilot){return;};var $0I=new DayPilot.Month(this.id);this.daypilot=$0I;for(name in $0H){$0I[name]=$0H[name];};$0I.Init();if(!$U){$U=$0I;}});if(this.length===1){return $U;}else{return j;}};})(jQuery);};if(typeof $0J!=='undefined'&&$0J.Application&&$0J.Application.notifyScriptLoaded){$0J.Application.notifyScriptLoaded();}})();

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


Written By
Czech Republic Czech Republic
My open-source event calendar/scheduling web UI components:

DayPilot for JavaScript, Angular, React and Vue

Comments and Discussions