(function(){var a=Ext.Button.prototype.onClick;Ext.override(Ext.Button,{onClick:function(b){b=new Ext.EventObjectImpl(b);this.focus();a.call(this,b);this.isDestroyed||this.blur()},template:new Ext.Template('<div id="{4}" class="x-btn {3}"><div class="{1}">','<em class="{2}" class="x-unselectable" unselectable="on"><button type="{0}"></button></em>',"</div></div>")})})();
(function(){var a=Ext.Component.prototype.initComponent,b=Ext.Component.prototype.destroy;Ext.override(Ext.Component,{stateful:false,statefulRelativeDimensions:true,statefulName:undefined,initComponent:function(){if(this.stateful!==false){if(!this.stateId)this.stateId=Ext.id(null,"state-");Ext.state.Manager.register(this)}a.apply(this,arguments)},getStateName:function(){var c=this.statefulName;c||(c=this.getXType().match(/(?:zarafa\.)?(.*)/)[1]);return c},destroy:function(){if(this.plugins)for(var c in this.plugins){var d=
this.plugins[c];d instanceof Ext.util.Observable&&d.purgeListeners()}this.stateful!==false&&Ext.state.Manager.unregister(this);b.apply(this,arguments)}})})();(function(){Ext.override(Ext.Container,{bufferResize:false})})();
(function(){Ext.Element.addMethods({addUnits:function(a){if(Ext.isEmpty(a)||a=="auto")a=a||"";else if(isNaN(a))a="";else/\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i.test(a)||(a+=this.defaultUnit||"px");return a},swallowEvent:function(a,b){var c=this,d=b===true?this.swallowEventHandlerPreventDefault:this.swallowEventHandler;if(Ext.isArray(a)){Ext.each(a,function(j){c.on(j,d,this)});return c}c.on(a,d,this);return c},swallowEventHandler:function(a){a.stopPropagation()},swallowEventHandlerPreventDefault:function(a){a.stopPropagation();
a.preventDefault()},spitOutEvent:function(a,b){var c=this,d=b===true?this.swallowEventHandlerPreventDefault:this.swallowEventHandler;if(Ext.isArray(a)){Ext.each(a,function(j){c.un(j,d,this)});return c}c.un(a,d,this);return c},selectable:function(){this.dom.unselectable="off";return this.spitOutEvent("selectstart",true).removeClass("x-unselectable")},clearClass:function(){this.dom.className=""}})})();
(function(){Ext.apply(Ext.EventManager,function(){function a(e){var h=false,f=0,k=A.length,n=false,l;if(e){if(e.getElementById||e.navigator){for(;f<k;++f){l=A[f];try{if(l.el===e){h=l.id;break}}catch(m){}}if(!h){h=Ext.id(e);A.push({id:h,el:e});n=true}}else h=Ext.id(e);if(!Ext.elCache[h]){Ext.Element.addToCache(new Ext.Element(e),h);if(n)Ext.elCache[h].skipGC=true}}return h}function b(e,h,f,k,n,l){e=Ext.getDom(e);var m=a(e);m=Ext.elCache[m].events;var p;p=v.on(e,h,n);m[h]=m[h]||[];m[h].push([f,n,l,
p,k]);if(e.addEventListener&&h=="mousewheel"){var q=["DOMMouseScroll",n,false];e.addEventListener.apply(e,q);Ext.EventManager.addListener(B,"unload",function(){e.removeEventListener.apply(e,q)})}e==t&&h=="mousedown"&&Ext.EventManager.stoppedMouseDownEvent.addListener(n)}function c(){if(window!=top)return false;try{t.documentElement.doScroll("left")}catch(e){return false}i();return true}function d(){if(Ext.isIE&&c())return true;if(t.readyState==F){i();return true}x||(y=setTimeout(arguments.callee,
2));return false}function j(){C||(C=Ext.query("style, link[rel=stylesheet]"));if(C.length==t.styleSheets.length){i();return true}x||(y=setTimeout(arguments.callee,2));return false}function g(){t.removeEventListener(z,arguments.callee,false);j()}function i(){if(!x){x=true;y&&clearTimeout(y);G&&t.removeEventListener(z,i,false);Ext.isIE&&d.bindIE&&t.detachEvent("onreadystatechange",d);v.un(B,"load",arguments.callee)}if(u&&!Ext.isReady){Ext.isReady=true;u.fire();u.listeners=[]}}function o(e,h){return function(){var f=
Ext.toArray(arguments);h.target==Ext.EventObject.setEvent(f[0]).target&&e.apply(this,f)}}function s(e,h,f){return function(k){f.delay(h.buffer,e,null,[new Ext.EventObjectImpl(k)])}}function H(e,h,f,k,n){return function(l){Ext.EventManager.removeListener(h,f,k,n);e(l)}}function I(e,h,f){return function(k){var n=new Ext.util.DelayedTask(e);if(!f.tasks)f.tasks=[];f.tasks.push(n);n.delay(h.delay||10,e,null,[new Ext.EventObjectImpl(k)])}}function D(e,h,f,k,n){function l(r){if(Ext){r=Ext.EventObject.setEvent(r);
var E;if(m.delegate){if(!(E=r.getTarget(m.delegate,p)))return}else E=r.target;m.stopEvent&&r.stopEvent();m.preventDefault&&r.preventDefault();m.stopPropagation&&r.stopPropagation();if(m.normalized===false)r=r.browserEvent;k.call(n||p,r,E,m)}}var m=!f||typeof f=="boolean"?{}:f,p=Ext.getDom(e),q;k=k||m.fn;n=n||m.scope;if(!p)throw'Error listening for "'+h+'". Element "'+e+"\" doesn't exist.";if(m.target)l=o(l,m);if(m.delay)l=I(l,m,k);if(m.single)l=H(l,p,h,k,n);if(m.buffer){q=new Ext.util.DelayedTask(l);
l=s(l,m,q)}b(p,h,k,q,l,n);return l}var u,y,x=false,G=Ext.isGecko||Ext.isWebKit||Ext.isSafari,v=Ext.lib.Event,t=document,B=window,z="DOMContentLoaded",F="complete",J=/^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/,A=[],C,w={addListener:function(e,h,f,k,n){if(typeof h=="object"){var l;for(l in h){f=h[l];J.test(l)||(Ext.isFunction(f)?D(e,l,h,f,h.scope):D(e,l,f))}}else D(e,h,n,f,k)},removeListener:function(e,h,f,k){e=Ext.getDom(e);var n=a(e),l=e&&Ext.elCache[n].events[h]||
[],m,p,q;m=0;for(p=l.length;m<p;m++)if(Ext.isArray(q=l[m])&&q[0]==f&&(!k||q[2]==k)){q[4]&&q[4].cancel();if(k=f.tasks&&f.tasks.length){for(;k--;)f.tasks[k].cancel();delete f.tasks}f=q[1];v.un(e,h,v.extAdapter?q[3]:f);f&&e.addEventListener&&h=="mousewheel"&&e.removeEventListener("DOMMouseScroll",f,false);f&&e==t&&h=="mousedown"&&Ext.EventManager.stoppedMouseDownEvent.removeListener(f);l.splice(m,1);l.length===0&&delete Ext.elCache[n].events[h];for(k in Ext.elCache[n].events)return false;Ext.elCache[n].events=
{};return false}},removeAll:function(e){e=Ext.getDom(e);var h=a(e),f=(Ext.elCache[h]||{}).events||{},k,n,l,m,p,q,r;for(m in f)if(f.hasOwnProperty(m)){k=f[m];n=0;for(l=k.length;n<l;n++){p=k[n];p[4]&&p[4].cancel();if(p[0].tasks&&(q=p[0].tasks.length)){for(;q--;)p[0].tasks[q].cancel();delete p.tasks}r=p[1];v.un(e,m,v.extAdapter?p[3]:r);e.addEventListener&&r&&m=="mousewheel"&&e.removeEventListener("DOMMouseScroll",r,false);r&&e==t&&m=="mousedown"&&Ext.EventManager.stoppedMouseDownEvent.removeListener(r)}}if(Ext.elCache[h])Ext.elCache[h].events=
{}},getListeners:function(e,h){e=Ext.getDom(e);var f=a(e);return(f=(Ext.elCache[f]||{}).events||{})&&f[h]?f[h]:null},purgeElement:function(e,h,f){e=Ext.getDom(e);var k=a(e);k=(Ext.elCache[k]||{}).events||{};var n,l;if(f){if(k&&k.hasOwnProperty(f)){n=k[f];k=0;for(l=n.length;k<l;k++)Ext.EventManager.removeListener(e,f,n[k][0])}}else Ext.EventManager.removeAll(e);if(h&&e&&e.childNodes){k=0;for(l=e.childNodes.length;k<l;k++)Ext.EventManager.purgeElement(e.childNodes[k],h,f)}},_unload:function(){var e;
for(e in Ext.elCache)Ext.EventManager.removeAll(e);delete Ext.elCache;delete Ext.Element._flyweights;var h,f,k=Ext.lib.Ajax;typeof k.conn=="object"?h=k.conn:h={};for(f in h)(e=h[f])&&k.abort({conn:e,tId:f})},onDocumentReady:function(e,h,f){if(Ext.isReady){u||(u=new Ext.util.Event);u.addListener(e,h,f);u.fire();u.listeners=[]}else{if(!u){u||(u=new Ext.util.Event);G&&t.addEventListener(z,i,false);if(Ext.isIE){if(!d()){d.bindIE=true;t.attachEvent("onreadystatechange",d)}}else if(Ext.isOpera)t.readyState==
F&&j()||t.addEventListener(z,g,false);else Ext.isWebKit&&d();v.on(B,"load",i)}f=f||{};f.delay=f.delay||1;u.addListener(e,h,f)}},fireDocReady:i};w.on=w.addListener;w.un=w.removeListener;w.stoppedMouseDownEvent=new Ext.util.Event;return w}())})();(function(){Ext.apply(Ext.EventObjectImpl.prototype,{SEMI_COLON:186,EQUAL_SIGN:187,COMMA:188,DASH:189,PERIOD:190,FORWARD_SLASH:191,OPEN_BRACKET:219,BACK_SLASH:220,CLOSE_BRACKET:221,SINGLE_QUOTE:222})})();
(function(){Ext.apply(Ext.Fx,{fxUnwrap:function(a,b,c){var d=this.dom;Ext.fly(d).clearPositioning();Ext.fly(d).setPositioning(b);if(!c.wrap)if(b=Ext.fly(a).dom.parentNode){b.insertBefore(d,a);Ext.fly(a).remove()}}});Ext.Element.addMethods(Ext.Fx)})();(function(){var a=Ext.Tip.prototype.doAutoWidth;Ext.override(Ext.Tip,{doAutoWidth:function(){a.call(this,Ext.isIE?1:0)}})})();
(function(){var a=Ext.Toolbar.TextItem.prototype.onRender;Ext.override(Ext.Toolbar.TextItem,{onRender:function(){a.apply(this,arguments);this.el&&this.el.unselectable()}})})();(function(){var a=Ext.data.Node.prototype.appendChild,b=Ext.data.Node.prototype.removeChild;Ext.override(Ext.data.Node,{appendChild:function(){this.leaf=false;return a.apply(this,arguments)},removeChild:function(){var c=b.apply(this,arguments);if(!this.hasChildNodes())this.leaf=true;return c}})})();
(function(){var a=function(b){return b!==undefined&&b!==null&&b!==""?parseInt(b,10):this.useNull?null:0};Ext.data.Types.INT.convert=a;Ext.data.Types.INTEGER.convert=a;a=function(b){return b!==undefined&&b!==null&&b!==""?parseFloat(b,10):this.useNull?null:0};Ext.data.Types.FLOAT.convert=a;Ext.data.Types.NUMBER.convert=a})();Ext.override(Ext.dd.DD,{scroll:false});
(function(){var a=Ext.dd.DragDropMgr.getLocation;Ext.apply(Ext.dd.DragDropMgr,{getGroupDDById:function(b,c){if(this.ids[b]&&this.ids[b][c])return this.ids[b][c];return null},getLocation:function(b){var c=b.getEl(),d=a.apply(this,arguments);if(c&&d)for(c=Ext.get(c.parentNode);c&&d;){if(c.isScrollable())d=d.intersect(c.getRegion());c=c.parent()}return d},getZIndex:function(){return-1}})})();
(function(){var a=Ext.dd.DragSource.prototype.onDragOver,b=Ext.dd.DragSource.prototype.onDragOut,c=Ext.dd.DragSource.prototype.onDragDrop;Ext.override(Ext.dd.DragSource,{onDragEnter:function(d,j){this.cachedTarget&&this.onDragOut(d,this.cachedTarget.id);var g;if((this.cachedTarget=g=this.ddGroup?Ext.dd.DragDropMgr.getGroupDDById(this.ddGroup,j):Ext.dd.DragDropMgr.getDDById(j))&&this.beforeDragEnter(g,d,j)!==false){g.isNotifyTarget?this.proxy.setStatus(g.notifyEnter(this,d,this.dragData)):this.proxy.setStatus(this.dropAllowed);
this.afterDragEnter&&this.afterDragEnter(g,d,j)}},onDragOver:function(d,j){this.cachedTarget||this.onDragEnter(d,j);this.cachedTarget=this.cachedTarget||Ext.dd.DragDropMgr.getGroupDDById(this.ddGroup,j);return a.apply(this,arguments)},onDragOut:function(){if(this.cachedTarget)return b.apply(this,arguments)},onDragDrop:function(){if(this.cachedTarget)return c.apply(this,arguments)}})})();
(function(){Ext.override(Ext.form.BasicForm,{updateRecord:function(a){a.beginEdit();var b,c;a.fields.each(function(d){if(b=this.findField(d.name)){c=b.getValue();if(Ext.type(c)!==false&&c.getGroupValue)c=c.getGroupValue();else if(b.isSingleValued!==true&&b.eachItem){c=[];b.eachItem(function(j){c.push(j.getValue())})}a.set(d.name,c)}},this);a.endEdit();return this},setValues:function(a){if(Ext.isArray(a))for(var b=0,c=a.length;b<c;b++){var d=a[b],j=this.findField(d.id);if(j)if(!j.hasFocus||j.originalValue==
j.el.dom.value){j.setValue(d.value);if(this.trackResetOnLoad)j.originalValue=j.getValue()}}else for(c in a)if(!Ext.isFunction(a[c])&&(b=this.findField(c)))if(!b.hasFocus||b.originalValue==b.el.dom.value){b.setValue(a[c]);if(this.trackResetOnLoad)b.originalValue=b.getValue()}return this}})})();
(function(){var a=Ext.form.Checkbox.prototype.onRender;Ext.override(Ext.form.Checkbox,{onRender:function(){a.apply(this,arguments);this.wrap.addClass("x-form-item");if(this.boxLabel&&this.el){var b=Ext.query(".x-form-cb-label",this.el.parent().dom)[0];b&&Ext.get(b).unselectable()}}})})();
(function(){var a=Ext.form.ComboBox.prototype.initList;Ext.override(Ext.form.ComboBox,{initList:function(){if(!this.tpl)this.tpl='<tpl for="."><div class="x-combo-list-item">{'+this.displayField+":htmlEncode}</div></tpl>";a.apply(this,arguments)}})})();
(function(){var a=Ext.form.DateField.prototype.getValue,b=Ext.form.DateField.prototype.initComponent;Ext.override(Ext.form.DateField,{initComponent:function(){if(!this.initialConfig.startDay)this.startDay=container.getSettingsModel().get("zarafa/v1/main/week_start");b.apply(this,arguments);if(this.startDay<0||this.startDay>=Date.dayNames.length)this.startDay=0},getValue:function(){var c=a.apply(this,arguments);return Ext.isEmpty(c)?null:c},processValue:function(c){return Ext.isEmpty(c)?"":c}})})();
(function(){Ext.override(Ext.form.DisplayField,{cls:"x-form-item"})})();(function(){Ext.override(Ext.form.FormPanel,{labelAlign:"right"})})();
(function(){var a=Ext.form.HtmlEditor.prototype.createToolbar,b=Ext.form.HtmlEditor.prototype.initEditor,c=Ext.form.HtmlEditor.prototype.initFrame;Ext.override(Ext.form.HtmlEditor,{createToolbar:function(){a.apply(this,arguments);this.getToolbar().layout.overflowTabIndex=-1;if(this.enableFont&&!Ext.isSafari2){var d=Ext.DomQuery.select(".x-font-select",this.tb.getEl().dom);Ext.isEmpty(d)||d[0].setAttribute("tabindex","-1")}},onFirstFocus:function(){this.activated=true;this.disableItems(this.readOnly);
this.fireEvent("activate",this)},fixKeys:function(){if(Ext.isIE)return function(d){var j=d.getKey(),g=this.getDoc(),i;if(j==d.TAB){d.stopEvent();j=this.win.getSelection();if(j.getRangeAt&&j.rangeCount){i=j.getRangeAt(0);i.deleteContents();d=g.createElement("div");d.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;";g=g.createDocumentFragment();for(var o,s;o=d.firstChild;)s=g.appendChild(o);i.insertNode(g);if(s){i=i.cloneRange();i.setStartAfter(s);i.collapse(true);j.removeAllRanges();j.addRange(i)}}this.deferFocus()}else if(j==
d.ENTER){j=this.win.getSelection();if(j.getRangeAt&&j.rangeCount){i=j.getRangeAt(0);i.deleteContents();o=i.commonAncestorContainer;if(!o||o.nodeName.toLowerCase()!="li"&&o.parentNode.nodeName.toLowerCase()!="li"){d.stopEvent();d=g.createElement("div");d.innerHTML="<br />";for(g=g.createDocumentFragment();o=d.firstChild;)s=g.appendChild(o);i.insertNode(g);if(s){i=i.cloneRange();i.setStartAfter(s);i.collapse(false);j.removeAllRanges();j.addRange(i)}}}}};else if(Ext.isOpera)return function(d){if(d.getKey()==
d.TAB){d.stopEvent();this.win.focus();this.execCmd("InsertHTML","&nbsp;&nbsp;&nbsp;&nbsp;");this.deferFocus()}};else if(Ext.isWebKit)return function(d){if(d.getKey()==d.TAB){d.stopEvent();this.execCmd("InsertText","\t");this.deferFocus()}}}(),initEditor:function(){b.apply(this,arguments);this.getWin().addEventListener("dragover",Zarafa.onWindowDragDrop,false);this.getWin().addEventListener("drop",Zarafa.onWindowDragDrop,false)},initFrame:function(){c.apply(this,arguments);if(Ext.isChrome&&window.location.href.search(/#$/)!==
-1){var d=this.findParentBy(function(j){return j.getEl().isScrollable()});this.getEditorBody().scrollTop=0;d!==null&&d.getEl().scrollTo("top",0)}}})})();(function(){var a=Ext.form.Label.prototype.onRender;Ext.override(Ext.form.Label,{cls:"x-form-item-label",onRender:function(){a.apply(this,arguments);this.positionEl=this.el.wrap({cls:"x-form-item"});this.el.unselectable()}})})();(function(){var a=/^(100?|\d?\d)?%?$/;Ext.apply(Ext.form.VTypes,{percentage:function(b){return a.test(b)},percentageText:_("Value must be between 0% to 100%")})})();
(function(){var a=Ext.grid.GridPanel.prototype.onClick;Ext.override(Ext.grid.GridPanel,{onClick:function(){a.apply(this,arguments);this.view.focusEl.focus()},reconfigure:function(b,c){this.stateful!==false&&c!==this.colModel&&this.mun(this.colModel,"hiddenchange",this.saveState,this);var d=this.rendered;if(d)if(this.loadMask){this.loadMask.destroy();this.loadMask=new Ext.LoadMask(this.bwrap,Ext.apply({},{store:b},this.initialConfig.loadMask))}this.view&&this.view.initData(b,c);this.store=b;this.colModel=
c;if(this.stateful!==false){this.initStateEvents();this.initState()}d&&this.view.refresh(true);this.fireEvent("reconfigure",this,b,c)}})})();(function(){var a=Ext.grid.GridView.prototype.onColConfigChange;Ext.override(Ext.grid.GridView,{getColumnWidth:function(b){b=this.cm.getColumnWidth(b);var c=this.borderWidth;return Ext.isNumber(b)?Ext.isBorderBox?b+"px":Math.max(b-c,0)+"px":b},onColConfigChange:function(){var b=this.grid;b.stateful!==false&&b.initState();a.apply(this,arguments)}})})();
(function(){var a=Ext.layout.BorderLayout.Region.prototype.beforeCollapse,b=Ext.layout.BorderLayout.Region.prototype.onExpand;Ext.override(Ext.layout.BorderLayout.Region,{beforeCollapse:function(){this.splitEl&&this.splitEl.addClass("x-hide-display");a.apply(this,arguments)},onExpand:function(){this.splitEl&&this.splitEl.removeClass("x-hide-display");b.apply(this,arguments)}})})();
(function(){var a=Ext.layout.ToolbarLayout.prototype.configureItem,b=Ext.layout.ToolbarLayout.prototype.hideItem,c=Ext.layout.ToolbarLayout.prototype.unhideItem,d=Ext.layout.ToolbarLayout.prototype.onLayout,j=Ext.layout.ToolbarLayout.prototype.addComponentToMenu;Ext.override(Ext.layout.ToolbarLayout,{triggerWidth:41,overflowTabIndex:undefined,onLayout:function(g){d.apply(this,arguments);g.items.each(function(i){Ext.isFunction(i.doLayout)&&i.doLayout()},this);this.overflowTabIndex&&this.more&&Ext.get(this.more.el).child("button").set({tabIndex:this.overflowTabIndex})},
configureItem:function(g){var i=this.container,o=i.getLayoutTarget();a.apply(this,arguments);g.on("show",function(s){s.xtbHidden!==true&&this.onLayout(i,o)},this);g.on("hide",function(s){s.xtbHidden!==true&&this.onLayout(i,o)},this)},hideItem:function(g){var i=this;b.apply(this,arguments);g.xtbOrigShow=g.show;g.show=function(){g.xtbOrigShow(true);g.xtbWidth=g.getPositionEl().dom.parentNode.offsetWidth;g.xtbOrigHide(false)};g.xtbOrigHide=g.hide;g.hide=function(){i.unhideItem(g);g.hide()}},unhideItem:function(g){g.show=
g.xtbOrigShow;delete g.xtbOrigShow;g.hide=g.xtbOrigHide;delete g.xtbOrigHide;delete g.xtbWidth;c.apply(this,arguments)},addComponentToMenu:function(g,i){if(i.xtbHidden===true||i.hidden!==true)j.apply(this,arguments)}})})();(function(){var a=Ext.layout.boxOverflow.Menu.prototype.addComponentToMenu;Ext.override(Ext.layout.boxOverflow.Menu,{addComponentToMenu:function(b,c){if(c.xtbHidden===true||c.hidden!==true)a.apply(this,arguments)}})})();
(function(){Ext.apply(Ext.state.Manager,{components:new Ext.util.MixedCollection(false,function(a){return a.getStateId()}),register:function(a){this.components.add(a)},unregister:function(a){this.components.remove(a)},getComponent:function(a){return this.components.get(a)}})})();
(function(){var a=Ext.tree.TreeEditor.prototype.bindScroll,b=Ext.tree.TreeEditor.prototype.fitToTree;Ext.override(Ext.tree.TreeEditor,{fitToTree:function(){this.tree&&this.tree.isDestroyed!==true&&b.apply(this,arguments)},bindScroll:function(){this.tree&&this.tree.isDestroyed!==true&&a.apply(this,arguments)}})})();(function(){Ext.override(Ext.tree.TreeSorter,{doSort:function(a){a.childNodes&&a.sort(this.sortFn)}})})();
(function(){Ext.apply(Ext.util.Format,{fileSize:function(a){Ext.isNumber(a)||(a=0);if(a<1024)return String.format(ngettext("{0} byte","{0} bytes",a),a);a=parseFloat((a/1024).toFixed(1));if(a<1024)return String.format(ngettext("{0} KB","{0} KB",a),a);a=parseFloat((a/1024).toFixed(1));if(a<1024)return String.format(ngettext("{0} MB","{0} MB",a),a);a=parseFloat((a/1024).toFixed(1));if(a<1024)return String.format(ngettext("{0} GB","{0} GB",a),a);a=parseFloat((a/1024).toFixed(1));return String.format(ngettext("{0} TB",
"{0} TB",a),a)},percentage:function(a,b){Ext.isDefined(b)||(b=2);return(a*100).toFixed(b)+"%"},duration:function(a,b){b=Ext.isDefined(b)?b:0;if(a<60)return String.format(ngettext("{0} minute","{0} minutes",a),a);a=parseFloat((a/60).toFixed(b));if(a<24)return String.format(ngettext("{0} hour","{0} hours",a),a);a=parseFloat((a/24).toFixed(b));if(a<7)return String.format(ngettext("{0} day","{0} days",a),a);a=parseFloat((a/7).toFixed(b));return String.format(ngettext("{0} week","{0} weeks",a),a)},indent:function(a,
b){for(var c=(Ext.isDefined(a)?a:1)*(Ext.isDefined(b)?b:4),d="",j=0;j<c;j++)d+="&nbsp;";return d},elide:function(a,b,c){b=b||0;c=Ext.isDefined(c)?c:b;if(b===0&&c===0)return a;if(a&&a.length>b+c)return a.substr(0,b)+"..."+a.substr(a.length-c);return a},htmlEncodeUndef:function(){return this.htmlEncode(this.undef.apply(this,arguments))},htmlEncodeDefaultValue:function(){return this.htmlEncode(this.defaultValue.apply(this,arguments))},htmlEncodeElide:function(){return this.htmlEncode(this.elide.apply(this,
arguments))},htmlEncodeEllipsis:function(){return this.htmlEncode(this.ellipsis.apply(this,arguments))},basename:function(a){return a.split("\\").pop()},htmlEncodeBasename:function(){return this.htmlEncode(this.basename.apply(this,arguments))},sensitivityString:function(a){return Zarafa.core.mapi.Sensitivity.getDisplayName(a)},importanceString:function(a){return Zarafa.core.mapi.Importance.getDisplayName(a)},meetingStatusString:function(a){return Zarafa.core.mapi.MeetingStatus.getDisplayName(a)},
responseStatusString:function(a){return Zarafa.core.mapi.ResponseStatus.getDisplayName(a)},taskStatusString:function(a){return Zarafa.core.mapi.TaskStatus.getDisplayName(a)},busyStatusString:function(a){return Zarafa.core.mapi.BusyStatus.getDisplayName(a)}})})();
(function(){Ext.override(Ext.ux.Spinner,{initSpinner:function(){this.field.addEvents({spin:true,spinup:true,spindown:true});this.keyNav=new Ext.KeyNav(this.el,{up:function(a){a.preventDefault();this.onSpinUp()},down:function(a){a.preventDefault();this.onSpinDown()},pageUp:function(a){a.preventDefault();this.onSpinUpAlternate()},pageDown:function(a){a.preventDefault();this.onSpinDownAlternate()},scope:this});this.field.mon(this.trigger,"click",this.onTriggerClick,this,{preventDefault:true});this.field.mon(this.trigger,
{mouseover:this.onMouseOver,mouseout:this.onMouseOut,mousemove:this.onMouseMove,mousedown:this.onMouseDown,mouseup:this.onMouseUp,scope:this,preventDefault:true});this.field.mon(this.wrap,"mousewheel",this.handleMouseWheel,this);this.dd.setXConstraint(0,0,10);this.dd.setYConstraint(1500,1500,10);this.dd.endDrag=this.endDrag.createDelegate(this);this.dd.startDrag=this.startDrag.createDelegate(this);this.dd.onDrag=this.onDrag.createDelegate(this)}})})();Ext.namespace("Zarafa.util");
Zarafa.util.Translations={msg:_("The quick brown fox jumps over the lazy dog"),SplitTranslation:function(a,b){if(!Ext.isDefined(b))return a;var c=a.indexOf(b);if(c==-1)return a;for(var d=c-1;a[d]==" "&&d>=0;)d--;for(c=c+b.length;a[c]==" "&&c<a.length;)c++;return[a.substr(0,d+1),a.substr(c)]},MultiSplitTranslation:function(a,b){Ext.isArray(b)||(b=[b]);var c=new Ext.util.MixedCollection;c.add(a);for(var d=0;d<b.length;d++)c.each(function(j,g){var i=Zarafa.util.Translations.SplitTranslation(j,b[d]);
if(!Ext.isArray(i))return true;c.removeAt(g);if(!Ext.isEmpty(i[0])){c.insert(g,i[0]);g++}c.insert(g,b[d]);g++;Ext.isEmpty(i[1])||c.insert(g,i[1]);return false});return c.getRange()}};
(function(){Ext.apply(Date,{dayNames:[_("Sunday"),_("Monday"),_("Tuesday"),_("Wednesday"),_("Thursday"),_("Friday"),_("Saturday")],monthNames:[_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),_("July"),_("August"),_("September"),_("October"),_("November"),_("December")]});Ext.PagingToolbar.tmpPageText=Zarafa.util.Translations.SplitTranslation(_("Page {A} of {0}"),"{A}");Ext.override(Ext.PagingToolbar,{displayMsg:_("Displaying messages {0} - {1} of {2}"),emptyMsg:_("No messages to display"),
beforePageText:Ext.PagingToolbar.tmpPageText[0],afterPageText:Ext.PagingToolbar.tmpPageText[1],firstText:_("First Page"),prevText:_("Previous Page"),nextText:_("Next Page"),lastText:_("Last Page"),refreshText:_("Refresh")});delete Ext.PagingToolbar.tmpPageText;Ext.override(Ext.DatePicker,{todayText:_("Today"),okText:"&nbsp;"+_("OK")+"&nbsp;",cancelText:_("Cancel"),todayTip:_("{0} (Spacebar)"),minText:_("This date is before the minimum date"),maxText:_("This date is after the maximum date"),format:_("d/m/Y"),
disabledDaysText:_("Disabled"),disabledDatesText:_("Disabled"),nextText:_("Next Month (Control+Right)"),prevText:_("Previous Month (Control+Left)"),monthYearText:_("Choose a month (Control+Up/Down to move years)"),monthNames:Date.monthNames,dayNames:Date.dayNames});Ext.override(Ext.form.HtmlEditor,{createLinkText:_("Please enter the URL for the link")+":",buttonTips:{bold:{title:_("Bold (Ctrl+B) text"),text:_("Make the selected text bold."),cls:"x-html-editor-tip"},italic:{title:_("Italic (Ctrl+I)"),
text:_("Make the selected text italic."),cls:"x-html-editor-tip"},underline:{title:_("Underline (Ctrl+U)"),text:_("Underline the selected text."),cls:"x-html-editor-tip"},increasefontsize:{title:_("Grow Text"),text:_("Increase the font size."),cls:"x-html-editor-tip"},decreasefontsize:{title:_("Shrink Text"),text:_("Decrease the font size."),cls:"x-html-editor-tip"},backcolor:{title:_("Text Highlight Color"),text:_("Change the background color of the selected text."),cls:"x-html-editor-tip"},forecolor:{title:_("Font Color"),
text:_("Change the color of the selected text."),cls:"x-html-editor-tip"},justifyleft:{title:_("Align Text Left"),text:_("Align text to the left."),cls:"x-html-editor-tip"},justifycenter:{title:_("Center Text"),text:_("Center text in the editor."),cls:"x-html-editor-tip"},justifyright:{title:_("Align Text Right"),text:_("Align text to the right."),cls:"x-html-editor-tip"},insertunorderedlist:{title:_("Bullet List"),text:_("Start a bulleted list."),cls:"x-html-editor-tip"},insertorderedlist:{title:_("Numbered List"),
text:_("Start a numbered list."),cls:"x-html-editor-tip"},createlink:{title:_("Hyperlink"),text:_("Make the selected text a hyperlink."),cls:"x-html-editor-tip"},sourceedit:{title:_("Source Edit"),text:_("Switch to source editing mode."),cls:"x-html-editor-tip"}}});Ext.override(Ext.grid.GridView,{sortAscText:_("Sort Ascending"),sortDescText:_("Sort Descending"),columnsText:_("Columns")});Ext.override(Ext.grid.GroupingView,{groupByText:_("Group By This Field"),showGroupsText:_("Show in Groups"),emptyGroupText:_("(None)")});
Ext.MessageBox.buttonText.ok=_("Ok");Ext.MessageBox.buttonText.cancel=_("Cancel");Ext.MessageBox.buttonText.yes=_("Yes");Ext.MessageBox.buttonText.no=_("No");Ext.override(Ext.LoadMask,{msg:_("Loading")+"..."});Ext.override(Ext.form.ComboBox,{loadingText:_("Loading")+"..."});Ext.override(Ext.form.Field,{invalidText:_("The value in this field is invalid")});Ext.override(Ext.form.TextField,{minLengthText:_("The minimum length for this field is {0}"),maxLengthText:_("The maximum length for this field is {0}"),
blankText:_("This field is required")});Ext.override(Ext.form.NumberField,{minText:_("The minimum value for this field is {0}"),maxText:_("The maximum value for this field is {0}"),nanText:_("{0} is not a valid number")});Ext.override(Ext.form.DateField,{format:_("d/m/Y"),disabledDaysText:_("Disabled"),disabledDatesText:_("Disabled"),minText:_("The date in this field must be equal to or after {0}"),maxText:_("The date in this field must be equal to or before {0}"),invalidText:_("{0} is not a valid date - it must be in the format {1}")});
Ext.override(Ext.form.CheckboxGroup,{blankText:_("You must select at least one item in this group")});Ext.override(Ext.form.RadioGroup,{blankText:_("You must select one item in this group")});Ext.override(Ext.form.TimeField,{minText:_("The time in this field must be equal to or after {0}"),maxText:_("The time in this field must be equal to or before {0}"),invalidText:_("{0} is not a valid time"),format:_("G:i")});Ext.override(Ext.grid.GridView,{sortAscText:_("Sort Ascending"),sortDescText:_("Sort Descending"),
columnsText:_("Columns")});Ext.override(Ext.grid.PropertyColumnModel,{nameText:_("Name"),valueText:_("Value"),dateFormat:_("d/m/Y"),trueText:_("true"),falseText:_("false")});Ext.apply(Ext.form.VTypes,{emailText:_('This field should be an e-mail address in the format "user@example.com"'),urlText:String.format(_('This field should be a URL in the format "{0}"'),"http://www.example.com"),alphaText:_("This field should only contain letters and _"),alphanumText:_("This field should only contain letters, numbers and _")})})();
(function(){var a=Ext.DatePicker.prototype.onRender,b=Ext.DatePicker.prototype.update,c=Ext.DatePicker.prototype.beforeDestroy,d=Ext.DatePicker.prototype.initComponent;Ext.override(Ext.DatePicker,{width:"180",showWeekNumber:false,weekCells:undefined,initComponent:function(){if(!this.initialConfig.startDay)this.startDay=container.getSettingsModel().get("zarafa/v1/main/week_start");if(this.startDay<0||this.startDay>=Date.dayNames.length)this.startDay=0;d.apply(this,arguments)},onRender:function(){a.apply(this,
arguments);this.getEl().down("table").applyStyles({width:this.width})},update:function(j){if(this.showWeekNumber===true&&!Ext.isDefined(this.weekCells)){var g=this.el.child("table.x-date-inner",true),i=g.tHead.rows[0],o={tag:"th",html:"<span>"+_("Wk")+"</span>"};Ext.DomHelper.insertFirst(i,o);g=g.tBodies[0];i={tag:"td",cls:"x-date-weeknumber",html:"<a><em><span></span></em></a>"};for(o=0;o<g.rows.length;o++)Ext.DomHelper.insertFirst(g.rows[o],i);this.weekCells=this.el.select("td.x-date-weeknumber a em span")}b.apply(this,
arguments);if(this.showWeekNumber===true){g=this.weekCells.elements;i=j.getFirstDateOfMonth();o=0;for(var s=g.length;o<s;o++){g[o].innerHTML=i.getWeekOfYear();i=i.add(Date.DAY,7)}}},beforeDestroy:function(){c.apply(this,arguments);if(this.rendered&&Ext.isDefined(this.weekCells)){Ext.destroy(this.weekCells.el);delete this.weekCells}}})})();
