/* This software is allowed to use under GPL or you need to obtain Commercial or Enterise License to use it in not GPL project. Please contact sales@dhtmlx.com for details */ scheduler.templates.calendar_month=scheduler.date.date_to_str("%F %Y");scheduler.templates.calendar_scale_date=scheduler.date.date_to_str("%D");scheduler.templates.calendar_date=scheduler.date.date_to_str("%d"); scheduler.renderCalendar=function(b,c){var a=null,d=b.date||new Date;typeof d=="string"&&(d=this.templates.api_date(d));if(c)a=this._render_calendar(c.parentNode,d,b,c),scheduler.unmarkCalendar(a);else{var e=b.container,f=b.position;typeof e=="string"&&(e=document.getElementById(e));typeof f=="string"&&(f=document.getElementById(f));if(f&&typeof f.left=="undefined")var n=getOffset(f),f={top:n.top+f.offsetHeight,left:n.left};e||(e=scheduler._get_def_cont(f));a=this._render_calendar(e,d,b);a.onclick= function(a){var a=a||event,b=a.target||a.srcElement;if(b.className.indexOf("dhx_month_head")!=-1){var c=b.parentNode.className;if(c.indexOf("dhx_after")==-1&&c.indexOf("dhx_before")==-1){var d=scheduler.templates.xml_date(this.getAttribute("date"));d.setDate(parseInt(b.innerHTML,10));scheduler.unmarkCalendar(this);scheduler.markCalendar(this,d,"dhx_calendar_click");this._last_date=d;this.conf.handler&&this.conf.handler.call(scheduler,d,this)}}}}for(var m=scheduler.date.month_start(d),k=scheduler.date.add(m, 1,"month"),p=this.getEvents(m,k),i=0;i=k.valueOf())break}this._markCalendarCurrentDate(a);a.conf=b;return a}; scheduler._get_def_cont=function(b){if(!this._def_count)this._def_count=document.createElement("DIV"),this._def_count.style.cssText="position:absolute;z-index:10100;width:251px; height:175px;",this._def_count.onclick=function(b){(b||event).cancelBubble=!0},document.body.appendChild(this._def_count);this._def_count.style.left=b.left+"px";this._def_count.style.top=b.top+"px";this._def_count._created=new Date;return this._def_count}; scheduler._locateCalendar=function(b,c){var a=b.childNodes[2].childNodes[0];typeof c=="string"&&(c=scheduler.templates.api_date(c));var d=b.week_start+c.getDate()-1;return a.rows[Math.floor(d/7)].cells[d%7].firstChild};scheduler.markCalendar=function(b,c,a){this._locateCalendar(b,c).className+=" "+a};scheduler.unmarkCalendar=function(b,c,a){c=c||b._last_date;a=a||"dhx_calendar_click";if(c){var d=this._locateCalendar(b,c);d.className=(d.className||"").replace(RegExp(a,"g"))}}; scheduler._week_template=function(b){for(var c=b||250,a=0,d=document.createElement("div"),e=this.date.week_start(new Date),f=0;f<7;f++)this._cols[f]=Math.floor(c/(7-f)),this._render_x_header(f,a,e,d),e=this.date.add(e,1,"day"),c-=this._cols[f],a+=this._cols[f];d.lastChild.className+=" dhx_scale_bar_last";return d};scheduler.updateCalendar=function(b,c){b.conf.date=c;this.renderCalendar(b.conf,b)};scheduler._mini_cal_arrows=[" "," "]; scheduler._render_calendar=function(b,c,a,d){var e=scheduler.templates,f=this._cols;this._cols=[];var n=this._mode;this._mode="calendar";var m=this._colsS;this._colsS={height:0};var k=new Date(this._min_date),p=new Date(this._max_date),i=new Date(scheduler._date),o=e.month_day;e.month_day=e.calendar_date;var c=this.date.month_start(c),l=this._week_template(b.offsetWidth-1),g;d?g=d:(g=document.createElement("DIV"),g.className="dhx_cal_container dhx_mini_calendar");g.setAttribute("date",this.templates.xml_format(c)); g.innerHTML="
"+l.innerHTML+"
";g.childNodes[0].innerHTML=this.templates.calendar_month(c);if(a.navigation){var h=document.createElement("DIV");h.className="dhx_cal_prev_button";h.style.cssText="left:1px;top:2px;position:absolute;";h.innerHTML=this._mini_cal_arrows[0];g.firstChild.appendChild(h);h.onclick=function(){scheduler.updateCalendar(g,scheduler.date.add(g._date,-1,"month"));scheduler._date.getMonth()== g._date.getMonth()&&scheduler._date.getFullYear()==g._date.getFullYear()&&scheduler._markCalendarCurrentDate(g)};h=document.createElement("DIV");h.className="dhx_cal_next_button";h.style.cssText="left:auto; right:1px;top:2px;position:absolute;";h.innerHTML=this._mini_cal_arrows[1];g.firstChild.appendChild(h);h.onclick=function(){scheduler.updateCalendar(g,scheduler.date.add(g._date,1,"month"));scheduler._date.getMonth()==g._date.getMonth()&&scheduler._date.getFullYear()==g._date.getFullYear()&&scheduler._markCalendarCurrentDate(g)}}g._date= new Date(c);g.week_start=(c.getDay()-(this.config.start_on_monday?1:0)+7)%7;var u=this.date.week_start(c);this._reset_month_scale(g.childNodes[2],c,u);for(var j=g.childNodes[2].firstChild.rows,q=j.length;q<6;q++){var t=j[j.length-1];j[0].parentNode.appendChild(t.cloneNode(!0));for(var r=parseInt(t.childNodes[t.childNodes.length-1].childNodes[0].innerHTML),r=r<10?r:0,s=0;s500))b=this._def_count.firstChild;if(b&&(b.onclick=null,b.innerHTML="",b.parentNode&&b.parentNode.removeChild(b),this._def_count))this._def_count.style.top="-1000px"};scheduler.isCalendarVisible=function(){return this._def_count&&parseInt(this._def_count.style.top,10)>0?this._def_count:!1}; scheduler.attachEvent("onTemplatesReady",function(){dhtmlxEvent(document.body,"click",function(){scheduler.destroyCalendar()})});scheduler.templates.calendar_time=scheduler.date.date_to_str("%d-%m-%Y"); scheduler.form_blocks.calendar_time={render:function(){var b="",c=scheduler.config,a=this.date.date_part(new Date);c.first_hour&&a.setHours(c.first_hour);b+=" ";var f=scheduler.config.full_day;return"
"+ b+"  –  "+b+"
"},set_value:function(b,c,a){function d(a,b,c){n(a,b,c);a.value=scheduler.templates.calendar_time(b);a._date=scheduler.date.date_part(new Date(b))}var e=b.getElementsByTagName("input"),f=b.getElementsByTagName("select"),n=function(a,b,c){a.onclick=function(){scheduler.destroyCalendar(null,!0);scheduler.renderCalendar({position:a,date:new Date(this._date),navigation:!0,handler:function(b){a.value=scheduler.templates.calendar_time(b); a._date=new Date(b);scheduler.destroyCalendar();scheduler.config.event_duration&&scheduler.config.auto_end_date&&c==0&&o()}})}};if(scheduler.config.full_day){if(!b._full_day){var m="";scheduler.config.wide_form||(m=b.previousSibling.innerHTML+m);b.previousSibling.innerHTML=m;b._full_day=!0}var k=b.previousSibling.getElementsByTagName("input")[0],p=scheduler.date.time_part(a.start_date)== 0&&scheduler.date.time_part(a.end_date)==0&&a.end_date.valueOf()-a.start_date.valueOf()<1728E5;k.checked=p;for(var i in f)f[i].disabled=k.checked;for(i=0;i