/*
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.attachEvent("onTemplatesReady",function(){function h(d,b,c,f){for(var e=b.getElementsByTagName(d),a=c.getElementsByTagName(d),g=a.length-1;g>=0;g--)if(c=a[g],f){var i=document.createElement("SPAN");i.className="dhx_text_disabled";i.innerHTML=f(e[g]);c.parentNode.insertBefore(i,c);c.parentNode.removeChild(c)}else c.disabled=!0}scheduler.attachEvent("onBeforeLightbox",function(d){if(this.config.readonly_form||this.getEvent(d).readonly)this.config.readonly_active=!0;else return this.config.readonly_active=
!1,!0;for(var b=0;b<this.config.lightbox.sections.length;b++)this.config.lightbox.sections[b].focus=!1;return!0});var k=scheduler._fill_lightbox;scheduler._fill_lightbox=function(){var d=this.config.lightbox.sections;if(this.config.readonly_active)for(var b=0;b<d.length;b++)if(d[b].type=="recurring"){var c=document.getElementById(d[b].id);c.style.display=c.nextSibling.style.display="none";d.splice(b,1);b--}var f=k.apply(this,arguments);if(this.config.readonly_active){var e=this._get_lightbox(),a=
this._lightbox_r=e.cloneNode(!0);a.id=scheduler.uid();a.style.color="red";h("textarea",e,a,function(a){return a.value});h("input",e,a,!1);h("select",e,a,function(a){return a.options[Math.max(a.selectedIndex||0,0)].text});a.removeChild(a.childNodes[2]);a.removeChild(a.childNodes[3]);e.parentNode.insertBefore(a,e);j.call(this,a);scheduler._lightbox&&scheduler._lightbox.parentNode.removeChild(scheduler._lightbox);this._lightbox=a;this.setLightboxSize();this._lightbox=null;a.onclick=function(a){var b=
a?a.target:event.srcElement;if(!b.className)b=b.previousSibling;if(b&&b.className)switch(b.className){case "dhx_cancel_btn":scheduler.callEvent("onEventCancel",[scheduler._lightbox_id]),scheduler._edit_stop_event(scheduler.getEvent(scheduler._lightbox_id),!1),scheduler.hide_lightbox()}}}return f};var j=scheduler.showCover;scheduler.showCover=function(){this.config.readonly_active||j.apply(this,arguments)};var l=scheduler.hide_lightbox;scheduler.hide_lightbox=function(){if(this._lightbox_r)this._lightbox_r.parentNode.removeChild(this._lightbox_r),
this._lightbox_r=null;return l.apply(this,arguments)}});
