/* 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 */ dhtmlx=function(a){for(var b in a)dhtmlx[b]=a[b];return dhtmlx}; dhtmlx.extend_api=function(a,b,c){var d=window[a];if(d)window[a]=function(a){if(a&&typeof a=="object"&&!a.tagName&&!(a instanceof Array)){var c=d.apply(this,b._init?b._init(a):arguments),g;for(g in dhtmlx)if(b[g])this[b[g]](dhtmlx[g]);for(g in a)if(b[g])this[b[g]](a[g]);else g.indexOf("on")==0&&this.attachEvent(g,a[g])}else c=d.apply(this,arguments);b._patch&&b._patch(this);return c||this},window[a].prototype=d.prototype,c&&dhtmlXHeir(window[a].prototype,c)}; dhtmlxAjax={get:function(a,b){var c=new dtmlXMLLoaderObject(!0);c.async=arguments.length<3;c.waitCall=b;c.loadXML(a);return c},post:function(a,b,c){var d=new dtmlXMLLoaderObject(!0);d.async=arguments.length<4;d.waitCall=c;d.loadXML(a,!0,b);return d},getSync:function(a){return this.get(a,null,!0)},postSync:function(a,b){return this.post(a,b,null,!0)}}; function dtmlXMLLoaderObject(a,b,c,d){this.xmlDoc="";this.async=typeof c!="undefined"?c:!0;this.onloadAction=a||null;this.mainObject=b||null;this.waitCall=null;this.rSeed=d||!1;return this} dtmlXMLLoaderObject.prototype.waitLoadFunction=function(a){var b=!0;return this.check=function(){if(a&&a.onloadAction!=null&&(!a.xmlDoc.readyState||a.xmlDoc.readyState==4)&&b){b=!1;if(typeof a.onloadAction=="function")a.onloadAction(a.mainObject,null,null,null,a);if(a.waitCall)a.waitCall.call(this,a),a.waitCall=null}}}; dtmlXMLLoaderObject.prototype.getXMLTopNode=function(a,b){if(this.xmlDoc.responseXML){var c=this.xmlDoc.responseXML.getElementsByTagName(a);c.length==0&&a.indexOf(":")!=-1&&(c=this.xmlDoc.responseXML.getElementsByTagName(a.split(":")[1]));var d=c[0]}else d=this.xmlDoc.documentElement;if(d)return this._retry=!1,d;if(_isIE&&!this._retry){var e=this.xmlDoc.responseText,b=this.xmlDoc;this._retry=!0;this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM");this.xmlDoc.async=!1;this.xmlDoc.loadXML(e);return this.getXMLTopNode(a, b)}dhtmlxError.throwError("LoadXML","Incorrect XML",[b||this.xmlDoc,this.mainObject]);return document.createElement("DIV")};dtmlXMLLoaderObject.prototype.loadXMLString=function(a){try{var b=new DOMParser;this.xmlDoc=b.parseFromString(a,"text/xml")}catch(c){this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM"),this.xmlDoc.async=this.async,this.xmlDoc.loadXML(a)}this.onloadAction(this.mainObject,null,null,null,this);if(this.waitCall)this.waitCall(),this.waitCall=null}; dtmlXMLLoaderObject.prototype.loadXML=function(a,b,c,d){this.rSeed&&(a+=(a.indexOf("?")!=-1?"&":"?")+"a_dhx_rSeed="+(new Date).valueOf());this.filePath=a;this.xmlDoc=!_isIE&&window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");if(this.async)this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this);this.xmlDoc.open(b?"POST":"GET",a,this.async);d?(this.xmlDoc.setRequestHeader("User-Agent","dhtmlxRPC v0.1 ("+navigator.userAgent+")"),this.xmlDoc.setRequestHeader("Content-type", "text/xml")):b&&this.xmlDoc.setRequestHeader("Content-type","application/x-www-form-urlencoded");this.xmlDoc.setRequestHeader("X-Requested-With","XMLHttpRequest");this.xmlDoc.send(c);this.async||(new this.waitLoadFunction(this))()};dtmlXMLLoaderObject.prototype.destructor=function(){return this.xmlDoc=this.mainObject=this.onloadAction=null}; dtmlXMLLoaderObject.prototype.xmlNodeToJSON=function(a){for(var b={},c=0;c-1&&(_isChrome=!0); if(navigator.userAgent.indexOf("Safari")!=-1||navigator.userAgent.indexOf("Konqueror")!=-1){var x=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Safari")+7,5));if(x>525){_isFF=!0;var w=1.9}else _isKHTML=!0}else navigator.userAgent.indexOf("Opera")!=-1?(_isOpera=!0,_OperaRv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Opera")+6,3))):navigator.appName.indexOf("Microsoft")!=-1?(_isIE=!0,navigator.appVersion.indexOf("MSIE 8.0")!=-1&&document.compatMode!="BackCompat"&& (_isIE=8)):(_isFF=!0,w=parseFloat(navigator.userAgent.split("rv:")[1])); dtmlXMLLoaderObject.prototype.doXPath=function(a,b,c,d){if(_isKHTML||!_isIE&&!window.XPathResult)return this.doXPathOpera(a,b);if(_isIE)return b||(b=this.xmlDoc.nodeName?this.xmlDoc:this.xmlDoc.responseXML),b||dhtmlxError.throwError("LoadXML","Incorrect XML",[b||this.xmlDoc,this.mainObject]),c!=null&&b.setProperty("SelectionNamespaces","xmlns:xsl='"+c+"'"),d=="single"?b.selectSingleNode(a):b.selectNodes(a)||[];else{var e=b;b||(b=this.xmlDoc.nodeName?this.xmlDoc:this.xmlDoc.responseXML);b||dhtmlxError.throwError("LoadXML", "Incorrect XML",[b||this.xmlDoc,this.mainObject]);b.nodeName.indexOf("document")!=-1?e=b:(e=b,b=b.ownerDocument);var f=XPathResult.ANY_TYPE;if(d=="single")f=XPathResult.FIRST_ORDERED_NODE_TYPE;var g=[],h=b.evaluate(a,e,function(){return c},f,null);if(f==XPathResult.FIRST_ORDERED_NODE_TYPE)return h.singleNodeValue;for(var i=h.iterateNext();i;)g[g.length]=i,i=h.iterateNext();return g}};function z(){if(!this.catches)this.catches=[];return this}z.prototype.catchError=function(a,b){this.catches[a]=b}; z.prototype.throwError=function(a,b,c){if(this.catches[a])return this.catches[a](a,b,c);if(this.catches.ALL)return this.catches.ALL(a,b,c);alert("Error type: "+a+"\nDescription: "+b);return null};window.dhtmlxError=new z; dtmlXMLLoaderObject.prototype.doXPathOpera=function(a,b){var c=a.replace(/[\/]+/gi,"/").split("/"),d=null,e=1;if(!c.length)return[];if(c[0]==".")d=[b];else if(c[0]=="")d=(this.xmlDoc.responseXML||this.xmlDoc).getElementsByTagName(c[e].replace(/\[[^\]]*\]/g,"")),e++;else return[];for(;e0?"&dhx_no_header=1":"")},b=function(b){return a.call(this,b)+(this._connector_sorting||"")+(this._connector_filter||"")},c=function(a,c,d){this._connector_sorting="&dhx_sort["+c+"]="+d;return b.call(this, a)},d=function(a,c,d){for(var h=0;h0)this.xy.nav_height=e;var f=this.xy.scale_height+ this.xy.nav_height+(this._quirks?-2:0);this.set_xy(this._els.dhx_cal_data[0],a,b-(f+2),0,f+2)};scheduler.set_xy=function(a,b,c,d,e){a.style.width=Math.max(0,b)+"px";a.style.height=Math.max(0,c)+"px";if(arguments.length>3)a.style.left=d+"px",a.style.top=e+"px"}; scheduler.get_elements=function(){for(var a=this._obj.getElementsByTagName("DIV"),b=0;bf.getHours()&&(f.setHours(g),a=f.valueOf());b=a+e}var h=new Date(b);f.valueOf()==h.valueOf()&&h.setTime(h.valueOf()+e);d.start_date=d.start_date||f;d.end_date=d.end_date||h;d.text=d.text||this.locale.labels.new_event;d.id=this._drag_id= this.uid();this._drag_mode="new-size";this._loading=!0;this.addEvent(d);this.callEvent("onEventCreated",[this._drag_id,c]);this._loading=!1;this._drag_event={};this._on_mouse_up(c)}; scheduler._on_dbl_click=function(a,b){b=b||a.target||a.srcElement;if(!this.config.readonly){var c=b.className.split(" ")[0];switch(c){case "dhx_scale_holder":case "dhx_scale_holder_now":case "dhx_month_body":case "dhx_wa_day_data":if(!scheduler.config.dblclick_create)break;var d=this._mouse_coords(a),e=this._min_date.valueOf()+(d.y*this.config.time_step+(this._table_view?0:d.x)*1440)*6E4,e=this._correct_shift(e);this.addEventNow(e,null,a);break;case "dhx_body":case "dhx_wa_ev_body":case "dhx_cal_event_line":case "dhx_cal_event_clear":var f= this._locate_event(b);if(!this.callEvent("onDblClick",[f,a]))break;this.config.details_on_dblclick||this._table_view||!this.getEvent(f)._timed?this.showLightbox(f):this.edit(f);break;case "":if(b.parentNode)return scheduler._on_dbl_click(a,b.parentNode);default:var g=this["dblclick_"+c];g&&g.call(this,a)}}}; scheduler._mouse_coords=function(a){var b,c=document.body,d=document.documentElement;b=a.pageX||a.pageY?{x:a.pageX,y:a.pageY}:{x:a.clientX+(c.scrollLeft||d.scrollLeft||0)-c.clientLeft,y:a.clientY+(c.scrollTop||d.scrollTop||0)-c.clientTop};b.x-=getAbsoluteLeft(this._obj)+(this._table_view?0:this.xy.scale_width);b.y-=getAbsoluteTop(this._obj)+this.xy.nav_height+(this._dy_shift||0)+this.xy.scale_height-this._els.dhx_cal_data[0].scrollTop;b.ev=a;var e=this["mouse_"+this._mode];if(e)return e.call(this, b);if(this._table_view){for(var f=0,f=1;fb.y)break;b.y=(Math.max(0,Math.ceil(b.x/this._cols[0])-1)+Math.max(0,f-1)*7)*1440/this.config.time_step;b.x=0}else b.x=Math.max(0,Math.ceil(b.x/this._cols[0])-1),b.y=Math.max(0,Math.ceil(b.y*60/(this.config.time_step*this.config.hour_size_px))-1)+this.config.first_hour*(60/this.config.time_step);return b}; scheduler._close_not_saved=function(){if((new Date).valueOf()-(scheduler._new_event||0)>500&&scheduler._edit_id){var a=scheduler.locale.labels.confirm_closing;(!a||confirm(a))&&scheduler.editStop(scheduler.config.positive_closing)}};scheduler._correct_shift=function(a,b){return a-=((new Date(scheduler._min_date)).getTimezoneOffset()-(new Date(a)).getTimezoneOffset())*6E4*(b?-1:1)}; scheduler._on_mouse_move=function(a){if(this._drag_mode){var b=this._mouse_coords(a);if(!this._drag_pos||b.custom||this._drag_pos.x!=b.x||this._drag_pos.y!=b.y){this._edit_id!=this._drag_id&&this._close_not_saved();this._drag_pos=b;if(this._drag_mode=="create"){this._close_not_saved();this._loading=!0;var c=this._min_date.valueOf()+(b.y*this.config.time_step+(this._table_view?0:b.x)*1440)*6E4,c=this._correct_shift(c);if(!this._drag_start){this._drag_start=c;return}var d=c;if(d==this._drag_start)return; this._drag_id=this.uid();this.addEvent(new Date(this._drag_start),new Date(d),this.locale.labels.new_event,this._drag_id,b.fields);this.callEvent("onEventCreated",[this._drag_id,a]);this._loading=!1;this._drag_mode="new-size"}var e=this.getEvent(this._drag_id);if(this._drag_mode=="move")c=this._min_date.valueOf()+(b.y*this.config.time_step+b.x*1440)*6E4,!b.custom&&this._table_view&&(c+=this.date.time_part(e.start_date)*1E3),c=this._correct_shift(c),d=e.end_date.valueOf()-(e.start_date.valueOf()-c); else{c=e.start_date.valueOf();if(this._table_view)d=this._min_date.valueOf()+b.y*this.config.time_step*6E4+(b.custom?0:864E5),this._mode=="month"&&(d=this._correct_shift(d,!1));else if(d=this.date.date_part(new Date(e.end_date)).valueOf()+b.y*this.config.time_step*6E4,this._els.dhx_cal_data[0].style.cursor="s-resize",this._mode=="week"||this._mode=="day")d=this._correct_shift(d);if(this._drag_mode=="new-size")if(d<=this._drag_start)var f=b.shift||(this._table_view&&!b.custom?864E5:0),c=d-(b.shift? 0:f),d=this._drag_start+(f||this.config.time_step*6E4);else c=this._drag_start;else d<=c&&(d=c+this.config.time_step*6E4)}var g=new Date(d-1),h=new Date(c);if(this._table_view||g.getDate()==h.getDate()&&g.getHours()this._min_date&&t.getHours()>=this.config.first_hour&&t.getHours()";for(var o=0;o<7;o++){l+= "=d?m="dhx_after":c.valueOf()==e.valueOf()&&(m="dhx_now");l+=" class='"+m+" "+this.templates.month_date_class(c,e)+"' ";l+=">
"+this.templates.month_day(c)+"
";c=this.date.add(c,1,"day")}l+="";i[k]=j;j+=this._colsS.height}l+="";this._max_date=c;a.innerHTML=l;return c}; scheduler.getLabel=function(a,b){for(var c=this.config.lightbox.sections,d=0;d11?"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 a}});b&&(a=a.replace(/date\.get/g, "date.getUTC"));return new Function("date",'return "'+a+'";')},str_to_date:function(a,b){for(var c="var temp=date.split(/[^0-9a-zA-Z]+/g);",d=a.match(/%[a-zA-Z]/g),e=0;e50?1900:2000);";break;case "%g":case "%G":case "%h":case "%H":c+="set[3]=temp["+e+"]||0;";break;case "%i":c+="set[4]=temp["+e+"]||0;";break;case "%Y":c+= "set[0]=temp["+e+"]||0;";break;case "%a":case "%A":c+="set[3]=set[3]%12+((temp["+e+"]||'').toLowerCase()=='am'?0:12);";break;case "%s":c+="set[5]=temp["+e+"]||0;";break;case "%M":c+="set[1]=scheduler.locale.date.month_short_hash[temp["+e+"]]||0;";break;case "%F":c+="set[1]=scheduler.locale.date.month_full_hash[temp["+e+"]]||0;"}var f="set[0],set[1],set[2],set[3],set[4],set[5]";b&&(f=" Date.UTC("+f+")");return new Function("date","var set=[0,0,1,0,0,0]; "+c+" return new Date("+f+");")},getISOWeek:function(a){if(!a)return!1; var b=a.getDay();b===0&&(b=7);var c=new Date(a.valueOf());c.setDate(a.getDate()+(4-b));var d=c.getFullYear(),e=Math.round((c.getTime()-(new Date(d,0,1)).getTime())/864E5),f=1+Math.floor(e/7);return f},getUTCISOWeek:function(a){return this.getISOWeek(a)}}; scheduler.locale={date:{month_full:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),month_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),day_full:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},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",week_agenda_tab:"Agenda"}}; 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:!1,drag_resize:1,drag_move:1,drag_create:1,dblclick_create:1,edit_on_create:1,details_on_create:0,click_form_details:0,cascade_event_display:!1,cascade_event_count:4,cascade_event_margin:30,drag_lightbox:!0,preserve_scroll:!0, server_utc:!1,positive_closing:!1,icons_edit:["icon_save","icon_cancel"],icons_select:["icon_details","icon_edit","icon_delete"],buttons_left:["dhx_save_btn","dhx_cancel_btn"],buttons_right:["dhx_delete_btn"],lightbox:{sections:[{name:"description",height:200,map_to:"text",type:"textarea",focus:!0},{name:"time",height:72,type:"time",map_to:"auto"}]},repeat_date_of_end:"01.01.2010"};scheduler.templates={}; scheduler.init_templates=function(){var a=scheduler.date.date_to_str,b=scheduler.config,c=function(a,b){for(var c in b)a[c]||(a[c]=b[c])};c(scheduler.templates,{day_date:a(b.default_date),month_date:a(b.month_date),week_date:function(a,b){return scheduler.templates.day_date(a)+" – "+scheduler.templates.day_date(scheduler.date.add(b,-1,"day"))},day_scale_date:a(b.default_date),month_scale_date:a(b.week_date),week_scale_date:a(b.day_date),hour_scale:a(b.hour_date),time_picker:a(b.hour_date),event_date:a(b.hour_date), month_day:a(b.month_day),xml_date:scheduler.date.str_to_date(b.xml_date,b.server_utc),load_format:a(b.load_date,b.server_utc),xml_format:a(b.xml_date,b.server_utc),api_date:scheduler.date.str_to_date(b.api_date),event_header:function(a,b){return scheduler.templates.event_date(a)+" - "+scheduler.templates.event_date(b)},event_text:function(a,b,c){return c.text},event_class:function(){return""},month_date_class:function(){return""},week_date_class:function(){return""},event_bar_date:function(a){return scheduler.templates.event_date(a)+ " "},event_bar_text:function(a,b,c){return c.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,b,c,d,e){if(!arguments.length)return this.addEventNow();var f=a;if(arguments.length!=1)f=e||{},f.start_date=a,f.end_date=b,f.text=c,f.id=d;f.id=f.id||scheduler.uid();f.text=f.text||"";if(typeof f.start_date=="string")f.start_date=this.templates.api_date(f.start_date);if(typeof f.end_date=="string")f.end_date=this.templates.api_date(f.end_date);var g=(this.config.event_duration||this.config.time_step)*6E4;f.start_date.valueOf()==f.end_date.valueOf()&&f.end_date.setTime(f.end_date.valueOf()+ g);f._timed=this.is_one_day_event(f);var h=!this._events[f.id];this._events[f.id]=f;this.event_updated(f);this._loading||this.callEvent(h?"onEventAdded":"onEventChanged",[f.id,f])};scheduler.deleteEvent=function(a,b){var c=this._events[a];if(b||this.callEvent("onBeforeEventDelete",[a,c])&&this.callEvent("onConfirmedBeforeEventDelete",[a,c]))c&&(delete this._events[a],this.unselect(a),this.event_updated(c)),this.callEvent("onEventDeleted",[a])};scheduler.getEvent=function(a){return this._events[a]}; scheduler.setEvent=function(a,b){this._events[a]=b};scheduler.for_rendered=function(a,b){for(var c=this._rendered.length-1;c>=0;c--)this._rendered[c].getAttribute("event_id")==a&&b(this._rendered[c],c)};scheduler.changeEventId=function(a,b){if(a!=b){var c=this._events[a];if(c)c.id=b,this._events[b]=c,delete this._events[a];this.for_rendered(a,function(a){a.setAttribute("event_id",b)});if(this._select_id==a)this._select_id=b;if(this._edit_id==a)this._edit_id=b;this.callEvent("onEventIdChange",[a,b])}}; (function(){for(var a="text,Text,start_date,StartDate,end_date,EndDate".split(","),b=function(a){return function(b){return scheduler.getEvent(b)[a]}},c=function(a){return function(b,c){var d=scheduler.getEvent(b);d[a]=c;d._changed=!0;d._timed=this.is_one_day_event(d);scheduler.event_updated(d,!0)}},d=0;dthis._colsS.height-22){for(var i=g.rows[h].cells,k=0;kb.id?1:-1:a.start_date>b.start_date?1:-1});for(var c=[],d=[],e=0;el)l=i[j]._sorder;f._sorder=l+1;f._inner=!1}else f._sorder=0;i.push(f);i.length>(i.max_count||0)?(i.max_count=i.length,f._count= i.length):f._count=f._count?f._count:1}if(g=this.config.last_hour)if(d.push(f),a[e]=f=this._copy_event(f),g=this.config.last_hour&&(f.end_date.setMinutes(0),f.end_date.setHours(this.config.last_hour)),f.start_date>f.end_date||g==this.config.last_hour)a.splice(e,1),e--}if(!b){for(e=0;ec.id?1:-1:a.start_date>c.start_date?1:-1})}; scheduler._pre_render_events_table=function(a,b){this._time_order(a);for(var c=[],d=[[],[],[],[],[],[],[]],e=this._colsS.heights,f,g=this._cols.length,h=0;hthis._max_date)j=this._max_date;var l=this.locate_holder_day(k,!1,i);i._sday=l%g;var o=this.locate_holder_day(j,!0,i)||g;i._eday=o%g||g;i._length=o-l;i._sweek=Math.floor((this._correct_shift(k.valueOf(),1)-this._min_date.valueOf())/(864E5*g));var m= d[i._sweek],n;for(n=0;n";if(this._quirks7)m.firstChild.style.height=g- 12+"px";this._editor=m.firstChild;this._editor.onkeypress=function(a){if((a||event).shiftKey)return!0;var b=(a||event).keyCode;b==scheduler.keys.edit_save&&scheduler.editStop(!0);b==scheduler.keys.edit_cancel&&scheduler.editStop(!1)};this._editor.onselectstart=function(a){return(a||event).cancelBubble=!0};m.firstChild.focus();this._els.dhx_cal_data[0].scrollLeft=0;m.firstChild.select()}if(this._select_id==a.id){if(this.config.cascade_event_display&&this._drag_mode)o.style.zIndex=1;for(var n=this.config["icons_"+ (this._edit_id==a.id?"edit":"select")],p="",q=a.color?"background-color:"+a.color+";":"",v=a.textColor?"color:"+a.textColor+";":"",s=0;s";var r=this._render_v_bar(a.id,i-b+1,f,b,n.length*20+26,"","
",p,!0);r.style.left=i-b+1;this._els.dhx_cal_data[0].appendChild(r);this._rendered.push(r)}}}}; scheduler._render_v_bar=function(a,b,c,d,e,f,g,h,i){var k=document.createElement("DIV"),j=this.getEvent(a),l="dhx_cal_event",o=scheduler.templates.event_class(j.start_date,j.end_date,j);o&&(l=l+" "+o);var m=j.color?"background-color:"+j.color+";":"",n=j.textColor?"color:"+j.textColor+";":"",p='
';p+='
 
'; p+='
'+g+"
";p+='
'+h+"
";p+='
';k.innerHTML=p;return k.firstChild};scheduler.locate_holder=function(a){return this._mode=="day"?this._els.dhx_cal_data[0].firstChild:this._els.dhx_cal_data[0].childNodes[a]}; scheduler.locate_holder_day=function(a,b){var c=Math.floor((this._correct_shift(a,1)-this._min_date)/864E5);b&&this.date.time_part(a)&&c++;return c}; scheduler.render_event_bar=function(a){var b=this._rendered_location,c=this._colsS[a._sday],d=this._colsS[a._eday];d==c&&(d=this._colsS[a._eday+1]);var e=this.xy.bar_height,f=this._colsS.heights[a._sweek]+(this._colsS.height?this.xy.month_scale_height+2:2)+a._sorder*e,g=document.createElement("DIV"),h=a._timed?"dhx_cal_event_clear":"dhx_cal_event_line",i=scheduler.templates.event_class(a.start_date,a.end_date,a);i&&(h=h+" "+i);var k=a.color?"background-color:"+a.color+";":"",j=a.textColor?"color:"+ a.textColor+";":"",l='
';a._timed&&(l+=scheduler.templates.event_bar_date(a.start_date,a.end_date,a));l+=scheduler.templates.event_bar_text(a.start_date,a.end_date,a)+"
";l+="";g.innerHTML=l;this._rendered.push(g.firstChild);b.appendChild(g.firstChild)}; scheduler._locate_event=function(a){for(var b=null;a&&!b&&a.getAttribute;)b=a.getAttribute("event_id"),a=a.parentNode;return b};scheduler.edit=function(a){if(this._edit_id!=a)this.editStop(!1,a),this._edit_id=a,this.updateEvent(a)};scheduler.editStop=function(a,b){if(!(b&&this._edit_id==b)){var c=this.getEvent(this._edit_id);if(c){if(a)c.text=this._editor.value;this._editor=this._edit_id=null;this.updateEvent(c.id);this._edit_stop_event(c,a)}}}; scheduler._edit_stop_event=function(a,b){this._new_event?(b?this.callEvent("onEventAdded",[a.id,a]):this.deleteEvent(a.id,!0),this._new_event=null):b&&this.callEvent("onEventChanged",[a.id,a])};scheduler.getEvents=function(a,b){var c=[],d;for(d in this._events){var e=this._events[d];e&&e.start_datea&&c.push(e)}return c};scheduler._loaded={}; scheduler._load=function(a,b){a=a||this._load_url;a+=(a.indexOf("?")==-1?"?":"&")+"timeshift="+(new Date).getTimezoneOffset();this.config.prevent_cache&&(a+="&uid="+this.uid());var c,b=b||this._date;if(this._load_mode){for(var d=this.templates.load_format,b=this.date[this._load_mode+"_start"](new Date(b.valueOf()));b>this._min_date;)b=this.date.add(b,-1,this._load_mode);c=b;for(var e=!0;cb&&this._loaded[d(f)]);if(c<=b)return!1;for(dhtmlxAjax.get(a+"&from="+d(b)+"&to="+d(c),function(a){scheduler.on_load(a)});b"},set_value:function(a,b){a.innerHTML=b||""},get_value:function(a){return a.innerHTML||""},focus:function(){}},textarea:{render:function(a){var b=(a.height||"130")+"px";return"
"},set_value:function(a,b){a.firstChild.value=b||""},get_value:function(a){return a.firstChild.value}, focus:function(a){var b=a.firstChild;b.select();b.focus()}},select:{render:function(a){for(var b=(a.height||"23")+"px",c="
";return c},set_value:function(a,b){if(typeof b=="undefined")b=(a.firstChild.options[0]||{}).value;a.firstChild.value=b||""},get_value:function(a){return a.firstChild.value},focus:function(a){var b= a.firstChild;b.select&&b.select();b.focus()}},time:{render:function(){var a=scheduler.config,b=this.date.date_part(new Date),c=1440,d=0;scheduler.config.limit_time_select&&(c=60*a.last_hour+1,d=60*a.first_hour,b.setHours(a.first_hour));for(var e=" ";return"
"+e+"  –  "+e+"
"},set_value:function(a, b,c){function d(a,b,c){a[b+0].value=Math.round((c.getHours()*60+c.getMinutes())/scheduler.config.time_step)*scheduler.config.time_step;a[b+1].value=c.getDate();a[b+2].value=c.getMonth();a[b+3].value=c.getFullYear()}var e=a.getElementsByTagName("select");if(scheduler.config.full_day){if(!a._full_day){var f="";scheduler.config.wide_form||(f=a.previousSibling.innerHTML+ f);a.previousSibling.innerHTML=f;a._full_day=!0}var g=a.previousSibling.getElementsByTagName("input")[0],h=scheduler.date.time_part(c.start_date)===0&&scheduler.date.time_part(c.end_date)===0&&c.end_date.valueOf()-c.start_date.valueOf()<1728E5;g.checked=h;for(var i in e)e[i].disabled=g.checked;g.onclick=function(){if(g.checked){var a=new Date(c.start_date),b=new Date(c.end_date);scheduler.date.date_part(a);b=scheduler.date.add(a,1,"day")}for(var f in e)e[f].disabled=g.checked;d(e,0,a||c.start_date); d(e,4,b||c.end_date)}}if(scheduler.config.auto_end_date&&scheduler.config.event_duration)for(var k=function(){c.start_date=new Date(e[3].value,e[2].value,e[1].value,0,e[0].value);c.end_date.setTime(c.start_date.getTime()+scheduler.config.event_duration*6E4);d(e,4,c.end_date)},j=0;j<4;j++)e[j].onchange=k;d(e,0,c.start_date);d(e,4,c.end_date)},get_value:function(a,b){s=a.getElementsByTagName("select");b.start_date=new Date(s[3].value,s[2].value,s[1].value,0,s[0].value);b.end_date=new Date(s[7].value, s[6].value,s[5].value,0,s[4].value);if(b.end_date<=b.start_date)b.end_date=scheduler.date.add(b.start_date,scheduler.config.time_step,"minute")},focus:function(a){a.getElementsByTagName("select")[0].focus()}}}; scheduler.showCover=function(a){if(a){a.style.display="block";var b=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop,c=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft,d=window.innerHeight||document.documentElement.clientHeight;a.style.top=b?Math.round(b+Math.max((d-a.offsetHeight)/2,0))+"px":Math.round(Math.max((d-a.offsetHeight)/2,0)+9)+"px";a.style.left=document.documentElement.scrollWidth>document.body.offsetWidth?Math.round(c+(document.body.offsetWidth- a.offsetWidth)/2)+"px":Math.round((document.body.offsetWidth-a.offsetWidth)/2)+"px"}this.show_cover()};scheduler.showLightbox=function(a){if(a&&this.callEvent("onBeforeLightbox",[a])){var b=this._get_lightbox();this.showCover(b);this._fill_lightbox(a,b);this.callEvent("onLightbox",[a])}}; scheduler._fill_lightbox=function(a,b){var c=this.getEvent(a),d=b.getElementsByTagName("span");scheduler.templates.lightbox_header?(d[1].innerHTML="",d[2].innerHTML=scheduler.templates.lightbox_header(c.start_date,c.end_date,c)):(d[1].innerHTML=this.templates.event_header(c.start_date,c.end_date,c),d[2].innerHTML=(this.templates.event_bar_text(c.start_date,c.end_date,c)||"").substr(0,70));for(var e=this.config.lightbox.sections,f=0;f
"+scheduler.locale.labels[c[d]]+"
";c=this.config.buttons_right;for(d=0;d
"+scheduler.locale.labels[c[d]]+"
";b+="";a.innerHTML=b;if(scheduler.config.drag_lightbox)a.firstChild.onmousedown= scheduler._ready_to_dnd,a.firstChild.onselectstart=function(){return!1},a.firstChild.style.cursor="pointer",scheduler._init_dnd_events();document.body.insertBefore(a,document.body.firstChild);this._lightbox=a;for(var e=this.config.lightbox.sections,b="",d=0;d
"+this.locale.labels["button_"+ e[d].button]+"
");this.config.wide_form&&(b+="
");b+="
"+g+this.locale.labels["section_"+e[d].name]+"
"+f.render.call(this,e[d]);b+="
"}}var h=a.getElementsByTagName("div");h[1].innerHTML=b;this.setLightboxSize();this._init_lightbox_events(this);a.style.display="none";a.style.visibility="visible"}return this._lightbox};scheduler._lightbox_template="
 
"; scheduler._dp_init=function(a){a._methods=["setEventTextStyle","","changeEventId","deleteEvent"];this.attachEvent("onEventAdded",function(b){!this._loading&&this.validId(b)&&a.setUpdated(b,!0,"inserted")});this.attachEvent("onConfirmedBeforeEventDelete",function(b){if(this.validId(b)){var c=a.getState(b);if(c=="inserted"||this._new_event)return a.setUpdated(b,!1),!0;if(c=="deleted")return!1;if(c=="true_deleted")return!0;a.setUpdated(b,!0,"deleted");return!1}});this.attachEvent("onEventChanged",function(b){!this._loading&& this.validId(b)&&a.setUpdated(b,!0,"updated")});a._getRowData=function(a){var c=this.obj.getEvent(a),d={},e;for(e in c)e.indexOf("_")!=0&&(d[e]=c[e]&&c[e].getUTCFullYear?this.obj.templates.xml_format(c[e]):c[e]);return d};a._clearUpdateFlag=function(){};a.attachEvent("insertCallback",scheduler._update_callback);a.attachEvent("updateCallback",scheduler._update_callback);a.attachEvent("deleteCallback",function(a,c){this.obj.setUserData(c,this.action_param,"true_deleted");this.obj.deleteEvent(c)})}; scheduler.setUserData=function(a,b,c){a?this.getEvent(a)[b]=c:this._userdata[b]=c};scheduler.getUserData=function(a,b){return a?this.getEvent(a)[b]:this._userdata[b]};scheduler.setEventTextStyle=function(a,b){this.for_rendered(a,function(a){a.style.cssText+=";"+b});var c=this.getEvent(a);c._text_style=b;this.event_updated(c)};scheduler.validId=function(){return!0}; scheduler._update_callback=function(a){var b=scheduler.xmlNodeToJSON(a.firstChild);b.text=b.text||b._tagvalue;b.start_date=scheduler.templates.xml_date(b.start_date);b.end_date=scheduler.templates.xml_date(b.end_date);scheduler.addEvent(b)};