/*
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._extra_xle=!1;scheduler.attachEvent("onXLE",function(){if(!scheduler._extra_xle){var a=!1,c;for(c in scheduler._events)if(scheduler._events[c].text){a=!0;break}if((localStorage._updated_events||!a)&&localStorage._events){scheduler._extra_xle=!0;scheduler.parse(localStorage._events,"json");scheduler._extra_xle=!1;var b=scheduler._dataprocessor,e=JSON.parse(localStorage._updated_events);b.setUpdateMode("off");for(var d in e)b.setUpdated(d,!0,e[d]);b.sendData();b.setUpdateMode("cell")}}});
scheduler.attachEvent("onBeforeEventDelete",function(a){var c=scheduler._dataprocessor.getState(a);if(c=="inserted"&&localStorage._updated_events){var b=JSON.parse(localStorage._updated_events);delete b[a];for(a in b){localStorage._updated_events=JSON.stringify(b);break}}return!0});var old_delete_event=scheduler.deleteEvent;scheduler.deleteEvent=function(a,c){old_delete_event.apply(this,arguments);localStorage._events=scheduler.toJSON()};scheduler._offline={};
scheduler._offline._after_update_events=[];var old_dp_init=scheduler._dp_init;
scheduler._dp_init=function(a){old_dp_init.apply(this,arguments);a.attachEvent("onAfterUpdate",function(c){scheduler._offline._after_update_events.push(c);return!0});a.attachEvent("onAfterUpdateFinish",function(){localStorage._events=scheduler.toJSON();for(var c=JSON.parse(localStorage._updated_events),b=0;b<scheduler._offline._after_update_events.length;b++)delete c[scheduler._offline._after_update_events[b]];var a=!1,d;for(d in c){a=!0;break}a?(localStorage._updated_events=JSON.stringify(c),scheduler._offline._after_update_event=
[]):delete localStorage._updated_events;return!0});a.attachEvent("onBeforeDataSending",function(a,b,e){var d={};localStorage._updated_events&&(d=JSON.parse(localStorage._updated_events));for(var f in e){var g=scheduler._dataprocessor.action_param;if(d[f]&&(d[f][g]=="inserted"||e[f][g]=="deleted")||!d[f])d[f]=e[f][g]}localStorage._events=scheduler.toJSON();localStorage._updated_events=JSON.stringify(d);return!0});dhtmlxError.catchError("LoadXML",function(){for(var a in scheduler._dataprocessor._in_progress)delete scheduler._dataprocessor._in_progress[a]})};
