Wtf.cal.utils=function(){return{evtRec:Wtf.data.Record.create(["eid","cid","startts","endts","subject","descr","location","showas","priority","recpattern","recend","resources","timestamp","dbflag"]),calRec:Wtf.data.Record.create([{name:"cid"},{name:"cname"},{name:"description"},{name:"location"},{name:"timezone"},{name:"colorcode"},{name:"caltype"},{name:"isdefault"},{name:"userid"},{name:"timestamp"}]),tempCalRec:Wtf.data.Record.create([{name:"id"},{name:"state1"}]),HexToDec:function(A){return(parseInt(A,16).toString(10))},MultiplyInt:function(B,A){return Math.round(B*A)},getTimeIndNo:function(A,C){var D=[];A=A.toLowerCase();var B=A.split(" ");B[0]=B[0].split(":")[0];A=B[0]+B[1];if(A.indexOf("a")!=-1){D=A.split("am");if(D[0]==12){if(C){D[0]=24}else{D[0]=0}}}else{D=A.split("pm");if(D[0]!=12){D[0]=parseInt(D[0],10)+12}else{D[0]=12}}return D[0]},getHourStr:function(A){var B=[];if(A==24){B.push("12 ");B.push("AM")}else{if(A>12){B.push(A%12+" ");B.push("PM")}else{if(A==12){B.push("12 ");B.push("PM")}else{if(A==0){B.push("12 ");B.push("AM")}else{B.push(A+" ");B.push("AM")}}}}return B},getCalCtrl:function(){var A=Wtf.getCmp("as").getActiveTab();var B=null;if(A!=null){if(A.id=="ascalctrl"){B=Wtf.getCmp("ascalctrl")}else{B=Wtf.getCmp(A.id.substr(3)+"calctrl")}}return B},sqlToJsDate:function(B){if(B){var F;var A=B.lastIndexOf(".");if(A==-1){F=B}else{F=B.substring(0,A)}var E=F.split(" ");var C=E[0].split("-");var D=E[1].split(":");return(new Date(C[1]+"/"+C[2]+"/"+C[0]+" "+D[0]+":"+D[1]+":"+D[2]))}return null},findAndReplace:function(D,A,C){var B=D.find(A,C[0].data[A],0,false,true);if(B!=-1){D.remove(D.getAt(B))}D.add(C)},DateDiff:function(D,C){var F=typeof D;var A=0;if(F=="string"){var E=new Date();E=Date.parseDate(D,"d/m/Y");var B=new Date();B=Date.parseDate(C,"d/m/Y");var G=E.getTime()-B.getTime();A=Math.floor(G/1000/60/60/24)}else{C=C.clearTime(false);var G=D.getTime()-C.getTime();A=Math.floor(G/1000/60/60/24)}return(A)},ShowErrorMsgBox:function(A){msgBoxShow(["Invalid Input",A],Wtf.MessageBox.ERROR)},getPermissionLevel:function(C,D){var B="";var A=C.calTree.agendaStore.find("cid",D);if(A!=-1){B=C.calTree.agendaStore.getAt(A).data["permissionlevel"]}return B},HTMLScriptStripper:function(A){return Wtf.util.Format.stripTags(A)},getPermLevelByEid:function(D,A){var E="";var C="";var B=D.eStore.find("eid",A);if(B!=-1){E=D.eStore.getAt(B).data["cid"]}B=D.calTree.agendaStore.find("cid",E);if(B!=-1){C=D.calTree.agendaStore.getAt(B).data["permissionlevel"]}return C}}}();Wtf.form.ComboBox.country=[["ma","Malaysia"],["In","India"],["jp","Japan"],["US","America"]];Wtf.form.ComboBox.timezone=[["myt","(GMT+08:00)Malaysian Standard Time"],["ist","(GMT+05:30)Indian Standard Time"],["jst","(GMT+09:00)Japan Standard Time"],["hst","(GMT-10:00)Hawaii Standard Time"]];Wtf.form.ComboBox.dupdata=[["b","Busy"],["t","Tentative"],["o","Out of Office"]];Wtf.form.ComboBox.dupmark=[["h","High"],["m","Moderate"],["l","Low"]];Wtf.form.ComboBox.dupReminder=[["e","E-mail"],["p","Pop up"]];Wtf.form.ComboBox.dupReminTime=[["5","5 minutes"],["10","10 minutes"],["15","15 minutes"],["30","30 minutes"],["60","1 hour"],["120","2 hours"],["300","5 hours"],["720","12 hours"],["1440","1 day"],["2880","2 days"],["10080","1 week"]];Wtf.form.ComboBox.duptime=[[0,"12 AM"],[1,"1 AM"],[2,"2 AM"],[3,"3 AM"],[4,"4 AM"],[5,"5 AM"],[6,"6 AM"],[7,"7 AM"],[8,"8 AM"],[9,"9 AM"],[10,"10 AM"],[11,"11 AM"],[12,"12 PM"],[13,"1 PM"],[14,"2 PM"],[15,"3 PM"],[16,"4 PM"],[17,"5 PM"],[18,"6 PM"],[19,"7 PM"],[20,"8 PM"],[21,"9 PM"],[22,"10 PM"],[23,"11 PM"]];Wtf.form.ComboBox.resourcename=[["1","Make changes to events"],["2","See all the events details"]];Wtf.cal.eventForms=function(A){this.parent=A;Wtf.cal.eventForms.superclass.constructor.call(this)};Wtf.extend(Wtf.cal.eventForms,Wtf.Component,{AddRecurring:function(){if(Wtf.isGecko==true){h=150}if(Wtf.isIE==true){h=130}win1=new Wtf.Window({id:this.parent.id+"Recurring",title:"Recurring",closable:true,width:240,height:350,resizable:false,modal:true,plain:true,layout:"fit",items:[{xtype:"form",frame:true,border:false,hideBorders:true,items:[{xtype:"fieldset",title:"Recurring Pattern",height:h,items:[{items:[{xtype:"radio",hideLabel:"true",checked:true,id:this.parent.id+"Daily",boxLabel:"Daily",name:"group1",value:"Daily"},{layout:"column",items:[{columnWidth:0.4,items:[{xtype:"radio",id:this.parent.id+"Weekly",hideLabel:"true",boxLabel:"Weekly , ",name:"group1",value:"Weekly"}]},{columnWidth:0.6,items:[{xtype:"textfield",id:this.parent.id+"weekTextBox",width:25}],html:"<label class='labelAlign'> week(s)</label>"}]},{xtype:"radio",hideLabel:"true",id:this.parent.id+"Monthly",boxLabel:"Monthly",name:"group1",value:"Monthly"},{xtype:"radio",hideLabel:"true",id:this.parent.id+"Yearly",boxLabel:"Yearly",name:"group1",value:"Yearly"}]}]},{xtype:"fieldset",title:"End of Recurrence",height:100,items:[{items:[{xtype:"radio",hideLabel:"true",checked:true,id:this.parent.id+"noEnd",boxLabel:"No end",name:"group2",value:"noEnd"},{layout:"column",items:[{columnWidth:0.4,items:[{xtype:"radio",hideLabel:"true",id:this.parent.id+"EndBy",boxLabel:"End by",name:"group2",value:"EndBy"}]},{columnWidth:0.6,labelWidth:50,items:[new Wtf.form.DateField({editable:false,hideLabel:true,format:Wtf.getDateFormat(),id:this.parent.id+"edate2"})]}]}]}]}]}],buttons:[{id:this.parent.id+"OkButton",handler:this.RecurrsionOK,scope:this,text:"OK"},{id:this.parent.id+"CancelButton",handler:this.RecurrsionCancel,scope:this,text:"Cancel"}]});win1.show();if(this.parent.rec[0]!=undefined&&this.parent.rec[0]!=""){Wtf.getCmp(this.parent.id+this.parent.rec[0]).setValue(1);if(this.parent.rec[0]=="Weekly"){Wtf.getCmp(this.parent.id+"weekTextBox").setValue(this.parent.rec[1])}}if(this.parent.rec[2]!=undefined&&this.parent.rec[2]!=""){Wtf.getCmp(this.parent.id+this.parent.rec[2]).setValue(1);if(this.parent.rec[2]=="EndBy"){Wtf.getCmp(this.parent.id+"edate2").setValue(this.parent.rec[3])}}},oncheck1:function(A,B){if(B.checked==true){Wtf.get(this.id+"timeRight").hide()}if(B.checked==false){Wtf.get(this.id+"timeRight").show()}},oncheck2:function(A,B){if(B.checked==true){}else{for(i=0;i<4;i++){this.parent.rec[i]=""}}},AddEditToolbar:function(){this.parent.add(new Wtf.Panel({border:false,layout:"fit",id:this.parent.id+"Appointmentform"}))},deleteGuest:function(E){var B=Wtf.getCmp(this.parent.id+"guestGrid");var A=B.getSelectionModel();var C=A.getSelections();var D=B.getStore();Wtf.MessageBox.confirm("Confirm Delete","Are you sure you want to delete?",function(F){if(F=="yes"){D.remove(C[0])}})},clearAppointmentValues:function(){Wtf.getCmp(this.parent.id+"Subject").setValue("");Wtf.getCmp(this.parent.id+"Location").setValue("");Wtf.getCmp(this.parent.id+"stime1").setValue("");Wtf.getCmp(this.parent.id+"etime1").setValue("");Wtf.getCmp(this.parent.id+"sdate1").setValue("");Wtf.getCmp(this.parent.id+"edate1").setValue("");Wtf.getCmp(this.parent.id+"Description").setValue("");Wtf.getCmp(this.parent.id+"showas").setValue("b");Wtf.getCmp(this.parent.id+"comboPriority").setValue("m");Wtf.getCmp(this.parent.id+"Resources").setValue("");var A=Wtf.getCmp(this.parent.id+"guestGrid");A.getStore().removeAll();for(var B=0;B<5;B++){if(Wtf.getCmp(this.parent.id+"MainRemindPanel"+B)!=undefined){Wtf.getCmp(this.parent.id+"MainRemindPanel"+B).destroy()}Wtf.getCmp(this.parent.id+"ReminderButton").enable()}},AddingTabPanelEvent:function(){var F;this.parent.hideMaintoolbar();this.parent.showFormtoolbar();this.parent.formview="Appointmentform";var D=Wtf.getCmp(this.parent.id+"Appointmentform");if(!D||!this.parent.apptForm){this.AddEditToolbar();D=Wtf.getCmp(this.parent.id+"Appointmentform");this.parent.showCalPanel(D)}else{this.parent.showCalPanel(D);this.clearAppointmentValues();return }this.guestRecord=Wtf.data.Record.create([{name:"username"},{name:"userid"},{name:"emailid"},{name:"response"},{name:"delmail"}]);this.dsGuest=new Wtf.data.Store({reader:new Wtf.data.ArrayReader({},this.guestRecord)});var B=new Wtf.grid.ColumnModel([{header:"Name",dataIndex:"username",mapping:"username"},{header:"user Id",dataIndex:"userid",mapping:"userid",hidden:true},{header:"Email Id",dataIndex:"emailid",mapping:"emailid"},{header:"Response",dataIndex:"response",mapping:"response"},{header:"Delete",width:40,renderer:this.delmail,dataIndex:"delmail"}]);var C=new Wtf.grid.RowSelectionModel();var A=new Wtf.grid.GridPanel({ds:this.dsGuest,id:this.parent.id+"guestGrid",cm:B,sm:C,height:190,width:"100%",viewConfig:{forceFit:true}});var E;if(Wtf.isGecko){E=150}if(Wtf.isIE){E=140}Wtf.getCmp(this.parent.id+"Appointmentform").add(tabpanel=new Wtf.TabPanel({id:this.parent.id+"tabPanel",border:false,deferredRender:true,activeTab:0,items:[{title:"Event",id:this.parent.id+"Appointment",autoScroll:true,bodyStyle:"position: relative;",border:false,layout:"column",frame:true,items:[new Wtf.Panel({frame:true,border:false,columnWidth:0.65,height:440,items:[{xtype:"form",title:"Event Details",items:[{xtype:"fieldset",id:this.parent.id+"detailsDiv",title:"Details",height:85,labelWidth:65,items:[{xtype:"textfield",fieldLabel:"Subject*",allowBlank:false,id:this.parent.id+"Subject",width:"97%"},{layout:"column",items:[{columnWidth:0.4999,labelWidth:65,layout:"form",items:[new Wtf.form.ComboBox({fieldLabel:"Show As",id:this.parent.id+"showas",store:this.parent.eventWin.storeShowas,displayField:"state1",value:"b",editable:false,typeAhead:true,valueField:"abbr1",mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"98%"})]},{columnWidth:0.4999,labelWidth:65,layout:"form",items:[new Wtf.form.ComboBox({fieldLabel:"Priority",value:"m",id:this.parent.id+"comboPriority",store:this.parent.eventWin.store4,editable:false,valueField:"abbr",displayField:"state",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"98%"})]}]}]},{xtype:"fieldset",title:"Time",height:E,items:[{layout:"column",items:[{columnWidth:0.9,layout:"form",items:[new Wtf.form.Checkbox({id:this.parent.id+"CheckAllDay1",boxLabel:"All day event",hideLabel:true,disabled:true})]},{columnWidth:0.4999,labelWidth:65,layout:"form",items:[new Wtf.form.DateField({fieldLabel:"Start Date",format:Wtf.getDateFormat(),readOnly:true,id:this.parent.id+"sdate1",anchor:"98%"}),new Wtf.form.DateField({format:Wtf.getDateFormat(),readOnly:true,fieldLabel:"End Date",id:this.parent.id+"edate1",anchor:"98%"})]},{columnWidth:0.4999,labelWidth:65,id:this.parent.id+"timeRight",layout:"form",items:[new Wtf.form.ComboBox({fieldLabel:"Start Time",id:this.parent.id+"stime1",store:this.parent.eventWin.store3,editable:false,displayField:"state1",typeAhead:true,valueField:"abbr1",mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"98%"}),new Wtf.form.ComboBox({fieldLabel:"End Time",id:this.parent.id+"etime1",store:this.parent.eventWin.store3,editable:false,displayField:"state1",valueField:"abbr1",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"98%"})]},{columnWidth:0.9,layout:"column"}]}]},{xtype:"fieldset",title:"Other Details",labelWidth:70,height:E,items:[{xtype:"textarea",fieldLabel:"Description",id:this.parent.id+"Description",width:"97%"},{xtype:"textfield",fieldLabel:"Location",id:this.parent.id+"Location",width:"97%"},{xtype:"textfield",fieldLabel:"Resources",id:this.parent.id+"Resources",width:"97%"}]}]}]}),{columnWidth:0.35,layout:"border",height:440,items:[new Wtf.Panel({autoHeight:true,title:"Guests",region:"north",layout:"fit",items:A,tbar:[{text:"Add guests",id:this.parent.id+"AddAction1",iconCls:"add",handler:this.AddGuest,scope:this}]}),new Wtf.Panel({height:195,title:"Reminder",frame:true,region:"center",border:true,items:[{xtype:"form",border:true,tbar:[{text:"Add Reminder",id:this.parent.id+"ReminderButton",iconCls:"add",scope:this,handler:this.AddingReminder}],items:[new Wtf.Panel({border:false,cls:"reminderDiv",id:this.parent.id+"RemainderPanel"})]}]})]}]}]}));this.parent.doLayout();this.parent.apptForm=tabpanel;Wtf.getCmp(this.parent.id+"edate1").disable();Wtf.get(this.parent.id+"CheckAllDay1").addListener("click",this.oncheck1,this)},TabChangeFun:function(B,A){if(A.id==this.parent.id+"schedule"){this.parent.doLayout()}},SaveGuests:function(){var B=this.grid.getSelections();this.dsGuest.removeAll();for(i=0;i<B.length;i++){if(this.dsGuest.find("userid",B[i].get("userid"))==-1){var C=new this.guestRecord({username:B[i].get("username"),userid:B[i].get("userid"),emailid:B[i].get("emailid"),response:B[i].get("response")});this.dsGuest.add(C);Wtf.get("_delGuest").on("click",this.deleteGuest,this)}}var A=Wtf.getCmp("contactsview");A.contactStore.rejectChanges();this.CloseWindow()},CloseWindow:function(){this.win.close()},delmail:function(){return("<img src='images/Delete.gif'  id=_delGuest title='Delete Person' class='xbtn'></img>")},AddGuest:function(){var H=new Wtf.grid.CheckboxSelectionModel();var B=Wtf.getCmp("contactsview");var A=new Wtf.grid.ColumnModel([H,{header:"Contact Name",dataIndex:"username"},{header:"user id",dataIndex:"userid",hidden:true},{header:"Email-Id",dataIndex:"emailid"},{header:"Response",dataIndex:"response",hidden:true}]);A.defaultSortable=true;this.grid=new Wtf.grid.GridPanel({ds:B.contactStore,cm:A,sm:H,headerStyle:"background-color: rgb(231,240,250) ",viewConfig:{forceFit:true}});this.win=new Wtf.Window({id:this.parent.id+"_Addguest",title:"Add guest",closable:true,width:300,height:400,modal:true,resizable:false,plain:true,renderTo:document.body,layout:"fit",items:this.grid,buttons:[{text:"Save",id:this.parent.id+"Save"},{text:"Cancel",id:this.parent.id+"cancelGuest"}]});this.win.show();var C=Wtf.getCmp(this.parent.id+"guestGrid");var D=C.getStore();for(i=0;i<D.getCount();i++){var E=B.contactStore.find("userid",D.getAt(i).get("userid"));if(E!=-1){H.selectRow(E,true);var G=B.contactStore.getAt(E);var F=D.getAt(i).get("response");G.set("response",F)}}Wtf.get(this.parent.id+"Save").on("click",this.SaveGuests,this);Wtf.get(this.parent.id+"cancelGuest").on("click",this.CloseWindow,this)},AddingReminder:function(E,C,F){if(E!=1){C="e";F="5"}this.parent.Calendar_countReminder++;var A=0;for(A=0;A<5;A++){if(Wtf.getCmp(this.parent.id+"MainRemindPanel"+A)==undefined){break}}if(this.parent.Calendar_countReminder==5){Wtf.getCmp(this.parent.id+"ReminderButton").disable()}var D=new Wtf.Panel({border:false,id:this.parent.id+"MainRemindPanel"+A,layout:"column",items:[{columnWidth:0.45,layout:"form",items:[new Wtf.form.ComboBox({id:this.parent.id+"PopupCombo"+A,hideLabel:true,store:this.parent.eventWin.storeReminder,editable:false,displayField:"state1",valueField:"abbr1",typeAhead:true,mode:"local",value:C,triggerAction:"all",selectOnFocus:true,anchor:"95%"})]},{columnWidth:0.45,layout:"form",items:[new Wtf.form.ComboBox({hideLabel:true,id:this.parent.id+"ReminderEndTime"+A,store:this.parent.eventWin.storereminderTime,valueField:"abbr1",editable:false,displayField:"state1",typeAhead:true,mode:"local",value:F,triggerAction:"all",selectOnFocus:true,anchor:"95%"})]},{columnWidth:0.1,layout:"form",items:[new Wtf.Panel({border:false,id:this.parent.id+"_RemoveReminderPanel_"+A})]}]});Wtf.getCmp(this.parent.id+"RemainderPanel").add(D);Wtf.getCmp(this.parent.id+"RemainderPanel").doLayout();var B=document.getElementById(this.parent.id+"_RemoveReminderPanel_"+A);B.innerHTML="<span id="+this.parent.id+"_button_"+A+" class ='AddReminderClass'><img src = 'images/Cancel.gif' height = '16px' width = '16px'/></span>";Wtf.get(B).addListener("click",this.RemoveReminder)},RemoveReminder:function(C){var A=this.id.split("_");Wtf.getCmp(A[0]+"MainRemindPanel"+A[2]).destroy();var B=Wtf.getCmp(A[0]);B.Calendar_countReminder--;if(B.Calendar_countReminder<5){Wtf.getCmp(A[0]+"ReminderButton").enable()}},AddingEventValues:function(a,eventClick){this.parent.EventClick=eventClick;this.parent.calPerm=Wtf.cal.utils.getPermissionLevel(this.parent,a[13]);this.parent.dbflag=a[14];if(this.parent.calPerm!=""&&this.parent.calPerm>1){Wtf.getCmp(this.parent.id+"SaveAction1").disable();Wtf.getCmp(this.parent.id+"deleteEventClick").disable()}else{if(a[14]=="true"){Wtf.getCmp(this.parent.id+"SaveAction1").enable();Wtf.getCmp(this.parent.id+"deleteEventClick").enable()}else{Wtf.getCmp(this.parent.id+"SaveAction1").disable();Wtf.getCmp(this.parent.id+"deleteEventClick").disable()}}Wtf.getCmp(this.parent.id+"Subject").setValue(a[0]);Wtf.getCmp(this.parent.id+"Location").setValue(a[1]);Wtf.getCmp(this.parent.id+"stime1").setValue(a[2]);Wtf.getCmp(this.parent.id+"etime1").setValue(a[3]);Wtf.getCmp(this.parent.id+"sdate1").setValue(a[4]);Wtf.getCmp(this.parent.id+"edate1").setValue(a[5]);Wtf.getCmp(this.parent.id+"Description").setValue(a[6]);Wtf.getCmp(this.parent.id+"showas").setValue(a[7]);Wtf.getCmp(this.parent.id+"comboPriority").setValue(a[8]);if(a[9]==""&&a[10]==this.parent.defaultTS){}else{var checkpattern=a[9].substring(0,1);if(checkpattern=="D"){this.parent.rec[0]="Daily";this.parent.rec[1]=""}else{if(checkpattern=="W"){this.parent.rec[0]="Weekly";this.parent.rec[1]=a[9].substring(1,3)}else{if(checkpattern=="M"){this.parent.rec[0]="Monthly";this.parent.rec[1]=""}else{if(checkpattern=="Y"){this.parent.rec[0]="Yearly";this.parent.rec[1]=""}}}}if(a[10]==this.parent.defaultTS){this.parent.rec[2]="noEnd";this.parent.rec[3]=""}else{this.parent.rec[2]="EndBy";this.parent.rec[3]=a[12]}}Wtf.getCmp(this.parent.id+"Resources").setValue(a[11]);if(this.parent.EventClick!=""){var eid;if(this.parent.currentview!="agendaView"){eid=this.parent.EventClick.split("e_")[1]}else{eid=this.parent.EventClick}Wtf.Ajax.request({url:Wtf.req.cal+"calEvent.jsp",method:"POST",params:({action:4,eid:eid}),scope:this,success:function(result,req){var nodeobj=eval("("+result.responseText.trim()+")");var Grid=Wtf.getCmp(this.parent.id+"guestGrid");var guestStore=Grid.getStore();var guestRecord=Wtf.data.Record.create([{name:"username"},{name:"userid"},{name:"emailid"},{name:"response"},{name:"delmail"}]);var contacts=Wtf.getCmp("contactsview");for(var i=0;i<nodeobj.data.length;i++){var contactCheck=contacts.contactStore.find("userid",nodeobj.data[i].userid);if(contactCheck!=-1){var statusfield;if(nodeobj.data[i].status=="p"){statusfield="Awaiting"}else{if(nodeobj.data[i].status=="r"){statusfield="Rejected"}else{if(nodeobj.data[i].status=="a"){statusfield="Accepted"}}}var p=new guestRecord({username:contacts.contactStore.getAt(contactCheck).get("username"),userid:contacts.contactStore.getAt(contactCheck).get("userid"),emailid:contacts.contactStore.getAt(contactCheck).get("emailid"),response:statusfield});guestStore.add(p);Wtf.get("_delGuest").on("click",this.deleteGuest,this)}}for(var i=0;i<nodeobj.Data1.data.length;i++){var remtype=nodeobj.Data1.data[i].rtype;var remtime=nodeobj.Data1.data[i].rtime;this.AddingReminder(1,remtype,remtime)}},failure:function(){Wtf.Msg.alert("Error","Error occurred while connecting to the server")}})}},AddingValue:function(A){Wtf.getCmp(this.parent.id+"Subject").setValue(A[0]);Wtf.getCmp(this.parent.id+"sdate1").setValue(A[1]);Wtf.getCmp(this.parent.id+"edate1").setValue(A[2]);Wtf.getCmp(this.parent.id+"stime1").setValue(A[3]);Wtf.getCmp(this.parent.id+"etime1").setValue(A[4]);Wtf.getCmp(this.parent.id+"Location").setValue(A[5]);Wtf.getCmp(this.parent.id+"comboPriority").setValue(A[7]);Wtf.getCmp(this.parent.id+"showas").setValue(A[6]);if(A[8]!="none"&&A[8]!=""){this.AddingReminder(1,A[8],A[9])}},RecurrsionOK:function(){var C=Wtf.getCmp(this.parent.id+"Daily").getValue();var B=Wtf.getCmp(this.parent.id+"Weekly").getValue();var H=Wtf.getCmp(this.parent.id+"Monthly").getValue();var G=Wtf.getCmp(this.parent.id+"Yearly").getValue();var F=Wtf.getCmp(this.parent.id+"noEnd").getValue();var E=Wtf.getCmp(this.parent.id+"EndBy").getValue();if(E==true){if(Wtf.getCmp(this.parent.id+"edate2").getValue()==""){Wtf.Msg.alert("Error","Please enter the valid end date for recurrence!");return }}if(B==true){var D=Wtf.getCmp(this.parent.id+"weekTextBox").getValue();D=Wtf.cal.utils.HTMLScriptStripper(D);var A=this.IsNum(D);if(A==false){Wtf.Msg.alert("Error","Please enter the no. of week(s) for recurrence!");return }this.parent.rec[0]="Weekly";this.parent.rec[1]=D}else{if(C==true){this.parent.rec[0]="Daily";this.parent.rec[1]=""}else{if(H==true){this.parent.rec[0]="Monthly";this.parent.rec[1]=""}else{if(G==true){this.parent.rec[0]="Yearly";this.parent.rec[1]=""}}}}if(F==true){this.parent.rec[2]="noEnd";this.parent.rec[3]=""}else{if(E==true){this.parent.rec[2]="EndBy";this.parent.rec[3]=Wtf.getCmp(this.parent.id+"edate2").getValue()}}Wtf.getCmp(this.parent.id+"Recurring").close()},IsNum:function(B){var A;if(B==""){A=false}else{A=(!isNaN(B))}return A},RecurrsionCancel:function(){Wtf.getCmp(this.parent.id+"Recurring").close()}});Wtf.calStore=function(){Wtf.calStore.superclass.constructor.call(this,{remoteSort:true,proxy:new Wtf.data.HttpProxy({url:Wtf.req.cal+"calEvent.jsp"}),reader:new Wtf.data.JsonReader({root:"data",id:"jsonReader"},["eid","cid","startts","endts","subject","descr","location","showas","priority","recpattern","recend","resources","timestamp","dbflag"])})};Wtf.extend(Wtf.calStore,Wtf.data.Store,{findRec:function(H,F,D){var B=[];var C=0;if(this.getCount()){var E;for(var G=0;G<F[0].length;G++){E=[F[0][G]];for(var A=1;A<F.length;A++){E[A]=F[A]}this.queryBy(function(J){for(var I=0;I<E.length;I++){if(D[I]==0){if(!(J.data[H[I]]==E[I])){return false}}else{if(D[I]==1){if(!(J.data[H[I]]>E[I])){return false}}else{if(D[I]==2){if(!(J.data[H[I]]<E[I])){return false}}else{if(D[I]==3){if(!(J.data[H[I]]>=E[I])){return false}}else{if(D[I]==4){if(!(J.data[H[I]]<=E[I])){return false}}}}}}}B[C++]=J;return true},this)}}return B},checkAndAdd:function(A,B){A.each(function(D){var C=this.find(B,D.data[B],0,false,true);if(C!=-1){this.remove(this.getAt(C))}this.add(D)},this)},updateStore:function(C,D,A){var B=this.find(C,D[0].data[C],0,false,true);if(B!=-1){this.remove(this.getAt(B));this.add(D)}}});Wtf.cal.eventWindow=function(A){this.activeCells;this.timeString;this.heighttoevent;this.widthtoevent;this.parent=A;this.store4=new Wtf.data.SimpleStore({fields:["abbr","state"],data:Wtf.form.ComboBox.dupmark});this.store3=new Wtf.data.SimpleStore({fields:["abbr1","state1"],data:Wtf.form.ComboBox.duptime});this.storeReminder=new Wtf.data.SimpleStore({fields:["abbr1","state1"],data:Wtf.form.ComboBox.dupReminder});this.storereminderTime=new Wtf.data.SimpleStore({fields:["abbr1","state1"],data:Wtf.form.ComboBox.dupReminTime});this.storeShowas=new Wtf.data.SimpleStore({fields:["abbr1","state1"],data:Wtf.form.ComboBox.dupdata});this.id="window_"+this.parent.id;Wtf.cal.eventWindow.superclass.constructor.call(this)};Wtf.extend(Wtf.cal.eventWindow,Wtf.Component,{CancelfuncWeek:function(){Wtf.getCmp(this.parent.id+"OtherWinShow").hide()},OkfuncWeek:function(){var A=Wtf.get(this.parent.id+"subjectweek").getValue();var I=(Wtf.getCmp(this.parent.id+"sdateweek").getValue()).format("Y-m-d");var H=Wtf.getCmp(this.parent.id+"Showasweek").getValue();var L=Wtf.getCmp(this.parent.id+"priorityweek").getValue();var E=Wtf.getCmp(this.parent.id+"Reminderweek").getValue();var G=Wtf.getCmp(this.parent.id+"ReminderTimeweek").getValue();if(E!=""&&E!="none"){if(G!="----------"){E+="_"+G}else{Wtf.cal.utils.ShowErrorMsgBox("Please select Time interval");return false}}else{E=""}if(A==""){Wtf.cal.utils.ShowErrorMsgBox("Please enter the required fields");return false}cid=Wtf.getCmp(this.parent.id+"calendarweek").getValue();var B=Wtf.getCmp(this.parent.id+"stimeweek").getValue();var C=Wtf.getCmp(this.parent.id+"etimeweek").getValue();var K=parseInt(B);var D=parseInt(C);if(K>=D){Wtf.cal.utils.ShowErrorMsgBox("Please enter a valid start time & end time ");return }Wtf.getCmp(this.parent.id+"OtherWinShow").hide();if(B.length==1){B="0"+B}if(C.length==1){C="0"+C}var J=Wtf.get(this.parent.id+"locationweek").getValue();J=Wtf.cal.utils.HTMLScriptStripper(J);if(!J||J=="undefined"){J=""}var F=["0",cid,I+" "+B+":00:00.00",I+" "+C+":00:00.00",A,"",J,H,L,"",this.parent.defaultTS,"","",E];this.parent.insertEvent(F)},closeEvent:function(B){var A=this.id;Wtf.MessageBox.confirm("Confirm Delete","Are you sure you want to delete the event?",function(F){if(F=="yes"){A=A.split("close_");var C=Wtf.getCmp(A[0]+"e_"+A[1]);var G=Wtf.getCmp(A[0]);var E=null;var D=G.eStore.find("eid",A[1]);if(D!=-1){E=G.eStore.getAt(D).data["cid"]}var H=[A[1],E];C.destroy();G.deleteEvent(H,"0")}})},eventHtmlStr:function(B,A,C,F){var E="";var D=this.parent.id;E+="<div id="+this.parent.id+"wrapper_"+B+" style='width: 100%; height: 15px;'>";E+="<span class=titleDiv id="+this.parent.id+"title_"+B+" style='font-size:smaller; height:15px; float: left; margin-left:1px;' wtf:qtip='"+A+"' wtf:qtitle='"+C+"'>"+A+"</span>";E+="<div class=closeDiv id="+this.parent.id+"close_"+B+" style='float: right; height:15px; display: none;' ><img id="+this.parent.id+"calImg_"+B+" style='height:11px;' src='images/deleteLink.gif' alt='Delete'/></div></div>";E+="<div class=textDiv id="+this.parent.id+"text_"+B+" style='clear: both; height:100%; padding:1 1 1 1;' wtf:qtip='"+A+"' wtf:qtitle='"+C+"'>"+C+"</div>";return(E)},showIcon:function(){var A=this.id.split("e_");Wtf.get(A[0]+"close_"+A[1]).dom.style.display="block";Wtf.get(A[0]+"text_"+A[1]).dom.style.textDecoration="underline"},hideIcon:function(){var A=this.id.split("e_");Wtf.get(A[0]+"close_"+A[1]).dom.style.display="none";Wtf.get(A[0]+"text_"+A[1]).dom.style.textDecoration="none"},createEventCell:function(A,G,I,K,H,L,J,F,O){var B=false;var E=Wtf.cal.utils.getPermissionLevel(this.parent,J);if(E==""||E==1){if(O=="true"){B=true}}var D=new Wtf.Panel({id:this.parent.id+"e_"+A,baseCls:"dummyclass",html:this.eventHtmlStr(A,I,K),height:H,width:L+"%",cls:"innerPanel",border:true,cellId:G.id,style:"z-index:1000;position:absolute;border:1px solid; cursor:pointer;",ts:F,editable:B});var N=G.getXY();D.setPagePosition(N[0]+3,N[1]);D.render(this.parent.id+this.parent.currentview+"eventPanel");if(B){var M=new Wtf.Resizable(D.id,{id:this.parent.id+"r_"+A,height:H,width:L+"%",border:true,transparent:true,heightIncrement:Wtf.fixHeight,minHeight:Wtf.fixHeight,handles:"n s"});M.on("resize",this.resizeEvent);D.el.addListener("mouseover",this.showIcon);D.el.addListener("mouseout",this.hideIcon);Wtf.get(this.parent.id+"close_"+A).addListener("click",this.closeEvent);this.parent.addDragCmp(D.id,true)}D.el.addListener("dblclick",this.showEventDetails);D.el.dom.style.position="absolute";D.el.dom.style.color="white";D.el.dom.setAttribute("Name",J);var C=this.parent.CheckforChecked(J);if(C==false){this.parent.HidingOtherSingleEvent(this.parent.id+"e_"+A)}this.parent.ChangingOtherSingleEventColor(J,this.parent.id+"e_"+A);return D},showEventDetails:function(E){E.preventDefault();E.stopPropagation();var H=this.id.split("e_");var B=Wtf.getCmp(H[0]);if(H[1]&&B.eStore&&B.eStore.getCount()){var C=B.eStore.find("eid",H[1]);var I=null;if(C!=-1){I=B.eStore.getAt(C)}if(I){var A=new Date(Wtf.cal.utils.sqlToJsDate(I.data["startts"]));var D=new Date(Wtf.cal.utils.sqlToJsDate(I.data["endts"]));var G=[];G[0]=I.data["subject"];G[1]=I.data["location"];var F=A.format("i");if(F&&F!="00"){G[2]=A.format("g:i A");G[3]=D.format("g:i A")}else{G[2]=A.format("G");G[3]=D.format("G")}G[4]=A;G[5]=D;G[6]=I.data["descr"];G[7]=I.data["showas"];G[8]=I.data["priority"];G[9]=I.data["recpattern"];G[10]=I.data["recend"];if(I.data["recend"]!=""){G[10]=(Wtf.cal.utils.sqlToJsDate(I.data["recend"])).format("Y-m-d 00:00:00");var J=new Date(Wtf.cal.utils.sqlToJsDate(I.data["recend"]));G[12]=J}else{G[10]=B.defaultTS}G[11]=I.data["resources"];G[13]=I.data["cid"];G[14]=I.data["dbflag"];B.RemoveMainPanelContent();eventobj=new Wtf.cal.eventForms(B);eventobj.AddingTabPanelEvent();eventobj.AddingEventValues(G,this.id)}else{Wtf.Msg.alert("Invalid Event","Event doesn't exist!");this.destroy()}}},resizeEvent:function(J){var L=J.el;var C=L.getHeight()/Wtf.fixHeight;var B=L.dom.getElementsByTagName("span");L=B[0].innerHTML;var A=L.split("-");var K=new Date();var N=this.id.split("r_");var G=Wtf.getCmp(N[0]);var O=G.eStore.find("eid",N[1]);if(this.activeHandle.position=="south"){K=Date.parseDate(A[0],"g:i A");K=K.add(Date.HOUR,C);if(O!=-1){var F=G.eStore.getAt(O);var H=Wtf.cal.utils.sqlToJsDate(F.data["endts"].toString());H=H.format("Y-m-d");var D=K.format("H");var I=[];var E=[F.data["eid"],F.data["cid"],F.data["startts"],H+" "+D+":00:00.0",F.data["subject"],F.data["descr"],F.data["location"],F.data["showas"],F.data["priority"],F.data["recpattern"],F.data["recend"],F.data["resources"],"","",0];G.updateEvent(E,"0")}}else{K=Date.parseDate(A[1],"g:i A");K=K.add(Date.HOUR,-C);if(O!=-1){var F=G.eStore.getAt(O);var M=Wtf.cal.utils.sqlToJsDate(F.data["startts"].toString());M=M.format("Y-m-d");var D=K.format("H");var I=[];var E=[F.data["eid"],F.data["cid"],M+" "+D+":00:00.0",F.data["endts"],F.data["subject"],F.data["descr"],F.data["location"],F.data["showas"],F.data["priority"],F.data["recpattern"],F.data["recend"],F.data["resources"],"","",0];G.updateEvent(E,"0")}}},getDateAndValue:function(H,B,A){var G=B;var E=A;var J=H.target.id.split("Day1");if(!J[1]){J=H.target.parentNode.id.split("Day1");if(!J[1]){return null}}var D=J[1].split("/");var C;if(!D[1]){C=Date.parseDate(D[0]+"/"+G+"/"+E,"d/n/Y");this.parent.changeCalDate(C)}else{if(D[1]<G){if(D[1]==1&&G==12){G=D[1];E++}else{G--}}else{if(D[1]==12&&G==1){G=D[1];E--}else{G++}}C=new Date();C=Date.parseDate(E+"-"+G+"-"+D[0],"Y-n-j");this.parent.RemoveMainPanelContent();this.parent.changeCalDate(C);this.parent.RemoveDiv();this.parent.AddMonth();var I=this.parent.calendar.getValue();var F=Wtf.getCmp(this.parent.id+"dateText1");F.setText(Date.monthNames[I.getMonth()]+" "+I.getFullYear());this.parent.seldate=I;this.parent.onCalViewChange()}return C},showWindowWeek:function(F,A,G,K){var J=Wtf.getCmp(this.parent.id+"OtherWinShow");if(!J||!this.parent.weekWin){var H=340;if(Wtf.isIE==true){H=374}var M=this.getTopFormPanel();var B=this.getCenterFormPanel(t,t);var D=this.getBottomFormPanel();var I=new Wtf.Window({title:"Create Event",id:this.parent.id+"OtherWinShow",closable:true,cls:"fontstyle",resizable:false,modal:true,width:400,height:H,layout:"border",items:[M,B,D],closeAction:"hide",buttons:[{cls:"padd",text:"Add More Details",id:this.parent.id+"addDetailsweek"},{text:"OK",id:this.parent.id+"okweek"},{text:"Cancel",id:this.parent.id+"cancelweek"}]});I.show();Wtf.getCmp(this.parent.id+"CheckAllDayweek").disable();Wtf.getCmp(this.parent.id+"edateweek").disable();Wtf.get(this.parent.id+"cancelweek").addListener("click",this.CancelfuncWeek,this);Wtf.get(this.parent.id+"addDetailsweek").addListener("click",this.addDetailsForm1,this);Wtf.get(this.parent.id+"okweek").addListener("click",this.OkfuncWeek,this);var C=Wtf.get(this.parent.id+"CheckAllDayweek").addListener("click",this.oncheck,this);this.parent.weekWin=I}else{J.show()}var E=this.parent.calendar.getValue();if(this.parent.currentview==("WeekView")){var L=F.split("_");L=parseInt(L[2],10);L=L-E.format("w");E=E.add(Date.DAY,L)}else{if(this.parent.currentview==("WorkWeekView")){var L=F.split("_");L=parseInt(L[2],10);L++;L=L-E.format("w");E=E.add(Date.DAY,L)}}this.activeCells=F;this.timeString=A;this.heighttoevent=G;this.widthtoevent=K;A=A.split("-");if(A[1]==24){A[1]=0}Wtf.getCmp(this.parent.id+"calendarweek").setValue(this.parent.tempCalStore.getAt(0).data["id"]);Wtf.getCmp(this.parent.id+"subjectweek").setValue("");Wtf.getCmp(this.parent.id+"locationweek").setValue("");Wtf.getCmp(this.parent.id+"sdateweek").setValue(E);Wtf.getCmp(this.parent.id+"edateweek").setValue(E);Wtf.getCmp(this.parent.id+"stimeweek").setValue(A[0]);Wtf.getCmp(this.parent.id+"etimeweek").setValue(A[1]);Wtf.getCmp(this.parent.id+"Showasweek").setValue("b");Wtf.getCmp(this.parent.id+"priorityweek").setValue("m");Wtf.getCmp(this.parent.id+"Reminderweek").setValue("none");Wtf.getCmp(this.parent.id+"ReminderTimeweek").setValue("----------")},addDetailsForm1:function(){var A=[];A[0]=Wtf.get(this.parent.id+"subjectweek").getValue();A[1]=Wtf.get(this.parent.id+"sdateweek").getValue();A[2]=Wtf.get(this.parent.id+"edateweek").getValue();A[3]=Wtf.getCmp(this.parent.id+"stimeweek").getValue();A[4]=Wtf.getCmp(this.parent.id+"etimeweek").getValue();A[5]=Wtf.get(this.parent.id+"locationweek").getValue();A[6]=Wtf.getCmp(this.parent.id+"Showasweek").getValue();A[7]=Wtf.getCmp(this.parent.id+"priorityweek").getValue();A[8]=Wtf.getCmp(this.parent.id+"Reminderweek").getValue();A[9]=Wtf.getCmp(this.parent.id+"ReminderTimeweek").getValue();Wtf.getCmp(this.parent.id+"OtherWinShow").hide();this.parent.RemoveMainPanelContent();var B=Wtf.getCmp(this.parent.id);eventfrm=new Wtf.cal.eventForms(B);eventfrm.AddingTabPanelEvent();eventfrm.AddingValue(A)},getTopFormPanel:function(){if(Wtf.isGecko){simHeight=98;cwidth=275}if(Wtf.isIE){simHeight=107;cwidth=265}var A=new Wtf.FormPanel({labelWidth:75,border:true,id:this.parent.id+"f1",frame:true,bodyStyle:"padding:5px 5px 0",width:250,height:simHeight,defaultType:"textfield",region:"north",items:[{fieldLabel:"Subject*",name:"subject",id:this.parent.id+"subjectweek",width:275,allowBlank:false},{fieldLabel:"Location",id:this.parent.id+"locationweek",width:275,name:"location"},CalendarCombo=new Wtf.form.ComboBox({id:this.parent.id+"calendarweek",fieldLabel:"Calendar",store:this.parent.tempCalStore,cls:"winshow",valueField:"id",displayField:"state1",typeAhead:true,mode:"local",editable:false,triggerAction:"all",selectOnFocus:true,width:cwidth})]});return A},getCenterFormPanel:function(A,C){var B=new Wtf.FormPanel({labelWidth:75,id:this.parent.id+"f2",frame:true,xtype:"fieldset",border:true,bodyStyle:"padding:0px 5px 0px",width:250,height:80,region:"center",layout:"column",items:[{columnWidth:0.5,layout:"form",items:[new Wtf.form.Checkbox({id:this.parent.id+"CheckAllDayweek",boxLabel:"All day event",hideLabel:true}),new Wtf.form.DateField({fieldLabel:"Start Date",readOnly:true,format:Wtf.getDateFormat(),value:A,id:this.parent.id+"sdateweek",anchor:"95%"}),new Wtf.form.DateField({layout:"form",readOnly:true,format:Wtf.getDateFormat(),value:C,fieldLabel:"End Date",id:this.parent.id+"edateweek",anchor:"95%"})]},{columnWidth:0.5,bodyStyle:"padding:33px 0px 0px 0px",id:this.parent.id+"timePan",layout:"form",items:[new Wtf.form.ComboBox({fieldLabel:"Start Time",id:this.parent.id+"stimeweek",store:this.store3,editable:false,displayField:"state1",valueField:"abbr1",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"95%"}),new Wtf.form.ComboBox({fieldLabel:"End Time",name:"etime",id:this.parent.id+"etimeweek",store:this.store3,valueField:"abbr1",editable:false,displayField:"state1",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"95%"})]}]});return B},getBottomFormPanel:function(){if(Wtf.isGecko){simHeight=72}if(Wtf.isIE){simHeight=87}var A=new Wtf.FormPanel({labelWidth:75,frame:true,id:this.parent.id+"f3",border:false,xtype:"fieldset",bodyStyle:"padding:5px 5px 10px",width:250,height:simHeight,region:"south",layout:"column",items:[{columnWidth:0.5,layout:"form",items:[new Wtf.form.ComboBox({id:this.parent.id+"Showasweek",fieldLabel:"Show as",value:"b",store:this.storeShowas,editable:false,displayField:"state1",typeAhead:true,valueField:"abbr1",mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"95%"}),new Wtf.form.ComboBox({id:this.parent.id+"Reminderweek",fieldLabel:"Reminder",emptyText:"none",store:this.storeReminder,editable:false,displayField:"state1",valueField:"abbr1",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"95%"})]},{columnWidth:0.5,layout:"form",items:[new Wtf.form.ComboBox({id:this.parent.id+"priorityweek",fieldLabel:"Priority",name:"markas",value:"m",store:this.store4,editable:false,valueField:"abbr",displayField:"state",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"95%"}),new Wtf.form.ComboBox({fieldLabel:"Time",id:this.parent.id+"ReminderTimeweek",store:this.storereminderTime,editable:false,emptyText:" ---------- ",displayField:"state1",valueField:"abbr1",typeAhead:true,mode:"local",triggerAction:"all",selectOnFocus:true,anchor:"95%"})]}]});return A},oncheck:function(B,C){if(C.checked==true){var A=Wtf.get(this.parent.id+"timePan").dom;A.style.display="none"}if(C.checked==false){var A=Wtf.get(this.parent.id+"timePan");A.show()}}});Wtf.cal.DDProxy=function(C,B,A){if(C){this.init(C,B,A);this.initFrame()}};Wtf.extend(Wtf.cal.DDProxy,Wtf.dd.DDProxy,{startDrag:function(A,D){var C=Wtf.get(this.getDragEl());var B=Wtf.get(this.getEl());C.applyStyles({border:"","z-index":2000,backgroundColor:B.dom.style.backgroundColor});C.update(B.dom.innerHTML);C.addClass(B.dom.className+" dd-proxy")},onDragOver:function(B,A){var C=Wtf.get(A);this.lastTarget=C;C.addClass("DragClass")},onDragOut:function(B,A){var C=Wtf.get(A);this.lastTarget=null;C.removeClass("DragClass")},endDrag:function(K){var E=Wtf.getCmp(this.id.split("e_")[0]);var I=Wtf.get(this.getDragEl());var B=Wtf.get(this.getEl());var N=Wtf.get(this.lastTarget);if(N){N=(N.id);N=N.split("Day1");if((B.id.indexOf("Showing"))>=0){var F=Wtf.get(E.id+"e_"+N[1]);var B=F.dom.cloneNode(true);F.dom.parentNode.removeChild(F)}if(this.lastTarget){Wtf.get(this.lastTarget).appendChild(B);this.lastTarget.removeClass("DragClass")}if("function"===typeof this.config.fn){this.config.fn.apply(this.config.scope||window,[this,this.config.dragData])}if(!E.ifArrayContains((K.getTarget().childNodes[0].innerHTML))){E.AddToArray(K.getTarget().childNodes[0].innerHTML)}var O=this.lastTarget.id.split("Day1");if(E.eStore){var H=E.eStore.find("eid",this.id.split("e_")[1]);if(H!=-1){var D=E.eStore.getAt(H);var M=Wtf.cal.utils.sqlToJsDate(D.data["startts"].toString());var G=Wtf.cal.utils.sqlToJsDate(D.data["endts"].toString());var L=M.format("Y-m-")+O[1]+M.format(" H:i:s");L=Wtf.cal.utils.sqlToJsDate(L.toString());var J=Wtf.cal.utils.DateDiff(L,M);var A=new Date(G);A.setDate(G.getDate()+J);var C=[D.data["eid"],D.data["cid"],L.format("Y-m-d H:i:s"),A.format("Y-m-d H:i:s"),D.data["subject"],D.data["descr"],D.data["location"],D.data["showas"],D.data["priority"],D.data["recpattern"],D.data["recend"],D.data["resources"],"","",0];E.updateEvent(C,"0")}}E.CalculateHowMore()}}});Wtf.cal.EventDZ=function(B,A){A=A||{};Wtf.apply(A,{ddel:document.createElement("div")});Wtf.cal.EventDZ.superclass.constructor.call(this,B,A)};Wtf.extend(Wtf.cal.EventDZ,Wtf.dd.DragZone,{getDragData:function(A){var B=Wtf.get(A.getTarget());if(B.hasClass("dd-ct")){return false}return{ddel:this.ddel,item:B}},onInitDrag:function(A){this.ddel.innerHTML=this.dragData.item.dom.innerHTML;this.ddel.className=this.dragData.item.dom.className;this.ddel.style.width=this.dragData.item.getWidth()+"px";this.proxy.update(this.ddel)},getRepairXY:function(B,A){A.item.highlight("#e8edff");return A.item.getXY()}});Wtf.cal.EventDT=function(B,A){Wtf.cal.EventDT.superclass.constructor.call(this,B,A)};Wtf.extend(Wtf.cal.EventDT,Wtf.dd.DropTarget,{notifyDrop:function(U,S,W){var I=Wtf.cal.utils.getCalCtrl();if(W.item.id.search(I.id+"e_")==0||W.item.id.search(I.id+"title_")==0||W.item.id.search(I.id+"wrapper_")==0||W.item.id.search(I.id+"text_")==0||W.item.id.search(I.id+"calImg_")==0){var X=W.item.id.split("_");var H=Wtf.getCmp(I.id+"e_"+X[1]);if(!H.editable){Wtf.Msg.alert("Invalid Operation","You dont have sufficient privileges to modify this event!");return false}var D=this.el.getXY();var V=Wtf.get(I.id+"title_"+X[1]);var A=V.dom.innerHTML.split("-");var Q=Wtf.cal.utils.getTimeIndNo(A[0],false);var F=Wtf.cal.utils.getTimeIndNo(A[1],true);var J=F-Q;var B=this.id.split("_");var P=parseInt(B[1]);if((P<0)||((P+J)>23)){return false}var O=[];var E=[];O=Wtf.cal.utils.getHourStr(P);E=Wtf.cal.utils.getHourStr(P+J);var R=O[0]+O[1]+"-"+E[0]+E[1];V.innerHTML=R;H.el.fadeIn({duration:0.5});H.setPagePosition(D[0],D[1]);H.render(I.id+I.currentview+"eventPanel");var N=I.eStore.find("eid",X[1]);if(N!=-1){var G=I.eStore.getAt(N);var T=Wtf.cal.utils.sqlToJsDate(G.data["startts"].toString());var L=Wtf.cal.utils.sqlToJsDate(G.data["endts"].toString());var K=0;var M=0;if(I.currentview!="DayView"){K=T.format("w");if(I.currentview!="WorkWeekView"){M=B[2]-K}else{M=B[2]-K+1}}T.setDate(T.getDate()+M);L.setDate(L.getDate()+M);Q=Wtf.cal.utils.getTimeIndNo(O[0]+O[1],false);F=Wtf.cal.utils.getTimeIndNo(E[0]+E[1],true);T.setHours(Q,0,0);L.setHours(F,0,0);var C=[G.data["eid"],G.data["cid"],T.format("Y-m-d H:i:s"),L.format("Y-m-d H:i:s"),G.data["subject"],G.data["descr"],G.data["location"],G.data["showas"],G.data["priority"],G.data["recpattern"],G.data["recend"],G.data["resources"],"","",0];I.updateEvent(C,"0")}return true}else{return false}}})