/* dhtmlxScheduler v.2.3 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 (c) DHTMLX Ltd. */ dhtmlx=function(B){for(var A in B){dhtmlx[A]=B[A]}return dhtmlx};dhtmlx.extend_api=function(A,D,C){var B=window[A];if(!B){return }window[A]=function(G){if(G&&typeof G=="object"&&!G.tagName&&!(G instanceof Array)){var F=B.apply(this,(D._init?D._init(G):arguments));for(var E in dhtmlx){if(D[E]){this[D[E]](dhtmlx[E])}}for(var E in G){if(D[E]){this[D[E]](G[E])}else{if(E.indexOf("on")==0){this.attachEvent(E,G[E])}}}}else{var F=B.apply(this,arguments)}if(D._patch){D._patch(this)}return F||this};window[A].prototype=B.prototype;if(C){dhtmlXHeir(window[A].prototype,C)}};dhtmlxAjax={get:function(A,C){var B=new dtmlXMLLoaderObject(true);B.async=(arguments.length<3);B.waitCall=C;B.loadXML(A);return B},post:function(A,C,D){var B=new dtmlXMLLoaderObject(true);B.async=(arguments.length<4);B.waitCall=D;B.loadXML(A,true,C);return B},getSync:function(A){return this.get(A,null,true)},postSync:function(A,B){return this.post(A,B,null,true)}};function dtmlXMLLoaderObject(B,D,C,A){this.xmlDoc="";if(typeof (C)!="undefined"){this.async=C}else{this.async=true}this.onloadAction=B||null;this.mainObject=D||null;this.waitCall=null;this.rSeed=A||false;return this}dtmlXMLLoaderObject.prototype.waitLoadFunction=function(B){var A=true;this.check=function(){if((B)&&(B.onloadAction!=null)){if((!B.xmlDoc.readyState)||(B.xmlDoc.readyState==4)){if(!A){return }A=false;if(typeof B.onloadAction=="function"){B.onloadAction(B.mainObject,null,null,null,B)}if(B.waitCall){B.waitCall.call(this,B);B.waitCall=null}}}};return this.check};dtmlXMLLoaderObject.prototype.getXMLTopNode=function(C,A){if(this.xmlDoc.responseXML){var B=this.xmlDoc.responseXML.getElementsByTagName(C);if(B.length==0&&C.indexOf(":")!=-1){var B=this.xmlDoc.responseXML.getElementsByTagName((C.split(":"))[1])}var E=B[0]}else{var E=this.xmlDoc.documentElement}if(E){this._retry=false;return E}if((_isIE)&&(!this._retry)){var D=this.xmlDoc.responseText;var A=this.xmlDoc;this._retry=true;this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM");this.xmlDoc.async=false;this.xmlDoc.loadXML(D);return this.getXMLTopNode(C,A)}dhtmlxError.throwError("LoadXML","Incorrect XML",[(A||this.xmlDoc),this.mainObject]);return document.createElement("DIV")};dtmlXMLLoaderObject.prototype.loadXMLString=function(B){try{var C=new DOMParser();this.xmlDoc=C.parseFromString(B,"text/xml")}catch(A){this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM");this.xmlDoc.async=this.async;this.xmlDoc.loadXML(B)}this.onloadAction(this.mainObject,null,null,null,this);if(this.waitCall){this.waitCall();this.waitCall=null}};dtmlXMLLoaderObject.prototype.loadXML=function(C,B,A,D){if(this.rSeed){C+=((C.indexOf("?")!=-1)?"&":"?")+"a_dhx_rSeed="+(new Date()).valueOf()}this.filePath=C;if((!_isIE)&&(window.XMLHttpRequest)){this.xmlDoc=new XMLHttpRequest()}else{this.xmlDoc=new ActiveXObject("Microsoft.XMLHTTP")}if(this.async){this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this)}this.xmlDoc.open(B?"POST":"GET",C,this.async);if(D){this.xmlDoc.setRequestHeader("User-Agent","dhtmlxRPC v0.1 ("+navigator.userAgent+")");this.xmlDoc.setRequestHeader("Content-type","text/xml")}else{if(B){this.xmlDoc.setRequestHeader("Content-type","application/x-www-form-urlencoded")}}this.xmlDoc.setRequestHeader("X-Requested-With","XMLHttpRequest");this.xmlDoc.send(null||A);if(!this.async){(new this.waitLoadFunction(this))()}};dtmlXMLLoaderObject.prototype.destructor=function(){this.onloadAction=null;this.mainObject=null;this.xmlDoc=null;return null};dtmlXMLLoaderObject.prototype.xmlNodeToJSON=function(D){var C={};for(var B=0;B-1){_isChrome=true}if((navigator.userAgent.indexOf("Safari")!=-1)||(navigator.userAgent.indexOf("Konqueror")!=-1)){var _KHTMLrv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Safari")+7,5));if(_KHTMLrv>525){_isFF=true;var _FFrv=1.9}else{_isKHTML=true}}else{if(navigator.userAgent.indexOf("Opera")!=-1){_isOpera=true;_OperaRv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Opera")+6,3))}else{if(navigator.appName.indexOf("Microsoft")!=-1){_isIE=true;if(navigator.appVersion.indexOf("MSIE 8.0")!=-1&&document.compatMode!="BackCompat"){_isIE=8}}else{_isFF=true;var _FFrv=parseFloat(navigator.userAgent.split("rv:")[1])}}}dtmlXMLLoaderObject.prototype.doXPath=function(C,E,D,I){if(_isKHTML||(!_isIE&&!window.XPathResult)){return this.doXPathOpera(C,E)}if(_isIE){if(!E){if(!this.xmlDoc.nodeName){E=this.xmlDoc.responseXML}else{E=this.xmlDoc}}if(!E){dhtmlxError.throwError("LoadXML","Incorrect XML",[(E||this.xmlDoc),this.mainObject])}if(D!=null){E.setProperty("SelectionNamespaces","xmlns:xsl='"+D+"'")}if(I=="single"){return E.selectSingleNode(C)}else{return E.selectNodes(C)||new Array(0)}}else{var A=E;if(!E){if(!this.xmlDoc.nodeName){E=this.xmlDoc.responseXML}else{E=this.xmlDoc}}if(!E){dhtmlxError.throwError("LoadXML","Incorrect XML",[(E||this.xmlDoc),this.mainObject])}if(E.nodeName.indexOf("document")!=-1){A=E}else{A=E;E=E.ownerDocument}var G=XPathResult.ANY_TYPE;if(I=="single"){G=XPathResult.FIRST_ORDERED_NODE_TYPE}var F=new Array();var B=E.evaluate(C,A,function(J){return D},G,null);if(G==XPathResult.FIRST_ORDERED_NODE_TYPE){return B.singleNodeValue}var H=B.iterateNext();while(H){F[F.length]=H;H=B.iterateNext()}return F}};function _dhtmlxError(B,A,C){if(!this.catches){this.catches=new Array()}return this}_dhtmlxError.prototype.catchError=function(B,A){this.catches[B]=A};_dhtmlxError.prototype.throwError=function(B,A,C){if(this.catches[B]){return this.catches[B](B,A,C)}if(this.catches.ALL){return this.catches.ALL(B,A,C)}alert("Error type: "+arguments[0]+"\nDescription: "+arguments[1]);return null};window.dhtmlxError=new _dhtmlxError();dtmlXMLLoaderObject.prototype.doXPathOpera=function(C,A){var E=C.replace(/[\/]+/gi,"/").split("/");var D=null;var B=1;if(!E.length){return[]}if(E[0]=="."){D=[A]}else{if(E[0]==""){D=(this.xmlDoc.responseXML||this.xmlDoc).getElementsByTagName(E[B].replace(/\[[^\]]*\]/g,""));B++}else{return[]}}for(B;B0?"&dhx_no_header=1":"")};var D=function(E){return A(E)+(this._connector_sorting||"")+(this._connector_filter||"")};var C=function(F,G,E){this._connector_sorting="&dhx_sort["+G+"]="+E;return D.call(this,F)};var B=function(F,E,H){for(var G=0;G0){this.xy.nav_height=F}var C=this.xy.scale_height+this.xy.nav_height+(this._quirks?-2:0);this.set_xy(this._els.dhx_cal_data[0],B,D-(C+2),0,C+2)};scheduler.set_xy=function(D,B,C,A,E){D.style.width=Math.max(0,B)+"px";D.style.height=Math.max(0,C)+"px";if(arguments.length>3){D.style.left=A+"px";D.style.top=E+"px"}};scheduler.get_elements=function(){var D=this._obj.getElementsByTagName("DIV");for(var C=0;CA.getHours()){A.setHours(F);G=A.valueOf()}B=G+E}C.start_date=C.start_date||A;C.end_date=C.end_date||new Date(B);C.text=C.text||this.locale.labels.new_event;C.id=this._drag_id=this.uid();this._drag_mode="new-size";this._loading=true;this.addEvent(C);this.callEvent("onEventCreated",[this._drag_id,D]);this._loading=false;this._drag_event={};this._on_mouse_up(D)};scheduler._on_dbl_click=function(C,D){D=D||(C.target||C.srcElement);if(this.config.readonly){return }var A=D.className.split(" ")[0];switch(A){case"dhx_scale_holder":case"dhx_scale_holder_now":case"dhx_month_body":if(!scheduler.config.dblclick_create){break}var G=this._mouse_coords(C);var F=this._min_date.valueOf()+(G.y*this.config.time_step+(this._table_view?0:G.x)*24*60)*60000;F=this._correct_shift(F);this.addEventNow(F,null,C);break;case"dhx_body":case"dhx_cal_event_line":case"dhx_cal_event_clear":var E=this._locate_event(D);if(!this.callEvent("onDblClick",[E,C])){return }if(this.config.details_on_dblclick||this._table_view||!this.getEvent(E)._timed){this.showLightbox(E)}else{this.edit(E)}break;case"":if(D.parentNode){return scheduler._on_dbl_click(C,D.parentNode)}default:var B=this["dblclick_"+A];if(B){B.call(this,C)}break}};scheduler._mouse_coords=function(D){var F;var A=document.body;var E=document.documentElement;if(D.pageX||D.pageY){F={x:D.pageX,y:D.pageY}}else{F={x:D.clientX+(A.scrollLeft||E.scrollLeft||0)-A.clientLeft,y:D.clientY+(A.scrollTop||E.scrollTop||0)-A.clientTop}}F.x-=getAbsoluteLeft(this._obj)+(this._table_view?0:this.xy.scale_width);F.y-=getAbsoluteTop(this._obj)+this.xy.nav_height+(this._dy_shift||0)+this.xy.scale_height-this._els.dhx_cal_data[0].scrollTop;F.ev=D;var C=this["mouse_"+this._mode];if(C){return C.call(this,F)}if(!this._table_view){F.x=Math.max(0,Math.ceil(F.x/this._cols[0])-1);F.y=Math.max(0,Math.ceil(F.y*60/(this.config.time_step*this.config.hour_size_px))-1)+this.config.first_hour*(60/this.config.time_step)}else{var B=0;for(B=1;BF.y){break}}F.y=(Math.max(0,Math.ceil(F.x/this._cols[0])-1)+Math.max(0,B-1)*7)*24*60/this.config.time_step;F.x=0}return F};scheduler._close_not_saved=function(){if(new Date().valueOf()-(scheduler._new_event||0)>500&&scheduler._edit_id){var A=scheduler.locale.labels.confirm_closing;if(!A||confirm(A)){scheduler.editStop(scheduler.config.positive_closing)}}};scheduler._correct_shift=function(B,A){return B-=((new Date(scheduler._min_date)).getTimezoneOffset()-(new Date(B)).getTimezoneOffset())*60000*(A?-1:1)};scheduler._on_mouse_move=function(F){if(this._drag_mode){var G=this._mouse_coords(F);if(!this._drag_pos||this._drag_pos.x!=G.x||this._drag_pos.y!=G.y){if(this._edit_id!=this._drag_id){this._close_not_saved()}this._drag_pos=G;if(this._drag_mode=="create"){this._close_not_saved();this._loading=true;var B=this._min_date.valueOf()+(G.y*this.config.time_step+(this._table_view?0:G.x)*24*60)*60000;B=this._correct_shift(B);if(!this._drag_start){this._drag_start=B;return }var E=B;if(E==this._drag_start){return }this._drag_id=this.uid();this.addEvent(new Date(this._drag_start),new Date(E),this.locale.labels.new_event,this._drag_id,G.fields);this.callEvent("onEventCreated",[this._drag_id,F]);this._loading=false;this._drag_mode="new-size"}var H=this.getEvent(this._drag_id);var B,E;if(this._drag_mode=="move"){B=this._min_date.valueOf()+(G.y*this.config.time_step+G.x*24*60)*60000;if(!G.custom&&this._table_view){B+=this.date.time_part(H.start_date)*1000}B=this._correct_shift(B);E=H.end_date.valueOf()-(H.start_date.valueOf()-B)}else{B=H.start_date.valueOf();if(this._table_view){E=this._min_date.valueOf()+G.y*this.config.time_step*60000+(G.custom?0:24*60*60000)}else{E=this.date.date_part(new Date(H.end_date)).valueOf()+G.y*this.config.time_step*60000;this._els.dhx_cal_data[0].style.cursor="s-resize";if(this._mode=="week"||this._mode=="day"){E=this._correct_shift(E)}}if(this._drag_mode=="new-size"){if(E<=this._drag_start){var D=G.shift||((this._table_view&&!G.custom)?24*60*60000:0);B=E-D;E=this._drag_start+(D||(this.config.time_step*60000))}else{B=this._drag_start}}else{if(E<=B){E=B+this.config.time_step*60000}}}var I=new Date(E-1);var C=new Date(B);if(this._table_view||(I.getDate()==C.getDate()&&I.getHours()";for(var C=0;C<7;C++){F+="=H){M="dhx_after"}else{if(I.valueOf()==A.valueOf()){M="dhx_now"}}}F+=" class='"+M+" "+this.templates.month_date_class(I,A)+"' ";F+=">
"+this.templates.month_day(I)+"
";I=this.date.add(I,1,"day")}F+="";G[E]=D;D+=this._colsS.height}F+="";this._max_date=I;J.innerHTML=F;return I};scheduler.getLabel=function(E,D){var F=this.config.lightbox.sections;for(var C=0;C11?"pm":"am")+"';case"%A":return'"+(date.getHours()>11?"PM":"AM")+"';case"%s":return'"+scheduler.date.to_fixed(date.getSeconds())+"';case"%W":return'"+scheduler.date.to_fixed(scheduler.date.getISOWeek(date))+"';default:return C}});if(A){B=B.replace(/date\.get/g,"date.getUTC")}return new Function("date",'return "'+B+'";')},str_to_date:function(E,C){var F="var temp=date.split(/[^0-9a-zA-Z]+/g);";var A=E.match(/%[a-zA-Z]/g);for(var B=0;B50?1900:2000);";break;case"%g":case"%G":case"%h":case"%H":F+="set[3]=temp["+B+"]||0;";break;case"%i":F+="set[4]=temp["+B+"]||0;";break;case"%Y":F+="set[0]=temp["+B+"]||0;";break;case"%a":case"%A":F+="set[3]=set[3]%12+((temp["+B+"]||'').toLowerCase()=='am'?0:12);";break;case"%s":F+="set[5]=temp["+B+"]||0;";break}}var D="set[0],set[1],set[2],set[3],set[4],set[5]";if(C){D=" Date.UTC("+D+")"}return new Function("date","var set=[0,0,1,0,0,0]; "+F+" return new Date("+D+");")},getISOWeek:function(C){if(!C){return false}var B=C.getDay();if(B==0){B=7}var D=new Date(C.valueOf());D.setDate(C.getDate()+(4-B));var A=D.getFullYear();var F=Math.floor((D.getTime()-new Date(A,0,1).getTime())/86400000);var E=1+Math.floor(F/7);return E},getUTCISOWeek:function(A){return this.getISOWeek(A)}};scheduler.locale={date:{month_full:["January","February","March","April","May","June","July","August","September","October","November","December"],month_short:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],day_full:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],day_short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},labels:{dhx_cal_today_button:"Today",day_tab:"Day",week_tab:"Week",month_tab:"Month",new_event:"New event",icon_save:"Save",icon_cancel:"Cancel",icon_details:"Details",icon_edit:"Edit",icon_delete:"Delete",confirm_closing:"",confirm_deleting:"Event will be deleted permanently, are you sure?",section_description:"Description",section_time:"Time period",full_day:"Full day",confirm_recurring:"Do you want to edit the whole set of repeated events?",section_recurring:"Repeat event",button_recurring:"Disabled",button_recurring_open:"Enabled",agenda_tab:"Agenda",date:"Date",description:"Description",year_tab:"Year"}};scheduler.config={default_date:"%j %M %Y",month_date:"%F %Y",load_date:"%Y-%m-%d",week_date:"%l",day_date:"%D, %F %j",hour_date:"%H:%i",month_day:"%d",xml_date:"%m/%d/%Y %H:%i",api_date:"%d-%m-%Y %H:%i",hour_size_px:42,time_step:5,start_on_monday:1,first_hour:0,last_hour:24,readonly:false,drag_resize:1,drag_move:1,drag_create:1,dblclick_create:1,edit_on_create:1,details_on_create:0,click_form_details:0,server_utc:false,positive_closing:false,icons_edit:["icon_save","icon_cancel"],icons_select:["icon_details","icon_edit","icon_delete"],lightbox:{sections:[{name:"description",height:200,map_to:"text",type:"textarea",focus:true},{name:"time",height:72,type:"time",map_to:"auto"}]}};scheduler.templates={};scheduler.init_templates=function(){var B=scheduler.date.date_to_str;var C=scheduler.config;var A=function(E,D){for(var F in D){if(!E[F]){E[F]=D[F]}}};A(scheduler.templates,{day_date:B(C.default_date),month_date:B(C.month_date),week_date:function(E,D){return scheduler.templates.day_date(E)+" – "+scheduler.templates.day_date(scheduler.date.add(D,-1,"day"))},day_scale_date:B(C.default_date),month_scale_date:B(C.week_date),week_scale_date:B(C.day_date),hour_scale:B(C.hour_date),time_picker:B(C.hour_date),event_date:B(C.hour_date),month_day:B(C.month_day),xml_date:scheduler.date.str_to_date(C.xml_date,C.server_utc),load_format:B(C.load_date,C.server_utc),xml_format:B(C.xml_date,C.server_utc),api_date:scheduler.date.str_to_date(C.api_date),event_header:function(F,D,E){return scheduler.templates.event_date(F)+" - "+scheduler.templates.event_date(D)},event_text:function(F,D,E){return E.text},event_class:function(F,D,E){return""},month_date_class:function(D){return""},week_date_class:function(D){return""},event_bar_date:function(F,D,E){return scheduler.templates.event_date(F)+" "},event_bar_text:function(F,D,E){return E.text}});this.callEvent("onTemplatesReady",[])};scheduler.uid=function(){if(!this._seed){this._seed=(new Date).valueOf()}return this._seed++};scheduler._events={};scheduler.clearAll=function(){this._events={};this._loaded={};this.clear_view()};scheduler.addEvent=function(A,G,D,F,B){var C=A;if(arguments.length!=1){C=B||{};C.start_date=A;C.end_date=G;C.text=D;C.id=F}C.id=C.id||scheduler.uid();C.text=C.text||"";if(typeof C.start_date=="string"){C.start_date=this.templates.api_date(C.start_date)}if(typeof C.end_date=="string"){C.end_date=this.templates.api_date(C.end_date)}C._timed=this.is_one_day_event(C);var E=!this._events[C.id];this._events[C.id]=C;this.event_updated(C);if(!this._loading){this.callEvent(E?"onEventAdded":"onEventChanged",[C.id,C])}};scheduler.deleteEvent=function(C,A){var B=this._events[C];if(!A&&!this.callEvent("onBeforeEventDelete",[C,B])){return }if(B){delete this._events[C];this.unselect(C);this.event_updated(B)}};scheduler.getEvent=function(A){return this._events[A]};scheduler.setEvent=function(B,A){this._events[B]=A};scheduler.for_rendered=function(C,B){for(var A=this._rendered.length-1;A>=0;A--){if(this._rendered[A].getAttribute("event_id")==C){B(this._rendered[A],A)}}};scheduler.changeEventId=function(C,A){if(C==A){return }var B=this._events[C];if(B){B.id=A;this._events[A]=B;delete this._events[C]}this.for_rendered(C,function(D){D.setAttribute("event_id",A)});if(this._select_id==C){this._select_id=A}if(this._edit_id==C){this._edit_id=A}this.callEvent("onEventIdChange",[C,A])};(function(){var A=["text","Text","start_date","StartDate","end_date","EndDate"];var C=function(E){return function(F){return(scheduler.getEvent(F))[E]}};var D=function(E){return function(H,G){var F=scheduler.getEvent(H);F[E]=G;F._changed=true;F._timed=this.is_one_day_event(F);scheduler.event_updated(F,true)}};for(var B=0;Bthis._colsS.height-22){var N=B.rows[E].cells;for(var C=0;CJ.start_date?1:-1});var G=[];var I=[];for(var C=0;C(E.max_count||0)){E.max_count=E.length}}if(D=this.config.last_hour){I.push(F);H[C]=F=this._copy_event(F);if(D=this.config.last_hour){F.end_date.setMinutes(0);F.end_date.setHours(this.config.last_hour)}if(F.start_date>F.end_date||D==this.config.last_hour){H.splice(C,1);C--;continue}}}if(!A){for(var C=0;CB.start_date?1:-1})};scheduler._pre_render_events_table=function(P,C){this._time_order(P);var F=[];var A=[[],[],[],[],[],[],[]];var N=this._colsS.heights;var I;var M=this._cols.length;for(var G=0;Gthis._max_date){H=this._max_date}var E=this.locate_holder_day(J,false,L);L._sday=E%M;var O=this.locate_holder_day(H,true,L)||M;L._eday=(O%M)||M;L._length=O-E;L._sweek=Math.floor((this._correct_shift(J.valueOf(),1)-this._min_date.valueOf())/(60*60*1000*24*M));var K=A[L._sweek];var D;for(D=0;D";if(this._quirks7){A.firstChild.style.height=O-12+"px"}this._editor=A.firstChild;this._editor.onkeypress=function(Q){if((Q||event).shiftKey){return true}var P=(Q||event).keyCode;if(P==scheduler.keys.edit_save){scheduler.editStop(true)}if(P==scheduler.keys.edit_cancel){scheduler.editStop(false)}};this._editor.onselectstart=function(P){return(P||event).cancelBubble=true};A.firstChild.focus();this._els.dhx_cal_data[0].scrollLeft=0;A.firstChild.select()}if(this._select_id==L.id){var N=this.config["icons_"+((this._edit_id==L.id)?"edit":"select")];var I="";for(var H=0;H"}var G=this._render_v_bar(L.id,E-D+1,K,D,N.length*20+26,"","
",I,true);G.style.left=E-D+1;this._els.dhx_cal_data[0].appendChild(G);this._rendered.push(G)}};scheduler._render_v_bar=function(D,M,L,N,H,B,F,E,A){var J=document.createElement("DIV");var K=this.getEvent(D);var I="dhx_cal_event";var C=scheduler.templates.event_class(K.start_date,K.end_date,K);if(C){I=I+" "+C}var G='
';G+='
 
';G+='
'+F+"
";G+='
'+E+"
";G+='
';J.innerHTML=G;return J.firstChild};scheduler.locate_holder=function(A){if(this._mode=="day"){return this._els.dhx_cal_data[0].firstChild}return this._els.dhx_cal_data[0].childNodes[A]};scheduler.locate_holder_day=function(B,C){var A=Math.floor((this._correct_shift(B,1)-this._min_date)/(60*60*24*1000));if(C&&this.date.time_part(B)){A++}return A};scheduler.render_event_bar=function(H){var J=this._els.dhx_cal_data[0];var I=this._colsS[H._sday];var A=this._colsS[H._eday];if(A==I){A=this._colsS[H._eday+1]}var D=this.xy.bar_height;var G=this._colsS.heights[H._sweek]+(this._colsS.height?(this.xy.month_scale_height+2):2)+H._sorder*D;var F=document.createElement("DIV");var E=H._timed?"dhx_cal_event_clear":"dhx_cal_event_line";var B=scheduler.templates.event_class(H.start_date,H.end_date,H);if(B){E=E+" "+B}var C='
';if(H._timed){C+=scheduler.templates.event_bar_date(H.start_date,H.end_date,H)}C+=scheduler.templates.event_bar_text(H.start_date,H.end_date,H)+"
";C+="";F.innerHTML=C;this._rendered.push(F.firstChild);J.appendChild(F.firstChild)};scheduler._locate_event=function(A){var B=null;while(A&&!B&&A.getAttribute){B=A.getAttribute("event_id");A=A.parentNode}return B};scheduler.edit=function(A){if(this._edit_id==A){return }this.editStop(false,A);this._edit_id=A;this.updateEvent(A)};scheduler.editStop=function(B,C){if(C&&this._edit_id==C){return }var A=this.getEvent(this._edit_id);if(A){if(B){A.text=this._editor.value}this._edit_id=null;this._editor=null;this.updateEvent(A.id);this._edit_stop_event(A,B)}};scheduler._edit_stop_event=function(A,B){if(this._new_event){if(!B){this.deleteEvent(A.id,true)}else{this.callEvent("onEventAdded",[A.id,A])}this._new_event=null}else{if(B){this.callEvent("onEventChanged",[A.id,A])}}};scheduler.getEvents=function(E,D){var A=[];for(var B in this._events){var C=this._events[B];if(C&&C.start_dateE){A.push(C)}}return A};scheduler._loaded={};scheduler._load=function(C,F){C=C||this._load_url;C+=(C.indexOf("?")==-1?"?":"&")+"timeshift="+(new Date()).getTimezoneOffset();if(this.config.prevent_cache){C+="&uid="+this.uid()}var E;F=F||this._date;if(this._load_mode){var B=this.templates.load_format;F=this.date[this._load_mode+"_start"](new Date(F.valueOf()));while(F>this._min_date){F=this.date.add(F,-1,this._load_mode)}E=F;var D=true;while(EF&&this._loaded[B(A)]);if(E<=F){return false}dhtmlxAjax.get(C+"&from="+B(F)+"&to="+B(E),function(G){scheduler.on_load(G)});while(F"},set_value:function(B,C,A){B.firstChild.value=C||""},get_value:function(B,A){return B.firstChild.value},focus:function(B){var A=B.firstChild;A.select();A.focus()}},select:{render:function(D){var A=(D.height||"23")+"px";var C="
";return C},set_value:function(B,C,A){if(typeof C=="undefined"){C=(B.firstChild.options[0]||{}).value}B.firstChild.value=C||""},get_value:function(B,A){return B.firstChild.value},focus:function(B){var A=B.firstChild;if(A.select){A.select()}A.focus()}},time:{render:function(){var A=scheduler.config;var E=this.date.date_part(new Date());var D=24*60,G=0;if(scheduler.config.limit_time_select){D=60*A.last_hour+1;G=60*A.first_hour;E.setHours(A.first_hour)}var C=" ";return"
"+C+"  –  "+C+"
"},set_value:function(A,I,G){var J=A.getElementsByTagName("select");if(scheduler.config.full_day){if(!A._full_day){A.previousSibling.innerHTML+="
";A._full_day=true}var H=A.previousSibling.getElementsByTagName("input")[0];var F=(scheduler.date.time_part(G.start_date)==0&&scheduler.date.time_part(G.end_date)==0&&G.end_date.valueOf()-G.start_date.valueOf()<2*24*60*60*1000);H.checked=F;for(var B in J){J[B].disabled=H.checked}H.onclick=function(){if(H.checked){var K=new Date(G.start_date);var M=new Date(G.end_date);scheduler.date.date_part(K);M=scheduler.date.add(K,1,"day")}for(var L in J){J[L].disabled=H.checked}C(J,0,K||G.start_date);C(J,4,M||G.end_date)}}if(scheduler.config.auto_end_date&&scheduler.config.event_duration){function E(){G.start_date=new Date(J[3].value,J[2].value,J[1].value,0,J[0].value);G.end_date.setTime(G.start_date.getTime()+(scheduler.config.event_duration*60*1000));C(J,4,G.end_date)}for(var D=0;D<4;D++){J[D].onchange=E}}function C(L,K,M){L[K+0].value=Math.round((M.getHours()*60+M.getMinutes())/scheduler.config.time_step)*scheduler.config.time_step;L[K+1].value=M.getDate();L[K+2].value=M.getMonth();L[K+3].value=M.getFullYear()}C(J,0,G.start_date);C(J,4,G.end_date)},get_value:function(B,A){s=B.getElementsByTagName("select");A.start_date=new Date(s[3].value,s[2].value,s[1].value,0,s[0].value);A.end_date=new Date(s[7].value,s[6].value,s[5].value,0,s[4].value);if(A.end_date<=A.start_date){A.end_date=scheduler.date.add(A.start_date,scheduler.config.time_step,"minute")}},focus:function(A){A.getElementsByTagName("select")[0].focus()}}};scheduler.showCover=function(A){this.show_cover();if(A){A.style.display="block";var B=getOffset(this._obj);A.style.top=Math.round(B.top+(this._obj.offsetHeight-A.offsetHeight)/2)+"px";A.style.left=Math.round(B.left+(this._obj.offsetWidth-A.offsetWidth)/2)+"px"}};scheduler.showLightbox=function(B){if(!B){return }if(!this.callEvent("onBeforeLightbox",[B])){return }var A=this._get_lightbox();this.showCover(A);this._fill_lightbox(B,A);this.callEvent("onLightbox",[B])};scheduler._fill_lightbox=function(H,E){var D=this.getEvent(H);var B=E.getElementsByTagName("span");if(scheduler.templates.lightbox_header){B[1].innerHTML="";B[2].innerHTML=scheduler.templates.lightbox_header(D.start_date,D.end_date,D)}else{B[1].innerHTML=this.templates.event_header(D.start_date,D.end_date,D);B[2].innerHTML=(this.templates.event_bar_text(D.start_date,D.end_date,D)||"").substr(0,70)}var F=this.config.lightbox.sections;for(var A=0;A
"+this.locale.labels["button_"+E[B].button]+"
"}C+="
"+A+this.locale.labels["section_"+E[B].name]+"
"+F.render.call(this,E[B])}var D=G.getElementsByTagName("div");D[4].innerHTML=scheduler.locale.labels.icon_save;D[7].innerHTML=scheduler.locale.labels.icon_cancel;D[10].innerHTML=scheduler.locale.labels.icon_delete;D[1].innerHTML=C;this.setLightboxSize();this._init_lightbox_events(this);G.style.display="none";G.style.visibility="visible"}return this._lightbox};scheduler._lightbox_template="
 
 
 
 
";scheduler._dp_init=function(A){A._methods=["setEventTextStyle","","changeEventId","deleteEvent"];this.attachEvent("onEventAdded",function(B){if(!this._loading&&this.validId(B)){A.setUpdated(B,true,"inserted")}});this.attachEvent("onBeforeEventDelete",function(C){if(!this.validId(C)){return }var B=A.getState(C);if(B=="inserted"||this._new_event){A.setUpdated(C,false);return true}if(B=="deleted"){return false}if(B=="true_deleted"){return true}A.setUpdated(C,true,"deleted");return false});this.attachEvent("onEventChanged",function(B){if(!this._loading&&this.validId(B)){A.setUpdated(B,true,"updated")}});A._getRowData=function(F,B){var D=this.obj.getEvent(F);var E={};for(var C in D){if(C.indexOf("_")==0){continue}if(D[C]&&D[C].getUTCFullYear){E[C]=this.obj.templates.xml_format(D[C])}else{E[C]=D[C]}}return E};A._clearUpdateFlag=function(){};A.attachEvent("insertCallback",scheduler._update_callback);A.attachEvent("updateCallback",scheduler._update_callback);A.attachEvent("deleteCallback",function(B,C){this.obj.setUserData(C,this.action_param,"true_deleted");this.obj.deleteEvent(C)})};scheduler.setUserData=function(C,A,B){if(C){this.getEvent(C)[A]=B}else{this._userdata[A]=B}};scheduler.getUserData=function(B,A){return B?this.getEvent(B)[A]:this._userdata[A]};scheduler.setEventTextStyle=function(C,A){this.for_rendered(C,function(D){D.style.cssText+=";"+A});var B=this.getEvent(C);B._text_style=A;this.event_updated(B)};scheduler.validId=function(A){return true};scheduler._update_callback=function(B,C){var A=scheduler.xmlNodeToJSON(B.firstChild);A.text=A.text||A._tagvalue;A.start_date=scheduler.templates.xml_date(A.start_date);A.end_date=scheduler.templates.xml_date(A.end_date);scheduler.addEvent(A)}; /* dhtmlxScheduler v.2.3 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 (c) DHTMLX Ltd. */