/*
 * jQuery JavaScript Library v1.5.1
 * http://jquery.com/
 *
 * Copyright 2011, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2011, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Wed Feb 23 13:55:29 2011 -0500
 */
(function(a,b){function cg(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cd(a){if(!bZ[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");
b.remove();if(c==="none"||c===""){c="block"}bZ[a]=c}return bZ[a]}function cc(a,b){var c={};d.each(cb.concat.apply([],cb.slice(0,b)),function(){c[this]=a});return c}function bY(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bX(){try{return new a.XMLHttpRequest}catch(b){}}function bW(){d(a).unload(function(){for(var a in bU){bU[a](0,1)}})}function bQ(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1){for(h in a.converters){typeof h==="string"&&(f[h.toLowerCase()]=a.converters[h])
}}l=k,k=e[g];if(k==="*"){k=l}else{if(l!=="*"&&l!==k){m=l+" "+k,n=f[m]||f["* "+k];if(!n){p=b;for(o in f){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=f[j[1]+" "+k];if(p){o=f[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&d.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}}return c}function bP(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g){i in d&&(c[g[i]]=d[i])}while(f[0]==="*"){f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"))
}if(h){for(i in e){if(e[i]&&e[i].test(h)){f.unshift(i);break}}}if(f[0] in d){j=f[0]}else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bO(a,b,c,e){if(d.isArray(b)&&b.length){d.each(b,function(b,f){c||bq.test(a)?e(a,f):bO(a+"["+(typeof f==="object"||d.isArray(f)?b:"")+"]",f,c,e)})}else{if(c||b==null||typeof b!=="object"){e(a,b)}else{if(d.isArray(b)||d.isEmptyObject(b)){e(a,"")}else{for(var f in b){bO(a+"["+f+"]",b[f],c,e)
}}}}}function bN(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bH,l;for(;i<j&&(k||!l);i++){l=h[i](c,d,e),typeof l==="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bN(a,c,d,e,l,g)))}(k||!l)&&!g["*"]&&(l=bN(a,c,d,e,"*",g));return l}function bM(a){return function(b,c){typeof b!=="string"&&(c=b,b="*");if(d.isFunction(c)){var e=b.toLowerCase().split(bB),f=0,g=e.length,h,i,j;for(;f<g;f++){h=e[f],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)
}}}}function bo(a,b,c){var e=b==="width"?bi:bj,f=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border"){return f}d.each(e,function(){c||(f-=parseFloat(d.css(a,"padding"+this))||0),c==="margin"?f+=parseFloat(d.css(a,"margin"+this))||0:f-=parseFloat(d.css(a,"border"+this+"Width"))||0});return f}function ba(a,b){b.src?d.ajax({url:b.src,async:!1,dataType:"script"}):d.globalEval(b.text||b.textContent||b.innerHTML||""),b.parentNode&&b.parentNode.removeChild(b)}function _(a){return"getElementsByTagName" in a?a.getElementsByTagName("*"):"querySelectorAll" in a?a.querySelectorAll("*"):[]
}function $(a,b){if(b.nodeType===1){var c=b.nodeName.toLowerCase();b.clearAttributes(),b.mergeAttributes(a);if(c==="object"){b.outerHTML=a.outerHTML}else{if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option"){b.selected=a.defaultSelected}else{if(c==="input"||c==="textarea"){b.defaultValue=a.defaultValue}}}else{a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)}}b.removeAttribute(d.expando)}}function Z(a,b){if(b.nodeType===1&&d.hasData(a)){var c=d.expando,e=d.data(a),f=d.data(b,e);
if(e=e[c]){var g=e.events;f=f[c]=d.extend({},e);if(g){delete f.handle,f.events={};for(var h in g){for(var i=0,j=g[h].length;i<j;i++){d.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}}}function Y(a,b){return d.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function O(a,b,c){if(d.isFunction(b)){return d.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c})}if(b.nodeType){return d.grep(a,function(a,d){return a===b===c
})}if(typeof b==="string"){var e=d.grep(a,function(a){return a.nodeType===1});if(J.test(b)){return d.filter(b,e,!c)}b=d.filter(b,e)}return d.grep(a,function(a,e){return d.inArray(a,b)>=0===c})}function N(a){return !a||!a.parentNode||a.parentNode.nodeType===11}function F(a,b){return(a&&a!=="*"?a+".":"")+b.replace(r,"`").replace(s,"&")}function E(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,q=[],r=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;
var t=s.live.slice(0);for(i=0;i<t.length;i++){g=t[i],g.origType.replace(p,"")===a.type?r.push(g.selector):t.splice(i--,1)}f=d(a.target).closest(r,a.currentTarget);for(j=0,k=f.length;j<k;j++){m=f[j];for(i=0;i<t.length;i++){g=t[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,e=null;if(g.preType==="mouseenter"||g.preType==="mouseleave"){a.type=g.preType,e=d(a.relatedTarget).closest(g.selector)[0]}(!e||e!==h)&&q.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=q.length;
j<k;j++){f=q[j];if(c&&f.level>c){break}a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped()){break}}}return b}}function C(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function w(){return !0}function v(){return !1}function g(a){for(var b in a){if(b!=="toJSON"){return !1
}}return !0}function f(a,c,f){if(f===b&&a.nodeType===1){f=a.getAttribute("data-"+c);if(typeof f==="string"){try{f=f==="true"?!0:f==="false"?!1:f==="null"?null:d.isNaN(f)?e.test(f)?d.parseJSON(f):f:parseFloat(f)}catch(g){}d.data(a,c,f)}else{f=b}}return f}var c=a.document,d=function(){function I(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(I,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x=!1,y,z="then done fail isResolved isRejected promise".split(" "),A,B=Object.prototype.toString,C=Object.prototype.hasOwnProperty,D=Array.prototype.push,E=Array.prototype.slice,F=String.prototype.trim,G=Array.prototype.indexOf,H={};
d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a){return this}if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e){return !e||e.jquery?(e||f).find(a):this.constructor(e).find(a)}if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);
return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2]){return f.find(a)}this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a)){return f.ready(a)}a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.1",length:0,size:function(){return this.length},toArray:function(){return E.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();
d.isArray(a)?D.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(E.apply(this,arguments),"slice",E.call(arguments).join(","))
},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:D,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++){if((a=arguments[j])!=null){for(c in a){e=i[c],f=a[c];if(i===f){continue
}l&&f&&(d.isPlainObject(f)||(g=d.isArray(f)))?(g?(g=!1,h=e&&d.isArray(e)?e:[]):h=e&&d.isPlainObject(e)?e:{},i[c]=d.extend(l,h,f)):f!==b&&(i[c]=f)}}}return i},d.extend({noConflict:function(b){a.$=f,b&&(a.jQuery=e);return d},isReady:!1,readyWait:1,ready:function(a){a===!0&&d.readyWait--;if(!d.readyWait||a!==!0&&!d.isReady){if(!c.body){return setTimeout(d.ready,1)}d.isReady=!0;if(a!==!0&&--d.readyWait>0){return}y.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=!0;
if(c.readyState==="complete"){return setTimeout(d.ready,1)}if(c.addEventListener){c.addEventListener("DOMContentLoaded",A,!1),a.addEventListener("load",d.ready,!1)}else{if(c.attachEvent){c.attachEvent("onreadystatechange",A),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&I()}}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval" in a
},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):H[B.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a)){return !1}if(a.constructor&&!C.call(a,"constructor")&&!C.call(a.constructor.prototype,"isPrototypeOf")){return !1}var c;for(c in a){}return c===b||C.call(a,c)},isEmptyObject:function(a){for(var b in a){return !1}return !0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b){return null
}b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,""))){return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))()}d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");
d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a){if(c.apply(a[f],e)===!1){break}}}else{for(;g<h;){if(c.apply(a[g++],e)===!1){break}}}}else{if(i){for(f in a){if(c.call(a[f],f,a[f])===!1){break}}}else{for(var j=a[0];g<h&&c.call(j,g,j)!==!1;j=a[++g]){}}}return a
},trim:F?function(a){return a==null?"":F.call(a)}:function(a){return a==null?"":(a+"").replace(j,"").replace(k,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var e=d.type(a);a.length==null||e==="string"||e==="function"||e==="regexp"||d.isWindow(a)?D.call(c,a):d.merge(c,a)}return c},inArray:function(a,b){if(b.indexOf){return b.indexOf(a)}for(var c=0,d=b.length;c<d;c++){if(b[c]===a){return c}}return -1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length==="number"){for(var f=c.length;e<f;
e++){a[d++]=c[e]}}else{while(c[e]!==b){a[d++]=c[e++]}}a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++){e=!!b(a[f],f),c!==e&&d.push(a[f])}return d},map:function(a,b,c){var d=[],e;for(var f=0,g=a.length;f<g;f++){e=b(a[f],f,c),e!=null&&(d[d.length]=e)}return d.concat.apply([],d)},guid:1,proxy:function(a,c,e){arguments.length===2&&(typeof c==="string"?(e=a,a=e[c],c=b):c&&!d.isFunction(c)&&(e=c,c=b)),!c&&a&&(c=function(){return a.apply(e||this,arguments)}),a&&(c.guid=a.guid=a.guid||c.guid||d.guid++);
return c},access:function(a,c,e,f,g,h){var i=a.length;if(typeof c==="object"){for(var j in c){d.access(a,j,c[j],f,g,e)}return a}if(e!==b){f=!h&&f&&d.isFunction(e);for(var k=0;k<i;k++){g(a[k],c,f?e.call(a[k],k,g(a[k],c)):e,h)}return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},_Deferred:function(){var a=[],b,c,e,f={done:function(){if(!e){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++){i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i)
}k&&f.resolveWith(k[0],k[1])}return this},resolveWith:function(d,f){if(!e&&!b&&!c){c=1;try{while(a[0]){a.shift().apply(d,f)}}catch(g){throw g}finally{b=[d,f],c=0}}return this},resolve:function(){f.resolveWith(d.isFunction(this.promise)?this.promise():this,arguments);return this},isResolved:function(){return c||b},cancel:function(){e=1,a=[];return this}};return f},Deferred:function(a){var b=d._Deferred(),c=d._Deferred(),e;d.extend(b,{then:function(a,c){b.done(a).fail(c);return this},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,promise:function(a){if(a==null){if(e){return e
}e=a={}}var c=z.length;while(c--){a[z[c]]=b[z[c]]}return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){var b=arguments.length,c=b<=1&&a&&d.isFunction(a.promise)?a:d.Deferred(),e=c.promise();if(b>1){var f=E.call(arguments,0),g=b,h=function(a){return function(b){f[a]=arguments.length>1?E.call(arguments,0):b,--g||c.resolveWith(e,f)}};while(b--){a=f[b],a&&d.isFunction(a.promise)?a.promise().then(h(b),c.reject):--g}g||c.resolveWith(e,f)}else{c!==a&&c.resolve(a)
}return e},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),y=d._Deferred(),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){H["[object "+b+"]"]=b.toLowerCase()
}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),G&&(d.inArray=function(a,b){return G.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?A=function(){c.removeEventListener("DOMContentLoaded",A,!1),d.ready()}:c.attachEvent&&(A=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",A),d.ready())});return d}();(function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;
var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e),b=e=f=null}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";
var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom" in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent){return !0}var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function"),b=null;return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null
}})();var e=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return !!a&&!g(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b){return}l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));
if(typeof c==="object"||typeof c==="function"){f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c)}i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c]){return i[g]&&i[g].events}return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,h=b.nodeType,i=h?d.cache:b,j=h?b[d.expando]:d.expando;if(!i[j]){return}if(c){var k=e?i[j][f]:i[j];if(k){delete k[c];if(!g(k)){return}}}if(e){delete i[j][f];if(!g(i[j])){return}}var l=i[j][f];d.support.deleteExpando||i!=a?delete i[j]:i[j]=null,l?(i[j]={},h||(i[j].toJSON=d.noop),i[j][f]=l):h&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)
}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b){return b!==!0&&a.getAttribute("classid")===b}}return !0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var g=this[0].attributes,h;for(var i=0,j=g.length;i<j;i++){h=g[i].name,h.indexOf("data-")===0&&(h=h.substr(5),f(this[0],h,e[h]))}}}return e}if(typeof a==="object"){return this.each(function(){d.data(this,a)
})}var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(c===b){e=this.triggerHandler("getData"+k[1]+"!",[k[0]]),e===b&&this.length&&(e=d.data(this[0],a),e=f(this[0],a,e));return e===b&&k[1]?this.data(k[0]):e}return this.each(function(){var b=d(this),e=[k[0],c];b.triggerHandler("setData"+k[1]+"!",e),d.data(this,a,c),b.triggerHandler("changeData"+k[1]+"!",e)})},removeData:function(a){return this.each(function(){d.removeData(this,a)})}}),d.extend({queue:function(a,b,c){if(a){b=(b||"fx")+"queue";var e=d._data(a,b);
if(!c){return e||[]}!e||d.isArray(c)?e=d._data(a,b,d.makeArray(c)):e.push(c);return e}},dequeue:function(a,b){b=b||"fx";var c=d.queue(a,b),e=c.shift();e==="inprogress"&&(e=c.shift()),e&&(b==="fx"&&c.unshift("inprogress"),e.call(a,function(){d.dequeue(a,b)})),c.length||d.removeData(a,b+"queue",!0)}}),d.fn.extend({queue:function(a,c){typeof a!=="string"&&(c=a,a="fx");if(c===b){return d.queue(this[0],a)}return this.each(function(b){var e=d.queue(this,a,c);a==="fx"&&e[0]!=="inprogress"&&d.dequeue(this,a)
})},dequeue:function(a){return this.each(function(){d.dequeue(this,a)})},delay:function(a,b){a=d.fx?d.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){d.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var h=/[\n\t\r]/g,i=/\s+/,j=/\r/g,k=/^(?:href|src|style)$/,l=/^(?:button|input)$/i,m=/^(?:button|input|object|select|textarea)$/i,n=/^a(?:rea)?$/i,o=/^(?:radio|checkbox)$/i;d.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"},d.fn.extend({attr:function(a,b){return d.access(this,a,b,!0,d.attr)
},removeAttr:function(a,b){return this.each(function(){d.attr(this,a,""),this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(d.isFunction(a)){return this.each(function(b){var c=d(this);c.addClass(a.call(this,b,c.attr("class")))})}if(a&&typeof a==="string"){var b=(a||"").split(i);for(var c=0,e=this.length;c<e;c++){var f=this[c];if(f.nodeType===1){if(f.className){var g=" "+f.className+" ",h=f.className;for(var j=0,k=b.length;j<k;j++){g.indexOf(" "+b[j]+" ")<0&&(h+=" "+b[j])}f.className=d.trim(h)
}else{f.className=a}}}}return this},removeClass:function(a){if(d.isFunction(a)){return this.each(function(b){var c=d(this);c.removeClass(a.call(this,b,c.attr("class")))})}if(a&&typeof a==="string"||a===b){var c=(a||"").split(i);for(var e=0,f=this.length;e<f;e++){var g=this[e];if(g.nodeType===1&&g.className){if(a){var j=(" "+g.className+" ").replace(h," ");for(var k=0,l=c.length;k<l;k++){j=j.replace(" "+c[k]+" "," ")}g.className=d.trim(j)}else{g.className=""}}}}return this},toggleClass:function(a,b){var c=typeof a,e=typeof b==="boolean";
if(d.isFunction(a)){return this.each(function(c){var e=d(this);e.toggleClass(a.call(this,c,e.attr("class"),b),b)})}return this.each(function(){if(c==="string"){var f,g=0,h=d(this),j=b,k=a.split(i);while(f=k[g++]){j=e?j:!h.hasClass(f),h[j?"addClass":"removeClass"](f)}}else{if(c==="undefined"||c==="boolean"){this.className&&d._data(this,"__className__",this.className),this.className=this.className||a===!1?"":d._data(this,"__className__")||""}}})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;
c<d;c++){if((" "+this[c].className+" ").replace(h," ").indexOf(b)>-1){return !0}}return !1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return !e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0){return null}for(var k=i?f:0,l=i?f+1:h.length;k<l;k++){var m=h[k];if(m.selected&&(d.support.optDisabled?!m.disabled:m.getAttribute("disabled")===null)&&(!m.parentNode.disabled||!d.nodeName(m.parentNode,"optgroup"))){a=d(m).val();
if(i){return a}g.push(a)}}if(i&&!g.length&&h.length){return d(h[f]).val()}return g}if(o.test(c.type)&&!d.support.checkOn){return c.getAttribute("value")===null?"on":c.value}return(c.value||"").replace(j,"")}return b}var n=d.isFunction(a);return this.each(function(b){var c=d(this),e=a;if(this.nodeType===1){n&&(e=a.call(this,b,c.val())),e==null?e="":typeof e==="number"?e+="":d.isArray(e)&&(e=d.map(e,function(a){return a==null?"":a+""}));if(d.isArray(e)&&o.test(this.type)){this.checked=d.inArray(c.val(),e)>=0
}else{if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else{this.value=e}}}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2){return b}if(f&&c in d.attrFn){return d(a)[c](e)}var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=k.test(c);
if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&l.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c)){return a.getAttributeNode(c).nodeValue}if(c==="tabIndex"){var o=a.getAttributeNode("tabIndex");return o&&o.specified?o.value:m.test(a.nodeName)||n.test(a.nodeName)&&a.href?0:b
}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c))){return b}var p=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return p===null?b:p}h&&(a[c]=e);return a[c]}});var p=/\.(.*)$/,q=/^(?:textarea|input|select)$/i,r=/\./g,s=/ /g,t=/[^\w\s.|`]/g,u=function(a){return a.replace(t,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)
}catch(h){}if(f===!1){f=v}else{if(!f){return}}var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k){return}var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(){return typeof d!=="undefined"&&!d.event.triggered?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);
var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1){c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=v);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t){return}c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";
for(h in t){d.event.remove(a,h+c)}return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),u).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p){continue}if(!e){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace)){d.event.remove(a,r,q.handler,j),p.splice(j--,1)}}continue}o=d.event.special[h]||{};for(j=f||0;j<p.length;j++){q=p[j];if(e.guid===q.guid){if(l||n.test(q.namespace)){f==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q)
}if(f!=null){break}}}if(p.length===0||f!=null&&p.length===1){(!o.teardown||o.teardown.call(a,m)===!1)&&d.removeEvent(a,h,s.handle),g=null,delete t[h]}}if(d.isEmptyObject(t)){var w=s.handle;w&&(w.elem=null),delete s.events,delete s.handle,d.isEmptyObject(s)&&d.removeData(a,b,!0)}}},trigger:function(a,c,e){var f=a.type||a,g=arguments[3];if(!g){a=typeof a==="object"?a[d.expando]?a:d.extend(d.Event(f),a):d.Event(f),f.indexOf("!")>=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];
e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8){return b}a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i){d.event.trigger(a,c,i,!0)}else{if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(p,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};
if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=!0,l[m]())}catch(q){}k&&(l["on"+m]=k),d.event.triggered=!1}}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];
if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l<m;l++){var n=f[l];if(e||h.test(n.namespace)){c.handler=n.handler,c.data=n.data,c.handleObj=n;var o=n.handler.apply(this,k);o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped()){break}}}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[d.expando]){return a
}var e=a;a=d.Event(e);for(var f=this.props.length,g;f;){g=this.props[--f],a[g]=e[g]}a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=c.documentElement,i=c.body;a.pageX=a.clientX+(h&&h.scrollLeft||i&&i.scrollLeft||0)-(h&&h.clientLeft||i&&i.clientLeft||0),a.pageY=a.clientY+(h&&h.scrollTop||i&&i.scrollTop||0)-(h&&h.clientTop||i&&i.clientTop||0)
}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:100000000,proxy:d.proxy,special:{ready:{setup:d.bindReady,teardown:d.noop},live:{add:function(a){d.event.add(this,F(a.origType,a.selector),d.extend({},a,{handler:E,guid:a.handler.guid}))},remove:function(a){d.event.remove(this,F(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){d.isWindow(this)&&(this.onbeforeunload=c)
},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},d.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},d.Event=function(a){if(!this.preventDefault){return new d.Event(a)}a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?w:v):this.type=a,this.timeStamp=d.now(),this[d.expando]=!0
},d.Event.prototype={preventDefault:function(){this.isDefaultPrevented=w;var a=this.originalEvent;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=w;var a=this.originalEvent;a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=w,this.stopPropagation()},isDefaultPrevented:v,isPropagationStopped:v,isImmediatePropagationStopped:v};var x=function(a){var b=a.relatedTarget;
try{if(b!==c&&!b.parentNode){return}while(b&&b!==this){b=b.parentNode}b!==this&&(a.type=a.data,d.event.handle.apply(this,arguments))}catch(e){}},y=function(a){a.type=a.data,d.event.handle.apply(this,arguments)};d.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){d.event.special[a]={setup:function(c){d.event.add(this,b,c&&c.selector?y:x,a)},teardown:function(a){d.event.remove(this,b,a&&a.selector?y:x)}}}),d.support.submitBubbles||(d.event.special.submit={setup:function(a,b){if(this.nodeName&&this.nodeName.toLowerCase()!=="form"){d.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;
(c==="submit"||c==="image")&&d(b).closest("form").length&&C("submit",this,arguments)}),d.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&d(b).closest("form").length&&a.keyCode===13&&C("submit",this,arguments)})}else{return !1}},teardown:function(a){d.event.remove(this,".specialSubmit")}});if(!d.support.changeBubbles){var z,A=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?d.map(a.options,function(a){return a.selected
}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},B=function B(a){var c=a.target,e,f;if(q.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=A(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e){return}if(e!=null||f){a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}}};d.event.special.change={filters:{focusout:B,beforedeactivate:B,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&B.call(this,a)
},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&B.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",A(b))}},setup:function(a,b){if(this.type==="file"){return !1}for(var c in z){d.event.add(this,c+".specialChange",z[c])}return q.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return q.test(this.nodeName)}},z=d.event.special.change.filters,z.focus=z.beforeactivate
}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function c(a){a=d.event.fix(a),a.type=b;return d.event.handle.call(this,a)}d.event.special[b]={setup:function(){this.addEventListener(a,c,!0)},teardown:function(){this.removeEventListener(a,c,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a){this[c](g,e,a[g],f)}return this}if(d.isFunction(e)||e===!1){f=e,e=b}var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);
return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one"){this.one(a,e,f)}else{for(var i=0,j=this.length;i<j;i++){d.event.add(this[i],a,h,e)}}return this}}),d.fn.extend({unbind:function(a,b){if(typeof a!=="object"||a.preventDefault){for(var e=0,f=this.length;e<f;e++){d.event.remove(this[e],a,b)}}else{for(var c in a){this.unbind(c,a[c])}}return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)
},trigger:function(a,b){return this.each(function(){d.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var c=d.Event(a);c.preventDefault(),c.stopPropagation(),d.event.trigger(c,b,this[0]);return c.result}},toggle:function(a){var b=arguments,c=1;while(c<b.length){d.proxy(a,b[c++])}return this.click(d.proxy(a,function(e){var f=(d._data(this,"lastToggle"+a.guid)||0)%c;d._data(this,"lastToggle"+a.guid,f+1),e.preventDefault();return b[f].apply(this,arguments)||!1}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)
}});var D={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};d.each(["live","die"],function(a,c){d.fn[c]=function(a,e,f,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:d(this.context);if(typeof a==="object"&&!a.preventDefault){for(var o in a){n[c](o,e,a[o],m)}return this}d.isFunction(e)&&(f=e,e=b),a=(a||"").split(" ");while((h=a[i++])!=null){j=p.exec(h),k="",j&&(k=j[0],h=h.replace(p,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,h==="focus"||h==="blur"?(a.push(D[h]+k),h=h+k):h=(D[h]||h)+k;
if(c==="live"){for(var q=0,r=n.length;q<r;q++){d.event.add(n[q],"live."+F(h,m),{data:e,selector:m,handler:f,origType:h,origHandler:f,preType:l})}}else{n.unbind("live."+F(h,m),f)}}return this}}),d.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){d.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)
},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!=="string"){if(i===b){j=!0;break}}else{if(k.filter(b,[i]).length>0){j=i;break}}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);
if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9){return[]}if(!b||typeof b!=="string"){return e}var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);
if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b)){if(x.length===2&&l.relative[x[0]]){j=v(x[0]+x[1],d)}else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length){b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}}}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;
while(x.length){r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}}else{n=x=[]}}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]"){if(u){if(d&&d.nodeType===1){for(t=0;n[t]!=null;t++){n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t])}}else{for(t=0;n[t]!=null;t++){n[t]&&n[t].nodeType===1&&e.push(j[t])}}}else{e.push.apply(e,n)}}else{p(n,e)}o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g){for(var b=1;
b<a.length;b++){a[b]===a[b-1]&&a.splice(b--,1)}}}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a){return[]}for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!=="undefined"?b.getElementsByTagName("*"):[]);
return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter){if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\"){continue}j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(f){if(f===!0){continue}}else{g=o=!0}}if(f){for(var s=0;(p=j[s])!=null;s++){if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}}}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");
if(!g){return[]}break}}}if(a===h){if(g==null){k.error(a)}else{break}}h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")
},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b==="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++){if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1){}a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;
e<f;e++){c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b)}d&&k.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!=="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!=="undefined"){var c=[],d=b.getElementsByName(a[1]);
for(var e=0,f=d.length;e<f;e++){d[e].getAttribute("name")===a[1]&&c.push(d[e])}return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!=="undefined"){return b.getElementsByTagName(a[1])}}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f){return a}for(var g=0,h;(h=b[g])!=null;g++){h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1))}return !1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()
},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else{a[2]&&k.error(a[0])}a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not"){if((a.exec(b[3])||"").length>1||/^\w/.test(b[3])){b[3]=k(b[3],null,null,c)
}else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return !1}}else{if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0])){return !0}}return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return !!a.firstChild},empty:function(a){return !a.firstChild
},has:function(a,b,c){return !!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.getAttribute("type")},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"
},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f){return f(a,c,b,d)}if(e==="contains"){return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0
}if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++){if(g[h]===a){return !1}}return !0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling){if(d.nodeType===1){return !1}}if(c==="first"){return !0}d=a;case"last":while(d=d.nextSibling){if(d.nodeType===1){return !1}}return !0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0){return !0}var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling){d.nodeType===1&&(d.nodeIndex=++i)
}h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1
},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f){return f(a,c,b,d)}}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match){l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n))}var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];
if(f.call(a)==="[object Array]"){Array.prototype.push.apply(d,a)}else{if(typeof a.length==="number"){for(var e=a.length;c<e;c++){d.push(a[c])}}else{for(;a[c];c++){d.push(a[c])}}}return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition){return a.compareDocumentPosition?-1:1}return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(a===b){g=!0;
return 0}if(h===i){return s(a,b)}if(!h){return -1}if(!i){return 1}while(j){e.unshift(j),j=j.parentNode}j=i;while(j){f.unshift(j),j=j.parentNode}c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++){if(e[k]!==f[k]){return s(e[k],f[k])}}return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b){return c}var d=a.nextSibling;while(d){if(d===b){return -1}d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++){c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes))
}return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");
return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++){c[e].nodeType===1&&d.push(c[e])}c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)
}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1]){return p(e.getElementsByTagName(b),f)}if(h[2]&&l.find.CLASS&&e.getElementsByClassName){return p(e.getElementsByClassName(h[2]),f)}}if(e.nodeType===9){if(b==="body"&&e.body){return p([e.body],f)
}if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode){return p([],f)}if(i.id===h[3]){return p([i],f)}}try{return p(e.querySelectorAll(b),f)}catch(j){}}else{if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q){return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}}catch(s){}finally{n||m.removeAttribute("id")}}}}return a(b,e,f,g)};
for(var e in a){k[e]=a[e]}b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector,d=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(e){d=!0}b&&(k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a)){try{if(d||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){return b.call(a,c)}}catch(e){}}return k(c,null,null,[a]).length>0})}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";
if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1){return}l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c){return b.getElementsByClassName(a[1])}},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return !!(a.compareDocumentPosition(b)&16)
}:k.contains=function(){return !1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a)){e+=c[0],a=a.replace(l.match.PSEUDO,"")}a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++){k(a,f[g],d)}return k.filter(e,d)};d.find=k,d.expr=k.selectors,d.expr[":"]=d.expr.filters,d.unique=k.uniqueSort,d.text=k.getText,d.isXMLDoc=k.isXML,d.contains=k.contains}();var G=/Until$/,H=/^(?:parents|prevUntil|prevAll)/,I=/,/,J=/^.[^:#\[\.,]*$/,K=Array.prototype.slice,L=d.expr.match.POS,M={children:!0,contents:!0,next:!0,prev:!0};
d.fn.extend({find:function(a){var b=this.pushStack("","find",a),c=0;for(var e=0,f=this.length;e<f;e++){c=b.length,d.find(a,this[e],b);if(e>0){for(var g=c;g<b.length;g++){for(var h=0;h<c;h++){if(b[h]===b[g]){b.splice(g--,1);break}}}}}return b},has:function(a){var b=d(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++){if(d.contains(this,b[a])){return !0}}})},not:function(a){return this.pushStack(O(this,a,!1),"not",a)},filter:function(a){return this.pushStack(O(this,a,!0),"filter",a)},is:function(a){return !!a&&d.filter(a,this).length>0
},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e<f;e++){i=a[e],j[i]||(j[i]=d.expr.match.POS.test(i)?d(i,b||this.context):i)}while(g&&g.ownerDocument&&g!==b){for(i in j){h=j[i],(h.jquery?h.index(g)>-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k})}g=g.parentNode,k++}}return c}var l=L.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e<f;e++){g=this[e];while(g){if(l?l.index(g)>-1:d.find.matchesSelector(g,a)){c.push(g);break
}g=g.parentNode;if(!g||!g.ownerDocument||g===b){break}}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string"){return d.inArray(this[0],a?d(a):this.parent().children())}return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(N(c[0])||N(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;
return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)
},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=K.call(arguments);G.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!M[a]?d.unique(f):f,(this.length>1||I.test(e))&&H.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");
return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e))){g.nodeType===1&&f.push(g),g=g[c]}return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c]){if(a.nodeType===1&&++e===b){break}}return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling){a.nodeType===1&&a!==b&&c.push(a)}return c}});var P=/ jQuery\d+="(?:\d+|null)"/g,Q=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,S=/<([\w:]+)/,T=/<tbody/i,U=/<|&#?\w+;/,V=/<(?:script|object|embed|option|style)/i,W=/checked\s*(?:[^=]|=\s*.checked.)/i,X={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};
X.optgroup=X.option,X.tbody=X.tfoot=X.colgroup=X.caption=X.thead,X.th=X.td,d.support.htmlSerialize||(X._default=[1,"div<div>","</div>"]),d.fn.extend({text:function(a){if(d.isFunction(a)){return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))})}if(typeof a!=="object"&&a!==b){return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))}return d.text(this)},wrapAll:function(a){if(d.isFunction(a)){return this.each(function(b){d(this).wrapAll(a.call(this,b))})}if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);
this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1){a=a.firstChild}return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a)){return this.each(function(b){d(this).wrapInner(a.call(this,b))})}return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)
}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)})}if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)
})}if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++){if(!a||d.filter(a,[e]).length){!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e)}}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild){b.removeChild(b.firstChild)
}}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(P,""):null}if(typeof a!=="string"||V.test(a)||!d.support.leadingWhitespace&&Q.test(a)||X[(S.exec(a)||["",""])[1].toLowerCase()]){d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a)}else{a=a.replace(R,"<$1></$2>");try{for(var c=0,e=this.length;
c<e;c++){this[c].nodeType===1&&(d.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}}catch(f){this.empty().append(a)}}return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(d.isFunction(a)){return this.each(function(b){var c=d(this),e=c.html();c.replaceWith(a.call(this,b,e))})}typeof a!=="string"&&(a=d(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;d(this).remove(),b?d(b).before(a):d(c).append(a)})}return this.pushStack(d(d.isFunction(a)?a():a),"replaceWith",a)
},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,e){var f,g,h,i,j=a[0],k=[];if(!d.support.checkClone&&arguments.length===3&&typeof j==="string"&&W.test(j)){return this.each(function(){d(this).domManip(a,c,e,!0)})}if(d.isFunction(j)){return this.each(function(f){var g=d(this);a[0]=j.call(this,f,c?g.html():b),g.domManip(a,c,e)})}if(this[0]){i=j&&j.parentNode,d.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?f={fragment:i}:f=d.buildFragment(a,this,k),h=f.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;
if(g){c=c&&d.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++){e.call(c?Y(this[l],g):this[l],f.cacheable||m>1&&l<n?d.clone(h,!0,!0):h)}}k.length&&d.each(k,ba)}return this}}),d.buildFragment=function(a,b,e){var f,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]==="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!V.test(a[0])&&(d.support.checkClone||!W.test(a[0]))&&(g=!0,h=d.fragments[a[0]],h&&(h!==1&&(f=h))),f||(f=i.createDocumentFragment(),d.clean(a,i,f,e)),g&&(d.fragments[a[0]]=h?f:1);
return{fragment:f,cacheable:g}},d.fragments={},d.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){d.fn[a]=function(c){var e=[],f=d(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&f.length===1){f[b](this[0]);return this}for(var h=0,i=f.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;
if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){$(a,e),f=_(a),g=_(e);for(h=0;f[h];++h){$(f[h],g[h])}}if(b){Z(a,e);if(c){f=_(a),g=_(e);for(h=0;f[h];++h){Z(f[h],g[h])}}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i){continue}if(typeof i!=="string"||U.test(i)){if(typeof i==="string"){i=i.replace(R,"<$1></$2>");
var j=(S.exec(i)||["",""])[1].toLowerCase(),k=X[j]||X._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--){m=m.lastChild}if(!d.support.tbody){var n=T.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]==="<table>"&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p){d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}}!d.support.leadingWhitespace&&Q.test(i)&&m.insertBefore(b.createTextNode(Q.exec(i)[0]),m.firstChild),i=m.childNodes
}}else{i=b.createTextNode(i)}i.nodeType?g.push(i):g=d.merge(g,i)}if(e){for(h=0;g[h];h++){!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h])}}return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()]){continue
}c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events){g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle)}b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bb=/alpha\([^)]*\)/i,bc=/opacity=([^)]*)/,bd=/-([a-z])/ig,be=/([A-Z])/g,bf=/^-?\d+(?:px)?$/i,bg=/^-?\d/,bh={position:"absolute",visibility:"hidden",display:"block"},bi=["Left","Right"],bj=["Top","Bottom"],bk,bl,bm,bn=function(a,b){return b.toUpperCase()
};d.fn.css=function(a,c){if(arguments.length===2&&c===b){return this}return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bk(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];
c=d.cssProps[h]||h;if(e===b){if(j&&"get" in j&&(g=j.get(a,!1,f))!==b){return g}return i[c]}if(typeof e==="number"&&isNaN(e)||e==null){return}typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set" in j)||(e=j.set(a,e))!==b){try{i[c]=e}catch(k){}}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get" in h&&(f=h.get(a,!0,e))!==b){return f}if(bk){return bk(a,c,g)}},swap:function(a,b,c){var d={};for(var e in b){d[e]=a.style[e],a.style[e]=b[e]}c.call(a);for(e in b){a.style[e]=d[e]
}},camelCase:function(a){return a.replace(bd,bn)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bo(a,b,e):d.swap(a,bh,function(){f=bo(a,b,e)});if(f<=0){f=bk(a,b,b),f==="0px"&&bm&&(f=bm(a,b,b));if(f!=null){return f===""||f==="auto"?"0px":f}}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bf.test(b)){return b}b=parseFloat(b);if(b>=0){return b+"px"
}}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return bc.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bb.test(f)?f.replace(bb,e):c.filter+" "+e}}),c.defaultView&&c.defaultView.getComputedStyle&&(bl=function(a,c,e){var f,g,h;e=e.replace(be,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView)){return b}if(h=g.getComputedStyle(a,null)){f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e))
}return f}),c.documentElement.currentStyle&&(bm=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bf.test(d)&&bg.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bk=bl||bm,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"
},d.expr.filters.visible=function(a){return !d.expr.filters.hidden(a)});var bp=/%20/g,bq=/\[\]$/,br=/\r?\n/g,bs=/#.*$/,bt=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bu=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bv=/(?:^file|^widget|\-extension):$/,bw=/^(?:GET|HEAD)$/,bx=/^\/\//,by=/\?/,bz=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bA=/^(?:select|textarea)/i,bB=/\s+/,bC=/([?&])_=[^&]*/,bD=/(^|\-)([a-z])/g,bE=function(a,b,c){return b+c.toUpperCase()
},bF=/^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,bG=d.fn.load,bH={},bI={},bJ,bK;try{bJ=c.location.href}catch(bL){bJ=c.createElement("a"),bJ.href="",bJ=bJ.href}bK=bF.exec(bJ.toLowerCase()),d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bG){return bG.apply(this,arguments)}if(!this.length){return this}var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;
d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("<div>").append(c.replace(bz,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bA.test(this.nodeName)||bu.test(this.type))}).map(function(a,b){var c=d(this).val();
return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(br,"\r\n")}}):{name:b.name,value:c.replace(br,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")
},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1}){c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c])}return a},ajaxSettings:{url:bJ,isLocal:bv.test(bK[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bM(bH),ajaxTransport:bM(bI),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;
var q,t,v,w=l?bP(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified")){d.lastModified[k]=x}if(y=u.getResponseHeader("Etag")){d.etag[k]=y}}if(a===304){c="notmodified",q=!0}else{try{t=bQ(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}}else{v=c;if(!c||a){c="error",a<0&&(a=0)}}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))
}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bD,bE)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bt.exec(m)){n[c[1].toLowerCase()]=c[2]}}c=n[a.toLowerCase()]}return c===b?null:c
},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2){for(b in a){j[b]=[j[b],a[b]]}}else{b=a[u.status],u.then(b,b)}}return this},e.url=((a||e.url)+"").replace(bs,"").replace(bx,bK[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bB),e.crossDomain||(q=bF.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bK[1]||q[2]!=bK[2]||(q[3]||(q[1]==="http:"?80:443))!=(bK[3]||(bK[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bN(bH,e,c,u);
if(r===2){return !1}s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!bw.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(by.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bC,"$1_="+w);e.url=x+(x===e.url?(by.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType){l["Content-Type"]=e.contentType}e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];
for(t in e.headers){u.setRequestHeader(t,e.headers[t])}if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return !1}for(t in {success:1,error:1,complete:1}){u[t](e[t])}o=bN(bI,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else{v(-1,"No Transport")}return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)
};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a)){d.each(a,function(){f(this.name,this.value)})}else{for(var g in a){bO(g,a[g],c,f)}}return e.join("&").replace(bp,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bR=d.now(),bS=/(\=)\?(&|$)|()\?\?()/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bR++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bS.test(b.url)||f&&bS.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])
};b.jsonp!==!1&&(j=j.replace(bS,l),b.url===j&&(f&&(k=k.replace(bS,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);
return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState)){d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")
}},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bT=d.now(),bU,bV;d.ajaxSettings.xhr=a.ActiveXObject?function(){return !this.isLocal&&bX()||bY()}:bX,bV=d.ajaxSettings.xhr(),d.support.ajax=!!bV,d.support.cors=bV&&"withCredentials" in bV,bV=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields){for(i in a.xhrFields){g[i]=a.xhrFields[i]
}}a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),(!a.crossDomain||a.hasContent)&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e){g.setRequestHeader(i,e[i])}}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bU[h]);if(i){g.readyState!==4&&g.abort()}else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;
try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bU||(bU={},bW()),h=bT++,g.onreadystatechange=bU[h]=c):c()},abort:function(){c&&c(0,1)}}}});var bZ={},b$=/^(?:toggle|show|hide)$/,b_=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,ca,cb=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;
if(a||a===0){return this.animate(cc("show",3),a,b,c)}for(var g=0,h=this.length;g<h;g++){e=this[g],f=e.style.display,!d._data(e,"olddisplay")&&f==="none"&&(f=e.style.display=""),f===""&&d.css(e,"display")==="none"&&d._data(e,"olddisplay",cd(e.nodeName))}for(g=0;g<h;g++){e=this[g],f=e.style.display;if(f===""||f==="none"){e.style.display=d._data(e,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0){return this.animate(cc("hide",3),a,b,c)}for(var e=0,f=this.length;e<f;e++){var g=d.css(this[e],"display");
g!=="none"&&!d._data(this[e],"olddisplay")&&d._data(this[e],"olddisplay",g)}for(e=0;e<f;e++){this[e].style.display="none"}return this},_toggle:d.fn.toggle,toggle:function(a,b,c){var e=typeof a==="boolean";d.isFunction(a)&&d.isFunction(b)?this._toggle.apply(this,arguments):a==null||e?this.each(function(){var b=e?a:d(this).is(":hidden");d(this)[b?"show":"hide"]()}):this.animate(cc("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)
},animate:function(a,b,c,e){var f=d.speed(b,c,e);if(d.isEmptyObject(a)){return this.each(f.complete)}return this[f.queue===!1?"each":"queue"](function(){var b=d.extend({},f),c,e=this.nodeType===1,g=e&&d(this).is(":hidden"),h=this;for(c in a){var i=d.camelCase(c);c!==i&&(a[i]=a[c],delete a[c],c=i);if(a[c]==="hide"&&g||a[c]==="show"&&!g){return b.complete.call(this)}if(e&&(c==="height"||c==="width")){b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(d.css(this,"display")==="inline"&&d.css(this,"float")==="none"){if(d.support.inlineBlockNeedsLayout){var j=cd(this.nodeName);
j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)}else{this.style.display="inline-block"}}}d.isArray(a[c])&&((b.specialEasing=b.specialEasing||{})[c]=a[c][1],a[c]=a[c][0])}b.overflow!=null&&(this.style.overflow="hidden"),b.curAnim=d.extend({},a),d.each(a,function(c,e){var f=new d.fx(h,b,c);if(b$.test(e)){f[e==="toggle"?g?"show":"hide":e](a)}else{var i=b_.exec(e),j=f.cur();if(i){var k=parseFloat(i[2]),l=i[3]||(d.cssNumber[c]?"":"px");l!=="px"&&(d.style(h,c,(k||1)+l),j=(k||1)/f.cur()*j,d.style(h,c,j+l)),i[1]&&(k=(i[1]==="-="?-1:1)*k+j),f.custom(j,k,l)
}else{f.custom(j,e,"")}}});return !0})},stop:function(a,b){var c=d.timers;a&&this.queue([]),this.each(function(){for(var a=c.length-1;a>=0;a--){c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}}),b||this.dequeue();return this}}),d.each({slideDown:cc("show",1),slideUp:cc("hide",1),slideToggle:cc("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};
e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+0.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)
},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!ca&&(ca=setInterval(f.tick,f.interval))
},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim){this.options.curAnim[e]!==!0&&(c=!1)
}if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show){for(var h in this.options.curAnim){d.style(this.elem,h,this.options.orig[h])}}this.options.complete.call(this.elem)}return !1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");
this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return !0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b<a.length;b++){a[b]()||a.splice(b--,1)}a.length||d.fx.stop()},interval:13,stop:function(){clearInterval(ca),ca=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){d.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now
}}}),d.expr&&d.expr.filters&&(d.expr.filters.animated=function(a){return d.grep(d.timers,function(b){return a===b.elem}).length});var ce=/^t(?:able|d|h)$/i,cf=/^(?:body|html)$/i;"getBoundingClientRect" in c.documentElement?d.fn.offset=function(a){var b=this[0],c;if(a){return this.each(function(b){d.offset.setOffset(this,a,b)})}if(!b||!b.ownerDocument){return null}if(b===b.ownerDocument.body){return d.offset.bodyOffset(b)}try{c=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,g=f.documentElement;
if(!c||!d.contains(g,b)){return c?{top:c.top,left:c.left}:{top:0,left:0}}var h=f.body,i=cg(f),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||d.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||d.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:d.fn.offset=function(a){var b=this[0];if(a){return this.each(function(b){d.offset.setOffset(this,a,b)})}if(!b||!b.ownerDocument){return null}if(b===b.ownerDocument.body){return d.offset.bodyOffset(b)
}d.offset.initialize();var c,e=b.offsetParent,f=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(d.offset.supportsFixedPosition&&k.position==="fixed"){break}c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===e&&(l+=b.offsetTop,m+=b.offsetLeft,d.offset.doesNotAddBorder&&(!d.offset.doesAddBorderForTableAndCells||!ce.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),f=e,e=b.offsetParent),d.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c
}if(k.position==="relative"||k.position==="static"){l+=i.offsetTop,m+=i.offsetLeft}d.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},d.offset={initialize:function(){var a=c.body,b=c.createElement("div"),e,f,g,h,i=parseFloat(d.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),a=b=e=f=g=h=null,d.offset.initialize=d.noop
},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=e==="absolute"&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using" in b?b.using.call(a,k):f.css(k)
}},d.fn.extend({position:function(){if(!this[0]){return null}var a=this[0],b=this.offsetParent(),c=this.offset(),e=cf.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!cf.test(a.nodeName)&&d.css(a,"position")==="static")){a=a.offsetParent
}return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f){return null}if(c!==b){return this.each(function(){g=cg(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c})}g=cg(f);return g?"pageXOffset" in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null
},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f){return a==null?null:this}if(d.isFunction(a)){return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))})}if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9){return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c])
}if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window);jQuery.noConflict();
/*
 * jQuery UI 1.8.8
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(c,j){function k(a){return !c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)
}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.8",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;
setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))
}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j){return this.css("zIndex",a)}if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0){return b}}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()
})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l){g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0}if(m){g-=parseFloat(c.curCSS(f,"margin"+this,true))||0}});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};
c.fn["inner"+b]=function(f){if(f===j){return i["inner"+b].call(this)}return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number"){return i["outer"+b].call(this,f)}return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return !!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map"){return false
}a=c("img[usemap=#"+d+"]")[0];return !!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart" in b;a.removeChild(b).style.display="none"
});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode){for(var e=0;e<b.length;e++){a.options[b[e][0]]&&b[e][1].apply(a.element,d)}}}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden"){return false}b=b&&b==="left"?"scrollLeft":"scrollTop";
var d=false;if(a[b]>0){return true}a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
/*
 * jQuery UI Widget 1.8.8
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;
(d=a[c])!=null;c++){b(d).triggerHandler("remove")}k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c){if(!a||b.filter(a,[this]).length){b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")})}}return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return !!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)
};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_"){return h}e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;
if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()
});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0){return b.extend({},this.options)
}if(typeof a==="string"){if(c===j){return this.options[a]}d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled"){this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)
},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return !(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
/*
 * jQuery UI Mouse 1.8.8
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
(function(c){c.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;
this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)}).bind("click."+this.widgetName,function(b){if(true===c.data(b.target,a.widgetName+".preventClickEvent")){c.removeData(b.target,a.widgetName+".preventClickEvent");b.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent=a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&&this._mouseUp(a);
this._mouseDownEvent=a;var b=this,e=a.which==1,f=typeof this.options.cancel=="string"?c(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){b.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();
return true}}this._mouseMoveDelegate=function(d){return b._mouseMove(d)};this._mouseUpDelegate=function(d){return b._mouseUp(d)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return a.originalEvent.mouseHandled=true}},_mouseMove:function(a){if(c.browser.msie&&!(document.documentMode>=9)&&!a.button){return this._mouseUp(a)}if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a)
}return !this._mouseStarted},_mouseUp:function(a){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;a.target==this._mouseDownEvent.target&&c.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance
},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of){return t.apply(this,arguments)}b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();
k=a.height();j={top:0,left:0}}else{if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else{if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}}}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1){f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"]}f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});
if(g.length===1){g[1]=g[0]}e[0]=parseInt(e[0],10)||0;if(e.length===1){e[1]=e[0]}e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right"){j.left+=h}else{if(b.at[0]==="center"){j.left+=h/2}}if(b.at[1]==="bottom"){j.top+=k}else{if(b.at[1]==="center"){j.top+=k/2}}j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;
if(b.my[0]==="right"){i.left-=l}else{if(b.my[0]==="center"){i.left-=l/2}}if(b.my[1]==="bottom"){i.top-=m}else{if(b.my[1]==="center"){i.top-=m/2}}i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))
})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];
b.left+=a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position"))){b.style.position="relative"}var d=c(b),g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;
g={top:a.top-g.top+e,left:a.left-g.left+h};"using" in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument){return null}if(b){return this.each(function(){c.offset.setOffset(this,b)})}return u.call(this)}}})(jQuery);(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))){this.element[0].style.position="relative"
}this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b=this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(a);
if(!this.handle){return false}return true},_mouseStart:function(a){var b=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager){d.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});
this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);
this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour){b=d.ui.ddmanager.drop(this,a)
}if(this.dropped){b=this.dropped;this.dropped=false}if(!this.element[0]||!this.element[0].parentNode){return false}if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else{this._trigger("stop",a)!==false&&this._clear()}return false
},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==a.target){b=true}});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone():this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);
a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string"){a=a.split(" ")}if(d.isArray(a)){a={left:+a[0],top:+a[1]||0}}if("left" in a){this.offset.click.left=a.left+this.margins.left}if("right" in a){this.offset.click.left=this.helperProportions.width-a.right+this.margins.left}if("top" in a){this.offset.click.top=a.top+this.margins.top}if("bottom" in a){this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top
}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie){a={top:0,left:0}}return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}
},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}
},_setContainment:function(){var a=this.options;if(a.containment=="parent"){a.containment=this.helper[0].parentNode}if(a.containment=="document"||a.containment=="window"){this.containment=[(a.containment=="document"?0:d(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,(a.containment=="document"?0:d(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]
}if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){var b=d(a.containment)[0];if(b){a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]
}}else{if(a.containment.constructor==Array){this.containment=a.containment}}},_convertPositionTo:function(a,b){if(!b){b=this.position}a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}
},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0]){e=this.containment[0]+this.offset.click.left}if(a.pageY-this.offset.click.top<this.containment[1]){g=this.containment[1]+this.offset.click.top
}if(a.pageX-this.offset.click.left>this.containment[2]){e=this.containment[2]+this.offset.click.left}if(a.pageY-this.offset.click.top>this.containment[3]){g=this.containment[3]+this.offset.click.top}}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;e=this.originalPageX+Math.round((e-this.originalPageX)/b.grid[0])*b.grid[0];
e=this.containment?!(e-this.offset.click.left<this.containment[0]||e-this.offset.click.left>this.containment[2])?e:!(e-this.offset.click.left<this.containment[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())}
},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return d.Widget.prototype._trigger.call(this,a,b,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}
}});d.extend(d.ui.draggable,{version:"1.8.8"});d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var g=d.data(this,"sortable");if(g&&!g.options.disabled){c.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;
c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;
this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=d(f).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,true);this.instance._mouseStart(a,true,true);
this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&this.instance._mouseDrag(a)}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;
this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}}})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor")){b._cursor=a.css("cursor")}a.css("cursor",b.cursor)
},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","iframeFix",{start:function(){var a=d(this).data("draggable").options;d(a.iframeFix===true?"iframe":a.iframeFix).each(function(){d('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(d(this).offset()).appendTo("body")})},stop:function(){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)
})}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity")){b._opacity=a.css("opacity")}a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML"){a.overflowOffset=a.scrollParent.offset()}},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;
if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!="x"){if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity){b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+c.scrollSpeed}else{if(a.pageY-b.overflowOffset.top<c.scrollSensitivity){b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop-c.scrollSpeed}}}if(!c.axis||c.axis!="y"){if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity){b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed
}else{if(a.pageX-b.overflowOffset.left<c.scrollSensitivity){b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}}}}else{if(!c.axis||c.axis!="x"){if(a.pageY-d(document).scrollTop()<c.scrollSensitivity){f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed)}else{if(d(window).height()-(a.pageY-d(document).scrollTop())<c.scrollSensitivity){f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed)}}}if(!c.axis||c.axis!="y"){if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity){f=d(document).scrollLeft(d(document).scrollLeft()-c.scrollSpeed)
}else{if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity){f=d(document).scrollLeft(d(document).scrollLeft()+c.scrollSpeed)}}}}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,a)}});d.ui.plugin.add("draggable","snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})
})},drag:function(a,b){for(var c=d(this).data("draggable"),f=c.options,e=f.snapTolerance,g=b.offset.left,n=g+c.helperProportions.width,m=b.offset.top,o=m+c.helperProportions.height,h=c.snapElements.length-1;h>=0;h--){var i=c.snapElements[h].left,k=i+c.snapElements[h].width,j=c.snapElements[h].top,l=j+c.snapElements[h].height;if(i-e<g&&g<k+e&&j-e<m&&m<l+e||i-e<g&&g<k+e&&j-e<o&&o<l+e||i-e<n&&n<k+e&&j-e<m&&m<l+e||i-e<n&&n<k+e&&j-e<o&&o<l+e){if(f.snapMode!="inner"){var p=Math.abs(j-o)<=e,q=Math.abs(l-m)<=e,r=Math.abs(i-n)<=e,s=Math.abs(k-g)<=e;
if(p){b.position.top=c._convertPositionTo("relative",{top:j-c.helperProportions.height,left:0}).top-c.margins.top}if(q){b.position.top=c._convertPositionTo("relative",{top:l,left:0}).top-c.margins.top}if(r){b.position.left=c._convertPositionTo("relative",{top:0,left:i-c.helperProportions.width}).left-c.margins.left}if(s){b.position.left=c._convertPositionTo("relative",{top:0,left:k}).left-c.margins.left}}var t=p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(j-m)<=e;q=Math.abs(l-o)<=e;r=Math.abs(i-g)<=e;
s=Math.abs(k-n)<=e;if(p){b.position.top=c._convertPositionTo("relative",{top:j,left:0}).top-c.margins.top}if(q){b.position.top=c._convertPositionTo("relative",{top:l-c.helperProportions.height,left:0}).top-c.margins.top}if(r){b.position.left=c._convertPositionTo("relative",{top:0,left:i}).left-c.margins.left}if(s){b.position.left=c._convertPositionTo("relative",{top:0,left:k-c.helperProportions.width}).left-c.margins.left}}if(!c.snapElements[h].snapping&&(p||q||r||s||t)){c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}))
}c.snapElements[h].snapping=p||q||r||s||t}else{c.snapElements[h].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"),10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=parseInt(a[0].style.zIndex)||0;
d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex")){b._zIndex=a.css("zIndex")}a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery);jQuery.effects||function(f,j){function n(c){var a;if(c&&c.constructor==Array&&c.length==3){return c}if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c)){return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)]
}if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c)){return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55]}if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c)){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c)){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}if(/rgba\(0, 0, 0, 0\)/.exec(c)){return o.transparent
}return o[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body")){break}a="backgroundColor"}while(c=c.parentNode);return n(b)}function p(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,a={},b,d;if(c&&c.length&&c[0]&&c[c[0]]){for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}}else{for(b in c){if(typeof c[b]==="string"){a[b]=c[b]
}}}return a}function q(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b))){delete c[a]}}return c}function u(c,a){var b={_:0},d;for(d in a){if(c[d]!=a[d]){b[d]=a[d]}}return b}function k(c,a,b,d){if(typeof c=="object"){d=a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;
d=d||a.complete;return[c,a,b,d]}function m(c){if(!c||typeof c==="number"||f.fx.speeds[c]){return true}if(typeof c==="string"&&!f.effects[c]){return true}return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=n(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"
}});var o={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},r=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};
f.effects.animateClass=function(c,a,b,d){if(f.isFunction(b)){d=b;b=null}return this.queue("fx",function(){var e=f(this),g=e.attr("style")||" ",h=q(p.call(this)),l,v=e.attr("className");f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});l=q(p.call(this));e.attr("className",v);e.animate(u(h,l),a,b,function(){f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else{e.attr("style",g)}d&&d.apply(this,arguments)});h=f.queue(this);
l=h.splice(h.length-1,1)[0];h.splice(1,0,l);f.dequeue(this)})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])
},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.8",save:function(c,a){for(var b=0;b<a.length;b++){a[b]!==null&&c.data("ec.storage."+a[b],c[0].style[a[b]])}},restore:function(c,a){for(var b=0;b<a.length;b++){a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))}},setMode:function(c,a){if(a=="toggle"){a=c.is(":hidden")?"show":"hide"}return a},getBaseline:function(c,a){var b;switch(c[0]){case"top":b=0;break;case"middle":b=0.5;
break;case"bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case"left":c=0;break;case"center":c=0.5;break;case"right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper")){return c.parent()}var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});
c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10))){a[e]="auto"}});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper")){return c.parent().replaceWith(c)}return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0){d[g]=unit[0]*b+unit[1]
}});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d){return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)})}return d.call(this,b)},_show:f.fn.show,show:function(c){if(m(c)){return this._show.apply(this,arguments)}else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(m(c)){return this._hide.apply(this,arguments)
}else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(m(c)||typeof c==="boolean"||f.isFunction(c)){return this.__toggle.apply(this,arguments)}else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0){b=[parseFloat(a),e]}});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)
},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return -d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1){return d/2*a*a+b}return -d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1){return d/2*a*a*a+b}return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return -d*((a=a/e-1)*a*a*a-1)+b
},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1){return d/2*a*a*a*a+b}return -d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/=e/2)<1){return d/2*a*a*a*a*a+b}return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return -d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return -d/2*(Math.cos(Math.PI*a/e)-1)+b
},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0){return b}if(a==e){return b+d}if((a/=e/2)<1){return d/2*Math.pow(2,10*(a-1))+b}return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return -d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1){return -d/2*(Math.sqrt(1-a*a)-1)+b
}return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0){return b}if((a/=e)==1){return b+d}g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else{c=g/(2*Math.PI)*Math.asin(d/h)}return -(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0){return b}if((a/=e)==1){return b+d}g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else{c=g/(2*Math.PI)*Math.asin(d/h)}return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b
},easeInOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0){return b}if((a/=e/2)==2){return b+d}g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else{c=g/(2*Math.PI)*Math.asin(d/h)}if(a<1){return -0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b}return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==j){g=1.70158}return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j){g=1.70158}return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b
},easeInOutBack:function(c,a,b,d,e,g){if(g==j){g=1.70158}if((a/=e/2)<1){return d/2*a*a*(((g*=1.525)+1)*a-g)+b}return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2){return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+b
}return f.easing.easeOutBounce(c,a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);(function(d){d.effects.shake=function(a){return this.queue(function(){var b=d(this),j=["position","top","bottom","left","right"];d.effects.setMode(b,a.options.mode||"effect");var c=a.options.direction||"left",e=a.options.distance||20,l=a.options.times||3,f=a.duration||a.options.duration||140;d.effects.save(b,j);b.show();d.effects.createWrapper(b);var g=c=="up"||c=="down"?"top":"left",h=c=="up"||c=="left"?"pos":"neg";c={};var i={},k={};
c[g]=(h=="pos"?"-=":"+=")+e;i[g]=(h=="pos"?"+=":"-=")+e*2;k[g]=(h=="pos"?"-=":"+=")+e*2;b.animate(c,f,a.options.easing);for(e=1;e<l;e++){b.animate(i,f,a.options.easing).animate(k,f,a.options.easing)}b.animate(i,f,a.options.easing).animate(c,f/2,a.options.easing,function(){d.effects.restore(b,j);d.effects.removeWrapper(b);a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()});b.dequeue()})}})(jQuery);var init={};function initAdd(name,ids){var list=init[name];if(!list){list=init[name]=[]
}for(var i in ids){list.push(ids[i])}}function initSet(name,ids){var list=init[name];if(!list){list=init[name]={}}for(var i in ids){list[i]=ids[i]}}function extend(parent,prototype){for(var i in parent.prototype){if(!(i in prototype)){prototype[i]=parent.prototype[i]}}return prototype}function emptyFunction(){}function identity(x){return x}function constant(x){return function(){return x}}function isEmpty(x){for(var i in x){return false}return true}function assert(value){if(!value){alert("Assertion failed")
}}var IE=(navigator.appName!="Microsoft Internet Explorer")?undefined:Number(navigator.appVersion.match(/MSIE (\d+\.\d+)/)[1]);var Mac=navigator.platform.substring(0,3)=="Mac";function classNameSetter(name){var regex=new RegExp("(\\s)\\s*"+name+"\\s+|\\s*"+name+"\\s*","g");return function(node,set){var c=String(node.className);regex.lastIndex=0;if(set){if(!regex.test(c)){c=c?c+" "+name:name}}else{c=c.replace(regex,"$1")}node.className=c;return c}}function escapeHTML(s){return s.replace(/[<>&"]/g,function(c){return htmlEscapes[c]
})}var htmlEscapes={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;"};function escapeRegExp(s){return s.replace(/([|^$\\.*+?()[\]{}])/g,"\\$1")}function quotePersonalAddr(s){return/[.,:;<>"]/.test(s)?'"'+s.replace(/(["\\])/g,"\\$1")+'"':s}function ObjectToArray(object){var tmp=[];for(var i in object){tmp.push(object[i])}return tmp}var events={};function encapsulateMethod(obj,methodname){return function(){obj[methodname].apply(obj,arguments)}}function register(name,callback){if(name in triggerSingleton.singletons){callback.apply(window,triggerSingleton.singletons[name])
}var list=(name in events)?events[name]:events[name]={};if("oxEventId" in callback){if(callback.oxEventId in list){return}}else{callback.oxEventId=Events.id++}list[callback.oxEventId]=callback}register.id=1;function unregister(name,callback){if(("oxEventId" in callback)&&(name in events)){delete events[name][callback.oxEventId]}}function triggerEvent(){var list=events[arguments[0]];var args=null;args=new Array(arguments.length-1);for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}if(list){for(var cb in list){try{list[cb].apply(null,args)
}catch(e){delete list[cb];var msg=String(e.message);if(msg.indexOf("cleared scope")===-1){if(debug||url.dev!==undefined){console.error("Caught error during triggerEvent",msg,e)}}}}}}function triggerSingleton(name){triggerEvent.apply(this,arguments);var args=triggerSingleton.singletons[name]=[];for(var i=1;i<arguments.length;i++){args.push(arguments[i])}}triggerSingleton.singletons={};function Events(){this.events={};this.posted={}}Events.id=1;Events.prototype={register:function(name,callback){var list=(name in this.events)?this.events[name]:this.events[name]=new Array();
for(var i in list){if(list[i]==callback){return}}list.push(callback)},unregister:function(name,callback){var list=this.events[name];if(!list){return}var cb=list.pop();if(cb==callback){return}for(var i=list.length-1;i>=0;i--){if(list[i]==callback){list[i]=cb;return}}if(cb){list.push(cb)}},trigger:function(){var list=this.events[arguments[0]];if(list){var args=new Array(arguments.length-1);for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}for(var cb in list){list[cb].apply(null,args)}}},post:function(name){if(!this.posted[name]){var Self=this;
setTimeout(function(){var args=Self.posted[name];delete Self.posted[name];var list=Self.events[name];if(list){var params=new Array(args.length-1);for(var i=1;i<args.length;i++){if(jQuery.isFunction(args[i])){params[i-1]=args[i]()}else{params[i-1]=args[i]}}for(var cb in list){list[cb].apply(null,params)}}},0)}this.posted[name]=arguments}};function I18nString(toString){this.toString=toString}I18nString.prototype=new String();I18nString.prototype.valueOf=function(){return this.toString()};var _;var noI18n;
var gettext;var pgettext;var dpgettext;var ngettext;var npgettext;var dnpgettext;var bindtextdomain;var setLanguage;var getDictionary;var listI18nDomains;var replacePOFile;function format(string,params){var param_array=params;if(Object.prototype.toString.call(params)!="[object Array]"){param_array=new Array(arguments.length-1);for(var i=1;i<arguments.length;i++){param_array[i-1]=arguments[i]}}if(string instanceof I18nString){return new I18nString(function(){return formatRaw(string,param_array)})}else{return formatRaw(string,param_array)
}}function formatRaw(string,params){var index=0;return String(string).replace(/%(([0-9]+)\$)?[A-Za-z]/g,function(match,pos,n){if(pos){index=n-1}return params[index++]}).replace(/%%/,"%")}function formatError(result,formatString){return format(formatString||_("Error: %2$s (%1$s, %3$s)"),result.code,format(_(result.error),result.error_params),result.error_id)}function expectI18n(text){expectI18n=debug?function(text){if(!(text instanceof I18nString)){console.warn("Untranslated text:",typeof text=="function"?text():text,getStackTrace())
}return String(text)}:String;return expectI18n(text)}(function(){var current,current_lang;var domains={"":"lang/%s.js"};var languages={};var originals={};var counter=0;_=gettext=function(text){return dpgettext("","",text)};noI18n=function(text){return new I18nString(constant(text))};pgettext=function(context,text){return dpgettext("",context,text)};function dpgettext_(domain,context,text){return new I18nString(function(){var c=current&&current[domain||""];var key=context?context+"\0"+text:text;return c&&c.dictionary[key]||text
})}dpgettext=function(){dpgettext=debug?function(domain,context,text){if(text instanceof I18nString){console.error("Retranslation",text)}return dpgettext_.apply(this,arguments)}:dpgettext_;return dpgettext.apply(this,arguments)};ngettext=function(singular,plural,n){return dnpgettext("","",singular,plural,n)};npgettext=function(context,singular,plural,n){return dnpgettext("",context,singular,plural,n)};dnpgettext=function(domain,context,singular,plural,n){var text=n!=1?plural:singular;return new I18nString(function(){var c=current&&current[domain||""];
if(!c){return text}var key=context?[context,"\0",singular,"\x01",plural].join(""):[singular,"\x01",plural].join("");var translation=c.dictionary[key];if(!translation){return text}return translation[Number(c.plural(n))]||text})};function parse(pattern,file){if(pattern.substring(pattern.length-2)=="po"){return parsePO(file)}else{return(new Function("return "+file))()}}bindtextdomain=function(domain,pattern,cont){domains[domain]=pattern;if(languages[current_lang]===current){setLanguage(current_lang,cont)
}else{if(cont){cont()}}};listI18nDomains=function(){var result=[];for(var i in domains){result.push(i)}return result};replacePOFile=function(domain,language,data){if(!languages[language]){languages[language]={}}languages[language][domain]=parsePO(data);if(language==current_lang){setLanguage(current_lang)}};setLanguage=function(name,cont){if(!name){if(cont){cont()}return}current_lang=name;var new_lang=languages[name];if(!new_lang){loadLanguage(name,cont);return}for(var i in domains){if(!(i in new_lang)){loadLanguage(name,cont);
return}}current=new_lang;for(var i in init.i18n){var attrs=init.i18n[i].split(",");var node=$(i);if(node){for(var j=0;j<attrs.length;j++){var attr=attrs[j];var id=attr+","+i;var text=attr?node.getAttributeNode(attr):node.firstChild;var val=text&&String(text.nodeValue);if(!val||val=="\xa0"){alert(format('Invalid i18n for id="%s"',i))}var original=originals[id];if(!original){original=originals[id]=val}var context="";var pipe=original.indexOf("|");if(pipe>=0){context=original.substring(0,pipe);original=original.substring(pipe+1)
}text.nodeValue=dpgettext("",context,original)}}}triggerEvent("LanguageChangedInternal");triggerEvent("LanguageChanged");if(cont){cont(name)}};loadOnce=(function(){var pending={};var process=function(url,type,args){var list=pending[url][type],i=0,$i=list.length;for(;i<$i;i++){if(list[i]){list[i].apply(window,args||[])}}list=null;delete pending[url]};return function(url,success,error){if(pending[url]===undefined){pending[url]={success:[success],error:[error]};jQuery.ajax({url:url,dataType:"text",success:function(){process(url,"success",arguments)
},error:function(){process(url,"error",arguments)}})}else{pending[url].success.push(success);pending[url].error.push(error)}}}());function loadLanguage(name,cont){if(corewindow!=window){var core_dict=corewindow.getDictionary(name);if(core_dict){current=languages[name]=core_dict;setLanguage(name,cont);return}}var curr=languages[name];if(!curr){curr=languages[name]={}}var join=new Join(function(){setLanguage(name,cont)});var lock=join.add();for(var d in domains){if(!(d in curr)){var file=format(domains[d],name);
file=file.replace(/(de_DE|en_GB|en_US)\.js/,"$1.jsz");var url=urlify(file);loadOnce(url,join.add((function(domain){return function(file){try{languages[name][domain]=parse(domains[domain],file)}catch(e){triggerEvent("OX_New_Error",4,e);join.add()}}})(d)),join.alt((function(domain){return function(xhr){languages[name][domain]=false;return String(xhr.status)==="404"}})(d)))}}lock()}getDictionary=function(name){return languages[name]}})();function parsePO(file){var po={nplurals:1,plural:function(n){return 0
},dictionary:{}};if(/^\s*$/.test(file)){return po}parsePO.tokenizer.lastIndex=0;var line_no=1;function next(){while(parsePO.tokenizer.lastIndex<file.length){var t=parsePO.tokenizer.exec(file);if(t[1]){continue}if(t[2]){line_no++;continue}if(t[3]){return t[3]}if(t[4]){return t[4]}if(t[5]){throw new Error(format("Invalid character in line %s.",line_no))}}}var lookahead=next();function clause(name,optional){if(lookahead==name){lookahead=next();var parts=[];while(lookahead&&lookahead.charAt(0)=='"'){parts.push((new Function("return "+lookahead))());
lookahead=next()}return parts.join("")}else{if(!optional){throw new Error(format("Unexpected '%1$s' in line %3$s, expected '%2$s'.",lookahead,name,line_no))}}}if(clause("msgid")!=""){throw new Error("Missing PO file header")}var header=clause("msgstr");if(parsePO.headerRegExp.exec(header)){po=(new Function("return "+header.replace(parsePO.headerRegExp,"{ nplurals: $1, plural: function(n) { return $2; }, dictionary: {} }")))()}while(lookahead){var ctx=clause("msgctxt",true);var id=clause("msgid");
var id_plural=clause("msgid_plural",true);var str;if(id_plural!==undefined){id=id+="\x01"+id_plural;str={};for(var i=0;i<po.nplurals;i++){str[i]=clause("msgstr["+i+"]")}}else{str=clause("msgstr")}if(ctx){id=ctx+"\0"+id}po.dictionary[id]=str}return po}parsePO.tokenizer=new RegExp('^(#.*|[ \\t\\v\\f]+)$|(\\r\\n|\\r|\\n)|^(msg[\\[\\]\\w]+)(?:$|[ \\t\\v\\f]+)|[ \\t\\v\\f]*("[^\r\n]*")\\s*$|(.)',"gm");parsePO.headerRegExp=new RegExp("^(?:[\\0-\\uffff]*\\n)?Plural-Forms:\\s*nplurals\\s*=\\s*([0-9]+)\\s*;\\s*plural\\s*=\\s*([^;]*);[\\0-\\uffff]*$");
function I18nNode(callback,template){if(template){for(var i in template){this[i]=template[i]}}if(callback instanceof I18nString){this.callback=function(){return String(callback)}}else{if(typeof callback!="function"){if(debug){console.warn("Untranslated string:",callback,getStackTrace())}this.callback=function(){return _(callback)}}else{if(debug){console.warn("Untranslated string:",callback(),getStackTrace())}this.callback=callback}}this.index=++I18nNode.counter;this.node=document.createTextNode(this.callback());
this.enable()}I18nNode.prototype={update:function(){if(typeof this.callback!="function"){console.error(format('The callback "%s" has type "%s".',this.callback,typeof this.callback))}else{this.node.nodeValue=this.callback()}},disable:function(){delete I18nNode.nodes[this.index]},enable:function(){I18nNode.nodes[this.index]=this}};I18nNode.nodes={};I18nNode.counter=0;register("LanguageChanged",function(){for(var i in I18nNode.nodes){I18nNode.nodes[i].update()}});function addTranslated(text,context,domain){return(new I18nNode(text instanceof I18nString?text:dpgettext(domain,context,text))).node
}function isToday(utc){var today=new Date(now());today.setUTCHours(0,0,0,0);var diff=(new Date(utc)).getTime()-today.getTime();return diff>=0&&diff<86400000}function isLocalToday(t){var local=new Date(now()),utc=new Date(t);return local.getUTCDate()===utc.getUTCDate()&&local.getUTCMonth()===utc.getUTCMonth()&&local.getUTCFullYear()===utc.getUTCFullYear()}var daysInFirstWeek=4;var weekStart=1;function getDays(d){return Math.floor(d/86400000)}function getWeek(d,inMonth){var keyDay=getKeyDayOfWeek(d);
var keyDate=new Date(keyDay*86400000);var jan1st=Date.UTC(keyDate.getUTCFullYear(),inMonth?keyDate.getUTCMonth():0);return Math.floor((keyDay-getDays(jan1st))/7)+1}function getKeyDayOfWeek(d){var firstDay=getDayInSameWeek(d,weekStart);return(firstDay+7-daysInFirstWeek)}function getDayInSameWeek(d,dayInWeek){return getDays(d.getTime())-(d.getUTCDay()-dayInWeek+7)%7}var formatDateTime;var parseDateTime;var weekdays=[];(function(){var regex=/(G+|y+|M+|w+|W+|D+|d+|F+|E+|a+|H+|k+|K+|h+|m+|s+|S+|z+|Z+)|\'(.+?)\'|(\'\')/g;
function num(n,x){var s=x.toString();n-=s.length;if(n<=0){return s}var a=new Array(n);for(var i=0;i<n;i++){a[i]="0"}a[n]=s;return a.join("")}function text(n,full,shrt){return n>=4?_(full):_(shrt)}var months=["January","February","March","April","May","June","July","August","September","October","November","December"];var shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var days=weekdays.untranslated=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var shortDays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];var funs={G:function(n,d){return d.getTime()<-62135596800000?_("BC"):_("AD")},y:function(n,d){var y=d.getUTCFullYear();if(y<1){y=1-y}return num(n,n==2?y%100:y)},M:function(n,d){var m=d.getUTCMonth();if(n>=3){return text(n,months[m],shortMonths[m])}else{return num(n,m+1)}},w:function(n,d){return num(n,getWeek(d))},W:function(n,d){return num(n,getWeek(d,true))},D:function(n,d){return num(n,getDays(d.getTime()-Date.UTC(d.getUTCFullYear(),0))+1)
},d:function(n,d){return num(n,d.getUTCDate())},F:function(n,d){return num(n,Math.floor(d.getUTCDate()/7)+1)},E:function(n,d){var m=d.getUTCDay();return text(n,days[m],shortDays[m])},a:function(n,d){return d.getUTCHours()<12?_("AM"):_("PM")},H:function(n,d){return num(n,d.getUTCHours())},k:function(n,d){return num(n,d.getUTCHours()||24)},K:function(n,d){return num(n,d.getUTCHours()%12)},h:function(n,d){return num(n,d.getUTCHours()%12||12)},m:function(n,d){return num(n,d.getUTCMinutes())},s:function(n,d){return num(n,d.getUTCSeconds())
},S:function(n,d){return num(n,d.getMilliseconds())},z:function(){return""},Z:function(){return""}};formatDateTime=function(format,date){return format instanceof I18nString?new I18nString(fmt):fmt();function fmt(){return String(format).replace(regex,function(match,fmt,text,quote){if(fmt){return funs[fmt.charAt(0)](fmt.length,date)}else{if(text){return text}else{if(quote){return"'"}}}})}};var f="G+|y+|M+|w+|W+|D+|d+|F+|E+|a+|H+|k+|K+|h+|m+|s+|S+|z+|Z+";var pregexStr="("+f+")(?!"+f+")|("+f+")(?="+f+")|'(.+?)'|('')|([$^\\\\.*+?()[\\]{}|])";
var pregex=new RegExp(pregexStr,"g");var monthRegex;var monthMap;function recreateMaps(){var names=months.concat(shortMonths);for(var i=0;i<names.length;i++){names[i]=escape(_(names[i]))}monthRegex="("+names.join("|")+")";monthMap={};for(var i=0;i<months.length;i++){monthMap[_(months[i])]=i;monthMap[_(shortMonths[i])]=i}weekdays.length=days.length;for(var i=0;i<days.length;i++){weekdays[i]=_(days[i])}}recreateMaps();register("LanguageChangedInternal",recreateMaps);function escape(rex){return String(rex).replace(/[$^\\.*+?()[\]{}|]/g,"\\$")
}var numRex="([+-]?\\d+)";function number(n){return numRex}var prexs={G:function(n){return"("+escape(_("BC"))+"|"+escape(_("AD"))+")"},y:number,M:function(n){return n>=3?monthRegex:numRex},w:number,W:number,D:number,d:number,F:number,E:number,a:function(n){return"("+escape(_("AM"))+"|"+escape(_("PM"))+")"},H:number,k:number,K:number,h:number,m:number,s:number,S:number};function mnum(n){return n>1?"([+-]\\d{1,"+(n-1)+"}|\\d{1,"+n+"})":"(\\d{1,"+n+"})"}var mrexs={G:prexs.G,y:mnum,M:function(n){return n>=3?monthRegex:mnum(n)
},w:mnum,W:mnum,D:mnum,d:mnum,F:mnum,E:prexs.E,a:prexs.a,H:mnum,k:mnum,K:mnum,h:mnum,m:mnum,s:mnum,S:mnum};var pfuns={G:function(n){return function(s,d){d.bc=s==_("BC")}},y:function(n){return function(s,d){d.century=n<=2&&s.match(/^\d\d$/);d.y=s}},M:function(n){return n>=3?function(s,d){d.m=monthMap[s]}:function(s,d){d.m=s-1}},w:emptyFunction,W:emptyFunction,D:emptyFunction,d:function(n){return function(s,d){d.d=s}},F:emptyFunction,E:emptyFunction,a:function(n){return function(s,d){d.pm=s==_("PM")
}},H:function(n){return function(s,d){d.h=s}},k:function(n){return function(s,d){d.h=s==24?0:s}},K:function(n){return function(s,d){d.h2=s}},h:function(n){return function(s,d){d.h2=s==12?0:s}},m:function(n){return function(s,d){d.min=s}},s:function(n){return function(s,d){d.s=s}},S:function(n){return function(s,d){d.ms=s}}};var threshold=new Date();var century=Math.floor((threshold.getUTCFullYear()+20)/100)*100;parseDateTime=function(formatMatch,string){var handlers=[];var rex=formatMatch.replace(pregex,function(match,pfmt,mfmt,text,quote,escape){if(pfmt){handlers.push(pfuns[pfmt.charAt(0)](pfmt.length));
return prexs[pfmt.charAt(0)](pfmt.length)}else{if(mfmt){handlers.push(pfuns[mfmt.charAt(0)](mfmt.length));return mrexs[mfmt.charAt(0)](mfmt.length)}else{if(text){return text}else{if(quote){return"'"}else{if(escape){return"\\"+escape}}}}}});var match=string.match(new RegExp("^\\s*"+rex+"\\s*$","i"));if(!match){return null}var d={bc:false,century:false,pm:false,y:1970,m:0,d:1,h:0,h2:0,min:0,s:0,ms:0};for(var i=0;i<handlers.length;i++){handlers[i](match[i+1],d)}if(d.century){d.y=Number(d.y)+century;
var date=new Date(0);date.setUTCFullYear(d.y-20,d.m,d.d);date.setUTCHours(d.h,d.min,d.s,d.ms);if(date.getTime()>threshold.getTime()){d.y-=100}}if(d.bc){d.y=1-d.y}if(!d.h){d.h=Number(d.h2)+(d.pm?12:0)}var date=new Date(0);date.setUTCFullYear(d.y,d.m,d.d);date.setUTCHours(d.h,d.min,d.s,d.ms);var yy=parseInt(d.y,10),mm=parseInt(d.m,10),dd=parseInt(d.d,10);if(date.getUTCFullYear()===yy&&date.getUTCMonth()===mm&&date.getUTCDate()===dd){return date}else{return null}}})();var formatDate;var parseDateString;
(function(){var formats;function updateFormats(){var date_def=configGetKey("gui.global.region.date.predefined")!=0;var time_def=configGetKey("gui.global.region.time.predefined")!=0;var date=date_def?_("yyyy-MM-dd"):configGetKey("gui.global.region.date.format");var time=time_def?_("HH:mm"):configGetKey("gui.global.region.time.format");var hour=configGetKey("gui.global.region.time.format_hour");var suffix=configGetKey("gui.global.region.time.format_suffix");formats={date:date,time:time,shortdate:_("MM/dd"),datetime:format(pgettext("datetime","%1$s %2$s"),date,time),dateday:format(_("EEEE, %s"),date),dateshortday:format(_("EEE, %s"),date),dateshortdayreverse:format(_("%s, EEE"),date),hour:time_def?pgettext("dayview","HH:mm"):hour,prefix:time_def?pgettext("dayview","HH"):suffix?"hh":"HH",suffix:time_def?pgettext("dayview","mm"):suffix?"a":"mm",onlyhour:time_def?pgettext("teamview","H"):suffix?"ha":"H"}
}register("LanguageChangedInternal",updateFormats);register("OX_Configuration_Changed",updateFormats);register("OX_Configuration_Loaded",updateFormats);formatDate=function(date,format){return formatDateTime(formats[format],new Date(date))};parseDateString=function(string,format){return parseDateTime(formats[format||"date"].replace("yyyy","yy"),string)}})();function formatNumbers(value,format_language){var val;if(!format_language){format_language=configGetKey("language")}switch(format_language){case"en_US":return value;
break;default:val=String(value).replace(/\./,",");return val;break}}function round(val){val=formatNumbers(Math.round(parseFloat(String(val).replace(/\,/,"."))*100)/100);return val}function getInterval(t,until){function minutes(m){return format(until?npgettext("in","%d minute","%d minutes",m):ngettext("%d minute","%d minutes",m),m)}function get_h(h){return format(until?npgettext("in","%d hour","%d hours",h):ngettext("%d hour","%d hours",h),h)}function get_hm(h,m){return format(until?npgettext("in","%1$d hour and %2$s","%1$d hours and %2$s",h):ngettext("%1$d hour and %2$s","%1$d hours and %2$s",h),h,minutes(m))
}function hours(t){if(t<60){return minutes(t)}var h=Math.floor(t/60);var m=t%60;return m?get_hm(h,m):get_h(h)}function get_d(d){return format(until?npgettext("in","%d day","%d days",d):ngettext("%d day","%d days",d),d)}function get_dhm(d,t){return format(until?npgettext("in","%1$d day, %2$s","%1$d days, %2$s",d):ngettext("%1$d day, %2$s","%1$d days, %2$s",d),d,hours(t))}function days(t){if(t<1440){return hours(t)}var d=Math.floor(t/1440);t=t%1440;return t?get_dhm(d,t):get_d(d)}function get_w(w){return format(until?npgettext("in","%d week","%d weeks",w):ngettext("%d week","%d weeks",w),w)
}t=Math.round(t/60000);if(t>=10080&&t%10080==0){return get_w(Math.round(t/10080))}else{return days(t)}}var currencies=[{iso:"CAD",name:"Canadian dollar",isoLangCodes:["CA"]},{iso:"CHF",name:"Swiss franc",isoLangCodes:["CH"]},{iso:"DKK",name:"Danish krone",isoLangCodes:["DK"]},{iso:"EUR",name:"Euro",isoLangCodes:["AT","BE","CY","FI","FR","DE","GR","IE","IT","LU","MT","NL","PT","SI","ES"]},{iso:"GBP",name:"Pound sterling",isoLangCodes:["GB"]},{iso:"PLN",name:"Zloty",isoLangCodes:["PL"]},{iso:"RUB",name:"Russian rouble",isoLangCodes:["RU"]},{iso:"SEK",name:"Swedish krona",isoLangCodes:["SE"]},{iso:"USD",name:"US dollar",isoLangCodes:["US"]},{iso:"JPY",name:"Japanese Yen",isoLangCodes:["JP"]},{iso:"RMB",name:"Renminbi",isoLangCodes:["CN","TW"]}];
var getGreetingPhrase=function(time){var hour,phrase;if(time===undefined){hour=new Date().getHours()}else{hour=new Date(time).getHours()}if(hour>=5&&hour<=11){phrase=_("Good morning")}else{if(hour>=18&&hour<=23){phrase=_("Good evening")}else{phrase=_("Hello")}}return phrase};var ox={};var debug=false;var debugDeep=false&&debug;var debugPlugins=false;var debugJSON=false;var activefolder=null;var embedded=false;var globalContextMenus={},menuarrows={};var AjaxRoot="/ajax";var help_location="[protocol]://[hostname][path]help/[language]/";
var logout_location="[protocol]://[hostname][path]";var sessionExpired_location="[protocol]://[hostname][path]";var directLink_location="[protocol]://[hostname][path]#m=[module]&f=[folder]&i=[object_id]";var uwaLink={text:"Please have a look at the %sInteresting UWA modules%s page. It shows a list of widgets and their associated data.",link:"http://www.open-xchange.com/index.php?id=361&L=[language{0}]"};var themesParent="themes/";var oxProductInfo={id:"com.openexchange.ox.gui.dhtml",version:"6.20.0.0",revision:"${revision}",pversion:"6.20.0 Rev36",build:"v=NJdKIkD",product_name:"Open-Xchange Server",vendor_address:"Open-Xchange AG\nMaxfeldstra&szlig;e 9\nD-90409 N&uuml;rnberg\nE-Mail: info@open-xchange.com"};
var oxThemeStyle={name:"Default",path:"default"};function isOldGecko(){if(navigator.appName=="Netscape"&&navigator.userAgent.indexOf("rv:")>=0){var version=Number(navigator.userAgent.match(/rv:(\d+\.\d+)/)[1]);if(version<=1.8){return true}}return false}var oldGecko=isOldGecko();var preloadingnewwindows=true;var bShared=true;var bPublic=true;function refreshWindow(){triggerEvent("OX_Refresh")}register("OX_Refresh",function(){storageCache.update()});var autorefresh_var;register("OX_Configuration_Loaded_Complete",function(){if(configGetKey("gui.global.autorefresh")!=0){autorefresh_var=window.setInterval(refreshWindow,(configGetKey("gui.global.autorefresh")*60000))
}if(!configContainsKey("gui.mail.auto_save_drafts")){configSetKey("gui.mail.auto_save_drafts",3)}var interval=configGetKey("cookielifetime");if(interval>0){setInterval(function(){ox.JSON.get(AjaxRoot+"/login?action=refreshSecret&session="+session,jQuery.noop);if(autologinEnabled){storeSession()}},interval*900)}if(ox.api.config.get("ui.global.help.help_path")!=null){help_location=ox.api.config.get("ui.global.help.help_path")}if(ox.api.config.get("ui.global.logout_path")!=null){logout_location=ox.api.config.get("ui.global.logout_path")
}if(ox.api.config.get("ui.global.sessionExpired_path")!=null){sessionExpired_location=ox.api.config.get("ui.global.sessionExpired_path")}if(ox.api.config.get("ui.global.directLink_path")!=null){directLink_location=ox.api.config.get("ui.global.directLink_path")}if(ox.api.config.get("ui.product.name")!=null){oxProductInfo.product_name=ox.api.config.get("ui.product.name")}if(ox.api.config.get("ui.product.vendor.address")!=null){oxProductInfo.vendor_address=ox.api.config.get("ui.product.vendor.address")
}if(ox.api.config.get("ui.global.uwa.link")!=null){uwaLink.link=ox.api.config.get("ui.global.uwa.link")}if(ox.api.config.get("ui.global.theme.path")!=null){themesParent=ox.api.config.get("ui.global.theme.path")}});register("OX_Configuration_Changed",function(param){if(param=="configuration/settings"){if(autorefresh_var){window.clearInterval(autorefresh_var)}if(configGetKey("gui.global.autorefresh")!=0){autorefresh_var=window.setInterval(refreshWindow,(configGetKey("gui.global.autorefresh")*60000))
}}});function Join(callback){this.callback=callback;this.count=0}Join.prototype={add:function(callback){this.count++;return this.alt(callback)},alt:function(callback){var Self=this;return function(){var retval;if(callback){retval=callback.apply(this,arguments)}if(!--Self.count){Self.callback()}return retval}}};var stopEvent=(function(){var stopNormal=function(e){e.preventDefault();e.stopPropagation()};var stopIE=function(e){e.returnValue=false;e.cancelBubble=true};return IE<9?stopIE:stopNormal}());
var cancelDefault=(function(){function cancelNormal(e){e.preventDefault()}function cancelIE(e){e.returnValue=false}return IE<9?cancelIE:cancelNormal})();function cancelBubbling(e){if(e.stopPropagation){e.stopPropagation()}else{e.cancelBubble=true}}var _IE_Events={};var addDOMEvent=(function(){var id=0;function makeHandler(id,win){var f=function(){var list=_IE_Events[id];var e=!win?window.event:win;if(!e.currentTarget){e.currentTarget=this}for(var i=list.length-1;i>=0;i--){if(list[i](e)===false){return false
}}return true};f.id=id;return f}function addIE(node,event,callback,win){event="on"+event;var oldHandler=node[event];var list;if(debug&&oldHandler&&!oldHandler.id){alert(format('Mixing addDOMEvent and DOM 0 events is not allowed!\nid="%s" event="%s"',node.id,event))}if(oldHandler&&oldHandler.id){list=_IE_Events[oldHandler.id]}else{node[event]=makeHandler(++id,win);list=_IE_Events[id]=[]}list.push(callback)}function addNormal(node,event,callback){node.addEventListener(event,callback,false)}return document.addEventListener?addNormal:addIE
})();var removeDOMEvent=(function(){function removeIE(node,event,callback){event="on"+event;var handler=node[event];if(!handler||!handler.id){return}var list=_IE_Events[handler.id];for(var i in list){if(list[i]==callback){list.splice(i,1);if(!list.length){delete _IE_Events[handler.id];node[event]=""}}}}function removeNormal(node,event,callback){node.removeEventListener(event,callback,false)}return function(node,event,callback){removeDOMEvent=node.addEventListener?removeNormal:removeIE;removeDOMEvent(node,event,callback)
}})();function setLoading(){}function setLoadingCursor(){}var JSONX=function(){this.first=null;this.last=null;this.processing=false};JSONX.serialize=function(data){if(typeof(data)=="string"){return'"'+data.replace(/[\x00-\x1f\\"]/g,function(c){var n=Number(c.charCodeAt(0)).toString(16);return"\\u00"+(n.length<2?"0"+n:n)})+'"'}if(typeof(data)=="function"){return"function"}if(!data||typeof(data)!=="object"){return String(data)}var strings=new Array(data.length);if(ox.util.isArray(data)){for(var i in data){strings[i]=JSONX.serialize(data[i])
}return"["+strings.join()+"]"}var j=0;for(var i in data){strings[j++]='"'+i+'":'+JSONX.serialize(data[i])}return"{"+strings.join()+"}"};JSONX.ignore404=function(result,status){return status==404};JSONX.count=0;JSONX.cursorCount=0;JSONX.prototype={get:function(uri,meta,cb,errorHandler,raw){var request={method:"GET",uri:uri,data:"",cb:cb,errorHandler:errorHandler,raw:raw,next:null};if(debugDeep){request.stack=getStack(3,2)}this.add(request);return request},post:function(uri,data,meta,cb,errorHandler,raw){var encoded=new Array(),n=0;
for(var i in data){encoded[n++]=i+"="+encodeURIComponent(data[i])}var request={method:"POST",uri:uri,data:encoded.join("&"),contenttype:"application/x-www-form-urlencoded",cb:cb,errorHandler:errorHandler,raw:raw,next:null};if(debugDeep){request.stack=getStack(3,2)}this.add(request);return request},put:function(uri,data,meta,cb,errorHandler,raw){var request={method:"PUT",uri:uri,contenttype:"text/javascript; charset=UTF-8",data:JSONX.serialize(data),cb:cb,errorHandler:errorHandler,raw:raw,next:null};
if(debugDeep){request.stack=getStack(3,2)}this.add(request);return request},cancel:function(request){if(request==this.first){request.cancelled=true;return false}for(var r=this.first;r;r=r.next){if(request==r.next){r.next=request.next;return true}}return false},remove:function(){if(this.first){if(this.last==this.first){this.last=null}this.first=this.first.next}},add:function(request){if(!this.first){this.last=this.first=request}else{this.last=this.last.next=request}if(!this.processing){this.process()
}},process:function(){JSONX.count++;JSONX.cursorCount++;if(!(this.processing=this.first!=null)){if(!--JSONX.count){setLoading(false)}if(!--JSONX.cursorCount){setLoadingCursor(false)}return}var xmlhttp=this.getXmlHttp();var Self=this;if(debugJSON){var debug_cb=JSONX.debug(this.first.method+" "+this.first.uri,[this.first.data].concat(JSONX.getHTMLStackTrace(2)),callback);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){debug_cb()}}}else{xmlhttp.onreadystatechange=callback}xmlhttp.open(this.first.method,this.first.uri,true);
if(this.first.contenttype){xmlhttp.setRequestHeader("Content-Type",this.first.contenttype)}xmlhttp.send(this.first.data);if(JSONX.count==1){setLoading(true)}if(JSONX.cursorCount==1){setLoadingCursor(true)}function callback(){if(xmlhttp.readyState!=4){return}JSONX.count--;JSONX.cursorCount--;xmlhttp.onreadystatechange=emptyFunction;var cb=Self.first.cb;var originalErrorHandler=Self.first.errorHandler;var errorHandler=originalErrorHandler?function(result,status){if(!originalErrorHandler(result,status)){JSONX.errorHandler(result,status)
}}:JSONX.errorHandler;var raw=Self.first.raw,uri=Self.first.uri,data=Self.first.data;if(debugDeep){trace=Self.first.stack}Self.remove();var result={};if(xmlhttp.status!=200){errorHandler(xmlhttp.statusText,xmlhttp.status);if(debugDeep){trace=null}Self.process();return}if(raw){result=xmlhttp.responseText}else{var s="return "+xmlhttp.responseText;try{result=Function(s)()}catch(e){alert(format(_('Syntax error in server response (%s): "%s"\n\nURL: %s\n\nData: %s\n\nResponse: %s'),formatDate(new Date(),"datetime"),e.message,uri,data,s));
if(debugDeep){trace=null}Self.process();return}if(result&&typeof(result)=="object"&&result.error){if(result.category==13){newServerError(result)}else{errorHandler(result);if(debugDeep){trace=null}Self.process();return}}}if(window.console&&console.exception){try{cb(result,xmlhttp.statusText,xmlhttp)}catch(e){console.exception(e)}if(debugDeep){trace=null}Self.process()}else{try{cb(result,xmlhttp.statusText,xmlhttp)}finally{if(debugDeep){trace=null}Self.process()}}}},getXmlHttp:function(){alert(_("Your browser does not support AJAX."))
}};JSONX.errorHandler=function(result,status){if(status){alert(format(_("Error: %1$s - %2$s"),status,result))}else{alert(formatError(result))}};(function(){var xmlhttp=null;try{xmlhttp=new XMLHttpRequest();if(xmlhttp){xmlhttp=null;JSONX.prototype.getXmlHttp=function(){return new XMLHttpRequest()}}}catch(e){try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");if(xmlhttp){xmlhttp=null;JSONX.prototype.getXmlHttp=function(){return new ActiveXObject("Msxml2.XMLHTTP")}}}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
if(xmlhttp){xmlhttp=null;JSONX.prototype.getXmlHttp=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}}catch(e){JSONX.prototype.getXmlHttp()}}}if(debugJSON){var requests={};var id=0;var w=JSONX.debugWindow=open("about:blank","oxJSONXDebugger");w.document.open();w.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>JSONX debugger</title></head><body><button type="button" id="toggle">Enable</button><button type="button" id="record">Record</button><div id="recorded">&#xa0;</div><ul id="ul"></ul></body></html>');
w.document.close();JSONX.debugDocument=w.document;var ul=w.document.getElementById("ul");var toggle=w.document.getElementById("toggle");var record=w.document.getElementById("record");var recorded=w.document.getElementById("recorded");toggle.addEventListener("click",function(){debugJSON=!debugJSON;record.disabled=debugJSON;toggle.firstChild.data=debugJSON?"Disable":"Enable"},false);record.addEventListener("click",function(){if(debugJSON){recorded.firstChild.data=JSONX.getRecordedCombination();record.firstChild.data="Record"
}else{JSONX.recordCombination();record.firstChild.data="Stop"}},false);debugJSON=false;JSONX.debug=JSONX.defaultDebug=function(caption,text,callback){var plus=newnode("img",0,{src:themesParent+"/default/img/plus.gif"},0,w.document);for(var i=0;i<text.length;i++){if(typeof text[i]=="string"){text[i]=newtext(text[i],w.document)}}var data=newnode("pre",{display:"none"},0,text,w.document);var finish=newnode("button",0,{type:"button",disabled:true},[newtext("Finish",w.document)],w.document);var debugBtn=newnode("button",0,{type:"button",disabled:true},[newtext("Debug",w.document)],w.document);
var li=newnode("li",0,0,[plus,newtext(caption,w.document),finish,debugBtn,data],w.document);ul.appendChild(li);plus.addEventListener("click",function(){if(data.style.display=="none"){plus.src=themesParent+"default/img/minus.gif";data.style.display="block"}else{plus.src=themesParent+"default/img/plus.gif";data.style.display="none"}},false);finish.addEventListener("click",function(){ul.removeChild(li);callback()},false);debugBtn.addEventListener("click",function(){ul.removeChild(li);eval("debugger");
callback()},false);var f=function(){finish.disabled=false;debugBtn.disabled=false};f.cancel=function(){ul.removeChild(li)};return f};var oldSetTimeout=JSONX.realSetTimeout=window.setTimeout;JSONX.setDebugCombination=function(combination){var c=this.debugCombination=combination?combination.split(","):[];for(var i=0;i<c.length;i++){c[i]=Number(c[i])}this.lastChoice=0;var index=0;var pending=[];var join=new Join(function(){while(!this.count&&pending.length){var choice;if(index>=c.length){choice=0}else{if(index==c.length-1){choice=c[index]+1
}else{choice=c[index]}}if(choice>=pending.length){throw new Error("Invalid debug choice "+choice+" in ["+c+"] at "+index+".")}c[index++]=choice;if(choice<pending.length-1){JSONX.lastChoice=index}var callback=pending[choice];pending.splice(choice,1);callback()}});this.debug=function(caption,text,callback){pending.push(callback);return join.add()};debugJSON=true;JSONX.getDebugCombination=function(){debugJSON=false;return this.debugCombination.slice(0,this.lastChoice).join()}};JSONX.recordCombination=function(){var recordedCombination=[],pending=[];
var callID=0;this.debug=function(caption,text,callback){var id=callID++;pending.push({id:id,caption:caption,callback:callback,toString:function(){return this.id+": "+this.caption}});return function(){for(var i=0;i<pending.length;i++){if(pending[i].id==id){var cb=pending.splice(i,1)[0];recordedCombination.push(i);cb.callback();break}}}};this.getRecordedCombination=function(){debugJSON=false;this.debug=this.defaultDebug;return recordedCombination.join()};debugJSON=true}}})();(function(){getStackTrace=function(){return{stack:""}
};if(!debugDeep){return}trace=null;getStack=function(start,end){return{stack:(new Error).stack,next:trace,start:start,end:end}};try{getStack()}catch(e){return}function wrap(f,stack){return function(){trace=stack;var retval=f.apply(this,arguments);trace=null;return retval}}getStackTrace=function(){var retval=[];for(var s=getStack(3);s;s=s.next){var stack=s.stack.split("\n");var end=stack.length-(s.next?s.next.end:0);for(var i=s.start;i<end;i++){var entry=stack[i];if(/function/.test(entry)){entry=entry.replace(/^(\w*\().*(\)@\S+:\d+)$/,"$1...$2")
}if(/@data:/.test(entry)){entry=entry.replace(/(@data:)\S+(:\d+)$/,"$1...$2")}retval.push(entry)}retval.push("---")}return{stack:retval.join("\n")}};var sources={},sourceID=0;function showSource(file,line){return function(e){e.preventDefault();var w=sources[file];if(!w||w.closed){var target="oxJSONDebuggerSource"+sourceID++;w=sources[file]=open("about:blank",target);w.document.open();w.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>'+file.replace(/^.*\/([^\/]+)$/,"$1")+' - JSON debugger</title><style type="text/css">pre {color:#666} a {color:black}</style></head><body><pre>');
var xml=new XMLHttpRequest;xml.open("GET",file,false);xml.send();var lines=xml.responseText.split("\n");var lineNoLength=String(lines.length).length;for(var i=1;i<=lines.length;i++){var lineNo=String(i);while(lineNo.length<lineNoLength){lineNo=" "+lineNo}w.document.write(lineNo+' <a id="'+i+'">'+escapeHTML(lines[i-1])+"</a>\n")}w.document.write("</pre></body></html>");w.document.close()}if(w.currentLine){w.currentLine.style.background=""}var l=w.currentLine=w.document.getElementById(line);l.style.background="#ccf";
w.document.documentElement.scrollTop=l.offsetTop-w.document.documentElement.clientHeight/2;w.focus()}}JSONX.getHTMLStackTrace=function(hide){var doc=this.debugDocument;var retval=[];for(var s=getStack(hide+4);s;s=s.next){var stack=s.stack.split("\n");var end=stack.length-(s.next?s.next.end:0);for(var i=s.start;i<end;i++){var entry=stack[i];if(/function/.test(entry)){entry=entry.replace(/^(\w*\().*(\)@\S+:\d+)$/,"$1...$2")}var match=/^((?:\w*\(.*\))?@)((\S+):(\d+))$/.exec(entry);if(match){var link=newnode("a",0,{href:match[3]+"#"+match[4],target:"oxJSONDebuggerSource"},[newtext(match[2],doc)],doc);
link.addEventListener("click",showSource(match[3],match[4]),false);retval.push(newnode("div",0,0,[newtext(match[1],doc),link],doc))}else{retval.push(newnode("div",0,0,[newtext(entry,doc)],doc))}}retval.push(newtext("---",doc));hide=0}return retval};JSONX.stackTrace=function(text){for(var a=[],i=1;i<arguments.length;i++){a.push(JSONX.serialize(arguments[i]));a.push(newnode("br"))}a=a.concat(JSONX.getHTMLStackTrace(2));JSONX.debug(text,a,emptyFunction)()};var oldSetTimeout=window.setTimeout;window.setTimeout=function(){if(typeof arguments[0]=="function"){arguments[0]=wrap(arguments[0],getStack(3,debugJSON?3:2));
if(debugJSON){arguments[0]=JSONX.debug("setTimeout "+arguments[1],JSONX.getHTMLStackTrace(0),arguments[0])}}if(debugJSON&&JSONX.debugCombination){arguments[1]=0}return oldSetTimeout.apply(this,arguments)};var oldSetInterval=window.setInterval;window.setInterval=function(){if(typeof arguments[0]=="function"){arguments[0]=wrap(arguments[0],getStack(3,2))}return oldSetInterval.apply(this,arguments)};var oldAjax=jQuery.ajax;jQuery.ajax=function(options){var stack=getStack(0,0);var opt=jQuery.extend({},options);
if(opt.success){opt.success=wrap(opt.success,stack)}if(opt.error){opt.error=wrap(opt.error,stack)}if(opt.complete){opt.complete=wrap(opt.complete,stack)}if(debugJSON){var cb=JSONX.debug(opt.type+" "+opt.url,[JSONX.serialize(opt.data)].concat(JSONX.getHTMLStackTrace(2)),function(){for(var i=0;i<cb.callbacks.length;i++){var c=cb.callbacks[i];c.callback.apply(c.that,c.args)}cb.callbacks=[]});cb.callbacks=[];function ok(callback,that,args){cb.callbacks.push({callback:callback,that:that,args:args});cb()
}if(opt.success){cb.success=opt.success;opt.success=function(){ok(cb.success,this,arguments)}}if(opt.error){cb.error=opt.error;opt.error=function(){ok(cb.error,this,arguments)}}if(opt.complete){cb.complete=opt.complete;opt.complete=function(){ok(cb.complete,this,arguments)}}}return oldAjax.call(this,opt)}})();function traceVariable(object,name){var variable=object[name];delete object[name];object.__defineGetter__(name,function(){return variable});object.__defineSetter__(name,function(value){console.info("variable trace",name,value,getStackTrace());
variable=value})}function traceAccess(object,name,cloning){var variable=object[name];delete object[name];if(cloning){object.__defineGetter__(name,function(){console.info("variable read",name,clone(variable),getStackTrace());return variable});object.__defineSetter__(name,function(value){console.info("variable write",name,clone(value),getStackTrace());variable=value})}else{object.__defineGetter__(name,function(){console.info("variable read",name,variable,getStackTrace());return variable});object.__defineSetter__(name,function(value){console.info("variable write",name,value,getStackTrace());
variable=value})}}var bClickedLogin=false,loginFader;var brandingReady=new Join(function(){triggerEvent("OX_Apply_Branding")});var brandingReadyThemeLoaded=brandingReady.add();var brandingReadyAdded=brandingReady.add();var loginReady=new Join(function(){loginSuccess()});var folderCache;var contentReady=loginReady.add(function(){loadMessage("Rebuild Tree...","50");triggerEvent("RebuildTree");initAll2(login)});var resizeReady=loginReady.add();var configReady=loginReady.add(function(){});var folderReady=loginReady.add(function(){if(ox.api.config.get("modules.mail.module")===true){folderCache.setComplete(0)
}});var accountsReady=loginReady.add();var userReady=loginReady.add();var modulesReady=loginReady.add(function(){var identifier;var join=new Join(function(){ox.api.http.pause();ox.api.config.load(configReady);var separator=config.modules.mail.defaultseparator;var tree=config.modules.folder.tree||0;folderCache=ox.api.cache["folder"+tree];if(ox.api.config.get("modules.mail.module")===true){if(tree==0){ox.api.folder.getMultiple({list:["1","2","3","6","9","default0","default0"+separator+"INBOX"],success:folderReady})
}else{ox.api.folder.getMultiple({list:["1","2","3","6","9","default0"+separator+"INBOX"],success:folderReady})}ox.api.account.all(accountsReady)}else{folderReady();accountsReady()}internalCache.getUsers([null],userReady);ox.api.http.resume();autologinEnabled=jQuery("#loading_data_complete input:radio:checked").val()==="true";if(autologinEnabled){setTimeout(storeSession,5000)}loadContents()});var themeReady=join.add(function(data){if(data&&data.theme){config.gui={theme:data.theme}}if(configContainsKey("gui.theme")&&configContainsKey(["modules","themes",configGetKey("gui.theme").path])){oxThemeStyle=configGetKey("gui.theme")
}else{configSetKey("gui.theme",oxThemeStyle)}if(url.theme!==undefined){ox.gui.themePath=urlify(themesParent+url.theme+"/");oxThemeStyle.path=url.theme}else{ox.gui.themePath=getFullImgSrc("")}loadCSSFile("ox.css",function(){loadCSSFile(themesParent+oxThemeStyle.path+"/css/concat.cssz",brandingReadyThemeLoaded)})});if(url.lang){ox.api.config.set("language",url.lang,true).done(join.add())}ox.api.config.load("config/ui",function(data){if(data&&data.global&&data.global.theme&&data.global.theme.path){themesParent=data.global.theme.path
}ox.api.config.load("config/gui",themeReady)})});var myjoin=new Join(contentReady);var htmlload=new Join(myjoin.add());var htmljsload=new Join(myjoin.add(function(){fillInitObject()}));var jsload=new Join(myjoin.add(function(){preloadJSFiles()}));var cssload=new Join(myjoin.add(function(){preloadCSSFiles()}));var cacheload=new Join(myjoin.add());var fileloaded=function(){};var wholeelement=new Object();var rootebene=this;var htmljsarray=new Array();var jsarray=new Array();var cssarray=new Array();
function urlify(path){return(path.substr(0,1)!=="/"&&path.substr(0,4)!=="http"&&corewindow==window&&oxProductInfo.build!==null)?oxProductInfo.build+"/"+path:path}function jEsc(str){return str.replace(/([#;&,.+*~':"!\^$\[\]()=>|\/])/g,"\\$1")}function preloadJSFiles(){var i,node,$l=jsarray.length,list=wholeelement.js;var head=document.getElementsByTagName("head")[0];for(i=0;i<$l;i++){head.appendChild(newnode("script",null,{type:"text/javascript",text:list[jsarray[i]]}))}}function switchTheme(path,name){var old=oxThemeStyle.path,$=jQuery;
var regex=new RegExp(themesParent+old);if(old!==path){$.ajax({url:urlify(themesParent+path+"/css/concat.cssz"),success:function(){loadCSSFileForNewWindow(themesParent+path+"/css/concat.cssz");removeCSSFile(themesParent+old+"/css/concat.cssz");$("img").each(function(){var src=$(this).attr("src");if(src){$(this).attr("src",src.replace(regex,themesParent+path))}});$("*").each(function(){var bg=$(this).css("background");if(bg){$(this).css("background",bg.replace(regex,themesParent+path))}var bgImg=$(this).css("backgroundImage");
if(bgImg){$(this).css("backgroundImage",bgImg.replace(regex,themesParent+path))}});oxThemeStyle={path:path,name:name};ox.gui.themePath=getFullImgSrc("")}})}}function preloadCSSFiles(){var i,code,node;for(i=0;i<cssarray.length;i++){code=wholeelement.css[cssarray[i]];node=newnode("style",null,{type:"text/css"});node.appendChild(document.createTextNode(code))}}var searchedsizeids=new Object();function fillInitObject(){function searchSizeNode(id){if(searchedsizeids[id]){return searchedsizeids[id]}var searchobjects=new Array();
searchobjects.push(init.size);for(var zaehler=0;zaehler<searchobjects.length;zaehler++){var myel=searchobjects[zaehler];myel.length;for(var i1=0;i1<myel.length;i1++){if(myel[i1]){if(myel[i1].id==id){searchedsizeids[id]=myel[i1].children;return searchedsizeids[id]}else{if(myel[i1].children.length){searchobjects.push(myel[i1].children)}}}}}return null}for(var i3=0;i3<htmljsarray.length;i3++){var node=wholeelement.htmljs[htmljsarray[i3]];eval(node.node);if(!preload){alert("Failure no preload var available")
}for(var i in preload){switch(i){case"size":if(preload[i].length>0){var element;if(node.parent){element=searchSizeNode(node.parent)}else{element=init.size}if(!element){alert("Error in Fill size: parent id -"+node.parent)}for(var i2 in preload[i]){element.push(preload[i][i2])}}break;default:if(init[i] instanceof Array){for(var i2 in preload[i]){init[i].push(preload[i][i2])}}else{for(var i2 in preload[i]){init[i][i2]=preload[i][i2]}}break}}delete preload}}function loadFile(page,cb,params,sizetreeid){(new JSONX).get(urlify(page),null,function(s){cb(s,params,sizetreeid)
},null,true)}function loadCSSFileForNewWindow(url){var node=newnode("link",null,{type:"text/css",rel:"stylesheet",href:urlify(url)});document.getElementsByTagName("head")[0].appendChild(node)}function removeCSSFile(url){jQuery("link[rel=stylesheet][href="+jEsc(urlify(url))+"]").remove()}function removeCSSFilesForNewWindow(path){loadCSSFileForNewWindow(themesParent+path+"/css/concat.cssz")}ox.boot=(function(){var fileCache={};var jsNodes={};wholeelement.js={};var loadingJS={};var bundleParts={mainpage:{alias:"core",place:undefined},"mail-core":{alias:"mail_core",place:"contentarea"},"calendar-core":{alias:"cal_core",place:"contentarea"},"contacts-core":{alias:"cont_core",place:"contentarea"},"infostore-core":{alias:"info_core",place:"contentarea"},"tasks-core":{alias:"tasks_core",place:"contentarea"},messaging:{alias:"messaging",place:"contentarea"}};
return{cacheHTML:function(opt){var options=jQuery.extend({file:"",success:jQuery.noop,error:jQuery.noop},opt);if(fileCache[options.file]===undefined){jQuery.ajax({url:oxProductInfo.build+"/"+options.file,dataType:"xml",success:function(data){var node=document.createElement("DIV");node.innerHTML=jQuery(data).text()||"";var nodes=jQuery("*[id]",node),i=0,$l=nodes.length,n,id;for(;i<$l;i++){n=nodes[i];id=n.getAttribute("id")||"";if(allnodes[id]!==undefined){alert('Internal Error: ID "'+id+'" used multiple times!');
allnodes[id]="Duplicate ID"}else{if(id.substr(id.length-11)=="scaffold-js"){jsNodes[id]=n}else{allnodes[id]=n}}}fileCache[options.file]=true;options.success(data)},error:function(xhr){if(debug){console.error("Error",options.file,options.id,xhr)}options.error()}})}},loadHTML:function(opt){var options=jQuery.extend({file:"",id:"",success:jQuery.noop,error:jQuery.noop},opt);if(fileCache[options.file]!==undefined){options.success(allnodes[options.id]);return}},loadJS:function(opt){var options=jQuery.extend({file:"",id:"",success:jQuery.noop,error:jQuery.noop,params:"",tree:undefined},opt);
if(fileCache[options.file]!==undefined){var node=jsNodes[options.id];htmljsarray.push(options.params);options.success(jQuery(node).text(),options.params,options.tree)}},loadJSFile:function(page){if(loadingJS[page]===undefined){if(debug){fileloaded=jsload.add();var d=newnode("script",null,{type:"text/javascript",src:urlify(page)});document.getElementsByTagName("head")[0].appendChild(d);loadingJS[page]=true}else{jsarray.push(page);var callback=function(node,param){loadingJS[page]=true;wholeelement.js[param]=node
};loadFile(page,jsload.add(callback),page)}}},bundles:{},getBundles:function(){var b=ox.boot.bundles,portal=configGetKey("modules.portal.module"),mail=configGetKey("modules.mail.module"),contacts=configGetKey("modules.contacts.module"),calendar=configGetKey("modules.calendar.module"),tasks=configGetKey("modules.tasks.module"),infostore=configGetKey("modules.infostore.module"),messaging=configGetKey("modules.messaging.module");b.MAIL=mail&&contacts&&!portal&&!calendar&&!tasks&&!infostore&&!messaging;
b.PIM=mail&&contacts&&portal&&calendar&&tasks&&!infostore&&!messaging;b.FULL=mail&&contacts&&portal&&calendar&&tasks&&infostore&&!messaging;b.ALL=mail&&contacts&&portal&&calendar&&tasks&&infostore&&messaging;return b},loadBundle:function(opt){var options=jQuery.extend({parts:[],name:"",success:jQuery.noop,htmlStore:jQuery.noop},opt);this.loadJSFile(options.name+".jsz");var layoutFile=options.name+".xmlz";var self=this;this.cacheHTML({file:layoutFile,success:htmlload.add(function(){loadMessage("Load Contents...","30");
var handler=function(){return htmljsload.add(options.htmlStore)};var p=options.parts,i=0,$l=p.length,id,part;for(;i<$l;i++){id=p[i];part=bundleParts[id];self.loadJS({file:layoutFile,id:id+"-scaffold-js",params:part.alias,tree:part.place,success:handler()});self.loadHTML({file:layoutFile,id:id+"-scaffold",success:htmlload.add(jQuery.noop)})}options.success()})})}}})();function loadCSSFile(path,cont){var url=urlify(path),links=jQuery("link[rel=stylesheet][href="+jEsc(url)+"]");if(links.length===0){jQuery.get(url,function(data){var node=newnode("link",null,{type:"text/css",rel:"stylesheet",href:url});
document.getElementsByTagName("head")[0].appendChild(node);ox.util.call(cont)})}}function loadContents(){function storeHTMLFile(node){function getIDs(obj){function recursive(obj){for(var i=obj.firstChild;i!=null;i=i.nextSibling){if(i.nodeType==1){idValue=i.id;if(idValue){if(allnodes[i.id]){alert('Internal Error: ID "'+i.id+'" used multiple times!');allnodes[i.id]="Duplicate ID"}else{allnodes[i.id]=i}}recursive(i)}}}if(obj.id){allnodes[obj.id]=obj}recursive(obj)}var el=document.createElement("div");
el.innerHTML=node;getIDs(el)}function storeHTMLJSFile(node,param,sizetreeid){if(!wholeelement.htmljs){wholeelement.htmljs=new Object()}wholeelement.htmljs[param]=new Object();if(sizetreeid){wholeelement.htmljs[param].parent=sizetreeid}wholeelement.htmljs[param].node=node}function storeJSFile(node,param){if(!wholeelement.js){wholeelement.js=new Object()}wholeelement.js[param]=node}function storeCSSFile(node,param){if(!wholeelement.css){wholeelement.css=new Object()}wholeelement.css[param]=node}function loadFileForCache(file){loadFile(file,emptyFunction,file)
}function loadHTMLFile(page){loadFile(page,htmlload.add(storeHTMLFile),null)}function loadHTMLJSFile(page,params,sizetreeid){htmljsarray[htmljsarray.length]=params;loadFile(page,htmljsload.add(storeHTMLJSFile),params,sizetreeid)}function debugJSLoad(page){fileloaded=jsload.add();var d=newnode("script",null,{type:"text/javascript",src:urlify(page)});document.getElementsByTagName("head")[0].appendChild(d)}function debugCSSLoad(url){var links=jQuery("link[rel=stylesheet][href="+jEsc(urlify(url))+"]");
if(links.length===0){var node=newnode("link",null,{type:"text/css",rel:"stylesheet",href:urlify(url)});document.getElementsByTagName("head")[0].appendChild(node)}}loadMessage("Load Contents...","20");var tmparray=new Array();tmparray.push(htmlload.add());tmparray.push(htmljsload.add());tmparray.push(jsload.add());tmparray.push(htmlload.add());tmparray.push(cacheload.add());tmparray.push(cssload.add());var bundle=ox.boot.getBundles();var finalize=function(){if(!bundle.ALL){if(configGetKey("modules.messaging.module")){loadHTMLFile("messaging.html");
loadHTMLJSFile("messaging.js","messaging","contentarea");loadJSFile("concat_messaging.js")}}for(var i=0;i<tmparray.length;i++){tmparray[i]()}loadMessage("Load Contents...","40")};var loadJS=ox.boot.loadJS;var loadJSFile=ox.boot.loadJSFile;var loadHTML=ox.boot.loadHTML;var cacheHTML=ox.boot.cacheHTML;if(bundle.FULL||bundle.ALL){var name="bundle_"+(bundle.ALL?"all":"full");var parts=["mainpage","mail-core","calendar-core","contacts-core","infostore-core","tasks-core"];if(bundle.ALL){parts.push("messaging")
}ox.boot.loadBundle({name:name,parts:parts,htmlStore:storeHTMLJSFile,success:finalize})}else{if(bundle.PIM){var name="bundle_pim";var parts=["mainpage","mail-core","calendar-core","contacts-core","tasks-core"];ox.boot.loadBundle({name:name,parts:parts,htmlStore:storeHTMLJSFile,success:finalize})}else{if(bundle.MAIL){var name="bundle_mail";var parts=["mainpage","mail-core","contacts-core"];ox.boot.loadBundle({name:name,parts:parts,htmlStore:storeHTMLJSFile,success:finalize})}else{loadHTMLFile("mainpage.html");
loadHTMLJSFile("mainpage.js","core");loadJSFile("concat_core.jsz");if(configGetKey("modules.messaging.module")){loadHTMLFile("messaging.html");loadHTMLJSFile("messaging.js","messaging","contentarea");loadJSFile("concat_messaging.jsz")}if(configGetKey("modules.portal.module")){loadJSFile("concat_portal.jsz")}if(configGetKey("modules.mail.module")){loadHTMLFile("mail_core.html");loadHTMLJSFile("mail_core.js","mail_core","contentarea");loadJSFile("concat_mail.jsz")}loadJSFile("concat_minicalendar.jsz");
if(configGetKey("modules.calendar.module")){loadHTMLFile("calendar_core.html");loadHTMLJSFile("calendar_core.js","cal_core","contentarea");loadJSFile("concat_calendar.jsz")}if(configGetKey("modules.contacts.module")){loadHTMLFile("contacts_core.html");loadHTMLJSFile("contacts_core.js","cont_core","contentarea");loadJSFile("concat_contacts.jsz")}if(configGetKey("modules.infostore.module")){loadHTMLFile("infostore_core.html");loadHTMLJSFile("infostore_core.js","info_core","contentarea");loadJSFile("concat_infostore.jsz")
}if(configGetKey("modules.tasks.module")){loadHTMLFile("tasks_core.html");loadHTMLJSFile("tasks_core.js","tasks_core","contentarea");loadJSFile("tasks.jsz")}loadJSFile("concat_sidepanel.jsz");loadJSFile("concat_config.jsz");for(var i=0;i<tmparray.length;i++){tmparray[i]()}loadFileForCache("concat_all.jsz")}}}}function loadModules(result){session=result.session;config=config||{};config.fastgui={preload:{mail:true,calendar:true,tasks:true,contacts:true,distributionlist:true,infostore:true}};config.modules=result.modules;
disableByUrl();triggerSingleton("Modules_Loaded");modulesReady()}function disableByUrl(){if(url.disable!==undefined&&config&&config.modules){var i=0,tmp=String(url.disable).split(/,/),$i=tmp.length;for(;i<$i;i++){delete config.modules[tmp[i]]}}}function uuid(){function hex(len,x){if(x===undefined){x=Math.random()}var s=new Array(len);for(var i=0;i<len;i++){x*=16;var digit=x&15;s[i]=digit+(digit<10?48:87)}return String.fromCharCode.apply(String,s)}return[hex(8),"-",hex(4),"-4",hex(3),"-",hex(4,0.5+Math.random()/4),"-",hex(12)].join("")
}function storeSession(){if(supportForAutoLogin===true){ox.api.http.GET({module:"login",params:{action:"store"}})}}function login(){if(bClickedLogin){return}bClickedLogin=true;if(loginFader){clearTimeout(loginFader)}jQuery("#loginStatus").stop().hide();jQuery("#loginPrompt input").attr("disabled","disabled");var commitLogin=function(){var form=document.getElementById("login");new JSONX().post(AjaxRoot+"/login?action=login&modules=true&client="+encodeURIComponent(oxProductInfo.id||"")+"&version="+encodeURIComponent(oxProductInfo.pversion||"")+"&authId="+uuid(),{name:form.username.value,password:form.password.value},null,function(result){loadMessage("Login...","10");
jQuery("#loading_data_complete").hide();jQuery("#loading_data").show();jQuery("#loginPrompt input").removeAttr("disabled");loadModules(result)},function(result,status){jQuery("#loginPrompt input").removeAttr("disabled");jQuery("#loginScreen").effect("shake",{times:2,distance:10},70,function(){var msg=formatError(result);triggerEvent("OX_Login_Failed");jQuery("#loading_data_complete").show();jQuery("#loading_data").hide();if(!status){if(result.code=="LGI-0006"){msg=_("Login failed. Please check your user name and password and try again.")
}else{msg=formatError(result)}}else{msg=format(_("Error: %1$s - %2$s"),status,result)}var category=0;if(result&&result.category){category=result.category}jQuery("#loginStatus td").empty().attr("class","error-category-"+category).text(msg.toString());jQuery("#loginStatus").fadeIn(500,function(){if(loginFader){clearTimeout(loginFader)}loginFader=setTimeout(function(){jQuery("#loginStatus").hide()},10000)});bClickedLogin=false;jQuery("#username").focus()});return true},null)};setTimeout(commitLogin,10);
return false}function loginSuccess(){changeImgPath(oxThemeStyle.path);register("Logout",logout);if((url.embedded!==undefined&&(!!new Boolean(url.embedded))===true)||configGetKey("ui.global.embedded")){embedded=true}$("everything").style.visibility="hidden";appendNode("everything");var view=null;var module="mail";if(!ox.api.config.get("mail.folder.inbox")&&(ox.api.ui.getModule("mail")&&ox.api.ui.getModule("mail").disabled===false)){ox.api.ui.getModule("mail").disabled=true;ox.api.config.set("modules.mail.module",false);
register("Ready",function(){ox.UINotifier.warn(_("Unable to establish a connection to the E-Mail server. Possible reasons: the mail server is (temporarily) down or there are network connection problems. To prevent further errors the module has been disabled. Please contact your administrator."),null,_("The E-Mail module is not available"))})}var modules=ox.api.ui.listModules();for(var i=0;i<modules.length;i++){var myModule=modules[i];if(myModule.disabled){continue}module=myModule.name;break}loadingComplete(true);
var lang=url.lang||configGetKey("language");setLanguage(lang,function(){triggerEvent("OX_SetTime");ox.gui.morph();triggerEvent("OX_Configuration_Loaded");triggerEvent("OX_Configuration_Loaded_Complete");loadPlugins(function(){triggerEvent("OX_Plugins_Loaded");var originalTitle=document.title;register("LanguageChanged",function(){document.title=_(originalTitle)+""});var landingPage=url.landingpage||configGetKey("gui.global.landing_page.module")||null;if(landingPage!==null){if(ox.api.ui.getModule(landingPage).disabled===false){module=landingPage
}}else{configSetKey("gui.global.landing_page.module",module)}view=configGetKey("gui."+module+".view")||module;ox.UIController.initialModule=module;ox.UIController.initialView=view;ox.desktop.validate();loadMessage("","100");triggerSingleton("OX_Login");ox.ToolBarController.initialResize();setTimeout(function(){var cont=function(){jQuery("#branding").append(jQuery("<img/>",{id:"branding-logo",src:getFullImgSrc("img/dummy.gif"),alt:""}));brandingReadyAdded();$("body").removeChild($("loginScreen"));
$("everything").style.visibility="visible";removeCSSFile("themes/login/default.css");triggerSingleton("Ready")};if(configGetKey("gui.global.expert_tree")===1){ox.UIController.firstSetExpertTree=true;ox.UIController.setExpertTree(true)}var m=ox.util.getHash("m"),f=ox.util.getHash("f"),id=ox.util.getHash("i");if(m!==undefined&&f!==undefined){var join=new Join(function(){triggerEvent("OX_Direct_Linking",m,{module:m,folder:f,id:id!==undefined?id:null,folder_id:f});cont()});var error=false;function errorHandler(){if(error){return
}error=true;defaultSetModule()}ox.api.folder.getParents({folder:f,tree:0,success:join.add(),error:errorHandler});ox.api.folder.getParents({folder:f,tree:1,success:join.add(),error:errorHandler})}else{defaultSetModule()}function defaultSetModule(){ox.UIController.setModule({module:module,folder:"default",success:function(){if(view){triggerEvent("OX_Switch_View",view)}triggerEvent("OX_Selected_Attachments",0);cont()}})}},10)})})}function getFullImgSrc(img){return urlify(themesParent+(corewindow.oxThemeStyle.path||"default")+"/"+img)
}function loadingComplete(main){var loggingOut=false;JSONX.errorHandler=function(result,status){if(typeof savePending!="undefined"&&savePending){savePending=false}if(status){triggerEvent("OX_New_Error",2,format(_("Error: %1$s - %2$s"),status,result))}else{if(result){if(result.code&&result.code.match(/^SES-02..$/)){if(!loggingOut){if(main){loggingOut=true;newAlert(_("Session has expired"),_("Your session has expired. Please log in again.")+" ("+format(_("Error-ID: %1$s"),[result.error_id])+")",function(){triggerEvent("OX_Session_Expired");
window.onbeforeunload=null;setTimeout(function(){window.location.replace(sessionExpired_location.format())},0)})}else{newAlert(_("Session has expired"),_("Your session has expired. You have to close this window.")+" ("+format(_("Error-ID: %1$s"),[result.error_id])+")")}}}else{newServerError(result,4,window.opener)}}else{newServerError("Unknown error: The server response is invalid or empty! Please try again. If it still not work please reload the application or contact your support!",4,window.opener)
}}}}function logout(){if(activemodule=="configuration"){configuration_askforSave(ox.api.ui.logout)}else{ox.api.ui.logout()}}register("OX_Apply_Branding",function(){var brandingHeight=jQuery("#branding").outerHeight();if(corewindow.embedded===true){corewindow.embedd=true;jQuery("#header").hide();jQuery("#header-decorator").hide();jQuery("#notheader").css({top:"0px"});if(jQuery("#branding").css("display")=="none"){brandingHeight=0}jQuery("#notheader").css({top:brandingHeight+"px"})}else{if(jQuery("#branding").css("display")!=="none"){corewindow.branding=true;
var topPanelHeight=jQuery("#header").outerHeight();jQuery("#header").css({top:brandingHeight+"px"});jQuery("#header-decorator").css({top:(brandingHeight+topPanelHeight)+"px"});jQuery("#notheader").css({top:(brandingHeight+topPanelHeight)+"px"})}}});var now=function(){now=function(){return(new Date()).getTime()+now.offset};now.offset=corewindow.now.offset;return now()};register("OX_SetTime",function(){now();now.offset=configGetKey("currentTime")-(new Date()).getTime();var d=new Date(now());activeYear=d.getUTCFullYear();
activeMonth=d.getUTCMonth();activeDay=d.getUTCDate()});var newWindow=(function(){var popupBlockerTitle="Error";var popupBlockerText="The window could not be opened. Most likely it has been blocked by a pop-up or advertisement blocker. Please check your browser settings and make sure pop-ups are allowed for this domain.";var windows={};setInterval(function(){for(var i in windows){if(windows[i]&&windows[i].closed){delete windows[i]}}},10000);var counter=1;function serialize(id){var parts=[];for(var i in id){parts.push(i+"="+id[i])
}return parts.sort().join("&")}return function newWindow(uri,options,id,nwin){var nwin=nwin||window;uri=urlify(uri);if(id){var sid=serialize(id);var win=windows[sid];if(win&&win.closed){delete windows[sid];win=null}if(win){setTimeout(function(){win.focus()},0)}else{win=windows[sid]=nwin.open(uri,"OX"+counter++,options)}if(!win){delete windows[sid];newAlert(_(popupBlockerTitle),_(popupBlockerText))}}else{win=nwin.open(uri,"OX"+counter++,options);if(!win){newAlert(_(popupBlockerTitle),_(popupBlockerText))
}}return win}})();var activemodule="portal";var modules=new Array();var modulesview=[];var customFolderIcons={};var addModuleIcon=emptyFunction;function registerModule(name,text,priority){var module=ox.api.ui.getModule(name);if(module!==null){module.disabled=false}else{ox.api.ui.registerModule({name:name,text:text,priority:priority,disabled:false})}}function registerModuleView(name,text,limit,adj){modulesview.push({name:name,text:text,limit:limit,adj:adj})}var views={name:"root",level:-1,children:{}};
var currentview=views;var currentfullpath;var currentpath2=[];var currentpath=[];function registerView(name,show,enter,leave,hide,change){var names=name.split("/");var view=views;for(var i=0;i<names.length;i++){var viewname=names[i];var nextview=view.children[viewname];if(!nextview){nextview=view.children[viewname]={name:view.name+"/"+names[i],parent:view,level:i,children:{}}}view=nextview}if(!view.show){view.show=new Array()}if(!view.enter){view.enter=new Array()}if(!view.change){view.change=new Array()
}if(!view.leave){view.leave=new Array()}if(!view.hide){view.hide=new Array()}view.show.push(show);view.enter.push(enter);view.change.push(change);view.leave.push(leave);view.hide.push(hide);return view}function changeView(name,param){var previous=(currentpath2||[]).join("/");var names=name.split("/");currentpath2=name.split("/");for(var i=0;i<names.length&&i<currentpath.length&&names[i]==currentpath[i];i++){}var kview=currentview;for(var j=currentview.level;j>=i;j--){if(currentview.leave){for(var n=0;
n<currentview.leave.length;n++){if(currentview.leave[n]){currentview.leave[n](param)}}}currentview=currentview.parent}for(var k=kview.level;k>=i;k--){if(kview.hide){for(var n=0;n<kview.hide.length;n++){if(kview.hide[n]){kview.hide[n](param)}}}kview=kview.parent}activemodule=names[0];currentfullpath=name;var tmpview=views;var issame=true;for(var z=0;z<=k;z++){tmpview=tmpview.children[currentpath[z]];if(tmpview.change){for(var n=0;n<tmpview.change.length;n++){if(tmpview.change[n]){tmpview.change[n](param)
}}}}for(k++;k<names.length;k++){kview=kview.children[names[k]];if(!kview){while(names.length>k){names.pop()}break}else{if(kview.show){for(var n=0;n<kview.show.length;n++){if(kview.show[n]){kview.show[n](param)}}}}}resizeHandler();for(j++;j<names.length;j++){currentview=currentview.children[names[j]];if(currentview){oldcurrentview=currentview;if(currentview.enter){for(var n=0;n<currentview.enter.length;n++){if(currentview.enter[n]){currentview.enter[n](param)}}}}}currentpath=names;if(previous!==currentpath.join("/")){triggerEvent("OX_View_Changed",{module:ox.UIController.getModule(),path:currentpath})
}return currentview}function LinkedList(){this.first=null;this.last=null}LinkedList.prototype={addLast:function(item){item.next=null;item.prev=this.last;if(this.last){this.last.next=item}else{this.first=item}this.last=item;return this.first===item},removeFirst:function(){var item=this.first;if(item){this.first=item.next;if(this.first){this.first.prev=null}else{this.last=null}}return item},removeLast:function(){var item=this.last;if(item){this.last=item.prev;if(this.last){this.last.next=null}else{this.first=null
}}return item},remove:function(item){if(item.next){item.next.prev=item.prev}if(item.prev){item.prev.next=item.next}if(item===this.first){this.first=item.next}if(item===this.last){this.last=item.prev}},setFirst:function(newfirst){if(newfirst){newfirst.prev=null}else{this.last=null}this.first=newfirst},insertBefore:function(newitem,nextitem){if(nextitem===this.first){this.first=newitem;newitem.prev=null}else{nextitem.prev.next=newitem;newitem.prev=nextitem.prev}newitem.next=nextitem;nextitem.prev=newitem
}};var setMouseCursor;var removeMouseCursor;(function(){var cursorIndex=-1;var cursors=new LinkedList();cursors.addLast({cursor:""});var setCursorCSS=emptyFunction;register("Loaded",function(){var stylesheet=document.styleSheets[0];var rules=stylesheet.cssRules||stylesheet.rules;var insertRule=stylesheet.insertRule?function(cursor,index){stylesheet.insertRule("* { cursor: "+cursor+" !important; }",cursorIndex)}:function(cursor,index){stylesheet.addRule("*","cursor: "+cursor+" !important")};var deleteRule=stylesheet.deleteRule?function(index){stylesheet.deleteRule(index)
}:function(index){stylesheet.removeRule(index)};setCursorCSS=function(cursor){if(cursorIndex>=0){deleteRule(cursorIndex);cursorIndex=-1}if(cursor){cursorIndex=rules.length;insertRule(cursor,cursorIndex)}}});setMouseCursor=function(cursor){var item={cursor:cursor};cursors.addLast(item);setCursorCSS(cursor);return item};removeMouseCursor=function(item){if(item===cursors.last){cursors.remove(item);setCursorCSS(cursors.last.cursor)}else{cursors.remove(item)}}})();function MRUList(size){if(!size){return new SimpleStorage()
}this.free=size;this.cache={};this.list=new LinkedList()}MRUList.prototype={get:function(key){var item=this.cache[key];if(!item){return undefined}this.list.remove(item);this.list.addLast(item);return item.data},set:function(key,value){var item=this.cache[key];if(item){item.data=value}else{item={key:key,data:value};this.list.addLast(item);this.cache[key]=item;if(this.free){this.free--}else{var key1=this.list.removeFirst().key;var ret=this.cache[key1].data;delete this.cache[key1];return ret}}},remove:function(key){var item=this.cache[key];
if(!item){return}this.list.remove(item);delete this.cache[key];this.free++}};function SimpleStorage(){this.data={}}SimpleStorage.prototype={get:function(key){return this.data[key]},set:function(key,value){this.data[key]=value},remove:function(key){delete this.data[key]}};function Storage(timestamp,ids,uri,prefetch,cacheSize,serialize,makeID,extraData,updateItem){this.timestamp=timestamp;this.ids=ids;this.indices={};this.uri=uri;this.prefetch=prefetch;this.cacheSize=cacheSize;this.serialize=serialize||identity;
this.makeID=makeID||function(x){return x[0]};this.extraData=extraData;this.updateItem=updateItem;this.serverUpdates=null;this.data=new MRUList(cacheSize);this.events=new Events();this.from=2147483647;this.to=0;this.json=new JSONX();this.requests=new LinkedList();this.processing=false;this.uid=Storage.uid++;for(var i=0;i<ids.length;i++){this.indices[this.serialize(ids[i])]=i}}Storage.uid=0;Storage.prototype={newIterate:function(ids,clear,set,final_cb,prefetch){var newids={};var min=Infinity,max=-1;
for(var i=0;i<ids.length;i++){var id=this.serialize(ids[i]);var ix=this.indices[id];min=Math.min(min,ix);max=Math.max(max,ix);var d=this.data.get(id);if(d){set(ix,d)}else{newids[id]=ix;clear(ix)}}if(isEmpty(newids)){if(final_cb){final_cb()}return}for(var i=Math.max(0,min-prefetch);i<min;i++){var id=this.serialize(this.ids[i]);var d=this.data.get(id);if(!d){newids[id]=i}}var last=Math.min(this.ids.length-1,max+prefetch);for(var i=max+1;i<=last;i++){var id=this.serialize(this.ids[i]);var d=this.data.get(id);
if(!d){newids[id]=i}}var newrequest={ids:newids,set:set,final_cb:final_cb};if(this.requests.addLast(newrequest)&&!this.processing){this.process()}return newrequest},process:function(){var idset={};for(var r=this.requests.first;r;r=r.next){for(var id in r.ids){if(!(id in idset)){idset[id]=this.ids[r.ids[id]]}}}var oldrequests=this.requests;this.requests=new LinkedList();this.processing=true;var ids=[];for(var id in idset){ids.push(idset[id])}var Self=this;this.json.put(this.uri,ids,null,function(obj){var items=obj.data;
var id,item;var makeIdItem=Self.extraData?function(i){id=Self.serialize(Self.makeID(items[i]));item=Self.updateItem(Self.extraData[id],items[i])}:function(i){item=items[i];id=Self.serialize(Self.makeID(item))};for(var i in items){makeIdItem(i);Self.data.set(id,item);for(var r=oldrequests.first;r;r=r.next){if(id in r.ids){r.set(r.ids[id],item);delete (r.ids[id])}}for(var r=Self.requests.first;r;r=r.next){if(id in r.ids){r.set(r.ids[id],item);delete (r.ids[id])}}}for(var r=oldrequests.first;r;r=r.next){if(r.final_cb){r.final_cb()
}}for(var r=Self.requests.first;r;r=r.next){if(isEmpty(r.ids)){if(r.final_cb){r.final_cb()}Self.requests.remove(r)}}if(Self.requests.first){Self.process()}else{Self.processing=false}})},purge:function(removeids){for(var i=0;i<removeids.length;i++){var serid=this.serialize(removeids[i]);this.data.remove(serid)}},cancel:function(request){this.requests.remove(request)},localUpdate:function(ids,callback){var Self=this;var min=Infinity;var max=-1;for(var i in ids){var id=this.serialize(ids[i]);var index=this.indices[id];
var data=this.data.get(id);if(!data){continue}var newdata=callback(index,data);if(!newdata){continue}this.data.set(id,newdata);min=Math.min(min,index);max=Math.max(max,index)}if(min<=max){this.postChanged(min,max+1)}},update:function(timestamp,ids,updates,extraData){this.timestamp=timestamp;if(extraData){this.extraData=extraData}var modified={},data=new MRUList(this.cacheSize);for(var i in updates){modified[this.serialize(this.makeID(updates[i]))]=updates[i]}var maxLength=Math.max(this.ids.length,ids.length);
this.ids.length=ids.length;this.indices={};for(var i=0;i<ids.length;i++){var id=this.serialize(this.ids[i]=this.makeID(ids[i]));var item=modified[id]||this.data.get(id);this.indices[id]=i;if(item){data.set(id,item)}}this.data=data;this.postChanged(0,maxLength)},append:function(items,extraData){var from=this.ids.length;var len=items.length;for(var i in items){var id=this.makeID(items[i]);var sid=this.serialize(id);this.indices[sid]=this.ids.length;this.ids.push(id);this.data.set(sid,items[i])}if(extraData){for(var i in extraData){this.extraData[i]=extraData[i]
}}this.postChanged(from,this.ids.length)},remove:function(from,to){if(to==undefined){to=from+1}for(var i=from;i<to;i++){var id=this.serialize(this.ids[i]);this.data.remove(id);delete this.indices[id];if(this.extraData){delete this.extraData[id]}}var oldlen=this.ids.length;this.ids.splice(from,to-from);for(var i=to;i<this.ids.length;i++){this.indices[this.serialize(this.ids[i])]=i}this.postChanged(from,oldlen)},removeIDs:function(ids){var indices=new Array(ids.length);for(var i=0,j=0;i<ids.length;
i++){var ix=this.indices[this.serialize(ids[i])];if(ix!==undefined){indices[j++]=ix}}indices.length=j;this.removeIndices(indices)},removeIndices:function(indices){if(!indices.length){return}indices.sort(function(a,b){return a-b});indices.push(Infinity);var n=0,next=indices[0],dest=next;this.postChanged(next,this.ids.length);for(var src=dest;src<this.ids.length;src++){if(src<next){var id=this.ids[src];this.ids[dest]=id;this.indices[this.serialize(id)]=dest++}else{var id=this.serialize(this.ids[src]);
this.data.remove(id);delete this.indices[id];if(this.extraData){delete this.extraData[id]}next=indices[++n]}}this.ids.length=dest},getIndex:function(id){return this.indices[this.serialize(id)]},getSID:function(index){var id=this.ids[index];if(id){return this.serialize(id)}},postChanged:function(from,to){this.from=Math.min(this.from,from);this.to=Math.max(this.to,to);var Self=this;this.events.post("Changed",function(){var from=Self.from;Self.from=2147483647;return from},function(){var to=Self.to;Self.to=0;
return to})}};function Selection(){this.count=0;this.data={};this.anchor=0;this.events=new Events();var Self=this;this.changed_cb=function(){var oldcount=Self.count;for(var id in Self.data){if(!(id in Self.storage.indices)){delete Self.data[id];Self.count--}}if(Self.count!=oldcount){Self.events.post("Selected",Self.count)}}}Selection.prototype={get:function(index){if(!this.storage){console.error("Selection.get without storage")}if(index in this.storage.ids){return this.serialize(this.storage.ids[index]) in this.data
}return false},get2:function(index){if(!this.storage){console.error("Selection.get without storage")}var id=this.storage.ids[index];if(!id){return false}return this.serialize(id) in this.data},toggle:function(index,e){var id=this.storage.ids[index];var sid=this.serialize(id);var oldval=sid in this.data;if(oldval){delete this.data[sid]}else{this.data[sid]=id}this.count+=oldval?-1:1;this.events.post("Selected",this.count,e);return !oldval},deselectSIDs:function(sids){for(var sid in sids){this.count-=(sid in this.data)?1:0;
delete this.data[sid]}this.events.post("Selected",this.count)},reset:function(e){this.data={};this.count=0;this.events.post("Selected",this.count,e)},select:function(from,to,e){for(var i=from;i<to;i++){var id=this.storage.ids[i];var sid=this.serialize(id);if(!(sid in this.data)){this.count++;this.data[sid]=id}}this.events.post("Selected",this.count,e)},getSelected:function(){var ids=[];for(var id in this.data){ids.push(this.data[id])}return ids},click:function(index,e){if(!this.storage){console.error("Selection.click without storage")
}if(index<0||index>=this.storage.ids.length){this.reset(e);return}if(!e||!(Mac?e.metaKey:e.ctrlKey)){this.reset(e)}if(e&&e.shiftKey){this.select(Math.min(this.anchor,index),Math.max(this.anchor,index)+1,e)}else{this.toggle(index,e);this.anchor=index}},setStorage:function(storage){if(this.storage){this.storage.events.unregister("Changed",this.changed_cb)}this.storage=storage;if(storage){this.serialize=storage.serialize;storage.events.register("Changed",this.changed_cb);this.changed_cb()}else{this.serialize=null
}},getID:function(){for(var i in this.data){return this.data[i]}}};function StorageCache(maxCount){this.cache=new MRUList(maxCount);this.json=new JSONX();this.storage=null;this.current=null}StorageCache.prefetch=20;StorageCache.cacheSize=1000;(function(){function makeURI(uri,params){var paramArray=[];for(var i in params){paramArray.push(i)}paramArray.sort();var uriArray=[uri,"?"];for(var i=0;i<paramArray.length;i++){uriArray.push(paramArray[i]+"="+encodeURIComponent(params[paramArray[i]]));uriArray.push("&")
}uriArray.pop();return uriArray.join("")}StorageCache.prototype={get:function(uri,params,callback,columns,cached,serialize,makeID,putBody,makeExtra,updateItem){this.putBody=putBody;this.uri=uri;if(!params.columns){params.columns="1,20"}params.session=session;this.params={};for(var i in params){this.params[i]=params[i]}var completeURI=makeURI(uri,params);this.columns=columns;params.columns=params.columns+","+columns;var key=makeURI(uri,params);if(cached==undefined){cached=true}this.serialize=serialize||function(x){return x.folder+"."+x.id
};this.makeID=makeID||function(x){return{id:x[0],folder:x[1]}};this.storage=cached?this.cache.get(key):null;if(!this.storage){var Self=this;function cb_json(obj){if(obj.error){return}var ids=new Array(obj.data.length);if(makeExtra){Self.extraData={};for(var i=0;i<obj.data.length;i++){var id=ids[i]=Self.makeID(obj.data[i]);Self.extraData[Self.serialize(id)]=makeExtra(obj.data[i])}}else{Self.extraData=null;for(var i=0;i<obj.data.length;i++){ids[i]=Self.makeID(obj.data[i])}}Self.current=Self.storage=new Storage(obj.timestamp,ids,makeURI(uri,{action:"list",session:session,columns:columns?params.columns:this.params.columns}),StorageCache.prefetch,StorageCache.cacheSize,Self.serialize,Self.makeID,Self.extraData,updateItem);
if(cached){Self.cache.set(key,Self.storage)}callback(Self.storage)}if(this.putBody){this.json.put(completeURI,this.putBody,null,cb_json)}else{this.json.get(completeURI,null,cb_json)}}else{this.current=this.storage;callback(this.storage)}},update:function(callback){if(!this.storage){if(callback){callback()}return}if(this.storage.serverUpdates){this.storage.serverUpdates();if(callback){callback()}return}var storage=this.storage;var ids,updateObj;var join=new Join(cb_forUpdate);var all_cb=join.add(function(obj){ids=obj.data
});var update_cb=join.add(function(obj){updateObj=obj});if(this.putBody){this.json.put(makeURI(this.uri,this.params),this.putBody,null,all_cb)}else{this.json.get(makeURI(this.uri,this.params),null,all_cb)}var p={};for(var i in this.params){p[i]=this.params[i]}p.action="updates";p.columns=this.columns?p.columns+","+this.columns:p.columns;p.ignore="deleted";p.timestamp=this.storage.timestamp;var Self=this;if(this.putBody){this.json.put(makeURI(this.uri,p),this.putBody,null,update_cb)}else{this.json.get(makeURI(this.uri,p),null,update_cb)
}function cb_forUpdate(){if(Self.makeExtra){var extraData={};for(var i in ids){extraData[Self.serialize(Self.makeID(ids[i]))]=Self.makeExtra(ids[i])}}storage.update(updateObj.timestamp,ids,updateObj.data,extraData);if(callback){callback()}}},setCurrent:function(storage){this.storage=null;this.current=storage}}})();function setTabLists(tabArray,panelArray,eventArray){tabsList=tabArray;panelsList=panelArray;eventList=eventArray}function changeTab(tab,panel,disable){if(!$(tab)){return}if(disable){return
}for(tabElementNr in tabsList){tabElement=tabsList[tabElementNr];panelElement=panelsList[tabElementNr];if(eventList!=null){eventElement=eventList[tabElementNr]}if(tabElement!=tab){if($(tabElement)){$(tabElement).style.display="none"}if($(panelElement)){if($(panelElement).nodeName=="TD"||$(panelElement).className.match(/^tabbing_tab/g)){$(panelElement).className="tabbing_tab_inactive"}else{classNameNew=(tabElementNr==0)?"tabPanelFirst tabPanelColors font-color-disabled background-color-additional-content border-color-design font-weight-default":"tabPanel tabPanelColors font-color-disabled background-color-additional-content border-color-design font-weight-default";
$(panelElement).className=classNameNew}}}else{if($(tabElement)){$(tabElement).style.display="block"}if(eventList!=null){triggerEvent(eventElement[0],eventElement[1])}if($(panelElement)){if($(panelElement).nodeName=="TD"||$(panelElement).className.match(/^tabbing_tab/g)){if(tabElementNr>0){$(panelsList[tabElementNr-1]).className="tabbing_tab_inactive_left"}$(panelElement).className="tabbing_tab_active"}else{classNameNew=(tabElementNr==0)?"tabPanelFirstHi tabPanelHiColor background-color-content font-style-lable border-color-content-default":"tabPanelHi tabPanelHiColor background-color-content font-style-lable border-color-content-default";
$(panelElement).className=classNameNew}}}}}function setTag(tag,ids,timestamp,callback){var tmpObject={};if(ids.length==1){tmpObject.color_label=tag;var servletUrl=activemodule;if(activemodule=="mail_detail"){servletUrl="mail"}var param=AjaxRoot+"/"+servletUrl+"?action=update&session="+session+"&id="+encodeURIComponent(ids[0].id)+"&folder="+encodeURIComponent(ids[0].folder||ids[0].folder_id)+"&timestamp="+timestamp;if(ids[0].recurrence_position&&ids[0].recurrence_position>0){tmpObject.recurrence_position=ids[0].recurrence_position
}(new JSONX).put(param,tmpObject,null,function(cb){timestamp=cb.timestamp;if(callback){callback(timestamp)}},function(){callback()})}else{if(ids.length>1){var multipleObject=[];for(var i=0;i<ids.length;i++){multipleObject[i]={action:"update",module:activemodule,timestamp:timestamp,id:ids[i].id,folder:(ids[i].folder||ids[i].folder_id),data:{color_label:tag}};if(ids[i].recurrence_position&&ids[i].recurrence_position>0){multipleObject[i].recurrence_position=ids[i].recurrence_position}}(new JSONX).put(AjaxRoot+"/multiple?session="+session+"&continue=true",multipleObject,null,function(cb){timestamp=cb.timestamp;
if(callback){callback(timestamp)}},function(){callback()})}}}var session=null;var config;var SplitWidth=3;var tabsList=new Array();var panelsList=new Array();var storageCache=new StorageCache(10);var focusedElement=null;register("Loaded",function(){addDOMEvent(body,"focus",function(e){focusedElement=e.target||e.srcElement})});function setFocus(node){if(node&&node.focus){setTimeout(function(){try{node.focus();focusedElement=node}catch(e){}},0)}}var url={};(function(){if(location.href.indexOf("#")==-1){return
}var qs=location.href.substring(location.href.indexOf("#")+1);var nv=qs.split("&");for(i=0;i<nv.length;i++){eq=nv[i].indexOf("=");url[nv[i].substring(0,eq).toLowerCase()]=decodeURIComponent(nv[i].substring(eq+1))}})();if(url.apilocation){AjaxRoot=url.apilocation}function filterArray(array,predicate,start){var len=array.length;for(var s=start||0;s<len&&predicate(array[s],s);s++){}for(var d=s++;s<len;s++){if(predicate(array[s])){array[d++]=array[s]}}if(d<len){array.length=d}return array}var LeftButton=document.implementation.hasFeature("MouseEvents","2.0")?0:1;
var RightButton=LeftButton+document.implementation.hasFeature("MouseEvents","2.0")?2:1;var flt=(function(){var div=document.createElement("div");div.innerHTML="<div stlye='float:left'></div>";return div.firstChild.style.cssFloat===undefined?"styleFloat":"cssFloat"})();var body;var resizeSplit;var $=function(arg){return document.getElementById(arg)},replace$;function getElement(node){if(!node){return node}while(node&&node.nodeType!=1){node=node.nextSibling}return node}function newnode(tag,style,props,children,doc){if(!doc){doc=document
}var retval=doc.createElement(tag);if(style){for(var i in style){retval.style[i=="flt"?flt:i]=style[i]}}if(props){for(var i in props){retval[i]=props[i]}}if(children){for(var i in children){retval.appendChild(children[i])}}return retval}function newtext(text,doc){if(!doc){doc=document}return doc.createTextNode(text||"")}function newinput(type,style,props,doc){style=style||{};props=props||{};if(IE<9){delete props.type;var parent=(doc||document).createElement("div");parent.innerHTML='<input type="'+type+'" name="'+(props.name||"")+'">';
var retval=parent.firstChild;for(var i in style){retval.style[i=="flt"?flt:i]=style[i]}for(var i in props){retval[i]=props[i]}return retval}else{props.type=type;return newnode("input",style,props,0,doc)}}function newradio(style,props,doc){style=style||{};props=props||{};if(IE<9){delete props.type;var parent=(doc||document).createElement("div");parent.innerHTML='<input type="radio" name="'+(props.name||"")+'">';var retval=parent.firstChild;for(var i in style){retval.style[i=="flt"?flt:i]=style[i]}for(var i in props){retval[i]=props[i]
}return retval}else{props.type="radio";return newnode("input",style,props,0,doc)}}function newcheckbox(style,props,doc){style=style||{};props=props||{};if(IE<9){delete props.type;var parent=(doc||document).createElement("div");parent.innerHTML='<input type="checkbox" name="'+(props.name||"")+'">';var retval=parent.firstChild;for(var i in style){retval.style[i=="flt"?flt:i]=style[i]}for(var i in props){retval[i]=props[i]}return retval}else{props.type="checkbox";return newnode("input",style,props,0,doc)
}}function newfrag(doc){if(!doc){doc=document}return doc.createDocumentFragment()}function newtab(style,props,children,doc){props=props||{};props.border=props.cellSpacing=props.cellPadding="0";return newnode("table",style,props,children,doc)}function animate(duration,end,callback,final_cb){var start=(new Date()).getTime();var f=end/duration;callback(0);var timer=setTimeout(anim,0);function anim(){timer=null;var dt=(new Date()).getTime()-start;if(dt<duration){callback(dt*f);timer=setTimeout(anim,0)
}else{callback(end);if(final_cb){final_cb()}}}return function(disableFinal){if(timer){clearTimeout(timer)}callback(end);if(!disableFinal&&final_cb){final_cb()}}}function nonLinear(power,end){var endPow=Math.pow(end,power-1);return function(x){return end-Math.pow(end-x,power)/endPow}}var benchmark,stopbenchmark;(function(){var times=[];benchmark=function(name){times.push({time:new Date().getTime(),name:name})};stopbenchmark=function(){times.push({time:new Date().getTime()});var s="Benchmark\n";for(var i=1;
i<times.length;i++){s+=i+": "+((times[i].time-times[i-1].time)/1000)+"s ("+times[i-1].name+")\n"}delete times[name];window.console?console.log(s):alert(s);times=[]}})();var resizeHandler;var resizeEvents=new Events();var pxPerEm;var rootebene=this;var evals=new Array();var allnodes={};loadMessage=function(){};function initLoginClick(){jQuery("#inner-login-button").bind("click",function(e){login()});jQuery("#login").bind("submit",function(e){login()});jQuery("#publicMachineDiv, #privateMachineDiv").hide();
jQuery("#show_loginsecurity").toggle(function(){var oldBoxHeight=jQuery("#loginPrompt").height();jQuery("#show_loginsecurity").text(_("Hide description")+"");jQuery("#publicMachineDiv, #privateMachineDiv").slideDown("slow",function(){var deltaBoxHeight=jQuery("#loginPrompt").height()-oldBoxHeight;var pxVal=-120-deltaBoxHeight/2+"px";jQuery("#loginPrompt").animate({"margin-top":pxVal},"slow")})},function(){jQuery("#show_loginsecurity").text(_("Description")+"");jQuery("#publicMachineDiv, #privateMachineDiv").slideUp("slow",function(){jQuery("#loginPrompt").animate({"margin-top":"-120px"},"slow")
})})}var supportForAutoLogin=false;function initAll(login){body=document.getElementsByTagName("body")[0];if(login){var join=new Join(function(){initLoginClick();corewindow.hasFocus=true;if(IE){document.onfocusin=function(e){corewindow.hasFocus=true};document.onfocusout=function(e){corewindow.hasFocus=false}}else{addDOMEvent(window,"focus",function(){corewindow.hasFocus=true});addDOMEvent(window,"blur",function(){corewindow.hasFocus=false})}loadMessage=function(message,status){var str=message?_(message)+" ":"";
jQuery("#loadmessage_text").text(str+status+"%")};if(url.session){window.location.hash=String(window.location.hash).replace(/&?\bsession=[^&]+/,"");(new JSONX()).get(AjaxRoot+"/config/modules?session="+url.session,null,function(result){loadModules({session:url.session,modules:result.data});if(url.store&&url.store=="true"){window.location.hash=String(window.location.hash).replace(/&?\bstore=[^&]+/,"");supportForAutoLogin=true;storeSession()}})}else{(new JSONX()).get(AjaxRoot+"/login?action=autologin&modules=true&client="+encodeURIComponent(oxProductInfo.id||"")+"&version="+encodeURIComponent(oxProductInfo.pversion||""),null,function(result){supportForAutoLogin=true;
loadModules(result)},function(result,status){if(!status&&(result.code=="SVL-0003"||result.code=="SES-0205")){supportForAutoLogin=true}else{supportForAutoLogin=false;jQuery("#rememberme").remove()}if(document.getElementById("loading_data")){document.getElementById("loading_data").style.display="none"}if(document.getElementById("loading_data_complete")){document.getElementById("loading_data_complete").style.display=""}if(document.getElementById("login")){document.getElementById("login").username.focus()
}triggerEvent("LoginPageLoaded");return true})}});var unlock=join.add();if(!url.session){var lang,match;if(url.lang){lang=url.lang}else{match=/(\w+)([-_](\w+))?/.exec(navigator.language||navigator.userLanguage);lang="en_US";Found:if(match){if(match[2]){lang=match[1].toLowerCase()+"_"+match[3].toUpperCase();if(corewindow&&lang in corewindow.all_languages){break Found}lang="en_US"}var lng=match[1].toLowerCase();if(corewindow&&lng in corewindow.all_languages){break Found}lng+="_";var len=lng.length,tmp=ox.util.keys(corewindow.all_languages)||[],i,$i;
if(corewindow.all_languages.en_US){tmp.unshift("en_US")}for(i=0,$i=tmp.length;i<$i;i++){if(tmp[i].substring(0,len)===lng){lang=tmp[i];break Found}}}}setLanguage(lang,join.add())}jQuery.ajax({url:urlify("plugins/static.conf"),success:function(data){var lines=jQuery.trim(data).split(/\n/),i=0,$i=lines.length,line,noI18n;for(;i<$i;i++){if((line=jQuery.trim(lines[i]))){if(line.indexOf("^")===0){line=line.substr(1);noI18n=true}else{noI18n=false}loadModule(line,join,noI18n)}}unlock()},error:function(){unlock()
}})}else{initAll2(login)}}function initAll2(login){if(!login&&"initCallback" in window){initCallback()}body=document.getElementsByTagName("body")[0];function getComputedStyle(node){return window.getComputedStyle?window.getComputedStyle(node,""):node.currentStyle}loadMessage("Rebuild Tree...","60");var nodes=document.getElementsByTagName("*");var nodes_len=nodes.length;for(var i=0;i<nodes_len;i++){var node=nodes[i];var id=node.id;if(id){if(allnodes[id]){alert('Internal Error: ID "'+id+'" used multiple times!');
allnodes[id]="Duplicate ID"}else{allnodes[id]=node}}}$=function(id){return allnodes[id]};replace$=function(node){if(node&&node.id){allnodes[node.id]=node}};if(corewindow!=window){setLanguage(corewindow.url.lang||corewindow.configGetKey("language"))}function cp(o){var retval={};for(var i in o){retval[i]=typeof(o[i])=="object"?cp(o[i]):o[i]}return retval}function copy(o){if(typeof(o)!="object"){return o}return cp(o)}function arraycopy(a){var retval=[];for(var i in a){retval[i]=copy(a[i])}return retval
}function copycontents(from,to){for(var i in to){delete to[i]}for(var i in from){to[i]=from[i]}}function zero(){return{px:0,em:0,ids:{},dep:{}}}function dependency(id){var retval=zero();retval.ids[id]=1;return retval}function parse(id,text,relativeTo){var retval=zero();var regex=/([+-]?[0-9]*(\.[0-9]*)?)(px|em|%)/g;var match;while(match=regex.exec(text)){if(match[3]=="%"){retval=add(retval,scale(relativeTo,Number(match[1])/100))}else{retval[match[3]]+=Number(match[1])}}return retval}function add(a,b){var retval={px:a.px+b.px,em:a.em+b.em,ids:copy(a.ids),dep:copy(a.dep)};
for(var i in b.ids){retval.ids[i]=(retval.ids[i]||0)+b.ids[i]}for(var i in b.dep){retval.dep[i]=(retval.dep[i]||0)+b.dep[i]}return retval}function sub(a,b){var retval={px:a.px-b.px,em:a.em-b.em,ids:copy(a.ids),dep:copy(a.dep)};for(var i in b.ids){retval.ids[i]=(retval.ids[i]||0)-b.ids[i]}for(var i in b.dep){retval.dep[i]=(retval.dep[i]||0)-b.dep[i]}return retval}function scale(a,s){var retval={px:a.px*s,em:a.em*s,ids:{},dep:{}};for(var i in a.ids){retval.ids[i]=a.ids[i]*s}for(var i in a.dep){retval.dep[i]=a.dep[i]*s
}return retval}IE6=false;function initResize(){var sizes={};function compute(coord,ix){var wh=(ix&1)+4;var retval={px:coord.px,em:coord.em};for(var i in coord.dep){retval=add(retval,scale(compute(sizes[i].size[wh],wh),coord.dep[i]))}wh=ix&1?"offsetWidth":"offsetHeight";for(var i in coord.ids){retval.px+=$(i)[wh]*coord.ids[i]}return retval}function getPanelSize(auto,size,panel){if(auto&&panel.align!=auto){alert(format('At id="%s": invalid ox:align="%s" inside ox:align="%s" without ox:size.',panel.id,panel.align,auto))
}var z=zero();var margin=extract(size,panel.margin,"margin");var border=extract(size,panel.border,"border");var padding=extract(size,panel.padding,"padding");var nodesize=adjust_wh(adjust_wh(adjust(size,margin),border),padding);var childsize=[padding[0],padding[1],padding[2],padding[3],nodesize[4],nodesize[5]];sizes[panel.id]={size:nodesize,panel:panel};var ix={top:0,right:1,bottom:2,left:3}[panel.align];var wh=(ix&1)+4;var retval=add(add(margin[wh],border[wh]),padding[wh]);if(panel.align=="stretch"){recursion(auto)
}else{delete nodesize[(ix+2)&3];if(panel.size){update(parse(panel.id,panel.size,size[wh]));recursion(null)}else{if(panel.children.length){update(recursion(panel.align))}else{retval=margin[wh];update(dependency(panel.id));delete nodesize[wh]}}}return retval;function extract(size,border,type){var retval=[z,z,z,z,z,z];if(!border){return retval}var deltas=border.split(" ");if(deltas.length!=4){alert(format('At id="%s": invalid ox:%s="%s"',panel.id,type,border))}for(var i=0,wh=4;i<4;i++,wh^=1){retval[wh]=add(retval[wh],retval[i]=parse(panel.id,deltas[i],size[wh]))
}return retval}function adjust(size,deltas){if(!deltas){return arraycopy(size)}var retval=[,,,,sub(size[4],deltas[4]),sub(size[5],deltas[5])];for(var i=0;i<4;i++){retval[i]=add(size[i],deltas[i])}return retval}function adjust_wh(size,deltas){var retval=arraycopy(size);if(deltas){retval[4]=sub(retval[4],deltas[4]);retval[5]=sub(retval[5],deltas[5])}return retval}function recursion(auto){var retval=zero();for(var i=0;i<panel.children.length;i++){var child=panel.children[i];if(child){retval=add(retval,getPanelSize(auto,childsize,child))
}}return retval}function update(psize){childsize[wh]=nodesize[wh]=copy(psize);if(panel.resize){(psize=zero()).dep[panel.id]=1;childsize[wh]=psize}retval=add(retval,psize);size[ix]=add(size[ix],retval);size[wh]=sub(size[wh],retval)}}var size=[zero(),zero(),zero(),zero(),dependency("body"),dependency("body")];for(var i=0;i<init.size.length;i++){var child=init.size[i];if(child){getPanelSize(null,size,child)}}var del1=IE6?2:4;var check1=IE6?4:2;var del2=IE6?1:5;var check2=IE6?5:1;for(var i in sizes){var size=sizes[i].size;
if(size[0]&&size[check1]){delete size[del1]}if(size[3]&&size[check2]){delete size[del2]}}var deps={};for(var i in sizes){var size=sizes[i].size;var dep=deps[i]={};for(var j=0;j<6;j++){if(size[j]){for(var id in size[j].ids){dep[id]=true}}}}for(var j in deps){delete deps[j].body}var size_panels=[];do{var level={};var hasNodes=false;for(var i in deps){var dep=deps[i];var independent=true;for(var j in dep){independent=false;break}if(independent){copycontents(sizes[i].size,level[i]=[])}hasNodes|=independent
}if(!hasNodes){break}size_panels.push(level);for(var i in level){delete deps[i]}for(var i in level){for(var j in deps){delete deps[j][i]}}}while(true);var s=["Circular dependencies detected:"];for(var i in deps){var d=[];for(var j in deps[i]){d.push(j)}s.push(format('"%s" depends on "%s"',i,d.join('", "')))}if(s.length>1){alert(s.join("\n"))}var sdeps={};for(var i in sizes){var size=sizes[i].size;for(var j=0;j<6;j++){if(!size[j]){continue}for(var k in size[j].dep){var sd=sdeps[k];if(!sd){sd=sdeps[k]={}
}sd[i]=true}}}var computed={};for(var i in sdeps){if(!computed[i]){transClosure(i)}}function transClosure(i){computed[i]=true;var list=sdeps[i];var newentries={};for(var j in list){if(!computed[j]){transClosure(j)}for(var k in sdeps[j]){newentries[k]=true}}for(var j in newentries){list[j]=true}}var resize_panels={};var len=size_panels.length;for(var i in sdeps){var panels=resize_panels[i]=new Array(len);for(var j=0;j<len;j++){panels[j]={}}panels[0][i]=sizes[i].size;for(var j in sdeps[i]){for(var k=0;
k<len;k++){if(j in size_panels[k]){copycontents(size_panels[k][j],panels[k][j]=[]);break}}}}loadMessage("Static resizing...","70");var pxFields=["top","right","bottom","left","height","width"];var emFields=["marginTop","marginRight","marginBottom","marginLeft"];for(var i in size_panels){var panels=size_panels[i];for(var j in panels){var panel=panels[j];var style=$(j).style;style.position="absolute";for(var k in panel){var stat=true;for(var l in panel[k].ids){stat=false;break}var size=compute(panel[k],k);
if(stat&&(emFields[k]||!size.px||!size.em)){if(size.px){style[pxFields[k]]=size.px+"px";if(emFields[k]){style[emFields[k]]=(size.em||0)+"em"}}else{style[pxFields[k]]=(size.em||0)+"em";if(emFields[k]){style[emFields[k]]=0}}delete panel[k]}}}}loadMessage("Dynamic resizing...","80");for(var i in size_panels){var panels=size_panels[i];Panels:for(var j in panels){var panel=panels[j];for(var k in panel){continue Panels}delete panels[j]}}function resizeChanges(changes,style,size,ix){var value=Math.max(0,size.px+size.em*pxPerEm)+"px";
var field=pxFields[ix];if(style[field]!=value){changes.push({style:style,field:field,value:value})}}function resizeSplitChanges(changes,style,size,ix){function change(field,value){if(style[field]!=value){changes.push({style:style,field:field,value:value})}}if(emFields[ix]||!size.em){change(pxFields[ix],size.px+"px");if(emFields[ix]){change(emFields[ix],size.em+"em")}}else{if(size.px){resizeChanges(changes,style,size,ix)}else{change(pxFields[ix],size.em+"em")}}}function resize(panel_lists,n,changesF,pending){var panels=panel_lists[n];
var changes=[];for(var i in panels){var node=$(i);var hidden=(node.style.display=="none");while(!hidden&&node.parentNode){hidden=node.style&&node.style.display=="none";node=node.parentNode}if(hidden){continue}var panel=panels[i];var style=$(i).style;for(var j in panel){if(!panel[j]){eval("debugger")}changesF(changes,style,compute(panel[j],j),j)}}if(changes.length){for(var j in changes){var change=changes[j];change.style[change.field]=change.value}}if(++n<panel_lists.length){pending.timeout=setTimeout(function(){resize(panel_lists,n,changesF,pending)
},0)}else{delete pending.timeout;resizeEvents.post("Resized")}}var resizeSplitPending={};resizeSplit=function(id,size){if(!sizes[id]){alert(format('Invalid resizeSplit() call with id="%s"',id))}var panel=sizes[id].panel;var ix={top:0,right:1,bottom:2,left:3}[panel.align];var wh=(ix&1)+4;copycontents(parse(id,size),sizes[id].size[wh]);if("timeout" in resizeSplitPending){clearTimeout(resizeSplitPending.timeout)}pxPerEm=scalediv.offsetHeight/1000;resize(resize_panels[id],0,resizeSplitChanges,resizeSplitPending)
};var scalediv=newnode("div",{position:"absolute",visibility:"hidden",width:0,height:"1000em"});body.appendChild(scalediv);var resizePending={};resizeHandler=function(){if("timeout" in resizePending){clearTimeout(resizePending.timeout)}pxPerEm=scalediv.offsetHeight/1000;if(IE6){resizePending.timeout=setTimeout(function(){resize(size_panels,0,resizeSplitChanges,resizePending)},0)}else{resize(size_panels,0,resizeSplitChanges,resizePending)}};window.onresize=resizeHandler;function final_resize(){resizeEvents.unregister("Resized",final_resize);
loadMessage("Initialization ...","90");triggerEvent("Preload");triggerEvent("Loaded");if(login){resizeReady()}else{if($("loading_data")){$("loading_data").style.display="none"}if($("loading_data_complete")){$("loading_data_complete").style.display="block"}}triggerEvent("OX_menu_Change_Height",true)}resizeEvents.register("Resized",final_resize);resizeHandler()}if(!window.console){var appended=false;var caption=newnode("div",{color:"white",backgroundColor:"#576586"},0,[document.createTextNode("Debug Log"),newnode("span",{flt:"right"},{onclick:function(){while(caption.nextSibling){logger.removeChild(caption.nextSibling)
}body.removeChild(logger);appended=false}},[newnode("img",0,{src:getFullImgSrc("img/x.png")})])]);var logger=newnode("div",{zIndex:9999,position:"absolute",width:"40em",height:"20em",overflow:"auto",right:0,bottom:0,border:"2px dashed red",backgroundColor:"white"},0,[caption]);window.console={log:function(text,params){if(!appended){body.appendChild(logger);appended=true}var lines=format.apply(null,arguments).split("\n");for(var i=0;i<lines.length;i++){logger.appendChild(newnode("div",0,0,[document.createTextNode(lines[i])]))
}}};window.console.warn=window.console.error=window.console.debug=window.console.log}function makeSplitCallback(split,align,live){var parent=split.parentNode;var previous=split.previousSibling;while(previous.nodeType!=1){previous=previous.previousSibling}return function(e){function getPixels(value){if(!value){return value}var match=/^([0-9.]+)(em|px)$/.exec(value);if(!match){alert(format('Invalid ox:min or ox:max at id="%1".',split.id))}var num=parseFloat(match[1]);switch(match[2]){case"px":return num;
case"em":return pxPerEm*num}}var min=getPixels(init.min[previous.id])||0;var max=getPixels(init.max[previous.id])||Infinity;var displayOffset;var sizeF={left:function(){displayOffset=previous.offsetLeft;var offset=previous.offsetWidth-e.clientX;var max2=Math.min(max,parent.clientWidth-split.offsetWidth);return function(x,y){return Math.min(max2,Math.max(min,offset+x))}},right:function(){displayOffset=previous.offsetLeft+previous.offsetWidth-parent.offsetWidth;var offset=previous.offsetWidth+e.clientX;
var max2=Math.min(max,parent.clientWidth-split.offsetWidth);return function(x,y){return Math.min(max2,Math.max(min,offset-x))}},top:function(){displayOffset=previous.offsetTop;var offset=previous.offsetHeight-e.clientY;var max2=Math.min(max,parent.clientHeight-split.offsetHeight);return function(x,y){return Math.min(max2,Math.max(min,offset+y))}},bottom:function(){displayOffset=previous.offsetTop+previous.offsetHeight-parent.offsetHeight;var offset=previous.offsetHeight+e.clientY;var max2=Math.min(max,parent.clientHeight-split.offsetHeight);
return function(x,y){return Math.min(max2,Math.max(min,offset-y))}}}[align]();var size=sizeF(e.clientX,e.clientY);function m(e){stopEvent(e);size=sizeF(e.clientX,e.clientY);if(live){var s=function(){return size};resizeSplit(previous.id,size+"px");resizeEvents.post("SplitResized",s,parent)}else{movingSplit.style[align]=(displayOffset+size)+"px"}}function u(){showIFrames();removeDOMEvent(body,"mousemove",m);removeDOMEvent(body,"mouseup",u);parent.style.cursor="";if(!live){split.parentNode.removeChild(movingSplit);
movingSplit=null;var s=function(){return size};resizeSplit(previous.id,size+"px");resizeEvents.post("SplitResized",s,parent)}}hideIFrames();parent.style.cursor=split.style.cursor;addDOMEvent(body,"mousemove",m);addDOMEvent(body,"mouseup",u);if(!live){var movingSplit=split.cloneNode(true);movingSplit.style[{top:"marginTop",right:"marginRight",bottom:"marginBottom",left:"marginLeft"}[align]]=0;movingSplit.style[align]=(displayOffset+size)+"px";movingSplit.style.zIndex=20;movingSplit.className=movingSplit.className+" moving";
split.parentNode.appendChild(movingSplit)}cancelDefault(e)}}for(var i in init.split){var split=$(i);addDOMEvent(split,"mousedown",makeSplitCallback(split,init.split[i],true))}var scalediv2=newnode("div",{position:"absolute",visibility:"hidden",width:0,top:0,bottom:0});body.appendChild(scalediv2);setTimeout(function(){IE6=scalediv2.offsetHeight<body.clientHeight;if(IE6){for(var i in init.IE6workaround){var workaround=init.IE6workaround[i];var dir=workaround.dir;var node=$(i);for(dir=dir&(dir-1);dir;
dir=dir&(dir-1)){node=getElement(node.firstChild);node.style.padding=workaround.padding}}try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}body.removeChild(scalediv2);scalediv2=null;initResize()},0);var loggingOut=false;if(login){JSONX.errorHandler=function(result,status){if(status){triggerEvent("OX_New_Error",2,format(_("Error: %1$s - %2$s"),status,result))}else{if(result){if(result.code&&result.code.match(/^SES-02..$/)){if(!loggingOut){loggingOut=true;window.onbeforeunload=null;
newAlert(_("Session has expired"),_("Your session has expired. Please log in again."),function(){triggerEvent("OX_Session_Expired");window.onbeforeunload=null;setTimeout(function(){window.location.replace(sessionExpired_location.format())},0)})}}else{newServerError(result,4)}}else{newServerError("Unknown error: The server response is invalid or empty! Please try again. If it still not work please reload the application or contact your support!",4,window.opener)}}}}}function unloadMessageMainLogin(e){}var hideIFrames,showIFrames;
(function(){var count=0;hideIFrames=function(){if(count++){return}for(var i in init.hide){var div=$(i+"-hide").style;var iframe=$(i);div.width=iframe.offsetWidth+"px";div.height=iframe.offsetHeight+"px";div.display="block"}};showIFrames=function(){if(--count){return}for(var i in init.hide){$(i+"-hide").style.display="none"}}})();function separateFilenameFromPath(sValue){var aTMP=sValue.split("/");if(aTMP.length==1){aTMP2=sValue.split("\\");return aTMP2[(aTMP2.length-1)]}return aTMP[(aTMP.length-1)]
}function removeClass(sClassName,sClassToDel){var sDeseletedClassName="";if(!sClassName||sClassName.length==0){return sDeseletedClassName}var aSplited=sClassName.split(" ");for(var nInd=0;nInd<aSplited.length;nInd++){if(aSplited[nInd].length>0&&aSplited[nInd]!=sClassToDel){sDeseletedClassName+=" "+aSplited[nInd]}}return sDeseletedClassName}function removeChildNodes(node){if(!node){return}var nodes=node.childNodes;if(nodes){while(nodes.length>0){node.removeChild(nodes[0])}}}function bytesToString(bytes,digits){var units=["bytes","KB","MB","GB","TB","PB","EB","ZB","YB"];
digits=Math.pow(10,digits===undefined?2:digits);for(var i=0;i<units.length;i++){if(bytes<1000){return format(pgettext("bytes","%1$s %2$s"),formatNumbers(Math.round(bytes*digits)/digits),_(units[i]))}bytes/=1024}}function clone(element,sourceWindow){if(typeof(element)!="object"){return element}var array=sourceWindow?sourceWindow.Array:Array;return subclone(element);function subclone(element){if(!element){return null}var retval=element instanceof array?[]:{};for(var i in element){retval[i]=typeof element[i]=="object"?subclone(element[i]):element[i]
}return retval}}function trimStr(withBlanks){return String(withBlanks||"").replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1")}function isIDNEmail(mail){var regexmail=/^([+%a-zA-Z0-9_-]|\\[!#$%&'*+=?^_{|}~])+(\.([+%a-zA-Z0-9_-]|\\[!#$%&'*+=?^_{|}~])+)*@.(.{0,61}.)?(\..(.{0,61}.)?)*\.[a-zA-Z]{2,6}$/;return regexmail.test(mail)}function validateEmail(mail){var regexmail=/^([+%a-zA-Z0-9_-]|\\[!#$%&'*+=?^_{|}~])+(\.([+%a-zA-Z0-9_-]|\\[!#$%&'*+=?^_{|}~])+)*@[a-zA-Z0-9_-]([a-zA-Z0-9_-]{0,61}[a-zA-Z0-9_-])?(\.[a-zA-Z0-9_-]([a-zA-Z0-9_-]{0,61}[a-zA-Z0-9_-])?)*\.[a-zA-Z]{2,6}$/;
return regexmail.test(mail)}var defaultviews=new Object();function addDefaultView(myview,viewname){if(!defaultviews){defaultviews=new Object()}defaultviews[myview]=viewname}function removeDefaultView(myview){if(!defaultviews){defaultviews=new Object()}delete defaultviews[myview]}function getDefaultViewName(myview){if(defaultviews){if(defaultviews[myview]){return defaultviews[myview]}}return null}function getDefaultSubviews(myview){var myret=new Object();for(i in defaultviews){var splitview=i.split("/");
var searchview=myview.split("/");for(i2=0;i2<searchview.length;i2++){if(!splitview[i2]){break}if(splitview[i2]!=searchview[i2]){break}if(searchview.length==(i2+1)){myret[i]=defaultviews[i]}}}return myret}function isDefaultableView(key){if(defaultviews){if(defaultviews[key]){return true}}return false}function revertUrlEncodedString(str){var sEncStr=decodeURIComponent(str);return sEncStr}function getUrlEncodedString(str){return encodeURIComponent(str)}function extendConfObj(obj){obj["language{0}"]=configGetKey("language").split("_")[0];
obj["language{1}"]=(configGetKey("language").split("_")[1]).toLowerCase();obj.protocol=location.protocol.match(/^(.*):/)[1];obj.hostname=location.host;obj.path=location.pathname.match(/(.*\/)(.*)/)[1];obj.file=location.pathname.match(/(.*\/)(.*)/)[2];obj.session=session;obj.loginname=$("username").value||"";return obj}var _strFormatRegexp=new RegExp("\\[([^\\]]+)\\]","g");String.prototype.format=function(obj){obj=extendConfObj(obj||{});function repl(_,val){return obj[val]||configGetKey(val)||val}return this.replace(_strFormatRegexp,repl)
};function redirect2Help(param){window.open(param.format()||help_location.format(),"oxhelp")}register("OX_Show_Help",redirect2Help);register("OX_Show_About",function(){var language=ox.api.config.get("language");$("about_product_name").firstChild.data=oxProductInfo.product_name;$("about_gui_version").firstChild.data=oxProductInfo.pversion;var description=ox.api.config.get("ui.product.description")||ox.api.config.get("ui.product.description-"+language);if(description){$("about_description").innerHTML=description.format().replace(/\n/gi,"<br/>");
$("about_description").style.display="block"}var address=oxProductInfo.vendor_address||"";$("about_vendor_address").innerHTML=address.format().replace(/\n/gi,"<br/>");$("about_server_version").firstChild.data=configGetKey("serverVersion")||_("Unknown");AboutPopup.openWindow()});register("Loaded",function(){var menu=globalContextMenus.mailAddress=new ContextMenu();menu.addItem((new MenuItem(_("Add to address book"),function(){createNewContactfromMail(this.getContext())})).setIcon("img/folder/newfolder.gif","img/folder/newfolder_d.gif"))
});var HelpMenu={addText:function(text,callback){globalContextMenus.help.addItem(new MenuItem(text,callback))}};function setContentHeader(fields){function setHeaderContent(data){if(data.created_by){internalCache.getUsers([data.created_by],function(cbObj){if(data.type==1||data.type==3){for(var i=0;i<fields.length;i++){$(fields[i]).firstChild.data=format(_("%1$s of %2$s"),data.title,cbObj[data.created_by].display_name)}}else{if(data.type==2){for(var i=0;i<fields.length;i++){$(fields[i]).firstChild.data=format(_("Public folder %s"),data.title)
}}else{for(var i=0;i<fields.length;i++){$(fields[i]).firstChild.data=format(_("Public folder %s"),data.title)}}}})}}ox.api.folder.get({folder:activefolder,success:setHeaderContent})}function getAdressStringLinked(node,addresses,personal){for(a=0;a<addresses.length;a++){var pAddr=addresses[a][0];var mAddr=addresses[a][1]||"";if(pAddr!=null&&(pAddr.split('"').length<=2&&pAddr.split("'").length<=2)){pAddr='"'+pAddr+'"'}var personalToShow=pAddr;if(personal&&personalToShow){personalToShow=personalToShow.replace(/(^"|^'|'$|"$)/g,"")
}var vMailAddr=personal&&personalToShow?personalToShow:personalToShow?personalToShow+" <"+mAddr+">":mAddr;var rMailAddr=pAddr?pAddr+" <"+mAddr+">":mAddr;var oDOMDiv=newnode("span",0,{className:"linkInView",title:personal?mAddr:""},[document.createTextNode(vMailAddr+(addresses.length-1>a?"; ":""))]);addDOMEvent(oDOMDiv,"click",(function(oDOMDiv,rMailAddr){return function(e){cancelDefault(e);corewindow.sendMailToRecipientMail(rMailAddr)}})(oDOMDiv,rMailAddr));var o={};o.email1=mAddr;o.last_name=pAddr||"";
o.last_name=o.last_name.replace(/"|'/g,"");var m=o.last_name.match(/(([^,]*),\s*(.+))|((\S*)\s+(.+))/);if(m){o.last_name=m[2]||m[6];o.first_name=m[3]||m[5]}addDOMEvent(oDOMDiv,"contextmenu",(function(o){return function(e){globalContextMenus.mailAddress.display(e.clientX,e.clientY,o)}})(o));try{if("registerSource" in window&&registerSource){registerSource(oDOMDiv,"mailaddress",(function(o){return function(){return o}})(o),null,null,mailaddressdefaultdisabled,defaultdisabledremove)}}catch(e){}node.appendChild(oDOMDiv)
}return node}function writeBottomString(oObj,sDomIdContainer){var nIdCreatedBy=oObj.created_by;var nIdModifiedBy=(oObj.modified_by==undefined)?oObj.created_by:oObj.modified_by;var creation_date=formatDate(oObj.creation_date,"datetime");var last_modified=formatDate(oObj.last_modified,"datetime");internalCache.getUsers([nIdCreatedBy],function(arg){var created_by=arg[nIdCreatedBy].display_name;internalCache.getUsers([nIdModifiedBy],function(arg){var modified_by=arg[nIdModifiedBy].display_name;removeChildNodes($(sDomIdContainer));
$(sDomIdContainer).appendChild(addTranslated(format(_("Created on %1$s by %2$s, last changed on %3$s by %4$s"),creation_date,created_by,last_modified,modified_by)))})})}function getFrameElement(id){return $ALL(id).contentWindow}var $2,$ALL,removeTMPId,addTMPId;var tmp_nodes;(function(){tmp_nodes=new Object();addTMPId=function(node){tmp_nodes[node.id]=new Object();tmp_nodes[node.id]["node"]=node};removeTMPId=function(id){if(id.id){id=id.id}delete tmp_nodes[id]};$2=function(id){return(tmp_nodes[id])?tmp_nodes[id].node:undefined
};$ALL=function(id){return $(id)||$2(id)||document.getElementById(id)}})();function getAbsolutePositionLeft(node){var xPos=node.offsetLeft;var oParent=node.offsetParent;while(oParent!=null){xPos+=oParent.offsetLeft-(oParent.scrollLeft||0);oParent=oParent.offsetParent}return xPos}function getAbsolutePositionTop(node){var yPos=node.offsetTop;var oParent=node.offsetParent;while(oParent!=null){yPos+=oParent.offsetTop-(oParent.scrollTop||0);oParent=oParent.offsetParent}return yPos}function getAbsolutePosition(node){for(var x=0,y=0;
node;node=node.offsetParent){x+=node.offsetLeft;y+=node.offsetTop}return{x:x,y:y}}function checkModified(oldObject,newObject){for(var i in newObject){if(!(i in oldObject)){continue}var newItem=newObject[i];var oldItem=oldObject[i];if(newItem==oldItem){delete newObject[i]}else{if(newItem&&typeof newItem=="object"){if(newItem instanceof Array){Compare:if(newItem.length==oldItem.length){for(var j=0;j<newItem.length;j++){if(newItem[j]!=oldItem[j]){break Compare}}delete newObject[i]}}else{if(oldItem){checkModified(oldItem,newItem)
}if(isEmpty(newItem)){delete newObject[i]}}}}}}function loadFileForCacheOnInit(file){(new JSONX).get(file,null,emptyFunction,null,true)}register("LoginPageLoaded",function(){setTimeout(function(){preloadMailNewImages()},10)});function preloadMailNewImages(){loadFileForCacheOnInit(urlify("3rdparty/tinymce/jscripts/tiny_mce/themes/advanced/img/icons.gif"))}function getDirectLinkLocal(oObj){if(!oObj){return}oObj.folder=oObj.folder||oObj.folder_id;if(oObj.id){oObj.object_id=oObj.id}oObj.module=oObj.module||"infostore";
return directLink_location.format(oObj)}function getMimeImage(sMimeType){if(sMimeType.indexOf(";")!=-1){sMimeType=sMimeType.substring(0,sMimeType.indexOf(";"))}var oImageMap={"image/gif":"image.png","image/jpeg":"image.png","image/pjpeg":"image.png","image/png":"image.png","image/tiff":"image.png","image/x-ms-bmp":"image.png","application/pdf":"pdf.png","text/plain":"txt.png","text/richtext":"txt.png","text/rtf":"txt.png","application/rtf":"txt.png","text/ical":"ical.gif","text/x-ical":"ical.gif","text/calendar":"ical.gif","text/x-calendar":"ical.gif","text/vcard":"vcard.gif","text/x-vcard":"vcard.gif","application/zip":"tgz.png","application/x-gzip":"tgz.png","application/x-tar":"tar.png","application/java-archive":"java_jar.png","application/octet-stream":"binary.png","application/postscript":"postscript.png","text/x-log":"log.png","video/x-ms-wmv":"video.png","video/ogg":"video.png","video/mpeg":"video.png","video/mp4":"video.png","video/quicktime":"video.png","video/x-flv":"video.png","video/x-ms-asf":"video.png","video/x-sgi-movie":"video.png","application/vnd.ms-excel":"ooo_writer.png","application/vnd.oasis.opendocument.text":"ooo_writer.png","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"ooo_writer.png","application/vnd.oasis.opendocument.spreadsheet":"ooo_calc.png","application/vnd.ms-excel":"ooo_calc.png","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"ooo_calc.png","application/vnd.ms-powerpoint":"ooo_draw.png","application/vnd.oasis.opendocument.graphics":"ooo_draw.png","application/vnd.openxmlformats-officedocument.presentationml.presentation":"ooo_draw.png"};
return(oImageMap[sMimeType]==undefined)?getFullImgSrc("img/infostore/mimetypes/empty.png"):getFullImgSrc("img/infostore/mimetypes/"+oImageMap[sMimeType])}var json=new JSONX();function fade(node,start,end,duration,cb){if(configGetKey("gui.effects.fading")){return animate(duration,Math.abs(start-end),function(val){var tmpvalue=start;if(start>end){tmpvalue=tmpvalue-val}else{tmpvalue=tmpvalue+val}fade_setOpacity(node,tmpvalue,true)},cb)}else{fade_setOpacity(node,end,false);if(cb){cb()}return emptyFunction
}}function fade_setOpacity(node,opacity,fading){if(opacity<100||fading){node.style.filter="alpha(style=0,opacity:"+opacity+")";node.style.opacity=(opacity/100)}else{node.style.filter="";node.style.opacity=""}if(opacity==0){node.style.display="none";return}if(node.style.display=="none"||node.style.display=="NONE"){if(node.tagName=="DIV"){node.style.display="block"}else{node.style.display=""}}}var windowWidth=800;var windowHeight=660;function getWindowOptions(width,height,optional){var x=(screen.width-(width||windowWidth))/2;
var y=(screen.height-(height||windowHeight))/2-(25);return"width="+(width||windowWidth)+"px,height="+(height||windowHeight)+"px,resizable=yes,menubar=no,toolbar=no,status=no,left="+x+",top="+y+",screenX="+x+",screenY="+y+(optional?", "+optional:"")}function equals(a,b){if(a===b){return true}if(!(a instanceof Object)||!(b instanceof Object)){return a==b}for(var child in a){if(!equals(a[child],b[child])){return false}}for(var child in b){if(!(child in a)){return false}}return true}function getDefaultCalendarView(){var defaults=configGetKey("gui.calendar.views");
return"calendar/"+defaults.view+"/"+defaults[defaults.view]}function removeFolder(id){var currentFolder=ox.UIController.getFolder();var currentModule=ox.UIController.getModule();var module;var remove=function(){ox.api.folder.remove({id:id,success:function(){if(module==="mail"){var collections=OXMailMapping.getSubCollections({criteria:{folder_id:id}},true);for(var i in collections){collections[i].check=true}ox.api.folder.getSubFolders({folder:ox.api.config.get("modules.mail.defaultFolder.trash"),cache:false,success:function(){ox.api.folder.dispatcher.trigger("remove modify *")
}})}}})};function yes(){ox.api.folder.get({folder:id,success:gotFolder})}function gotFolder(data){module=data.module;if(id===currentFolder){ox.api.folder.getParents({folder:id,success:function(path){if(path.length<2||!ox.api.ui.isModule(path[1].module)){ox.UIController.setModule({module:currentModule,folder:"default",success:remove})}else{ox.UIController.setFolder({folder:path[1].id,module:"default",success:remove})}}})}else{remove()}}newConfirm(_("Delete Folder"),_("Are you sure you want to delete the selected folder?"),AlertPopup.YESNO,null,null,yes,null)
}var track=function(options){triggerEvent("User_Action",options)};function requireOAuth(){requireOAuth.required=true}function Selection2(){this.count=0;this.data=new LRUKeyList();this.anchor=0;this.events=new Events();var Self=this;this.collection;this.selectedIndex=0}Selection2.prototype={get:function(index){if(!this.collection){console.error("Selection.get without collection")}var key=this.collection.objects[index];if(!key){return false}return this.data.get(key)!=null},get2:function(index){if(!this.collection){console.error("Selection.get2 without collection")
}var key=collection.objects[index];if(!key){return false}return this.data.get(key)!=null},toggle:function(index){if(!this.collection){console.error("Selection.toggle without collection")}var key=this.collection.objects[index];var oldValue=this.data.get(key);(oldValue)?this.data.remove(key):this.data.set(key,true);this.count+=oldValue?-1:1;this.events.post("Selected",this.count);return !(oldValue!=null)},deselectSIDs:function(keys){for(var i in keys){var oldValue=this.data.get(keys[i]);this.count-=(oldValue)?1:0;
this.data.remove(keys[i])}this.events.post("Selected",this.count)},selectIDs:function(keys){this.reset();for(var i in keys){this.data.set(keys[i],true)}this.count=keys.length;this.events.post("Selected",this.count)},reset:function(){this.data=new LRUKeyList();this.count=0;this.events.post("Selected",this.count)},select:function(from,to){if(!this.collection){console.error("Selection.select without collection")}for(var i=from;i<to;i++){var key=this.collection.objects[i];var oldValue=this.data.get(key);
if(!(oldValue)){this.count++;this.data.set(key,true)}}this.events.post("Selected",this.count)},getSelected:function(){var myArray=new Array();var tmpKeys=this.data.keys();if(!this.collection){return tmpKeys}for(var i=0;i<tmpKeys.length;i++){myArray.push(this.collection.objects[this.collection.map_objects.get(tmpKeys[i])-1]||tmpKeys[i])}return myArray},click:function(index,e){if(!this.collection){console.error("Selection.click without collection")}if(index<0||index>=this.collection.objects.length){this.reset();
return}if(!e||!(Mac?e.metaKey:e.ctrlKey)){this.reset()}if(e&&e.shiftKey){this.select(Math.min(this.anchor,index),Math.max(this.anchor,index)+1)}else{this.toggle(index);this.anchor=index}},setCollection:function(collection,selectedIndex){var oldcount=this.count;if(collection){var keys=this.data.keys();for(var id in keys){if(!(collection.map_objects.get(keys[id]))){this.data.remove(keys[id]);this.count--}}}this.collection=collection;var retval=!this.count;if(collection){if(!this.count&&selectedIndex!=undefined){this.click(selectedIndex)
}else{if(this.count!=oldcount){this.events.post("Selected",this.count)}}}return retval},getID:function(){return this.data.get(this.data.keys()[0])}};var OX_UI_Visible=true;function centerPopupWindow(popupwindow,width,height){var $=jQuery,display,content,w=width,h=height;if(OX_UI_Visible===false){var fn=function(){unregister("OX_Visible",fn);OX_UI_Visible=true;setTimeout(function(){centerPopupWindow(popupwindow,width,height)},0)};register("OX_Visible",fn)}else{function center(){var availWidth=jQuery(window).width();
var availHeight=jQuery(window).height();$(popupwindow).css({left:Math.floor((availWidth-w)/2)+"px",top:Math.floor((availHeight-h)/2)+"px"})}display=$(popupwindow).css("display");$(popupwindow).css({visibility:"hidden",display:"block"});content=$(".popup_center_area",popupwindow);if(w===undefined){w=content.children().width()}if(h===undefined){h=0;content.children().each(function(index){h=h+$(this).height()})}if(w>0&&(h+0)>0){$(popupwindow).css({width:w+"px",height:h+0+"px"})}center();if(display==="none"){$(popupwindow).hide()
}else{$(popupwindow).css("display","block")}$(popupwindow).css("visibility","visible")}}register("Loaded",function(){jQuery("#body").bind("contextmenu",function(e){var elem=e.target||e.srcElement;switch(elem.nodeName.toLowerCase()){case"textarea":case"input":case"a":break;default:if(!elem.className||elem.className.match(/enablectxmenu/g)===null){e.stopPropagation();return false}}return true});for(var i in init.movable){var node=$(init.movable[i]);var parent=$(node.id.substring(0,node.id.length-2));
(function(node,parent){addDOMEvent(node,"mousedown",function(e){if(e.button!=LeftButton){return}moving=parent;offsetX=parent.offsetLeft-e.clientX;offsetY=parent.offsetTop-e.clientY;parent.style.cursor="move";function moveHandler(e){var topposition=(e.clientY+offsetY);var leftposition=(e.clientX+offsetX);if(topposition<0){topposition=0}else{if(topposition+parent.offsetHeight>$("body").offsetHeight){topposition=$("body").offsetHeight-parent.offsetHeight}}if(leftposition<0){leftposition=0}else{if(leftposition+parent.offsetWidth>$("body").offsetWidth){leftposition=$("body").offsetWidth-parent.offsetWidth
}}if(moving){moving.style.left=leftposition+"px";moving.style.top=topposition+"px"}stopEvent(e)}function upHandler(e){if(moving&&e.button==LeftButton){moving=null;parent.style.cursor="auto";removeDOMEvent(body,"mousemove",moveHandler);removeDOMEvent(body,"mouseup",upHandler);stopEvent(e)}}addDOMEvent(body,"mousemove",moveHandler);addDOMEvent(body,"mouseup",upHandler);cancelDefault(e)});addDOMEvent(node.firstChild,"click",function(){parent.style.display="none"})})(node,parent)}});function addOnClose(popupwindow,onclose){addDOMEvent(popupwindow.getElementsByTagName("img")[1],"click",onclose)
}function removeOnClose(popupwindow,onclose){removeDOMEvent(getElement(popupwindow.firstChild).firstChild,"click",onclose)}function Popup(node){this.node=node;this.zIndex=1;body.appendChild(this.node)}Popup.stopAnimation=null;Popup.prototype={show:function(){if(this.isVisible){return}this.isVisible=true;if(Popup.stopAnimation){Popup.stopAnimation()}var style=this.node.style;if(configGetKey("gui.effects.fading")){Popup.stopAnimation=animate(300,1,function(value){style.opacity=value;style.filter="alpha(opacity="+value*100+")"
},function(){style.opacity="";style.filter="";Popup.stopAnimation=null})}style.zIndex=this.zIndex||1;style.display="block";hideIFrames()},hide:function(){if(!this.isVisible){return}this.isVisible=false;if(Popup.stopAnimation){Popup.stopAnimation()}this.node.style.display="none";showIFrames()},isVisible:false,position:function(x,y,w,h){var $=jQuery,node=$(this.node);var width=node.outerWidth(),height=node.outerHeight();if(x+width>$(document.body).width()){x=x+(w||0)-width}if(x<0){x=0}if(y+height>$(document.body).height()){y=y+(h||0)-height
}if(y<0){y=0}node.css({left:x+"px",top:y+"px"})}};function MousePopup(node){Popup.call(this,node);var Self=this;if(document.addEventListener){this.clickHandler=function(e){if(Self.captureEvents(e.target)){stopEvent(e)}}}else{var recursion={};this.clickHandler=function(e){if(recursion[e.type]){return}if(!Self.captureEvents(e.srcElement)){Self.mouseHandler(e)}};this.mouseHandler=function(e){if(recursion[e.type]){return}recursion[e.type]=true;if(MousePopup.active){body.onlosecapture=null;body.releaseCapture()
}switch(e.type){case"click":e.srcElement.click();break;default:e.srcElement.fireEvent("on"+e.type)}if(MousePopup.active){body.onlosecapture=MousePopup.hideActive;body.setCapture()}recursion[e.type]=false}}}MousePopup.active=0;MousePopup.prototype=extend(Popup,{show:function(){Popup.prototype.show.call(this);if(!MousePopup.active&&"Hover" in window&&Hover.current){Hover.current.hide()}this.registerHide();MousePopup.active++},hide:function(){if(this.isVisible){Popup.prototype.hide.call(this);MousePopup.active--;
this.unregisterHide()}},captureEvents:function(t){while(t&&!t.oxPopupMenu){t=t.parentNode}if(!t){this.hide()}return false}});if(document.addEventListener){MousePopup.prototype.registerHide=function(){jQuery("html").bind("click",this.clickHandler);body.parentNode.addEventListener("mousedown",this.clickHandler,true)};MousePopup.prototype.unregisterHide=function(){jQuery("html").unbind("click",this.clickHandler);body.parentNode.removeEventListener("mousedown",this.clickHandler,true)}}else{MousePopup.activePopups={};
MousePopup.nextID=0;MousePopup.hideActive=function(){for(var i in MousePopup.activePopups){MousePopup.activePopups[i].hide()}};MousePopup.prototype.registerHide=function(){if(!MousePopup.active){jQuery("body").bind("click",this.clickHandler);addDOMEvent(body,"mousedown",this.clickHandler);addDOMEvent(body,"mouseover",this.mouseHandler);addDOMEvent(body,"mouseout",this.mouseHandler);body.onlosecapture=MousePopup.hideActive;body.setCapture()}if(!this.activeID){this.activeID=++MousePopup.nextID}MousePopup.activePopups[this.activeID]=this
};MousePopup.prototype.unregisterHide=function(){if(!MousePopup.active){jQuery("body").unbind("click",this.clickHandler);removeDOMEvent(body,"mousedown",this.clickHandler);removeDOMEvent(body,"mouseover",this.mouseHandler);removeDOMEvent(body,"mouseout",this.mouseHandler);body.onlosecapture=null;body.releaseCapture()}delete MousePopup.activePopups[this.activeID]}}function PopupMenu(){MousePopup.call(this,newnode("div",{position:"absolute",display:"none"},{className:"PopupMenuDiv font-size-small",oxPopupMenu:true}));
this.items=[]}PopupMenu.timeout=100;PopupMenu.getTimeout=function(){return PopupMenu.timeout};PopupMenu.prototype=extend(MousePopup,{show:function(){if(this.isVisible){return}if(this.onShow){this.onShow(this.getContext())}MousePopup.prototype.show.call(this);for(var i in this.items){this.items[i].show()}PopupMenu.last=this},hide:function(){if(!this.isVisible){return}MousePopup.prototype.hide.call(this);for(var i in this.items){this.items[i].hide()}if(this.onHide){this.onHide()}},close:function(){PopupMenu.last=null;
this.hide();if(this.parent instanceof MenuItem){this.parent.close()}},addItem:function(item){this.items.push(item);this.node.appendChild(item.node);item.parent=this;if(item.icon){this.iconAdded()}if(item.submenu){this.submenuAdded();item.submenu.zIndex=this.zIndex+1}else{item.zIndex=this.zIndex+1}},removeItem:function(item){for(var i=0;i<this.items.length;i++){if(this.items[i]==item){this.items.splice(i,1);this.node.removeChild(item.node);break}}},removeAllItems:function(){for(var i=0;i<this.items.length;
i++){this.node.removeChild(this.items[i].node)}this.items=[]},itemSelected:function(e){for(var i in this.items){this.items[i].siblingSelected(e)}},getContext:function(){var p=this.parent;return p&&p.getContext!==undefined?p.getContext():{}},iconAdded:function(){PopupMenu.setIconClass(this.node,true)},submenuAdded:function(){PopupMenu.setSubmenuClass(this.node,true)}});PopupMenu.setIconClass=classNameSetter("popup-menu-icons");PopupMenu.setSubmenuClass=classNameSetter("popup-menu-submenus");function MenuItem(text,action){if(action instanceof PopupMenu){this.submenu=action;
action.parent=this}else{this.action=action}var Self=this;this.node=newnode("div",{position:"relative"},{className:"PopupEntryDiv"},[newnode("span",0,0,[addTranslated(text)])]);addDOMEvent(this.node,"click",function(e){if(Self.checkbox){var target=e.target||e.srcElement;if(target==Self.checkbox){cancelBubbling(e);handleClick()}else{stopEvent(e);Self.checkbox.click()}}else{stopEvent(e);handleClick()}function handleClick(){if(Self.enabled){if(Self.action&&Self.action(Self.getContext())!==false){Self.parent.close()
}}else{if(Self.disabled_action&&Self.disabled_action()!==false){Self.parent.close()}}}});with(FSM){var transitions=[Trans("start","selected",Event(this.node,"mouseover",select)),Trans("selected","start",Event(this.node,"mouseout",MouseOut(deselect)))]}if(this.submenu){with(FSM){var deselection=Trans("both","open",Callback(deselect));transitions=transitions.concat([Trans("selected","both",Timeout(PopupMenu.getTimeout,open)),deselection,Trans("open","both",Event(this.node,"mouseover",select)),Trans("open","start",Timeout(PopupMenu.getTimeout,close))])
}this.node.appendChild(newnode("img",IE<8?0:{position:"absolute",right:0,top:0,bottom:0,margin:"auto",width:"4px",height:"7px"},{src:getFullImgSrc("/img/arrows/arrow_darkgrey_right.gif")}))}this.fsm=FSM("start",transitions);if(this.submenu){this.siblingSelected=deselection.fire}function select(){Self.parent.itemSelected();if(!Self.enabled){return false}Self.node.className="PopupEntryDivActive border-color-PMG-selection-elements"}function deselect(){Self.node.className="PopupEntryDiv"}function open(){Self.submenu.show();
var node=jQuery(Self.node);var parent=jQuery(Self.parent.node);var width=parent.outerWidth();var o=node.offset(),op=parent.offset();Self.submenu.position(op.left+width-3,o.top-5)}function close(){Self.submenu.hide()}}MenuItem.prototype={enabled:true,enable:function(){this.setEnabled(true)},disable:function(){this.setEnabled(false)},setEnabled:function(enabled){this.enabled=enabled;this.node.className=this.enabled?"PopupEntryDiv":"PopupEntryDivDisabled font-color-disabled";if(this.img){this.img.src=this.getIcon()
}},siblingSelected:emptyFunction,setIcon:function(icon,disabled_icon){this.icon=icon;this.disabled_icon=disabled_icon;if(icon){if(this.img){this.img.src=this.getIcon()}else{this.img=newnode("img",{position:"absolute",left:0,top:0,bottom:0,margin:"auto",width:"16px",height:"16px"},{alt:"",src:getFullImgSrc("img/dummy.gif")});this.node.insertBefore(this.img,this.node.firstChild)}if(this.parent){this.parent.iconAdded()}}else{if(this.img){this.node.removeChild(this.img);delete this.img}}return this},getIcon:function(){return getFullImgSrc(this.enabled?this.icon:(this.disabled_icon||this.icon))
},setChecked:function(checked){if(this.checkbox){this.checkbox.defaultChecked=checked;this.checkbox.checked=checked}else{this.checkbox=newnode("input",0,{type:"checkbox",className:"noborder",defaultChecked:checked,checked:checked});this.node.insertBefore(this.checkbox,this.node.firstChild)}return this},getChecked:function(){return this.checkbox&&this.checkbox.checked},show:function(){if(this.onShow){this.onShow(this.getContext())}this.fsm.reset();this.node.zIndex=this.zIndex;this.node.className=this.enabled?"PopupEntryDiv":"PopupEntryDivDisabled font-color-disabled";
if(this.img){this.img.src=this.getIcon()}},hide:function(){if(this.submenu){this.submenu.hide()}this.fsm.disable()},close:function(){this.parent.close()},visible:true,setVisible:function(visible){this.visible=visible;this.node.style.display=visible?"":"none"},waiting:false,setWaiting:function(waiting){if(waiting==this.waiting){return}this.waiting=waiting;if(waiting){this.waitEnabled=this.enabled;this.setEnabled(false);this.waitSetEnabled=this.setEnabled;this.setEnabled=function(enabled){this.waitEnabled=enabled
};this.waitIcon=this.icon;this.waitDisabledIcon=this.disabled_icon;this.setIcon("img/ox_animated_withoutbg.gif")}else{this.setEnabled=this.waitSetEnabled;this.setEnabled(this.waitEnabled);this.setIcon(this.waitIcon,this.waitDisabledIcon);delete this.waitEnabled;delete this.waitSetEnabled;delete this.waitIcon;delete this.waitDisabledIcon}},setEnabledF:function(enableFunction){var Self=this;Value.eval(enableFunction,function(wait,enable){if(!wait){Self.setEnabled(enable)}Self.setWaiting(wait)})},autoSetEnabled:function(){this.getAutoEnabled(function(flag){this.setEnabled(flag)
})},getAutoEnabled:function(cont){if(!this.submenu){cont(this.enabled&&this.visible)}else{var found=false;var join=new Join(function(){cont(found)});var lock=join.add();var i=0,items=this.submenu.items,$l=items.length,item,callback;for(;i<$l;i++){if(items[i].getAutoEnabled){(function(item){item.getAutoEnabled(join.add(function(flag){found=found||flag}))}(items[i]))}}lock()}},getContext:function(){var p=this.parent;return p&&p.getContext!==undefined?p.getContext():{}}};function Value(){var f=function(){var e=Value.evaluations[Value.evaluations.length-1];
f.callbacks[e.id]=e.callback;if("value" in f){return f.value}else{throw Value.WaitException}};f.callbacks={};f.set=function(value){if(this.value==value){return}this.value=value;this.update()};f.clear=function(){delete this.value;this.update()};f.update=function(){var callbacks=this.callbacks;this.callbacks={};for(var i in callbacks){callbacks[i]()}};return f}Value.WaitException={};Value.id=0;Value.evaluations=[];Value.eval=function(f,callback){var updatePending=false;function delayUpdate(){if(!updatePending){updatePending=true;
setTimeout(update,0)}}function update(){updatePending=false;Value.evaluations.push({id:Value.id++,callback:delayUpdate});try{var result=f();Value.evaluations.pop();callback(false,result)}catch(e){Value.evaluations.pop();if(e==Value.WaitException){callback(true)}else{throw e}}}update()};function MenuSeparator(){this.node=newnode("div",{borderTop:"1px solid #ccc",margin:"0.6em 0"});var Self=this;addDOMEvent(this.node,"mouseover",function(){Self.parent.itemSelected()})}MenuSeparator.prototype={siblingSelected:emptyFunction,show:emptyFunction,hide:emptyFunction,setVisible:function(visible){this.visible=visible;
this.node.style.display=visible?"":"none"}};function ContextMenu(){PopupMenu.call(this)}ContextMenu.prototype=extend(PopupMenu,{display:function(x,y,context){this.context=context;this.position(x,y);this.show()},getContext:function(){return this.context}});function PulldownMenu(trigger){PopupMenu.call(this);this.trigger=trigger;var Self=this;addDOMEvent(trigger,"click",function(e){if(PopupMenu.last==Self){PopupMenu.last=null}else{Self.show()}cancelBubbling(e)});trigger.oxPulldownTrigger=true}PulldownMenu.prototype=extend(PopupMenu,{show:function(){this.node.style.minWidth=this.trigger.offsetWidth+"px";
PopupMenu.prototype.show.call(this);var pos=getAbsolutePosition(this.trigger);this.position(pos.x,pos.y+this.trigger.offsetHeight,this.trigger.offsetWidth,-this.trigger.offsetHeight)},captureEvents:function(t){while(t&&!t.oxPopupMenu&&!t.oxPulldownTrigger){t=t.parentNode}if(!t||t==this.trigger){this.hide();return true}else{if(t.oxPulldownTrigger){this.hide()}}return false}});function PulldownPopup(trigger,node,manual){node.oxPopupMenu=true;MousePopup.call(this,node);this.trigger=trigger;var Self=this;
if(!manual){addDOMEvent(trigger,"click",function(e){if(PopupMenu.last==Self){PopupMenu.last=null}else{Self.show()}cancelBubbling(e)})}trigger.oxPulldownTrigger=true}PulldownPopup.prototype=extend(MousePopup,{show:function(){if(this.isVisible){return}this.node.style.minWidth=this.trigger.offsetWidth+"px";if(this.onShow){this.onShow()}MousePopup.prototype.show.call(this);PopupMenu.last=this;var ref=jQuery(this.trigger),off=ref.offset();this.position(off.left,off.top+ref.height(),ref.width(),-ref.height())
},hide:function(){if(!this.isVisible){return}MousePopup.prototype.hide.call(this);if(this.onHide){this.onHide()}},captureEvents:PulldownMenu.prototype.captureEvents,manualShow:function(){if(PopupMenu.last==this){PopupMenu.last=null}else{this.show()}}});var corewindow=window;function configGetKey(key){var splitkey=typeof key=="string"?key.split("."):key;if(!window.config){return null}var tmp=ox.api.config.get();for(var i=0;i<splitkey.length;i++){if(tmp[splitkey[i]]!=undefined){tmp=tmp[splitkey[i]]
}else{return null}}return clone(tmp)}function configSetKey(key,value){if(!corewindow.config){corewindow.config={}}var tmp=ox.api.config.get();var splitkey=typeof key=="string"?key.split("."):key;for(var i=0;i<splitkey.length-1;i++){if(tmp[splitkey[i]]){tmp=tmp[splitkey[i]];if(typeof(tmp)!="object"){alert(""+tmp+" parentNode is a value");return}}else{tmp[splitkey[i]]={};tmp=tmp[splitkey[i]]}}tmp[splitkey[splitkey.length-1]]=clone(value);configuration_changed_outside=true;triggerEvent("OX_Configuration_Parameter_Changed",key,value)
}function configContainsKey(key){var splitkey=typeof key=="string"?key.split("."):key;if(!config){return false}var tmp=ox.api.config.get();for(var i=0;i<splitkey.length;i++){if(tmp[splitkey[i]]!=undefined){tmp=tmp[splitkey[i]]}else{return false}}return true}function configRemoveKey(key){var tmp=ox.api.config.get();var splitkey=typeof key=="string"?key.split("."):key;for(var i=0;i<splitkey.length-1;i++){if(tmp[splitkey[i]]){tmp=tmp[splitkey[i]];if(typeof(tmp)!="object"){alert(""+tmp+" parentNode is a value");
return}}else{tmp[splitkey[i]]={};tmp=tmp[splitkey[i]]}}delete tmp[splitkey[splitkey.length-1]];configuration_changed_outside=true;triggerEvent("OX_Configuration_Parameter_Changed",key,undefined)}var angle=0;var dir=0.01;var left,right;var cubetimeout;function startrotate(node1,node2,direction){if(cubetimeout){clearTimeout(cubetimeout)}if(configGetKey("gui.effects.global")){var a=Math.PI/4,b=Math.PI/2;cubetimeout=setTimeout(function(){if(node1&&node2&&node1.id==node2.id){return}if(direction>=0){left=node1;
right=node2}else{right=node1;left=node2}dir=(direction>=0)?0.005:-0.005;angle=(direction>=0)?0:b;rotate(direction)},1200)}else{if(node1){node1.style.left=Math.round(24-24*Math.cos(Math.PI/4))+"px";node1.style.width="0px"}if(node2){node2.style.left=Math.round(24-24*Math.cos(Math.PI/4))+"px";node2.style.width="34px"}}}function rotate(direction){var a=Math.PI/4,b=Math.PI/2;var start=(new Date()).getTime();setTimeout(function(){var now=(new Date()).getTime();angle+=dir*(now-start);if(dir>0&&angle>=b){angle=b
}else{if(dir<0&&angle<0){angle=0}else{rotate(direction)}}if(left){left.style.left=Math.round(24-24*Math.cos(angle-a))+"px";left.style.width=Math.round(34*Math.cos(angle))+"px"}if(right){right.style.left=Math.round(24+24*Math.cos(angle+a))+"px";right.style.width=Math.round(34*Math.sin(angle))+"px"}},0)}function Accordion(maxheight,width,hover){this.hover=hover;this.speed=12;this.intervalcounts=0;this.interval=10;this.actualcontent=0;this.components=new Object();this.maxheight=maxheight;this.width="100%";
if(width){this.width=width+"px"}this.container=newnode("div",{width:this.width},{},[])}Accordion.prototype.addComponent=function(title,node,maximumheight){if(this.components[title]){this.container.removeChild(this.components[title].content)}this.components[title]={title:title,content:node,maximumheight:maximumheight};node.style.height="0px";var height=Accordion.getHeight(node,this,maximumheight);this.components[title].maxheight=height;this.container.appendChild(node);this.checkHeight()};Accordion.prototype.checkComponentHeight=function(title){if(this.components[title]){this.components[title].maxheight=Accordion.getHeight(this.components[title].content,this,this.components[title].maximumheight);
this.checkHeight()}};Accordion.prototype.removeComponent=function(title){if(this.components[title]){try{this.container.removeChild(this.components[title].content)}catch(e){}delete this.components[title]}};Accordion.prototype.clear=function(){this.components=new Object();this.getDomNode()};Accordion.prototype.inTree=function(){var node=this.container;while(node){if(node==$("body")){return true}node=node.parentNode}};Accordion.prototype.setHover=function(hover){this.hover=hover};Accordion.prototype.checkHeight=function(){if(this.intervalcounts==0){if(this.maxheight&&this.maxheight<this.container.offsetHeight){this.container.style.height=this.maxheight+"px";
this.container.style.overflowX="hidden";this.container.style.overflowY="auto"}else{this.container.style.height=""}if(!this.hover){if(OXAppointmentHover.actualHover){OXAppointmentHover.actualHover.sizeChanged()}}else{this.hover.sizeChanged()}}};Accordion.prototype.getDomNode=function(){removeChildNodes(this.container);var tmpintree=this.inTree();if(!tmpintree){$("body").appendChild(this.container)}for(var i in this.components){var tmp=this.components[i];this.container.appendChild(tmp.content);this.components[i].maxheight=Accordion.getHeight(tmp.content,this);
this.components[i].content.style.height="0px"}if(!tmpintree){$("body").removeChild(this.container)}return this.container};Accordion.prototype.showExtraContent=function(number){var tmpcontents=(""+this.actualcontent).split(",");tmpcontents.push(number);this.showContent(tmpcontents.join(","))};Accordion.prototype.hideExtraContent=function(number){var tmpcontents=(""+this.actualcontent).split(",");for(var i=0;i<tmpcontents.length;i++){if(tmpcontents[i]==number){tmpcontents.splice(i,1);break}}this.showContent(tmpcontents.join(","))
};Accordion.prototype.showContent=function(number){var Self=this;var newnumbers=(""+number).split(",");var oldnumbers=(""+Self.actualcontent).split(",");var oldobject=new Object();var newobject=new Object();for(var i=0;i<oldnumbers.length;i++){oldobject[oldnumbers[i]]=true}for(var i=0;i<newnumbers.length;i++){newobject[newnumbers[i]]=true}this.container.style.height="";this.container.style.overflow="";for(var i2 in Self.components){if(!oldobject[i2]){if(!newobject[i2]){Self.components[i2].content.style.height="0px"
}else{Self.setDisplay(Self.components[i2],true)}}else{if(!newobject[i2]){Self.setDisplay(Self.components[i2],false)}else{if(Self.components[i2].content.style.height=="0px"){Self.setDisplay(Self.components[i2],true)}}}}Self.checkHeight();var newnumbers=new Array();for(var i in newobject){newnumbers.push(i)}Self.actualcontent=newnumbers};Accordion.prototype.setDisplay=function(containerobject,direction){var Self=this;var fade=configGetKey("gui.effects.fading");if(direction){containerobject.content.style.height="0px";
containerobject.content.style.display="block";if(!containerobject.maxheight){containerobject.tmpheight=0}else{containerobject.tmpheight=containerobject.maxheight}if(containerobject.interval){containerobject.interval()}Self.intervalcounts++;function final_cb1(){if(fade){containerobject.content.style.opacity="";containerobject.content.style.filter=""}if(containerobject.maximumheight&&containerobject.content.offsetHeight>=containerobject.maximumheight){containerobject.content.style.height=containerobject.maximumheight+"px"
}else{containerobject.content.style.height=""}containerobject.interval=null;Self.intervalcounts--;if(fade){Self.checkHeight()}}if(configGetKey("gui.effects.global")){containerobject.interval=animate(500,100,function(curr){var tmpheight=containerobject.maxheight||0;var nextheight=Math.round(tmpheight*(curr/100));if(containerobject.maximumheight&&nextheight>containerobject.maximumheight){nextheight=containerobject.maximumheight}if(fade){containerobject.content.style.opacity=(curr/100);containerobject.content.style.filter="alpha(style=0,opacity:"+(curr)+")"
}containerobject.content.style.height=nextheight+"px"},final_cb1)}else{if(containerobject.maximumheight&&containerobject.maxheight>containerobject.maximumheight){containerobject.content.style.height=containerobject.maximumheight+"px"}final_cb1()}}else{if(containerobject.interval){containerobject.interval()}Self.intervalcounts++;function final_cb2(){if(fade){containerobject.content.style.opacity=0;containerobject.content.style.filter="alpha(style=0,opacity:"+(0)+")"}containerobject.content.style.height="0px";
containerobject.interval=null;Self.intervalcounts--;if(fade){Self.checkHeight()}}if(configGetKey("gui.effects.global")){containerobject.interval=animate(500,100,function(curr){var tmpheight=containerobject.maxheight||0;var nextheight=Math.round(tmpheight*((100-curr)/100));if(containerobject.maximumheight&&containerobject.maximumheight<=nextheight){nextheight=containerobject.maximumheight}if(fade){containerobject.content.style.opacity=(curr/100);containerobject.content.style.filter="alpha(style=0,opacity:"+(curr)+")"
}containerobject.content.style.height=nextheight+"px"},final_cb2)}else{if(containerobject.maximumheight&&containerobject.maxheight>containerobject.maximumheight){containerobject.content.style.height=containerobject.maximumheight+"px"}final_cb2()}}};Accordion.getHeight=function(node,accordion,maximumheight){var tmpheight=node.style.height;var tmpnode=node.cloneNode(true);tmpnode.style.height="";tmpnode.style.zIndex=-1;body.appendChild(tmpnode);var value=tmpnode.offsetHeight;if(maximumheight&&value>maximumheight){node.style.overflow="auto"
}else{node.style.overflow="hidden"}body.removeChild(tmpnode);return value};function createHoverContent(innerwidth,headerheight,borderheight,imgsizes,tabnummer){var mywidth=412;var innerwidthtop;if(!innerwidthtop){innerwidthtop=392}var innerwidthbottom;if(!innerwidthbottom){innerwidthbottom=392}if(!innerwidth){innerwidth=400}if(!imgsizes){imgsizes={t:9,tl:10,tr:10,r:6,l:6,b:15,bl:10,br:10}}if(!headerheight){headerheight=9}if(!borderheight){borderheight=15}var mywidthtop=innerwidth+imgsizes.tr+imgsizes.tl;
var returnobj=new Object();var coreelement=newnode("div",{position:"absolute",width:"414px",zIndex:100000,left:"300px",top:"100px",display:"none"},{},[newnode("div",{position:"relative",width:"0px",height:("0px"),whiteSpace:"nowrap"},{},[newnode("div",{position:"absolute",top:"0px",left:"0px",width:"0px",height:"0px"},{className:"hover-header-t"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")},[])]),newnode("div",{position:"absolute",top:"0px",left:"0px",width:"0px",height:"0px"},{className:"hover-header-tr"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")},[])]),newnode("div",{position:"absolute",top:"0px",left:"0px",width:"0px",height:"0px"},{className:"hover-header-tl"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")},[])]),newnode("div",{position:"absolute",left:"0px",top:"0px",width:"0px",height:"0px"},{className:"hover-header-r"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")},[])]),newnode("div",{position:"absolute",left:"0px",top:"0px",width:"0px",height:"0px"},{className:"hover-header-l"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")},[])]),newnode("div",{position:"absolute",left:"0px",top:"0px",width:"0px",height:"0px"},{className:"hover-header-color"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")},[])])]),newnode("div",{position:"relative",overflow:"hidden",width:"414px"},{},[newnode("div",{marginLeft:(imgsizes.l+2)+"px",width:(innerwidth)+"px",overflow:"hidden",zIndex:"1"},{className:"hover_background"},[newnode("div",{height:"100%",width:"100%",overflow:"hidden"},null)]),newnode("div",{position:"absolute",left:"408px",top:"23px",height:"1000px",width:"8px"},{className:"hover-body-r"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")})]),newnode("div",{position:"absolute",left:"0px",top:"23px",height:"1000px",width:"8px"},{className:"hover-body-l"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")})]),newnode("div",{position:"absolute",top:"0px",left:"0px",width:(imgsizes.tl+"px"),height:("23px")},{className:"hover_master_background hover-header-tab-tl_ac",id:tabnummer+"hover-tabbin-corner-l"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")})]),newnode("div",{position:"absolute",top:"0px",left:"406px",width:"10px",height:"23px"},{className:"hover_master_background hover-header-tab-tr",id:tabnummer+"hover-tabbin-corner-r"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")})])]),newnode("div",{position:"relative",width:mywidth+"px",height:(borderheight+"px")},{},[newnode("div",{position:"absolute",left:"406px",top:borderheight-imgsizes.b+"px",width:(imgsizes.br+"px"),height:(imgsizes.b+"px")},{className:"hover_master_background hover-bottom-br"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")},[])]),newnode("div",{position:"absolute",left:"0px",top:borderheight-imgsizes.b+"px",width:(imgsizes.bl+"px"),height:(imgsizes.b+"px")},{className:"hover_master_background hover-bottom-bl"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")},[])]),newnode("div",{position:"absolute",left:"0px",top:"0px",width:(imgsizes.bl+"px"),height:((borderheight-imgsizes.b)+"px")},{className:"hover-bottom-l"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")},[])]),newnode("div",{position:"absolute",left:(innerwidthbottom+imgsizes.bl)+"px",top:"0px",width:(imgsizes.br+"px"),height:((borderheight-imgsizes.b)+"px")},{className:"hover-bottom-r"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")},[])]),newnode("div",{position:"absolute",left:imgsizes.bl+"px",top:(borderheight-imgsizes.b)+"px",width:"396px",height:(imgsizes.b)+"px"},{className:"hover-bottom-b"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")},[])]),newnode("div",{position:"absolute",left:imgsizes.bl+"px",top:"0px",width:(innerwidthbottom)+"px",height:(borderheight-imgsizes.b)+"px"},{className:"hover-bottom-color"},[newnode("img",{},{src:getFullImgSrc("img/dummy.gif")},[])])])]);
returnobj.node=coreelement;returnobj.header=coreelement.getElementsByTagName("div")[6];returnobj.body=coreelement.getElementsByTagName("div")[9];returnobj.bottom=coreelement.getElementsByTagName("div")[18];return returnobj}function Tabbing(id){this.id=id;this.tabs=new Array();this.selected}Tabbing.prototype={getDOMNode:function(){var Self=this;var trnode=newnode("tr");for(var i in this.tabs){var tdnode=this.tabs[i].getDOMNode();trnode.appendChild(tdnode)}trnode.appendChild(newnode("td",{width:"100%"},{className:"tabbing_border_style"},[document.createTextNode("\u00a0")]));
return trnode},addTab:function(tab){var Self=this;if(this.tabs.length==0){tab.select(true);this.selected=0}this.tabs.push(tab);addDOMEvent(tab.getDOMNode(),"click",(function(id,pos){return function(e){Self.selectTabById(id)}})(tab.id))},removeTab:function(id){for(var i in this.tabs){if(this.tabs[i].id==id){this.tabs.splice(i,i)}}},selectTabById:function(id){var pos=0;for(var i in this.tabs){if(id==this.tabs[i].id){this.selected=pos=i}this.tabs[i].select(id==this.tabs[i].id)}if(this.tabs[this.selected].onShow){this.tabs[this.selected].onShow()
}if(this.selected==0){$ALL(this.id+"hover-tabbin-corner-l").className="hover_master_background hover-header-tab-tl_ac"}else{$ALL(this.id+"hover-tabbin-corner-l").className="hover_master_background hover-header-tab-tl";this.tabs[this.selected-1].getDOMNode().className="hover_master_background tabbing_tab_inactive_left"}},getTabById:function(id){for(var i in this.tabs){if(this.tabs[i].id==id){return this.tabs[i]}}return null}};function Tab(id,title,onShow){this.id=id;this.title=title;this.onShow=onShow;
this.enabled=true;this.node=newnode("td",0,{className:"clickable hover_master_background tabbing_tab_inactive"},[addTranslated(title)])}Tab.prototype={show:function(enabled){this.enabled=enabled;this.node.style.display=this.enabled?"":"none"},select:function(selected){this.node.className=selected?"hover_master_background tabbing_tab_active":"hover_master_background tabbing_tab_inactive"},setTitle:function(title){this.node.firstChild.nodeValue=title},getDOMNode:function(){return this.node}};function Key(){}Key.prototype.equals=function(keyObject1){return this.module==keyObject1.module&&this.folder_id==keyObject1.folder_id&&this.id==keyObject1.id&&(this.recurrence_position||0)==(keyObject1.recurrence_position||0)
};Key.prototype.hashCode=function(){if(this.calculatedHash){return this.calculatedHash}if(this.recurrence_position||(this.recurrence_position==0)){if(!isNaN(this.folder_id)&&!isNaN(this.id)&&!isNaN(this.recurrence_position)){this.calculatedHash=parseInt(this.folder_id)+parseInt(this.id)+Number(this.recurrence_position);return this.calculatedHash}else{this.calculatedHash=(this.folder_id+this.id+this.recurrence_position);return this.calculatedHash}}else{if(!isNaN(this.folder_id)&&!isNaN(this.id)){this.calculatedHash=(parseInt(this.folder_id)+parseInt(this.id));
return this.calculatedHash}else{this.calculatedHash=(this.folder_id+this.id);return this.calculatedHash}}};Key.createfromObject=function(keyObject){var element=new Key();element.module=keyObject.module;element.folder_id=keyObject.folder_id||keyObject.folder;element.id=keyObject.id;element.recurrence_position=keyObject.recurrence_position;return element};function LRUKeyList(size){this.free=size;if(!this.free){this.free=-1}this.cache={};this.list=new LinkedList()}LRUKeyList.prototype={get:function(key,changeList,wholeobject){var items=this.cache[key.hashCode()];
var item;if(items){for(var i=0;i<items.length;i++){if(key.equals(items[i].key)){item=items[i];break}}}if(!item){return undefined}if(changeList){this.list.remove(item);this.list.addLast(item)}if(!wholeobject){return item.data}else{return item}},set:function(key,value){var item=this.get(key,false,true);if(item){item.data=value}else{item={key:key,data:value};this.list.addLast(item);var hash=key.hashCode();if(!this.cache[hash]){this.cache[hash]=new Array()}this.cache[hash].push(item);if(this.free){this.free--
}else{var key1=this.list.removeFirst().key;var ret=this.get(key1,false,true);this.remove(key1);this.free--;return ret}}},remove:function(key){var items=this.cache[key.hashCode()];var item;if(items){for(var i=0;i<items.length;i++){if(key.equals(items[i].key)){this.list.remove(items[i]);items.splice(i,1);if(!items.length){this.cache[key.hashCode()]=undefined}this.free++;break}}}},keys:function(){var myKeys=new Array();for(var hashcode in this.cache){if(this.cache[hashcode]){for(var i=0;i<this.cache[hashcode].length;
i++){if(this.cache[hashcode][i].key){myKeys.push(this.cache[hashcode][i].key)}}}}return myKeys}};function OXCollection(){this.last_modified;this.lastRequest;this.criteria;this.order;this.objects=new Array();this.map_objects=new LRUKeyList()}OXCollection.prototype={getIndex:function(key){return this.map_objects.get(key)}};function switchStringObject(object){var myObject=new Object();for(var i in object){myObject[object[i]]=i}return myObject}var OXCache={};OXCache.updateTime=300000;OXCache.objectSize=20000;
OXCache.criteriaSize=10;OXCache.sequence=0;OXCache.getSequence=function(){return OXCache.sequence++};OXCache.moduleMappings=new Object();OXCache.cachedObjects=new LRUKeyList(OXCache.objectSize);OXCache.cachedCollections=new MRUList(OXCache.criteriaSize);OXCache.cachedObjectsTrash=new LRUKeyList();OXCache.cachedCollectionsTrash=new Array();OXCache.objectShortKey=new LRUKeyList();OXCache.waitingrequests=new Array();OXCache.modifiedCallbacks=new Object();OXCache.actualCallbacks=new Object();OXCache.modifiedObjects=new Array();
OXCache.deletedObjects=new Array();OXCache.requested={CNOT:[],CEXP:[],CMIS:{},LNOT:{},LEXP:{},LMIS:{}};OXCache.executeActive=false;OXCache.requestSequence=0;OXCache.getRequestSequence=function(){return OXCache.requestSequence++};OXCache.addRequest=function(module,collection,cb,uniqueName){OXCache.waitingrequests.push({module:module,collection:collection,cb:cb,uniqueName:uniqueName})};OXCache.join=new Join(function(){var ca=OXCache.callbackArray,ma=OXCache.modifiedArray;OXCache.callbackArray=new Object();
OXCache.modifiedArray=new Object();for(var i in OXCache.actualCallbacks){OXCache.callbackArray[i]=true}for(var i in OXCache.modifiedCallbacks){OXCache.modifiedArray[i]=true}for(var i in OXCache.moduleMappings){if(OXCache.moduleMappings[i].execute){OXCache.moduleMappings[i].execute()}}OXCache.callbackArray=ca;OXCache.modifiedArray=ma;for(var i in OXCache.modifiedObjects){OXCache.modifiedObjects[i].modified=false}OXCache.modifiedObjects=new Array();OXCache.deletedObjects=new Array();for(var i in OXCache.cachedCollections.cache){OXCache.cachedCollections.cache[i].data.modified=false
}var wr={};for(var i=0;i<OXCache.waitingrequests.length;i++){wr[OXCache.waitingrequests[i].uniqueName]=OXCache.waitingrequests[i]}OXCache.waitingrequests=new Array();for(var i in wr){OXCache.actualCallbacks[i]={module:wr[i].module,collection:wr[i].collection,fn:wr[i].cb};OXCache.moduleMappings[wr[i].module].get(i,wr[i].module,wr[i].collection,null,wr[i].cb,true)}OXCache.cachedObjectsTrash=new LRUKeyList();OXCache.cachedCollectionsTrash=new Array();OXCache.requested={CNOT:[],CEXP:[],CMIS:{},LNOT:{},LEXP:{},LMIS:{}}
});OXCache.errorHandler=function(uniqueName,request,response,response2){if(debug){console.debug("Error",uniqueName,request,response,response2)}if(response.error){switch(response.category){case 1:newServerError(response);OXCache.unregister(uniqueName);break;case 2:newServerError(response);OXCache.unregister(uniqueName);break;case 3:case 4:case 5:newServerError(response);var col=OXCache.cachedCollections.get(uniqueName);if(col){col.check=false;col.modified=false}else{OXCache.unregister(uniqueName)}break;
case 6:newServerError(response);OXCache.unregister(uniqueName);break;case 7:newServerError(response);OXCache.unregister(uniqueName);break;case 8:newServerError(response);OXCache.unregister(uniqueName);break;case 9:newServerError(response);OXCache.unregister(uniqueName);break;case 10:newServerError(response);OXCache.unregister(uniqueName);break;case 11:newServerError(response);OXCache.unregister(uniqueName);break;case 12:newServerError(response);OXCache.unregister(uniqueName);break;case 13:newServerError(response);
OXCache.unregister(uniqueName);break;default:newServerError(response);break}}return};OXCache.getJSONX=function(url,data,cb){(new JSONX()).put(url,data,null,OXCache.join.add(cb),OXCache.join.alt())};OXCache.setMapping=function(module,mapping){if(OXCache.moduleMappings[module]){if(debug){alert("A module mapping for module >"+module+"< is still available in Object cache.")}return}OXCache.moduleMappings[module]=mapping};OXCache.newRequest=function(uniqueName,module,collection,callbackModified,callback,forceupdate,errorHandler){var returnobject;
uniqueName="oxcache_external_"+OXCache.getRequestSequence();if(!OXCache.moduleMappings[module]){if(debug){alert("A module mapping for module >"+module+"< is not available in Object cache.")}return}if(!uniqueName){if(debug){alert("No uniquename entered for modified function")}return}if((OXCache.modifiedCallbacks[uniqueName]&&OXCache.modifiedCallbacks[uniqueName].fn&&callbackModified)||(OXCache.actualCallbacks[uniqueName]&&OXCache.actualCallbacks[uniqueName].fn&&callback)){if(debug){alert("A modified function for name >"+uniqueName+"< is still available in Object cache.")
}}if(callbackModified){var modCB=OXCache.modifiedCallbacks[uniqueName]={module:module,collection:collection};modCB.fn=callbackModified.fn||callbackModified;if(callbackModified.before){modCB.before=callbackModified.before}}if(callback){OXCache.actualCallbacks[uniqueName]={module:module,collection:collection,fn:callback,errorHandler:errorHandler}}var returnobject=OXCache.moduleMappings[module].get(uniqueName,module,collection,callbackModified,callback,forceupdate);returnobject.uniqueName=uniqueName;
return returnobject};OXCache.unregister=function(uniqueName){var registered=false;if(OXCache.modifiedCallbacks[uniqueName]){delete OXCache.modifiedCallbacks[uniqueName];registered=true}var callback=OXCache.actualCallbacks[uniqueName];if(callback){if(callback.errorHandler){callback.fn=callback.errorHandler}else{delete OXCache.actualCallbacks[uniqueName]}registered=true}};OXCache.update=function(){for(var c=OXCache.cachedCollections.list.first;c;c=c.next){c.data.check=true}for(var i=0;i<OXCache.cachedCollectionsTrash.length;
i++){OXCache.cachedCollectionsTrash[i].check=true}for(var counter in OXCache.modifiedCallbacks){var uniqueObject=OXCache.newRequest(null,OXCache.modifiedCallbacks[counter].module,OXCache.modifiedCallbacks[counter].collection,null,function(data){if(uniqueObject){OXCache.unregister(uniqueObject.uniqueName)}else{}},true)}};function OXAbstractMapping(){}OXAbstractMapping.get=function(oxMapping){return function(uniquename,module,collection,callbackModified,callback,forceupdate){if(collection.criteria){oxMapping.criteriaRequest(uniquename,module,collection,callbackModified,callback,forceupdate)
}else{if(collection.objects){return oxMapping.listRequest(uniquename,module,collection,callbackModified,callback,forceupdate)}else{if(debug){alert("Illegal request: Neighter criteria nor objects are set")}}}return{}}};OXAbstractMapping.execute=function(oxMapping){return function(){for(var i in OXCache.actualCallbacks){if(OXCache.callbackArray[i]){var tmpCallback=OXCache.actualCallbacks[i];if(!tmpCallback.executed){tmpCallback.executed=true;if(tmpCallback.module==oxMapping.module){var cb=OXCache.actualCallbacks[i];
delete OXCache.actualCallbacks[i];delete OXCache.callbackArray[i];var ret=oxMapping.buildResponse(tmpCallback,false,i);if(ret){cb.fn(ret)}}tmpCallback.executed=false}}}for(var i in OXCache.modifiedCallbacks){if(OXCache.actualCallbacks[i]){continue}if(OXCache.modifiedArray[i]){var tmpCallback=OXCache.modifiedCallbacks[i];if(!tmpCallback.executed){tmpCallback.executed=true;if(tmpCallback.module==oxMapping.module){var ret=oxMapping.buildResponse(tmpCallback,true,i);if(ret){OXCache.modifiedCallbacks[i].fn(ret)
}}tmpCallback.executed=false}}}}};OXAbstractMapping.buildResponse=function(oxMapping){return function(tmpCallback,isModified,uniqueName){var collection=tmpCallback.collection;if(collection.criteria){var tmpCollection=oxMapping.getCollection(collection,false,true);if(!tmpCollection||tmpCollection.check){if(debug){console.debug("Missing or changed collection:",collection)}OXCache.addRequest(oxMapping.module,collection,tmpCallback.fn,uniqueName);if(tmpCollection){tmpCollection.check=false}}else{if(!isModified||tmpCollection.modified){var retCol=new OXCollection();
retCol.timestamp=tmpCollection.timestamp;retCol.criteria=tmpCollection.criteria;retCol.search=tmpCollection.search;retCol.order=collection.order;var direction=1;if(collection.order&&collection.order.length){if(collection.order[0].order!=tmpCollection.order[0].order){direction=-1}}retCol.objects=new Array(tmpCollection.objects.length);retCol.map_objects=new LRUKeyList();var counter=(direction==1)?0:tmpCollection.objects.length-1;for(var i=0;i<tmpCollection.objects.length;i++){var tmpObject=tmpCollection.objects[i];
if(tmpObject){retCol.objects[counter]=tmpObject;retCol.map_objects.set(tmpObject,counter+1)}else{if(debug){console.debug(tmpCollection.objects[i],i,"is missing")}}counter=counter+direction}}}return retCol}else{if(collection.objects){if(isModified){if(!tmpCallback.modified){var realmodified=false;for(var i=0;i<OXCache.modifiedObjects.length;i++){for(var i2=0;i2<collection.objects.length;i2++){if(OXCache.modifiedObjects[i].equals(collection.objects[i2])){realmodified=true;break}}}if(!realmodified){return
}}else{tmpCallback.modified=false}}var retCol=new OXCollection();retCol.objects=new Array();for(var i=0;i<collection.objects.length;i++){if(!collection.objects[i].hashCode||!collection.objects[i].equals){collection.objects[i]=oxMapping.objectConstructor.createfromObject(collection.objects[i])}var tmpObject=OXCache.cachedObjects.get(collection.objects[i])||OXCache.cachedObjectsTrash.get(collection.objects[i]);if(tmpObject){if(!tmpObject.hasColumns(collection.columns,{level:1})){if(debug){console.debug("Lost columns",collection.columns,clone(tmpObject),getStackTrace())
}OXCache.addRequest(oxMapping.module,collection,tmpCallback.fn,uniqueName);return}retCol.objects.push(tmpObject);retCol.map_objects.set(tmpObject,i+1)}else{if(debug){console.debug(collection.objects[i],i,"is missing")}}}return retCol}}}};OXAbstractMapping.criteriaRequest=function(oxMapping){return function(uniqueName,module,collection,callbackModified,callback,forceupdate){var onlymandatory=false;if(!collection.columns){var tmpColumns=new Array();for(var value in oxMapping.stringmapping){tmpColumns.push(value);
collection.columns=tmpColumns}}for(var i=0;i<collection.columns.length;i++){for(var i2=0;i2<oxMapping.mandatoryfields.length;i2++){if(collection.columns[i]==oxMapping.mandatoryfields[i2]){collection.columns.splice(i,1)}}}if(!collection.columns.length){onlymandatory=true}collection.columns=oxMapping.mandatoryfields.concat(collection.columns);var myCollection=oxMapping.getCollection(collection,false);if(myCollection){if(!forceupdate&&(myCollection.lastRequest&&myCollection.lastRequest>(new Date().getTime()-OXCache.updateTime))){if(!onlymandatory){for(var i=0;
i<myCollection.objects.length;i++){var tmpObject=OXCache.cachedObjects.get(myCollection.objects[i]);if(!(tmpObject&&tmpObject.hasColumns(collection.columns))){if(!tmpObject){if(myCollection.objects[i].hashCode){tmpObject=myCollection.objects[i]}}oxMapping.addCriteriaMissingColumn(collection.columns,tmpObject,uniqueName)}}}}else{oxMapping.addCriteriaExpired(collection,myCollection.timestamp,uniqueName)}}else{oxMapping.addCriteriaNotInCache(collection,uniqueName)}var tmpFn=OXCache.join.add();oxMapping.request();
delete oxMapping.requestCriteriaNotInCache;delete oxMapping.requestCriteriaExpired;delete oxMapping.requestCriteriaMissingColumn;tmpFn()}};OXAbstractMapping.listRequest=function(oxMapping){return function(uniqueName,module,collection,callbackModified,callback,forceupdate){var returnobject={};returnobject.clear=[];returnobject.set=[];var isrequest=false;if(collection.objects){if(!collection.columns){var cols=collection.columns=[];for(var value in oxMapping.stringmapping){cols.push(value)}if(oxMapping.alternative){for(var i in oxMapping.alternative){var alt=oxMapping.alternative[i];
if(typeof alt!="function"||alt()){cols.push(i)}}}}for(var i=0;i<collection.columns.length;i++){for(var i2=0;i2<oxMapping.mandatoryfields.length;i2++){if(collection.columns[i]==oxMapping.mandatoryfields[i2]){collection.columns.splice(i,1)}}}collection.columns=oxMapping.mandatoryfields.concat(collection.columns);for(var i=0;i<collection.objects.length;i++){var tmpVar=collection.objects[i];var tmpObject=oxMapping.objectConstructor.createfromObject(tmpVar);var myCacheObject=OXCache.cachedObjects.get(tmpObject);
if(myCacheObject){if(myCacheObject.hasColumns(collection.columns)){if(forceupdate||(!(myCacheObject.lastRequest>(new Date().getTime()-OXCache.updateTime)))){oxMapping.addListExpired(collection.columns,tmpObject,uniqueName);isrequest=true}returnobject.set.push(OXCache.cachedObjects.get(tmpObject))}else{oxMapping.addListMissingColumn(collection.columns,tmpObject,uniqueName);returnobject.clear.push(tmpObject);isrequest=true}}else{oxMapping.addListNotInCache(collection.columns,tmpObject,uniqueName);returnobject.clear.push(tmpObject);
isrequest=true}}}var tmpFn=OXCache.join.add();oxMapping.request();delete oxMapping.requestListNotInCache;delete oxMapping.requestListExpired;delete oxMapping.requestListMissingColumn;tmpFn();return isrequest?returnobject:{}}};OXAbstractMapping.addCriteriaNotInCache=function(oxMapping){return function(collection,uniqueName){if(!oxMapping.requestCriteriaNotInCache){oxMapping.requestCriteriaNotInCache=new Array()}var cnot=OXCache.requested.CNOT;for(var i=0;i<OXCache.requested.CNOT.length;i++){if(oxMapping.equalsCollection(cnot[i].collection,collection)){return
}}OXCache.requested.CNOT.push({collection:collection,uniqueName:uniqueName});oxMapping.requestCriteriaNotInCache.push({type:0,collection:collection,uniqueName:uniqueName})}};OXAbstractMapping.addCriteriaExpired=function(oxMapping){return function(collection,last_modified,uniqueName){if(!oxMapping.requestCriteriaExpired){oxMapping.requestCriteriaExpired=new Array()}var cexp=OXCache.requested.CEXP;for(var i=0;i<cexp;i++){if(oxMapping.equalsCollection(cexp[i].collection,collection)){return}}cexp.push({collection:collection,last_modified:last_modified});
oxMapping.requestCriteriaExpired.push({type:1,collection:collection,last_modified:last_modified,uniqueName:uniqueName})}};OXAbstractMapping.addCriteriaMissingColumn=function(oxMapping){return function(columns,object,uniqueName){if(!oxMapping.requestCriteriaMissingColumn){oxMapping.requestCriteriaMissingColumn=new Array()}var key=JSONX.serialize([columns,object]);if(OXCache.requested.CMIS[key]){return}OXCache.requested.CMIS[key]=true;oxMapping.requestCriteriaMissingColumn.push({type:2,columns:columns,object:object,uniqueName:uniqueName})
}};OXAbstractMapping.addListNotInCache=function(oxMapping){return function(columns,object,uniqueName){if(!oxMapping.requestListNotInCache){oxMapping.requestListNotInCache=new Array()}var key=JSONX.serialize([columns,object]);if(OXCache.requested.LNOT[key]){return}OXCache.requested.LNOT[key]=true;oxMapping.requestListNotInCache.push({type:3,columns:columns,object:object,uniqueName:uniqueName})}};OXAbstractMapping.addListExpired=function(oxMapping){return function(columns,object,uniqueName){if(!oxMapping.requestListExpired){oxMapping.requestListExpired=new Array()
}var key=JSONX.serialize([columns,object]);if(OXCache.requested.LEXP[key]){return}OXCache.requested.LEXP[key]=true;oxMapping.requestListExpired.push({type:4,columns:columns,object:object,uniqueName:uniqueName})}};OXAbstractMapping.addListMissingColumn=function(oxMapping){return function(columns,object,uniqueName){if(!oxMapping.requestListMissingColumn){oxMapping.requestListMissingColumn=new Array()}var key=JSONX.serialize([columns,object]);if(OXCache.requested.LMIS[key]){return}OXCache.requested.LMIS[key]=true;
oxMapping.requestListMissingColumn.push({type:5,columns:columns,object:object,uniqueName:uniqueName})}};OXAbstractMapping.repeatRequest=function(request){switch(request.type){case 0:this.addCriteriaNotInCache(request.collection,request.uniqueName);break;case 1:this.addCriteriaExpired(request.collection,request.last_modified,request.uniqueName);break;case 2:this.addCriteriaMissingColumn(request.columns,request.object,request.uniqueName);break;case 3:this.addListNotInCache(request.columns,request.object,request.uniqueName);
break;case 4:this.addListExpired(request.columns,request.object,request.uniqueName);break;case 5:this.addListMissingColumn(request.columns,request.object,request.uniqueName);break;default:if(debug){throw new Error("Invalid request type")}}};OXAbstractMapping.request=function(oxMapping){return function(){var multipleRequests=new Array();if(oxMapping.requestCriteriaNotInCache){for(var i=0;i<oxMapping.requestCriteriaNotInCache.length;i++){var tmpObject={action:"all",module:oxMapping.module};var cols=oxMapping.convertColumns(oxMapping.requestCriteriaNotInCache[i].collection.columns);
for(var j in cols){tmpObject[j]=cols[j].join(",")}for(var counter in oxMapping.requestCriteriaNotInCache[i].collection.criteria){switch(counter){case"folder_id":tmpObject.folder=oxMapping.requestCriteriaNotInCache[i].collection.criteria[counter];break;default:tmpObject[counter]=oxMapping.requestCriteriaNotInCache[i].collection.criteria[counter]}}if(oxMapping.requestCriteriaNotInCache[i].collection.search){var searchObject=oxMapping.requestCriteriaNotInCache[i].collection.search;var operator="or";
switch(oxMapping.module){case"tasks":for(var key in searchObject){var value=searchObject[key];if(key.toLowerCase()=="operator"&&value.toLowerCase()=="or"){operator="or"}else{if(key=="title"||key=="categories"||key=="note"){tmpObject.action="search";tmpObject.data={pattern:value};break}else{alert("This search"+searchObject+"is not supported for tasks")}}}break;case"contacts":if(searchObject.startletter){if(searchObject.last_name){tmpObject.action="search";tmpObject.data={pattern:searchObject.last_name,startletter:true};
if(tmpObject.folder){tmpObject.data.folder=tmpObject.folder}}else{alert("This search"+searchObject+"is not supported for contacts")}}else{if(searchObject.advancedSearch){tmpObject.action="advancedSearch";tmpObject.data={filter:searchObject.advancedSearch}}else{tmpObject.action="search";tmpObject.data={};if(tmpObject.folder){tmpObject.data.folder=tmpObject.folder}var searchFields={email1:1,email2:1,email3:1,display_name:1,first_name:1,last_name:1,company:1,categories:1,city_business:1,street_business:1,department:1,yomiFirstName:1,yomiLastName:1,yomiCompany:1};
for(var key in searchObject){var value=searchObject[key];if(key.toLowerCase()=="operator"&&value.toLowerCase()=="or"){tmpObject.data.orSearch=true}else{if(key in searchFields){tmpObject.data[key]=value}else{alert("This search"+searchObject+"is not supported for contacts")}}}}}break;case"mail":for(var key in searchObject){var value=searchObject[key];if(key.toLowerCase()=="operator"&&value.toLowerCase()=="or"){operator="or"}else{tmpObject.action="search";if(!tmpObject.data){tmpObject.data=[]}var tmpCol=oxMapping.convertColumns([trimStr(key)]).columns[0];
if(tmpCol){tmpObject.data.push({col:parseInt(tmpCol),pattern:searchObject[key]})}}}break;case"infostore":for(var key in searchObject){var value=searchObject[key];if(key.toLowerCase()=="operator"&&value.toLowerCase()=="or"){operator="or"}else{if(key=="title"||key=="url"||key=="filename"||key=="version_comment"||key=="categories"||key=="description"){tmpObject.action="search";tmpObject.data={pattern:value};break}else{alert("This search"+searchObject+"is not supported for tasks")}}}break}}if(oxMapping.requestCriteriaNotInCache[i].collection.order){var tmpOrder=oxMapping.requestCriteriaNotInCache[i].collection.order[0];
if(oxMapping.convertColumns([trimStr(tmpOrder.sort)]).columns[0]){tmpObject.sort=oxMapping.convertColumns([trimStr(tmpOrder.sort)]).columns[0];tmpObject.order=(tmpOrder.order.toLowerCase()=="desc")?"desc":"asc"}}multipleRequests.push(tmpObject)}}if(oxMapping.requestCriteriaExpired){for(var i=0;i<oxMapping.requestCriteriaExpired.length;i++){var tmpObject={action:"all",module:oxMapping.module};var cols=oxMapping.convertColumns(oxMapping.requestCriteriaExpired[i].collection.columns);for(var j in cols){tmpObject[j]=cols[j].join(",")
}var tmpObject2={action:"updates",module:oxMapping.module,timestamp:oxMapping.requestCriteriaExpired[i].last_modified||0,ignore:"deleted"};var cols=oxMapping.convertColumns(oxMapping.requestCriteriaExpired[i].collection.columns);for(var j in cols){tmpObject2[j]=cols[j].join(",")}for(var counter in oxMapping.requestCriteriaExpired[i].collection.criteria){switch(counter){case"folder_id":tmpObject.folder=oxMapping.requestCriteriaExpired[i].collection.criteria[counter];tmpObject2.folder=oxMapping.requestCriteriaExpired[i].collection.criteria[counter];
break;default:tmpObject[counter]=oxMapping.requestCriteriaExpired[i].collection.criteria[counter];tmpObject2[counter]=oxMapping.requestCriteriaExpired[i].collection.criteria[counter]}}if(oxMapping.requestCriteriaExpired[i].collection.search){var searchObject=oxMapping.requestCriteriaExpired[i].collection.search;var operator="or";switch(oxMapping.module){case"tasks":for(var key in oxMapping.requestCriteriaExpired[i].collection.search){var value=oxMapping.requestCriteriaExpired[i].collection.search[key];
if(key.toLowerCase()=="operator"&&value.toLowerCase()=="or"){operator="or"}else{if(key=="title"||key=="categories"||key=="note"){tmpObject.action="search";tmpObject.data={pattern:value};if(tmpObject.folder){tmpObject.data.folder=tmpObject.folder}}else{alert("This search"+oxMapping.requestCriteriaExpired[i].collection.search+"is not supported for tasks")}}}break;case"contacts":if(searchObject.startletter){if(searchObject.last_name){tmpObject.action="search";tmpObject.data={pattern:searchObject.last_name,startletter:true};
if(tmpObject.folder){tmpObject.data.folder=tmpObject.folder}}else{alert("This search"+searchObject+"is not supported for contacts")}}else{if(searchObject.advancedSearch){tmpObject.action="advancedSearch";tmpObject.data={filter:searchObject.advancedSearch}}else{tmpObject.action="search";tmpObject.data={};if(tmpObject.folder){tmpObject.data.folder=tmpObject.folder}for(var key in searchObject){var value=searchObject[key];if(key.toLowerCase()=="operator"&&value.toLowerCase()=="or"){tmpObject.data.orSearch=true
}else{if(key in {email1:1,email2:1,email3:1,display_name:1,first_name:1,last_name:1,company:1,categories:1,city_business:1,street_business:1,department:1}){tmpObject.data[key]=value}else{alert("This search"+searchObject+"is not supported for contacts")}}}}}break;case"mail":for(var key in searchObject){var value=searchObject[key];if(key.toLowerCase()=="operator"&&value.toLowerCase()=="or"){operator="or"}else{tmpObject.action="search";if(!tmpObject.data){tmpObject.data=[]}var tmpCol=oxMapping.convertColumns([trimStr(key)]).columns[0];
if(tmpCol){tmpObject.data.push({col:parseInt(tmpCol),pattern:searchObject[key]})}}}break;case"infostore":for(var key in searchObject){var value=searchObject[key];if(key.toLowerCase()=="operator"&&value.toLowerCase()=="or"){operator="or"}else{if(key=="title"||key=="url"||key=="filename"||key=="version_comment"||key=="categories"||key=="description"){tmpObject.action="search";tmpObject.data={pattern:value};break}else{alert("This search"+searchObject+"is not supported for tasks")}}}break}}if(oxMapping.requestCriteriaExpired[i].collection.order){var tmpOrder=oxMapping.requestCriteriaExpired[i].collection.order[0];
if(oxMapping.convertColumns([trimStr(tmpOrder.sort)]).columns[0]){tmpObject.sort=oxMapping.convertColumns([trimStr(tmpOrder.sort)]).columns[0];tmpObject.order=(tmpOrder.order.toLowerCase()=="desc")?"desc":"asc"}}multipleRequests.push(tmpObject);if(!tmpObject.search&&(tmpObject.action&&!tmpObject.action.search)&&!tmp.folder){multipleRequests.push(tmpObject2)}}}if(oxMapping.requestCriteriaMissingColumn&&oxMapping.requestCriteriaMissingColumn.length){var tmpData=[];var tmpColumns;var tmpObject={action:"list",module:oxMapping.module,data:tmpData};
for(var i=0;i<oxMapping.requestCriteriaMissingColumn.length;i++){if(!tmpColumns){tmpColumns=oxMapping.convertColumns(oxMapping.requestCriteriaMissingColumn[i].columns);for(var j in tmpColumns){tmpObject[j]=tmpColumns[j].join(",")}}var tmpString=oxMapping.requestCriteriaMissingColumn[i].object;tmpData.push({folder:tmpString.folder_id||tmpString.folder,id:tmpString.id})}multipleRequests.push(tmpObject)}processList(oxMapping.requestListNotInCache);processList(oxMapping.requestListExpired);processList(oxMapping.requestListMissingColumn);
function processList(list){if(!list||!list.length){return}var tmpData=[];var tmpColumns;var tmpAction="list";var param={view:"text"};for(var i=0;i<list.length;i++){if(!tmpColumns){tmpColumns=oxMapping.convertColumns(list[i].columns);for(var i2=0;i2<tmpColumns.columns.length;i2++){if(!tmpColumns.columns[i2]){tmpAction="get";list[i].get=true;var stringcolumn=list[i].columns[i2];if(stringcolumn=="attachments_plain"){param.view="text"}else{if(stringcolumn=="attachments_html"){param.view="html"}else{if(stringcolumn=="attachments_html_noimage"){param.view="noimg"
}else{if(stringcolumn=="unseen"){param.unseen="true"}}}}}}}var tmpString=list[i].object;if(tmpAction=="get"){var tmpObject={action:tmpAction,module:oxMapping.module,id:tmpString.id,folder:tmpString.folder_id||tmpString.folder};for(var i3 in param){tmpObject[i3]=param[i3]}multipleRequests.push(tmpObject)}else{var fields={};fields.folder=tmpString.folder_id||tmpString.folder;fields.id=tmpString.id;if(tmpString.recurrence_position!=undefined){fields.recurrence_position=tmpString.recurrence_position}tmpData.push(fields)
}}if(tmpAction=="list"){var tmpObject={action:tmpAction,module:oxMapping.module,data:tmpData};for(var i in tmpColumns){tmpObject[i]=tmpColumns[i].join()}multipleRequests.push(tmpObject)}}var tmpFn=OXCache.join.add();if(multipleRequests.length){if(debug){console.debug("Requests",multipleRequests)}(function(requestCriteriaNotInCache,requestCriteriaExpired,requestCriteriaMissingColumn,requestListNotInCache,requestListExpired,requestListMissingColumn){tmptime=new Date().getTime();OXCache.getJSONX(AjaxRoot+"/multiple?session="+session+"&continue=true",multipleRequests,function(response){oxMapping.handleResponse(response,requestCriteriaNotInCache,requestCriteriaExpired,requestCriteriaMissingColumn,requestListNotInCache,requestListExpired,requestListMissingColumn)
})})(clone(oxMapping.requestCriteriaNotInCache),clone(oxMapping.requestCriteriaExpired),clone(oxMapping.requestCriteriaMissingColumn),clone(oxMapping.requestListNotInCache),clone(oxMapping.requestListExpired),clone(oxMapping.requestListMissingColumn))}tmpFn()}};OXAbstractMapping.handleResponse=function(oxMapping){return function(response,requestCriteriaNotInCache,requestCriteriaExpired,requestCriteriaMissingColumn,requestListNotInCache,requestListExpired,requestListMissingColumn){tmptime=new Date().getTime();
for(var i in OXCache.modifiedCallbacks){var mc=OXCache.modifiedCallbacks[i];if(mc&&mc.module==oxMapping.module&&mc.before){mc.before()}}if(!response){response=[{code:"UII-CA001",error_id:"-internal-",category:6,error_params:[],error:"Unexpected: Unable to load data because the server response was empty! Please try again later or contact the system administrator!"}]}var count=0;for(var i=0;requestCriteriaNotInCache&&i<requestCriteriaNotInCache.length;i++){oxMapping.handleCriteriaNotInCache(requestCriteriaNotInCache[i].collection,response[count],requestCriteriaNotInCache[i].uniqueName);
count++}for(var i=0;requestCriteriaExpired&&i<requestCriteriaExpired.length;i++){if(requestCriteriaExpired[i].collection.search){oxMapping.handleCriteriaExpired(requestCriteriaExpired[i].collection,response[count],null,requestCriteriaExpired[i].uniqueName);count++}else{oxMapping.handleCriteriaExpired(requestCriteriaExpired[i].collection,response[count],response[count+1],requestCriteriaExpired[i].uniqueName);count++;count++}}if(requestCriteriaMissingColumn&&requestCriteriaMissingColumn.length){oxMapping.handleCriteriaMissingColumn(requestCriteriaMissingColumn,response[count],requestCriteriaMissingColumn.uniqueName);
count++}processList(requestListNotInCache,oxMapping.handleListNotInCache);processList(requestListExpired,oxMapping.handleListExpired);processList(requestListMissingColumn,oxMapping.handleListMissingColumn);function processList(list,handler){if(!list||!list.length){return}if(list[0].get){for(var i=0;i<list.length;i++){handler.call(oxMapping,list[i],response[count],list[i].uniqueName);count++}}else{handler.call(oxMapping,list,response[count],list[0].uniqueName);count++}}if(response[count]&&response[count].error){newServerError(response[count].error)
}}};OXAbstractMapping.handleCriteriaNotInCache=function(oxMapping){return function(request,response,uniqueName){if(debug){console.debug("Criteria not in cache:",request,response,uniqueName)}oxMapping.handleCriteria(request,response,null,uniqueName)}};OXAbstractMapping.handleCriteriaExpired=function(oxMapping){return function(request,response,response2,uniqueName){if(debug){console.debug("Criteria expired:",request,response,response2,uniqueName)}oxMapping.handleCriteria(request,response,response2,uniqueName)
}};OXAbstractMapping.handleCriteria=function(oxMapping){return function(request,response,response2,uniqueName){var tmpCollection=oxMapping.getCollection(request,false);if(response&&response.error||response2&&response2.error){oxMapping.errorHandler(uniqueName,request,response,response2);if(tmpCollection){return}response={data:[],timestamp:0}}if(response.data.length>OXCache.objectSize){OXCache.cachedObjects.free+=response.data.length-OXCache.objectSize;OXCache.objectSize=response.data.length}if(!tmpCollection){var tmpCollection=new OXCollection();
tmpCollection.criteria=request.criteria;tmpCollection.search=request.search;tmpCollection.order=request.order;tmpCollection.last_modified=response.timestamp;tmpCollection.timestamp=response.timestamp;tmpCollection.lastRequest=new Date().getTime();tmpCollection.objects=new Array(response.data.length);tmpCollection.map_objects=new LRUKeyList();tmpCollection.modified=true;for(var i=0;i<response.data.length;i++){var tmpObject=oxMapping.createKeyFromData(response.data[i],response.timestamp);tmpCollection.objects[i]=tmpObject;
tmpCollection.map_objects.set(tmpObject,i+1);oxMapping.createCacheObject(request.columns,response.data[i],response.timestamp,tmpObject)}oxMapping.checkAddCriteria(tmpCollection.objects,request);var tmp=OXCache.cachedCollections.set(OXCache.getSequence(),tmpCollection);if(tmp){OXCache.cachedCollectionsTrash.push({data:tmp})}tmpCollection.check=false}else{var tmpList=new LRUKeyList(response.data.length);var tmpArray=new Array(response.data.length);var changed=response.data.length!=tmpCollection.objects.length;
for(var i=0;i<response.data.length;i++){var tmpObject=oxMapping.createKeyFromData(response.data[i],response.timestamp);tmpList.set(tmpObject,i+1);tmpArray[i]=tmpObject}if(response2&&response2.data.length){for(var i=0;i<response2.data.length;i++){var tmpObject=oxMapping.createKeyFromData(response2.data[i],response2.timestamp);oxMapping.createCacheObject(request.columns,response2.data[i],response2.timestamp,tmpObject,true,tmpCollection);changed=true}}var toDelete=[];for(var i=0;i<tmpCollection.objects.length;
i++){if(!tmpList.get(tmpCollection.objects[i])){changed=true;toDelete.push(tmpCollection.objects[i])}}if(toDelete.length){oxMapping.deleteObjectsInternal(toDelete)}if(oxMapping.module=="mail"||request.search){for(var i=0;i<tmpArray.length;i++){if(!tmpCollection.map_objects.get(tmpArray[i])){oxMapping.createCacheObject(request.columns,response.data[i],response.timestamp,tmpArray[i],true,tmpCollection);changed=true}}}tmpCollection.objects=tmpArray;tmpCollection.order=request.order;tmpCollection.map_objects=tmpList;
if(changed){tmpCollection.last_modified=response.timestamp;tmpCollection.timestamp=response.timestamp;tmpCollection.modified=true}tmpCollection.check=false;tmpCollection.lastRequest=new Date().getTime()}}};OXAbstractMapping.checkAddCriteria=function(oxMapping){return function(objects,request){var collections=oxMapping.getSubCollections(request);for(var i=0;i<collections.length;i++){if(!oxMapping.equalsCollection(collections[i],request)){if(!collections[i].check){for(var i2=0;i2<objects.length;i2++){if(collections[i].map_objects.get(objects[i2])){collections[i].check=true;
break}}}}}}};OXAbstractMapping.checkAddEditDeleteObject=function(oxMapping){return function(object,executeCollection){var collections=oxMapping.getSubCollectionsfromObject(object,true);for(var i=0;i<collections.length;i++){if(!executeCollection||!oxMapping.equalsCollection(collections[i],executeCollection)){if(!collections[i].check){collections[i].check=true}}}for(var i in OXCache.modifiedCallbacks){if(OXCache.modifiedCallbacks[i].module==oxMapping.module&&!(OXCache.modifiedCallbacks[i].collection.criteria)){for(var count=0;
count<OXCache.modifiedCallbacks[i].collection.objects.length;count++){if(object.equals(OXCache.modifiedCallbacks[i].collection.objects[count])){OXCache.modifiedCallbacks[i].modified=true;break}}}}}};OXAbstractMapping.handleCriteriaMissingColumn=function(oxMapping){return function(request,response,uniqueName){if(debug){console.debug("Criteria missing column:",request,response,uniqueName)}oxMapping.handleList(request,response,uniqueName)}};OXAbstractMapping.handleListNotInCache=function(oxMapping){return function(request,response,uniqueName){if(debug){console.debug("Objects not in Cache:",request,response,uniqueName)
}oxMapping.handleList(request,response,uniqueName)}};OXAbstractMapping.handleListExpired=function(oxMapping){return function(request,response,uniqueName){if(debug){console.debug("Objects expired:",request,response,uniqueName)}oxMapping.handleList(request,response,uniqueName)}};OXAbstractMapping.handleListMissingColumn=function(oxMapping){return function(request,response,uniqueName){if(debug){console.debug("Objects columns missing:",request,response,uniqueName,getStackTrace())}oxMapping.handleList(request,response,uniqueName)
}};OXAbstractMapping.handleList=function(oxMapping){return function(request,response,uniqueName){if(response&&response.error){oxMapping.errorHandler(uniqueName,request,response);return}if(response.data&&response.data.constructor==Array){if(request.length==response.data.length){for(var i=0;i<request.length;i++){oxMapping.createCacheObject(request[i].columns,response.data[i],response.timestamp,0,true)}}else{var toDelete=[];for(var i=0;i<request.length;i++){var deleted=true;for(var i2=0;i2<response.data.length;
i2++){var key=oxMapping.createKeyFromData(response.data[i2]);if((key.folder_id||key.folder)==(request[i].object.folder_id||request[i].object.folder)&&key.id==request[i].object.id&&(request[i].object.recurrence_position||0)==(key.recurrence_position||0)){deleted=false;oxMapping.createCacheObject(request[i].columns,response.data[i2],response.timestamp,0,true);break}}if(deleted){toDelete.push(request[i].object)}}if(toDelete.length){oxMapping.deleteObjectsInternal(toDelete)}}}else{if(response.data){for(var i in request.object){if(response.data[i]===undefined){response.data[i]=request.object[i]
}}oxMapping.createCacheObject(request.columns,response.data,response.timestamp,0,true)}else{triggerEvent("OX_New_Error",4,_("Internal Fatal Error: Server response contains no or invalid data. Some functions may be disabled or not useable. (OC02="+request+")"))}}}};OXAbstractMapping.createCacheObject=function(oxMapping){return function(columns,data,timestamp,key,events,executeCollection){var itsupdate=false;var seen=false;if(!key){if(data.constructor==Array){key=oxMapping.createKeyFromData(data)}else{key=oxMapping.createKeyFromObject(data)
}}var tmpObject=key;var oldObject=OXCache.cachedObjects.get(key);if(!oldObject){if(data.constructor==Array){for(var i=0;i<columns.length;i++){var path=columns[i].split("/");if(path.length==1){tmpObject[columns[i]]=data[i]}else{var subObj=tmpObject[path[0]];if(!subObj){subObj=tmpObject[path[0]]={}}subObj[path[1]]=data[i]}}}else{for(var i=0;i<columns.length;i++){if(columns[i] in data){tmpObject[columns[i]]=data[columns[i]]}else{if(data[columns[i]]===undefined){if((oxMapping.module=="mail")&&(columns[i]=="attachments_plain"||columns[i]=="attachments_html"||columns[i]=="attachments_html_noimage")){tmpObject[columns[i]]=data.attachments||null;
if(data.modified&&data.modified==1){tmpObject.blocked_images=true}else{tmpObject.blocked_images=false}}else{if(columns[i]=="blocked_images"){}else{tmpObject[columns[i]]=null}}}}}if(oxMapping.module=="mail"&&(data.unread||data.unread==0)){ox.api.folder.update({local:true,folder:tmpObject.folder_id||tmpObject.folder,data:{unread:data.unread}})}}tmpObject.timestamp=timestamp;tmpObject.lastRequest=new Date().getTime();var tmp=OXCache.cachedObjects.set(tmpObject,tmpObject);if(tmp){OXCache.cachedObjectsTrash.set(tmp.key,tmp.data)
}if(events){oxMapping.checkAddEditDeleteObject(tmpObject,executeCollection)}if(oxMapping.module=="mail"&&(data.unread||data.unread==0)){ox.api.folder.update({local:true,folder:tmpObject.folder_id||tmpObject.folder,data:{unread:data.unread}})}}else{if(data.constructor==Array){for(var i=0;i<columns.length;i++){var path=columns[i].split("/");if(path.length==1){tmpObject[columns[i]]=data[i]}else{var subObj=tmpObject[path[0]];if(!subObj){subObj=oldObject[path[0]]||{};tmpObject[path[0]]=subObj}subObj[path[1]]=data[i]
}}}else{for(var i=0;i<columns.length;i++){if(columns[i] in data){tmpObject[columns[i]]=data[columns[i]]}else{if(data[columns[i]]===undefined){if((oxMapping.module=="mail")&&(columns[i]=="attachments_plain"||columns[i]=="attachments_html"||columns[i]=="attachments_html_noimage")){tmpObject[columns[i]]=data.attachments||null;if(data.modified&&data.modified==1){tmpObject.blocked_images=true}else{tmpObject.blocked_images=false}}else{if(columns[i]=="blocked_images"){}else{if(oxMapping.module=="mail"&&columns[i]=="level"){}else{tmpObject[columns[i]]=null
}}}}}}if(oxMapping.module=="mail"&&(data.unread||data.unread==0)){ox.api.folder.update({local:true,folder:tmpObject.folder_id||tmpObject.folder,data:{unread:data.unread}})}}if(oldObject.last_modified==tmpObject.last_modified){for(var i=0;i<columns.length;i++){var path=columns[i].split("/");if(path.length==1){var oldO=oldObject,col=path[0];var newvalue=tmpObject[col]}else{var oldO=oldObject[path[0]],col=path[1];var newvalue=tmpObject[path[0]][col]}var value=oldO&&oldO[col];if(value!==undefined&&newvalue!==undefined&&value!=newvalue&&!itsupdate&&typeof(value)!="object"){tmpObject.modified=true;
OXCache.modifiedObjects.push(tmpObject);itsupdate=true}if(newvalue!==undefined){if(!oldO){oldO=oldObject[path[0]]={}}oldO[col]=newvalue}}if(!tmpObject.modified){oldObject.lastRequest=new Date().getTime();if(oldObject.timestamp<timestamp){oldObject.timestamp=timestamp}OXCache.cachedObjects.set(oldObject,oldObject)}else{if(oxMapping.module=="mail"&&!tmpObject.level&&(oldObject.level||oldObject.level==0)){tmpObject.level=oldObject.level}tmpObject.lastRequest=new Date().getTime();if(tmpObject.timestamp<timestamp){tmpObject.timestamp=timestamp
}oxMapping.editObjectsInternal([tmpObject],tmpObject)}}else{tmpObject.lastRequest=new Date().getTime();tmpObject.timestamp=timestamp;tmpObject.modified=true;OXCache.modifiedObjects.push(tmpObject);var tmp=OXCache.cachedObjects.set(tmpObject,tmpObject);if(tmp){OXCache.cachedObjectsTrash.set(tmp.key,tmp.data)}if(events){oxMapping.checkAddEditDeleteObject(tmpObject,executeCollection)}}}}};OXAbstractMapping.getCollection=function(oxMapping){return function(collection,first){function search(myArray){for(var colCount in myArray){var tmpCollection=myArray[colCount].data;
var same=true;if(collection.criteria&&tmpCollection.criteria){for(var criteriaCount in tmpCollection.criteria){if(collection.criteria[criteriaCount]!=tmpCollection.criteria[criteriaCount]){same=false;break}}for(var criteriaCount in collection.criteria){if(tmpCollection.criteria[criteriaCount]!=collection.criteria[criteriaCount]){same=false;break}}}else{if(!(!collection.criteria&&!tmpCollection.criteria)){continue}}if(collection.search&&tmpCollection.search){for(var searchCount in tmpCollection.search){if(!equals(collection.search[searchCount],tmpCollection.search[searchCount])){same=false;
break}}}else{if(!(!collection.search&&!tmpCollection.search)){continue}}if(!same){continue}if(collection.order&&tmpCollection.order){if(collection.order.length!=tmpCollection.order.length){continue}var direction=0;for(var i=0;i<collection.order.length;i++){var tmpObject=collection.order[i];var tmpObject2=tmpCollection.order[i];if(tmpObject.sort!=tmpObject2.sort){same=false;break}if(tmpObject.order!=tmpObject2.order){if(!direction){direction=-1}if(direction!=-1){same=false;break}}else{if(!direction){direction=1
}if(direction!=1){same=false;break}}if(same!=true){break}}if(!same){continue}}else{if(!(!collection.order&&!tmpCollection.order)){continue}}if(first){var tmp1=OXCache.cachedCollections.get(colCount)}return tmpCollection}}return search(OXCache.cachedCollections.cache)||search(OXCache.cachedCollectionsTrash)}};OXAbstractMapping.equalsCollection=function(oxMapping){return function(collection1,collection2){if(collection1.criteria&&collection2.criteria){for(var criteriaCount in collection2){if(collection1.criteria[criteriaCount]!=collection2.criteria[criteriaCount]){return false
}}for(var criteriaCount in collection1.criteria){if(collection2.criteria[criteriaCount]!=collection1.criteria[criteriaCount]){return false}}}else{if(!(!collection1.criteria&&!collection2.criteria)){return false}}if(collection1.search&&collection2.search){for(var criteriaCount in collection2){if(collection1.search[criteriaCount]!=collection2.search[criteriaCount]){return false}}for(var criteriaCount in collection1.search){if(collection2.search[criteriaCount]!=collection1.search[criteriaCount]){return false
}}}else{if(!(!collection1.search&&!collection2.search)){return false}}if(collection1.order&&collection2.order){if(collection1.order.length!=collection2.order.length){return false}var direction=0;for(var i=0;i<collection1.order.length;i++){var tmpObject=collection1.order[i];var tmpObject2=collection2.order[i];if(tmpObject.sort!=tmpObject2.sort){return false}if(tmpObject.order!=tmpObject2.order){if(!direction){direction=-1}if(direction!=-1){return false}}else{if(!direction){direction=1}if(direction!=1){return false
}}}}else{if(!(!collection1.order&&!collection2.order)){return false}}return true}};OXAbstractMapping.getSubCollections=function(oxMapping){return function(collection,ignoreChecked){function search(myArray){var tmpArray=new Array();for(var colCount in myArray){var tmpCollection=myArray[colCount].data;if(ignoreChecked&&tmpCollection.check){continue}var same=true;if(collection.criteria&&tmpCollection.criteria){for(var criteriaCount in tmpCollection.criteria){if(collection.criteria[criteriaCount]!==undefined&&collection.criteria[criteriaCount]!=tmpCollection.criteria[criteriaCount]){same=false;
break}}}if(collection.search&&tmpCollection.search){for(var criteriaCount in tmpCollection.search){if(collection.search[criteriaCount]!==undefined&&!equals(collection.search[criteriaCount],tmpCollection.search[criteriaCount])){same=false;break}}}if(!same){continue}tmpArray.push(tmpCollection)}return tmpArray}return search(OXCache.cachedCollections.cache).concat(search(OXCache.cachedCollectionsTrash))}};OXAbstractMapping.getSubCollectionsfromObject=function(oxMapping){return function(object,ignoreChecked){function search(myArray){var tmpArray=new Array();
for(var colCount in myArray){var tmpCollection=myArray[colCount].data;if(ignoreChecked&&tmpCollection.check){continue}var same=true;if(tmpCollection.criteria){for(var criteriaCount in tmpCollection.criteria){if(same!=true){break}switch(criteriaCount){default:if(object[criteriaCount]!==undefined&&object[criteriaCount]!=tmpCollection.criteria[criteriaCount]){same=false;break}break}}}if(!same){continue}tmpArray.push(tmpCollection)}return tmpArray}return search(OXCache.cachedCollections.cache).concat(search(OXCache.cachedCollectionsTrash))
}};OXAbstractMapping.convertColumns=function(oxMapping){return function(columns){var retval={columns:[]};for(var i=0;i<columns.length;i++){var col=trimStr(columns[i]);var tmpColumn=oxMapping.stringmapping[col];if(!tmpColumn){var path=col.split("/");if(path.length==2){if(!(path[0] in retval)){retval[path[0]]=[]}retval[path[0]].push(path[1]);continue}if(oxMapping.alternative){tmpColumn=oxMapping.alternative[col]}if(typeof tmpColumn=="function"){tmpColumn=tmpColumn(true)}}if(!tmpColumn&&tmpColumn!=false){if(debug){alert("Column "+columns[i]+" not found in Mapping")
}}retval.columns.push(tmpColumn)}return retval}};OXAbstractMapping.setTag=function(oxMapping){return function(tag,ids){var multipleObject=[];for(var i=0;i<ids.length;i++){var o=OXCache.cachedObjects.get(oxMapping.createKeyFromObject(ids[i]));multipleObject.push({action:"update",module:o.module,timestamp:o.timestamp||0,id:o.id,folder:o.folder_id||o.folder,data:{color_label:tag}});if(o.recurrence_position&&o.recurrence_position>0){multipleObject[i]=o.recurrence_position}}json.put(AjaxRoot+"/multiple?session="+session+"&continue=true",multipleObject,null,function(callback){var timestamp=0;
for(var i=0;i<callback.length;i++){if(callback[i].error){newServerError(callback[i]);return}else{if(callback[i].timestamp&&callback[i].timestamp>timestamp){timestamp=callback[i].timestamp}}}oxMapping.editObjectsInternal(ids,{color_label:tag,timestamp:timestamp})})}};function OXTaskMapping(){}OXTaskMapping.mandatoryfields=["folder_id","id","last_modified","created_by","creation_date"];OXTaskMapping.idmapping={"1":"id","2":"created_by","3":"modified_by","4":"creation_date","5":"last_modified","20":"folder_id","100":"categories","101":"private_flag","104":"number_of_attachments","200":"title","201":"start_date","202":"end_date","203":"note","204":"alarm","209":"recurrence_type","212":"days","213":"days_in_month","214":"month","215":"internal","216":"until","220":"participants","221":"users","300":"status","301":"percent_completed","302":"actual_costs","303":"actual_duration","305":"billing_information","307":"target_costs","308":"target_duration","309":"priority","312":"currency","313":"trip_meter","314":"companies","315":"date_completed","102":"color_label"};
OXTaskMapping.stringmapping=switchStringObject(OXTaskMapping.idmapping);OXTaskMapping.module="tasks";OXTaskMapping.createKeyFromData=function(myArray,timestamp){var tmp=new OXTaskObjectCache();tmp.module=OXTaskMapping.module;tmp.folder_id=myArray[0];tmp.id=myArray[1];tmp.created_by=myArray[3];if(timestamp){tmp.timestamp=timestamp}return tmp};OXTaskMapping.createKeyFromObject=function(myObject){var tmp=new OXTaskObjectCache();tmp.module=OXTaskMapping.module;tmp.folder_id=myObject.folder_id;tmp.id=myObject.id;
tmp.created_by=myObject.created_by;return tmp};OXTaskMapping.objectConstructor=OXTaskObjectCache;OXTaskMapping.get=OXAbstractMapping.get(OXTaskMapping);OXTaskMapping.execute=OXAbstractMapping.execute(OXTaskMapping);OXTaskMapping.buildResponse=OXAbstractMapping.buildResponse(OXTaskMapping);OXTaskMapping.criteriaRequest=OXAbstractMapping.criteriaRequest(OXTaskMapping);OXTaskMapping.listRequest=OXAbstractMapping.listRequest(OXTaskMapping);OXTaskMapping.addCriteriaNotInCache=OXAbstractMapping.addCriteriaNotInCache(OXTaskMapping);
OXTaskMapping.addCriteriaExpired=OXAbstractMapping.addCriteriaExpired(OXTaskMapping);OXTaskMapping.addCriteriaMissingColumn=OXAbstractMapping.addCriteriaMissingColumn(OXTaskMapping);OXTaskMapping.addListNotInCache=OXAbstractMapping.addListNotInCache(OXTaskMapping);OXTaskMapping.addListExpired=OXAbstractMapping.addListExpired(OXTaskMapping);OXTaskMapping.addListMissingColumn=OXAbstractMapping.addListMissingColumn(OXTaskMapping);OXTaskMapping.request=OXAbstractMapping.request(OXTaskMapping);OXTaskMapping.handleResponse=OXAbstractMapping.handleResponse(OXTaskMapping);
OXTaskMapping.handleCriteriaNotInCache=OXAbstractMapping.handleCriteriaNotInCache(OXTaskMapping);OXTaskMapping.handleCriteriaExpired=OXAbstractMapping.handleCriteriaExpired(OXTaskMapping);OXTaskMapping.handleCriteriaMissingColumn=OXAbstractMapping.handleCriteriaMissingColumn(OXTaskMapping);OXTaskMapping.handleCriteria=OXAbstractMapping.handleCriteria(OXTaskMapping);OXTaskMapping.handleListNotInCache=OXAbstractMapping.handleListNotInCache(OXTaskMapping);OXTaskMapping.handleListExpired=OXAbstractMapping.handleListExpired(OXTaskMapping);
OXTaskMapping.handleListMissingColumn=OXAbstractMapping.handleListMissingColumn(OXTaskMapping);OXTaskMapping.handleList=OXAbstractMapping.handleList(OXTaskMapping);OXTaskMapping.getCollection=OXAbstractMapping.getCollection(OXTaskMapping);OXTaskMapping.convertColumns=OXAbstractMapping.convertColumns(OXTaskMapping);OXTaskMapping.createCacheObject=OXAbstractMapping.createCacheObject(OXTaskMapping);OXTaskMapping.checkAddCriteria=OXAbstractMapping.checkAddCriteria(OXTaskMapping);OXTaskMapping.checkAddEditDeleteObject=OXAbstractMapping.checkAddEditDeleteObject(OXTaskMapping);
OXTaskMapping.getSubCollectionsfromObject=OXAbstractMapping.getSubCollectionsfromObject(OXTaskMapping);OXTaskMapping.getSubCollections=OXAbstractMapping.getSubCollections(OXTaskMapping);OXTaskMapping.equalsCollection=OXAbstractMapping.equalsCollection(OXTaskMapping);OXTaskMapping.errorHandler=OXCache.errorHandler;OXTaskMapping.deleteObjectsInternal=function(objects){var tmpFn=OXCache.join.add();var oxMapping=OXTaskMapping;for(var i in OXCache.modifiedCallbacks){var mc=OXCache.modifiedCallbacks[i];
if(mc.module==oxMapping.module&&mc.before){mc.before()}}var tmpCollect=[];for(var mail=0;mail<objects.length;mail++){OXCache.cachedObjects.remove(objects[mail]);var collections=oxMapping.getSubCollectionsfromObject(objects[mail],true);for(var count=0;count<collections.length;count++){if(collections[count].check){continue}var index=collections[count].map_objects.get(objects[mail]);if(index){collections[count].modified=true;if(!collections[count].tmpIndexes){collections[count].tmpIndexes=[]}collections[count].tmpIndexes.push(index);
tmpCollect.push(collections[count]);collections[count].modifiedtmp=true}}}for(var count=0;count<tmpCollect.length;count++){if(tmpCollect[count].modifiedtmp){var indexes=tmpCollect[count].tmpIndexes;indexes.sort(function(a,b){return a-b});for(var i=indexes.length-1;i>=0;i--){tmpCollect[count].objects.splice(indexes[i]-1,1)}delete tmpCollect[count].tmpIndexes;tmpCollect[count].map_objects=new LRUKeyList();for(var index=0;index<tmpCollect[count].objects.length;index++){tmpCollect[count].map_objects.set(tmpCollect[count].objects[index],index+1)
}tmpCollect[count].modifiedtmp=false}}tmpFn()};OXTaskMapping.deleteObjects=function(objects,cb){var oxMapping=OXTaskMapping;for(var i=0;i<objects.length;i++){var tmpTime=objects[i]["timestamp"];if(!tmpTime){var tmpObject=OXCache.cachedObjects.get(objects[i]);if(tmpObject){tmpTime=tmpObject.timestamp}}var request=new Array();for(var i in objects){request.push({module:"tasks",action:"delete",folder:objects[i]["folder_id"],timestamp:objects[i]["timestamp"],data:{folder:objects[i]["folder_id"],id:objects[i]["id"]}})
}}json.put(AjaxRoot+"/multiple?session="+session+"&continue=true",request,null,function(reply){var tmpFn=OXCache.join.add(cb);var error=new Array();for(var i=0;i<reply.length;i++){if(reply[i].error){newServerError(reply[i]);error.push(i)}}if(!error.length){oxMapping.deleteObjectsInternal(objects)}tmpFn()})};OXTaskMapping.editObjectsInternal=function(oldObjects,changes,checkExist){var oxMapping=OXTaskMapping;var tmpFn=OXCache.join.add();for(var myObject in oldObjects){var tmpKeyOld=oxMapping.createKeyFromObject(oldObjects[myObject]);
var collections=oxMapping.getSubCollectionsfromObject(oldObjects[myObject],true);for(var i=0;i<collections.length;i++){if(!collections[i].check){collections[i].check=true}}for(var i in OXCache.modifiedCallbacks){if(OXCache.modifiedCallbacks[i].module==oxMapping.module&&!(OXCache.modifiedCallbacks[i].collection.criteria)){for(var count=0;count<OXCache.modifiedCallbacks[i].collection.objects.length;count++){if(tmpKeyOld.equals(OXCache.modifiedCallbacks[i].collection.objects[count])){var mc=OXCache.modifiedCallbacks[i];
if(!mc.modified&&mc.before){mc.before()}mc.modified=true}}}}var tmpObjectOld=OXCache.cachedObjects.get(tmpKeyOld);if(tmpObjectOld){if(changes){for(var i in changes){if(!checkExist||tmpObjectOld[i]!==undefined){if(i!="notification"){tmpObjectOld[i]=changes[i]}}}}}OXCache.cachedObjects.set(tmpKeyOld,tmpObjectOld)}tmpFn()};OXTaskMapping.editObjects=function(oldObjects,changes){setTimeout(function(){var tmpFn=OXCache.join.add();OXTaskMapping.editObjectsInternal(oldObjects,changes);tmpFn()},0)};OXTaskMapping.createObject=function(newObject){setTimeout(function(){var tmpFn=OXCache.join.add();
OXTaskMapping.createObjectsInternal([newObject]);tmpFn()},0)};OXTaskMapping.createObjectsInternal=function(newObjects){setTimeout(function(){var oxMapping=OXTaskMapping;for(var i in OXCache.modifiedCallbacks){var mc=OXCache.modifiedCallbacks[i];if(mc.module==oxMapping.module&&mc.before){mc.before()}}var tmpFn=OXCache.join.add();for(var object in newObjects){var collections=oxMapping.getSubCollectionsfromObject(newObjects[object],true);for(var i=0;i<collections.length;i++){if(!collections[i].check){collections[i].check=true
}}}tmpFn()},0)};OXTaskMapping.setTag=OXAbstractMapping.setTag(OXTaskMapping);OXCache.setMapping("tasks",OXTaskMapping);function OXCalendarMapping(){}OXCalendarMapping.mandatoryfields=["folder_id","id","recurrence_position","last_modified","created_by"];OXCalendarMapping.idmapping={"1":"id","2":"created_by","3":"modified_by","4":"creation_date","5":"last_modified","20":"folder_id","100":"categories","101":"private_flag","102":"color_label","104":"number_of_attachments","200":"title","201":"start_date","202":"end_date","203":"note","204":"alarm","207":"recurrence_position","208":"recurrence_date_position","209":"recurrence_type","212":"days","213":"days_in_month","214":"month","215":"interval","216":"until","220":"participants","221":"users","400":"location","401":"full_time","402":"shown_as","206":"recurrence_id"};
OXCalendarMapping.module="calendar";OXCalendarMapping.createKeyFromData=function(myArray,timestamp){var tmp=new OXCalendarObjectCache();tmp.module=OXCalendarMapping.module;tmp.folder_id=myArray[0];tmp.id=myArray[1];tmp.recurrence_position=myArray[2]||0;tmp.created_by=myArray[4];if(timestamp){tmp.timestamp=timestamp}return tmp};OXCalendarMapping.createKeyFromObject=function(myObject){var tmp=new OXCalendarObjectCache();tmp.module=OXCalendarMapping.module;tmp.folder_id=myObject.folder_id;tmp.id=myObject.id;
tmp.recurrence_position=myObject.recurrence_position;tmp.created_by=myObject.created_by;return tmp};OXCalendarMapping.objectConstructor=OXCalendarObjectCache;OXCalendarMapping.stringmapping=switchStringObject(OXCalendarMapping.idmapping);OXCalendarMapping.get=OXAbstractMapping.get(OXCalendarMapping);OXCalendarMapping.execute=OXAbstractMapping.execute(OXCalendarMapping);OXCalendarMapping.buildResponse=OXAbstractMapping.buildResponse(OXCalendarMapping);OXCalendarMapping.criteriaRequest=OXAbstractMapping.criteriaRequest(OXCalendarMapping);
OXCalendarMapping.listRequest=OXAbstractMapping.listRequest(OXCalendarMapping);OXCalendarMapping.addCriteriaNotInCache=OXAbstractMapping.addCriteriaNotInCache(OXCalendarMapping);OXCalendarMapping.addCriteriaExpired=OXAbstractMapping.addCriteriaExpired(OXCalendarMapping);OXCalendarMapping.addCriteriaMissingColumn=OXAbstractMapping.addCriteriaMissingColumn(OXCalendarMapping);OXCalendarMapping.addListNotInCache=OXAbstractMapping.addListNotInCache(OXCalendarMapping);OXCalendarMapping.addListExpired=OXAbstractMapping.addListExpired(OXCalendarMapping);
OXCalendarMapping.addListMissingColumn=OXAbstractMapping.addListMissingColumn(OXCalendarMapping);OXCalendarMapping.request=OXAbstractMapping.request(OXCalendarMapping);OXCalendarMapping.handleResponse=OXAbstractMapping.handleResponse(OXCalendarMapping);OXCalendarMapping.handleCriteriaNotInCache=OXAbstractMapping.handleCriteriaNotInCache(OXCalendarMapping);OXCalendarMapping.handleCriteriaExpired=OXAbstractMapping.handleCriteriaExpired(OXCalendarMapping);OXCalendarMapping.handleCriteriaMissingColumn=OXAbstractMapping.handleCriteriaMissingColumn(OXCalendarMapping);
OXCalendarMapping.handleCriteria=OXAbstractMapping.handleCriteria(OXCalendarMapping);OXCalendarMapping.handleListNotInCache=OXAbstractMapping.handleListNotInCache(OXCalendarMapping);OXCalendarMapping.handleListExpired=OXAbstractMapping.handleListExpired(OXCalendarMapping);OXCalendarMapping.handleListMissingColumn=OXAbstractMapping.handleListMissingColumn(OXCalendarMapping);OXCalendarMapping.handleList=OXAbstractMapping.handleList(OXCalendarMapping);OXCalendarMapping.getCollection=OXAbstractMapping.getCollection(OXCalendarMapping);
OXCalendarMapping.convertColumns=OXAbstractMapping.convertColumns(OXCalendarMapping);OXCalendarMapping.createCacheObject=OXAbstractMapping.createCacheObject(OXCalendarMapping);OXCalendarMapping.checkAddCriteria=OXAbstractMapping.checkAddCriteria(OXCalendarMapping);OXCalendarMapping.checkAddEditDeleteObject=OXAbstractMapping.checkAddEditDeleteObject(OXCalendarMapping);OXCalendarMapping.getSubCollectionsfromObject=OXAbstractMapping.getSubCollectionsfromObject(OXCalendarMapping);OXCalendarMapping.getSubCollections=OXAbstractMapping.getSubCollections(OXCalendarMapping);
OXCalendarMapping.equalsCollection=OXAbstractMapping.equalsCollection(OXCalendarMapping);OXCalendarMapping.errorHandler=OXCache.errorHandler;OXCalendarMapping.editObjectsInternal=function(oldObjects,changes,checkExist){var oxMapping=OXCalendarMapping;var tmpFn=OXCache.join.add();for(var myObject in oldObjects){var tmpKeyOld=oxMapping.createKeyFromObject(oldObjects[myObject]);var collections=oxMapping.getSubCollectionsfromObject(oldObjects[myObject],true);for(var i=0;i<collections.length;i++){if(!collections[i].check){collections[i].check=true
}}for(var i in OXCache.modifiedCallbacks){if(OXCache.modifiedCallbacks[i].module==oxMapping.module&&!(OXCache.modifiedCallbacks[i].collection.criteria)){for(var count=0;count<OXCache.modifiedCallbacks[i].collection.objects.length;count++){if(tmpKeyOld.equals(OXCache.modifiedCallbacks[i].collection.objects[count])){var mc=OXCache.modifiedCallbacks[i];if(!mc.modified&&mc.before){mc.before()}mc.modified=true}}}}var tmpObjectOld=OXCache.cachedObjects.get(tmpKeyOld);if(tmpObjectOld){if(changes){for(var i in changes){if(!checkExist||tmpObjectOld[i]!==undefined){if(i!="notification"){tmpObjectOld[i]=changes[i]
}}}}}OXCache.cachedObjects.set(tmpKeyOld,tmpObjectOld)}tmpFn()};OXCache.setMapping("calendar",OXCalendarMapping);function OXContactMapping(){}OXContactMapping.mandatoryfields=["folder_id","id","last_modified","created_by"];OXContactMapping.idmapping={"1":"id","2":"created_by","3":"modified_by","4":"creation_date","5":"last_modified","20":"folder_id","100":"categories","101":"private_flag","500":"display_name","501":"first_name","502":"last_name","503":"second_name","504":"suffix","505":"title","506":"street_home","507":"postal_code_home","508":"city_home","509":"state_home","510":"country_home","511":"birthday","512":"marital_status","513":"number_of_children","514":"profession","515":"nickname","516":"spouse_name","517":"anniversary","518":"note","519":"department","520":"position","521":"employee_type","522":"room_number","523":"street_business","525":"postal_code_business","526":"city_business","527":"state_business","528":"country_business","529":"number_of_employees","530":"sales_volume","531":"tax_id","532":"commercial_register","533":"branches","534":"business_category","535":"info","536":"manager_name","537":"assistant_name","538":"street_other","539":"city_other","540":"postal_code_other","541":"country_other","542":"telephone_business1","543":"telephone_business2","544":"fax_business","545":"telephone_callback","546":"telephone_car","547":"telephone_company","548":"telephone_home1","549":"telephone_home2","550":"fax_home","551":"cellular_telephone1","552":"cellular_telephone2","553":"telephone_other","554":"fax_other","555":"email1","556":"email2","557":"email3","558":"url","559":"telephone_isdn","560":"telephone_pager","561":"telephone_primary","562":"telephone_radio","563":"telephone_telex","564":"telephone_ttytdd","565":"instant_messenger1","566":"instant_messenger2","567":"telephone_ip","568":"telephone_assistant","569":"company","571":"userfield01","572":"userfield02","573":"userfield03","574":"userfield04","575":"userfield05","576":"userfield06","577":"userfield07","578":"userfield08","579":"userfield09","580":"userfield10","581":"userfield11","582":"userfield12","583":"userfield13","584":"userfield14","585":"userfield15","586":"userfield16","587":"userfield17","588":"userfield18","589":"userfield19","590":"userfield20","592":"distribution_list","594":"number_of_distribution_list","596":"contains_image1","597":"image_last_modified","598":"state_other","599":"file_as","104":"number_of_attachments","601":"image1_content_type","602":"mark_as_distributionlist","605":"default_address","102":"color_label","524":"internal_userid","606":"image1_url"};
OXContactMapping.alternative={sort:function(convert){return convert?"607":false}};OXContactMapping.stringmapping=switchStringObject(OXContactMapping.idmapping);OXContactMapping.module="contacts";OXContactMapping.createKeyFromData=function(myArray,timestamp){var tmp=new OXContactObjectCache();tmp.module=OXContactMapping.module;tmp.folder_id=myArray[0];tmp.id=myArray[1];tmp.created_by=myArray[3];if(timestamp){tmp.timestamp=timestamp}return tmp};OXContactMapping.createKeyFromObject=function(myObject){var tmp=new OXContactObjectCache();
tmp.module=OXContactMapping.module;tmp.folder_id=myObject.folder_id;tmp.id=myObject.id;tmp.created_by=myObject.created_by;return tmp};OXContactMapping.objectConstructor=OXContactObjectCache;OXContactMapping.get=OXAbstractMapping.get(OXContactMapping);OXContactMapping.execute=OXAbstractMapping.execute(OXContactMapping);OXContactMapping.buildResponse=OXAbstractMapping.buildResponse(OXContactMapping);OXContactMapping.criteriaRequest=OXAbstractMapping.criteriaRequest(OXContactMapping);OXContactMapping.listRequest=OXAbstractMapping.listRequest(OXContactMapping);
OXContactMapping.addCriteriaNotInCache=OXAbstractMapping.addCriteriaNotInCache(OXContactMapping);OXContactMapping.addCriteriaExpired=OXAbstractMapping.addCriteriaExpired(OXContactMapping);OXContactMapping.addCriteriaMissingColumn=OXAbstractMapping.addCriteriaMissingColumn(OXContactMapping);OXContactMapping.addListNotInCache=OXAbstractMapping.addListNotInCache(OXContactMapping);OXContactMapping.addListExpired=OXAbstractMapping.addListExpired(OXContactMapping);OXContactMapping.addListMissingColumn=OXAbstractMapping.addListMissingColumn(OXContactMapping);
OXContactMapping.request=OXAbstractMapping.request(OXContactMapping);OXContactMapping.handleResponse=OXAbstractMapping.handleResponse(OXContactMapping);OXContactMapping.handleCriteriaNotInCache=OXAbstractMapping.handleCriteriaNotInCache(OXContactMapping);OXContactMapping.handleCriteriaExpired=OXAbstractMapping.handleCriteriaExpired(OXContactMapping);OXContactMapping.handleCriteriaMissingColumn=OXAbstractMapping.handleCriteriaMissingColumn(OXContactMapping);OXContactMapping.handleCriteria=OXAbstractMapping.handleCriteria(OXContactMapping);
OXContactMapping.handleListNotInCache=OXAbstractMapping.handleListNotInCache(OXContactMapping);OXContactMapping.handleListExpired=OXAbstractMapping.handleListExpired(OXContactMapping);OXContactMapping.handleListMissingColumn=OXAbstractMapping.handleListMissingColumn(OXContactMapping);OXContactMapping.handleList=OXAbstractMapping.handleList(OXContactMapping);OXContactMapping.getCollection=OXAbstractMapping.getCollection(OXContactMapping);OXContactMapping.convertColumns=OXAbstractMapping.convertColumns(OXContactMapping);
OXContactMapping.createCacheObject=OXAbstractMapping.createCacheObject(OXContactMapping);OXContactMapping.checkAddCriteria=OXAbstractMapping.checkAddCriteria(OXContactMapping);OXContactMapping.checkAddEditDeleteObject=OXAbstractMapping.checkAddEditDeleteObject(OXContactMapping);OXContactMapping.getSubCollectionsfromObject=OXAbstractMapping.getSubCollectionsfromObject(OXContactMapping);OXContactMapping.getSubCollections=OXAbstractMapping.getSubCollections(OXContactMapping);OXContactMapping.equalsCollection=OXAbstractMapping.equalsCollection(OXContactMapping);
OXContactMapping.errorHandler=OXCache.errorHandler;OXContactMapping.deleteObjectsInternal=function(objects){var tmpFn=OXCache.join.add();var oxMapping=OXContactMapping;for(var i in OXCache.modifiedCallbacks){var mc=OXCache.modifiedCallbacks[i];if(mc.module==oxMapping.module&&mc.before){mc.before()}}var tmpCollect=[];for(var mail=0;mail<objects.length;mail++){OXCache.cachedObjects.remove(objects[mail]);var collections=oxMapping.getSubCollectionsfromObject(objects[mail],true);for(var count=0;count<collections.length;
count++){if(collections[count].check){continue}var index=collections[count].map_objects.get(objects[mail]);if(index){collections[count].modified=true;if(!collections[count].tmpIndexes){collections[count].tmpIndexes=[]}collections[count].tmpIndexes.push(index);tmpCollect.push(collections[count]);collections[count].modifiedtmp=true}}}for(var count=0;count<tmpCollect.length;count++){if(tmpCollect[count].modifiedtmp){var indexes=tmpCollect[count].tmpIndexes;indexes.sort(function(a,b){return a-b});for(var i=indexes.length-1;
i>=0;i--){tmpCollect[count].objects.splice(indexes[i]-1,1)}delete tmpCollect[count].tmpIndexes;tmpCollect[count].map_objects=new LRUKeyList();for(var index=0;index<tmpCollect[count].objects.length;index++){tmpCollect[count].map_objects.set(tmpCollect[count].objects[index],index+1)}tmpCollect[count].modifiedtmp=false}}tmpFn()};OXContactMapping.deleteObjects=function(objects,cb){var oxMapping=OXContactMapping;var request=new Array();for(var i in objects){var tmpTime=objects[i]["timestamp"];if(!tmpTime){var tmpObject=OXCache.cachedObjects.get(objects[i]);
if(tmpObject){tmpTime=tmpObject.timestamp}}request.push({module:oxMapping.module,action:"delete",folder:objects[i]["folder_id"],timestamp:tmpTime,data:{folder:objects[i]["folder_id"],id:objects[i]["id"]}})}json.put(AjaxRoot+"/multiple?session="+session+"&continue=true",request,null,function(reply){var tmpFn=OXCache.join.add(cb);var error=new Array();for(var i=0;i<reply.length;i++){if(reply[i].error){newServerError(reply[i]);error.push(i)}}if(!error.length){oxMapping.deleteObjectsInternal(objects)
}tmpFn()})};OXContactMapping.editObjects=function(oldObjects,changes){setTimeout(function(){var tmpFn=OXCache.join.add();OXContactMapping.editObjectsInternal(oldObjects,changes);tmpFn()},0)};OXContactMapping.editObjectsInternal=function(oldObjects,changes,checkExist){var oxMapping=OXContactMapping;var tmpFn=OXCache.join.add();for(var myObject in oldObjects){var tmpKeyOld=oxMapping.createKeyFromObject(oldObjects[myObject]);var collections=oxMapping.getSubCollectionsfromObject(oldObjects[myObject],true);
for(var i=0;i<collections.length;i++){if(!collections[i].check){collections[i].check=true}}for(var i in OXCache.modifiedCallbacks){if(OXCache.modifiedCallbacks[i].module==oxMapping.module&&!(OXCache.modifiedCallbacks[i].collection.criteria)){for(var count=0;count<OXCache.modifiedCallbacks[i].collection.objects.length;count++){if(tmpKeyOld.equals(OXCache.modifiedCallbacks[i].collection.objects[count])){var mc=OXCache.modifiedCallbacks[i];if(!mc.modified&&mc.before){mc.before()}mc.modified=true}}}}var tmpObjectOld=OXCache.cachedObjects.get(tmpKeyOld);
if(tmpObjectOld){if(changes){for(var i in changes){if(!checkExist||tmpObjectOld[i]!==undefined){if(i!="notification"){tmpObjectOld[i]=changes[i]}}}}}OXCache.cachedObjects.set(tmpKeyOld,tmpObjectOld)}tmpFn()};OXContactMapping.createObject=function(newObject){setTimeout(function(){var tmpFn=OXCache.join.add();OXContactMapping.createObjectsInternal([newObject]);tmpFn()},0)};OXContactMapping.createObjectsInternal=function(newObjects){setTimeout(function(){var oxMapping=OXContactMapping;for(var i in OXCache.modifiedCallbacks){var mc=OXCache.modifiedCallbacks[i];
if(mc.module==oxMapping.module&&mc.before){mc.before()}}var tmpFn=OXCache.join.add();for(var object in newObjects){var collections=oxMapping.getSubCollectionsfromObject(newObjects[object],true);for(var i=0;i<collections.length;i++){if(!collections[i].check){collections[i].check=true}}}tmpFn()},0)};OXContactMapping.setTag=OXAbstractMapping.setTag(OXContactMapping);OXCache.setMapping("contacts",OXContactMapping);function OXMailMapping(){}OXMailMapping.mandatoryfields=["id","folder_id"];OXMailMapping.idmapping={"600":"id","601":"folder_id","602":"attachment","603":"from","604":"to","605":"cc","606":"bcc","607":"subject","608":"size","609":"sent_date","610":"received_date","611":"flags","612":"level","614":"priority","102":"color_label","652":"account_name"};
(function(){function returnFalse(){return false}OXMailMapping.alternative={user:returnFalse,attachments:returnFalse,nested_msgs:returnFalse,attachments_html:function(convert){if(convert){return false}return configGetKey("mail.inlineattachments")&&configGetKey("modules.mail.allowhtmlimages")},attachments_html_noimage:function(convert){if(convert){return false}return configGetKey("mail.inlineattachments")&&!configGetKey("modules.mail.allowhtmlimages")},attachments_plain:function(convert){if(convert){return false
}return !configGetKey("mail.inlineattachments")},blocked_images:returnFalse,mailtext:"-1",disp_notification_to:"613",flags_sort:"651",headers:returnFalse}})();OXMailMapping.GETHTML=["id","folder_id","attachment","attachments_html","from","to","cc","bcc","subject","size","sent_date","received_date","flags","priority","color_label","account_name","user","nested_msgs","disp_notification_to","flags_sort","headers"];OXMailMapping.GETPLAIN=["id","folder_id","attachment","attachments_plain","from","to","cc","bcc","subject","size","sent_date","received_date","flags","priority","color_label","account_name","user","nested_msgs","disp_notification_to","flags_sort","headers"];
OXMailMapping.GETHTMLNOIMAGE=["id","folder_id","attachment","attachments_html_noimage","blocked_images","from","to","cc","bcc","subject","size","sent_date","received_date","flags","priority","color_label","account_name","user","nested_msgs","disp_notification_to","flags_sort","headers"];OXMailMapping.flagmapping={seen:{flag:32,bool:true},unseen:{flag:32,bool:false},answer:{flag:1,bool:true},answered:{flag:1,bool:false},"delete":{flag:2,bool:true},undelete:{flag:2,bool:false},spam:{flag:128,bool:true},ham:{flag:128,bool:false}};
OXMailMapping.module="mail";OXMailMapping.createKeyFromData=function(myArray,timestamp){var tmp=new OXMailObjectCache();tmp.module=OXMailMapping.module;tmp.folder_id=myArray[1];tmp.id=myArray[0];return tmp};OXMailMapping.createKeyFromObject=function(myObject){var tmp=new OXMailObjectCache();tmp.module=OXMailMapping.module;tmp.folder_id=myObject.folder_id;tmp.id=myObject.id;return tmp};OXMailMapping.stringmapping=switchStringObject(OXMailMapping.idmapping);OXMailMapping.objectConstructor=OXMailObjectCache;
OXMailMapping.stringmapping=switchStringObject(OXMailMapping.idmapping);OXMailMapping.get=OXAbstractMapping.get(OXMailMapping);OXMailMapping.execute=OXAbstractMapping.execute(OXMailMapping);OXMailMapping.buildResponse=OXAbstractMapping.buildResponse(OXMailMapping);OXMailMapping.criteriaRequest=OXAbstractMapping.criteriaRequest(OXMailMapping);OXMailMapping.listRequest=OXAbstractMapping.listRequest(OXMailMapping);OXMailMapping.addCriteriaNotInCache=OXAbstractMapping.addCriteriaNotInCache(OXMailMapping);
OXMailMapping.addCriteriaExpired=OXAbstractMapping.addCriteriaExpired(OXMailMapping);OXMailMapping.addCriteriaMissingColumn=OXAbstractMapping.addCriteriaMissingColumn(OXMailMapping);OXMailMapping.addListNotInCache=OXAbstractMapping.addListNotInCache(OXMailMapping);OXMailMapping.addListExpired=OXAbstractMapping.addListExpired(OXMailMapping);OXMailMapping.addListMissingColumn=OXAbstractMapping.addListMissingColumn(OXMailMapping);OXMailMapping.request=OXAbstractMapping.request(OXMailMapping);OXMailMapping.handleResponse=OXAbstractMapping.handleResponse(OXMailMapping);
OXMailMapping.handleCriteriaNotInCache=OXAbstractMapping.handleCriteriaNotInCache(OXMailMapping);OXMailMapping.handleCriteriaExpired=OXAbstractMapping.handleCriteriaExpired(OXMailMapping);OXMailMapping.handleCriteriaMissingColumn=OXAbstractMapping.handleCriteriaMissingColumn(OXMailMapping);OXMailMapping.handleCriteria=OXAbstractMapping.handleCriteria(OXMailMapping);OXMailMapping.handleListNotInCache=OXAbstractMapping.handleListNotInCache(OXMailMapping);OXMailMapping.handleListExpired=OXAbstractMapping.handleListExpired(OXMailMapping);
OXMailMapping.handleListMissingColumn=OXAbstractMapping.handleListMissingColumn(OXMailMapping);OXMailMapping.handleList=OXAbstractMapping.handleList(OXMailMapping);OXMailMapping.getCollection=OXAbstractMapping.getCollection(OXMailMapping);OXMailMapping.convertColumns=OXAbstractMapping.convertColumns(OXMailMapping);OXMailMapping.createCacheObject=OXAbstractMapping.createCacheObject(OXMailMapping);OXMailMapping.checkAddCriteria=OXAbstractMapping.checkAddCriteria(OXMailMapping);OXMailMapping.checkAddEditDeleteObject=OXAbstractMapping.checkAddEditDeleteObject(OXMailMapping);
OXMailMapping.getSubCollectionsfromObject=OXAbstractMapping.getSubCollectionsfromObject(OXMailMapping);OXMailMapping.getSubCollections=OXAbstractMapping.getSubCollections(OXMailMapping);OXMailMapping.equalsCollection=OXAbstractMapping.equalsCollection(OXMailMapping);OXMailMapping.errorHandler=function(uniqueName,request,response,response2){if(debug){console.debug("Error",uniqueName,request,response,response2)}if(response.error){switch(response.code){case"MSG-0032":triggerEvent("OX_Global_Error",4,formatError(response));
OXMailMapping.deleteObjectsInternal([request.object]);break;default:OXCache.errorHandler(uniqueName,request,response,response2);break}}return};OXMailMapping.deleteObjectsInternal=function(objects){var objects_tmp=new Array(objects.length);for(var i=0;i<objects.length;i++){objects_tmp[i]=objects[i]}var tmpFn=OXCache.join.add();var oxMapping=OXMailMapping;for(var i in OXCache.modifiedCallbacks){var mc=OXCache.modifiedCallbacks[i];if(mc.module==oxMapping.module&&mc.before){mc.before()}}var tmpCollect=[];
for(var mail=0;mail<objects_tmp.length;mail++){OXCache.cachedObjects.remove(objects_tmp[mail]);var collections=oxMapping.getSubCollectionsfromObject(objects_tmp[mail],true);for(var count=0;count<collections.length;count++){if(collections[count].check){continue}var index=collections[count].map_objects.get(objects_tmp[mail]);if(index){collections[count].modified=true;if(!collections[count].tmpIndexes){collections[count].tmpIndexes=[]}collections[count].tmpIndexes.push(index);tmpCollect.push(collections[count]);
collections[count].modifiedtmp=true}}}for(var count=0;count<tmpCollect.length;count++){if(tmpCollect[count].modifiedtmp){var indexes=tmpCollect[count].tmpIndexes;indexes.sort(function(a,b){return a-b});for(var i=indexes.length-1;i>=0;i--){tmpCollect[count].objects.splice(indexes[i]-1,1)}delete tmpCollect[count].tmpIndexes;tmpCollect[count].map_objects=new LRUKeyList();for(var index=0;index<tmpCollect[count].objects.length;index++){tmpCollect[count].map_objects.set(tmpCollect[count].objects[index],index+1)
}tmpCollect[count].modifiedtmp=false}}for(var i2 in OXCache.modifiedCallbacks){var mc=OXCache.modifiedCallbacks[i2];if(mc.module==oxMapping.module&&!(mc.collection.criteria)){for(var count=0;count<mc.collection.objects.length;count++){for(var i=0;i<objects_tmp.length;i++){if(mc.collection.objects[count].equals(objects_tmp[i])){mc.collection.objects.splice(count,1);count--;mc.modified=true;break}}}}}tmpFn()};OXMailMapping.deleteObjects=function(mailObjects,harddelete,optCb){var oxMapping=OXMailMapping;
var request=new Array();var idArray=new Array();for(var i=0;i<mailObjects.length;i++){idArray.push({id:mailObjects[i].id,folder:mailObjects[i].folder_id})}if(idArray.length){var req={module:"mail",action:"delete",folder:idArray[0].folder,data:idArray};if(harddelete){req.harddelete=1}request.push(req)}var tmpFn=OXCache.join.add();var callit=false;json.put(AjaxRoot+"/multiple?session="+session+"&continue=true",request,null,function(reply){var tmpCollect=new Array();for(var i=0;i<reply.length;i++){if(reply[i].error){if(reply[i].code=="MSG-0039"){function cbyes(){oxMapping.deleteObjects(mailObjects,true,optCb)
}newConfirm(_("Quota Exceed"),_("Permanently remove your deleted E-Mails?"),AlertPopup.YESNO,null,null,cbyes,null)}else{newServerError(reply[i])}}else{oxMapping.deleteObjectsInternal(mailObjects);oxMapping.createObjectsInternal([{folder_id:configGetKey("mail.folder.trash"),module:"mail"}]);callit=true}}tmpFn();if(optCb&&callit){optCb()}})};OXMailMapping.setMailFlags=function(flag,objects,callback){var oxMapping=OXMailMapping;var mailFlagsParam=OXMailMapping.flagmapping[flag];var Self=this;var tmpObject={};
if(objects.length!=0){var tmpFn=OXCache.join.add(callback);var multipleObject=[];var folders=[],folder;for(var i=0;i<objects.length;i++){folder=objects[i].folder||objects[i].folder_id;folders.push(folder);multipleObject.push({action:"update",module:"mail",timestamp:0,id:objects[i].id,folder:folder,data:{flags:mailFlagsParam.flag,value:mailFlagsParam.bool}})}(new JSONX).put(AjaxRoot+"/multiple?session="+session+"&continue=true",multipleObject,null,function(daten){if(flag=="spam"||flag=="ham"){oxMapping.deleteObjectsInternal(objects);
var uFolder=ox.api.config.get("mail.folder.spam");if(flag=="ham"){uFolder=ox.api.config.get("mail.folder.inbox")}for(var i in OXCache.cachedCollections.cache){var col=OXCache.cachedCollections.cache[i].data;if(col.criteria&&col.criteria.folder_id===uFolder){col.modified=true;col.check=true}}}else{oxMapping.editObjectsInternal(objects,null,true,[mailFlagsParam])}tmpFn();ox.api.folder.getMultiple({list:folders,ignoreCache:true})})}};OXMailMapping.editObjectsInternal=function(oldObjects,changes,checkExist,optionalFlags){var oxMapping=OXMailMapping;
var tmpFn=OXCache.join.add();for(var myObject in oldObjects){var tmpKeyOld=OXMailMapping.createKeyFromObject(oldObjects[myObject]);var collections=oxMapping.getSubCollectionsfromObject(oldObjects[myObject],true);var tmpObjectOld=OXCache.cachedObjects.get(tmpKeyOld);for(var i=0;i<collections.length;i++){if(!collections[i].check){collections[i].modified=true;var orders=collections[i].order;var order=orders&&orders[0];var sort=order&&order.sort;collections[i].check=Boolean(!tmpObjectOld||changes&&(sort in changes)&&changes[sort]!=tmpObjectOld[sort]||(sort=="flags"||sort=="flags_sort")&&optionalFlags)
}}for(var i in OXCache.modifiedCallbacks){if(OXCache.modifiedCallbacks[i].module==oxMapping.module&&!(OXCache.modifiedCallbacks[i].collection.criteria)){for(var count=0;count<OXCache.modifiedCallbacks[i].collection.objects.length;count++){if(tmpKeyOld.equals(OXCache.modifiedCallbacks[i].collection.objects[count])){var mc=OXCache.modifiedCallbacks[i];if(!mc.modified&&mc.before){mc.before()}mc.modified=true}}}}if(tmpObjectOld){if(changes){for(var i in changes){if(!checkExist||tmpObjectOld[i]!==undefined){tmpObjectOld[i]=changes[i]
}}}if(optionalFlags){if(!checkExist||tmpObjectOld.flags!==undefined){for(var i in optionalFlags){if(optionalFlags[i].flag&32){ox.api.folder.update({local:true,folder:tmpObjectOld.folder_id||tmpObjectOld.folder,filter:function(data){data.unread+=((tmpObjectOld.flags&32)>>5)-optionalFlags[i].bool;return data}})}if((tmpObjectOld.flags&optionalFlags[i].flag)&&!optionalFlags[i].bool){tmpObjectOld.flags=tmpObjectOld.flags-optionalFlags[i].flag}else{if(!(tmpObjectOld.flags&optionalFlags[i].flag)&&optionalFlags[i].bool){tmpObjectOld.flags=tmpObjectOld.flags+optionalFlags[i].flag
}}}}}}}OXCache.cachedObjects.set(tmpKeyOld,tmpObjectOld);tmpFn()};OXMailMapping.createObjectsInternal=function(newObjects){setTimeout(function(){var oxMapping=OXMailMapping;for(var i in OXCache.modifiedCallbacks){var mc=OXCache.modifiedCallbacks[i];if(mc.module==oxMapping.module&&mc.before){mc.before()}}var tmpFn=OXCache.join.add();for(var object in newObjects){var collections=oxMapping.getSubCollectionsfromObject(newObjects[object],true);for(var i=0;i<collections.length;i++){if(!collections[i].check){collections[i].check=true
}}}tmpFn()},0)};OXMailMapping.editObject=function(oldObject,newObject){setTimeout(function(){var oxMapping=OXMailMapping;var tmpFn=OXCache.join.add();var tmpKeyOld=OXMailMapping.createKeyFromObject(oldObject);var collections=oxMapping.getSubCollectionsfromObject(oldObject,true);for(var i=0;i<collections.length;i++){if(!collections[i].check){collections[i].check=true}}for(var i in OXCache.modifiedCallbacks){if(OXCache.modifiedCallbacks[i].module==oxMapping.module&&!(OXCache.modifiedCallbacks[i].collection.criteria)){for(var count=0;
count<OXCache.modifiedCallbacks[i].collection.objects.length;count++){if(tmpKeyOld.equals(OXCache.modifiedCallbacks[i].collection.objects[count])){var mc=OXCache.modifiedCallbacks[i];if(!mc.modified&&mc.before){mc.before()}mc.modified=true}}}}var tmpObjectOld=OXCache.cachedObjects.get(tmpKeyOld);OXCache.cachedObjects.set(tmpKeyOld,tmpObjectOld);tmpFn()},0)};OXMailMapping.createObject=function(newObject){setTimeout(function(){var oxMapping=OXTaskMapping;for(var i in OXCache.modifiedCallbacks){var mc=OXCache.modifiedCallbacks[i];
if(mc.module==oxMapping.module&&mc.before){mc.before()}}var tmpFn=OXCache.join.add();var collections=oxMapping.getSubCollectionsfromObject(newObject,true);for(var i=0;i<collections.length;i++){if(!collections[i].check){collections[i].check=true}}tmpFn()},0)};OXMailMapping.setTag=OXAbstractMapping.setTag(OXMailMapping);OXCache.setMapping("mail",OXMailMapping);function OXInfoStoreMapping(){}OXInfoStoreMapping.mandatoryfields=["folder_id","id","last_modified","created_by","creation_date"];OXInfoStoreMapping.idmapping={"1":"id","2":"created_by","3":"modified_by","4":"creation_date","5":"last_modified","20":"folder_id","100":"categories","700":"title","701":"url","702":"filename","703":"file_mimetype","704":"file_size","705":"version","706":"description","707":"locked_until","708":"file_md5sum","709":"version_comment","710":"current_version","711":"number_of_versions","102":"color_label"};
OXInfoStoreMapping.stringmapping=switchStringObject(OXInfoStoreMapping.idmapping);OXInfoStoreMapping.module="infostore";OXInfoStoreMapping.createKeyFromData=function(myArray,timestamp){var tmp=new OXInfoStoreObjectCache();tmp.module=OXInfoStoreMapping.module;tmp.folder_id=myArray[0];tmp.id=myArray[1];tmp.created_by=myArray[3];if(timestamp){tmp.timestamp=timestamp}return tmp};OXInfoStoreMapping.createKeyFromObject=function(myObject){var tmp=new OXInfoStoreObjectCache();tmp.module=OXInfoStoreMapping.module;
tmp.folder_id=myObject.folder_id;tmp.id=myObject.id;tmp.created_by=myObject.created_by;return tmp};OXInfoStoreMapping.objectConstructor=OXInfoStoreObjectCache;OXInfoStoreMapping.stringmapping=switchStringObject(OXInfoStoreMapping.idmapping);OXInfoStoreMapping.get=OXAbstractMapping.get(OXInfoStoreMapping);OXInfoStoreMapping.execute=OXAbstractMapping.execute(OXInfoStoreMapping);OXInfoStoreMapping.buildResponse=OXAbstractMapping.buildResponse(OXInfoStoreMapping);OXInfoStoreMapping.criteriaRequest=OXAbstractMapping.criteriaRequest(OXInfoStoreMapping);
OXInfoStoreMapping.listRequest=OXAbstractMapping.listRequest(OXInfoStoreMapping);OXInfoStoreMapping.addCriteriaNotInCache=OXAbstractMapping.addCriteriaNotInCache(OXInfoStoreMapping);OXInfoStoreMapping.addCriteriaExpired=OXAbstractMapping.addCriteriaExpired(OXInfoStoreMapping);OXInfoStoreMapping.addCriteriaMissingColumn=OXAbstractMapping.addCriteriaMissingColumn(OXInfoStoreMapping);OXInfoStoreMapping.addListNotInCache=OXAbstractMapping.addListNotInCache(OXInfoStoreMapping);OXInfoStoreMapping.addListExpired=OXAbstractMapping.addListExpired(OXInfoStoreMapping);
OXInfoStoreMapping.addListMissingColumn=OXAbstractMapping.addListMissingColumn(OXInfoStoreMapping);OXInfoStoreMapping.request=OXAbstractMapping.request(OXInfoStoreMapping);OXInfoStoreMapping.handleResponse=OXAbstractMapping.handleResponse(OXInfoStoreMapping);OXInfoStoreMapping.handleCriteriaNotInCache=OXAbstractMapping.handleCriteriaNotInCache(OXInfoStoreMapping);OXInfoStoreMapping.handleCriteriaExpired=OXAbstractMapping.handleCriteriaExpired(OXInfoStoreMapping);OXInfoStoreMapping.handleCriteriaMissingColumn=OXAbstractMapping.handleCriteriaMissingColumn(OXInfoStoreMapping);
OXInfoStoreMapping.handleCriteria=OXAbstractMapping.handleCriteria(OXInfoStoreMapping);OXInfoStoreMapping.handleListNotInCache=OXAbstractMapping.handleListNotInCache(OXInfoStoreMapping);OXInfoStoreMapping.handleListExpired=OXAbstractMapping.handleListExpired(OXInfoStoreMapping);OXInfoStoreMapping.handleListMissingColumn=OXAbstractMapping.handleListMissingColumn(OXInfoStoreMapping);OXInfoStoreMapping.handleList=OXAbstractMapping.handleList(OXInfoStoreMapping);OXInfoStoreMapping.getCollection=OXAbstractMapping.getCollection(OXInfoStoreMapping);
OXInfoStoreMapping.convertColumns=OXAbstractMapping.convertColumns(OXInfoStoreMapping);OXInfoStoreMapping.createCacheObject=OXAbstractMapping.createCacheObject(OXInfoStoreMapping);OXInfoStoreMapping.checkAddCriteria=OXAbstractMapping.checkAddCriteria(OXInfoStoreMapping);OXInfoStoreMapping.checkAddEditDeleteObject=OXAbstractMapping.checkAddEditDeleteObject(OXInfoStoreMapping);OXInfoStoreMapping.getSubCollectionsfromObject=OXAbstractMapping.getSubCollectionsfromObject(OXInfoStoreMapping);OXInfoStoreMapping.getSubCollections=OXAbstractMapping.getSubCollections(OXInfoStoreMapping);
OXInfoStoreMapping.equalsCollection=OXAbstractMapping.equalsCollection(OXInfoStoreMapping);OXInfoStoreMapping.errorHandler=OXCache.errorHandler;OXInfoStoreMapping.editObjects=function(oldObjects,changes){setTimeout(function(){var tmpFn=OXCache.join.add();OXInfoStoreMapping.editObjectsInternal(oldObjects,changes);tmpFn()},0)};OXInfoStoreMapping.editObjectsInternal=function(oldObjects,changes,checkExist){var oxMapping=OXInfoStoreMapping;var tmpFn=OXCache.join.add();for(var myObject in oldObjects){var tmpKeyOld=oxMapping.createKeyFromObject(oldObjects[myObject]);
var collections=oxMapping.getSubCollectionsfromObject(oldObjects[myObject],true);for(var i=0;i<collections.length;i++){if(!collections[i].search&&!collections[i].check){collections[i].check=true}}for(var i in OXCache.modifiedCallbacks){if(OXCache.modifiedCallbacks[i].module==oxMapping.module&&!(OXCache.modifiedCallbacks[i].collection.criteria)){for(var count=0;count<OXCache.modifiedCallbacks[i].collection.objects.length;count++){if(tmpKeyOld.equals(OXCache.modifiedCallbacks[i].collection.objects[count])){var mc=OXCache.modifiedCallbacks[i];
if(!mc.modified&&mc.before){mc.before()}mc.modified=true}}}}var tmpObjectOld=OXCache.cachedObjects.get(tmpKeyOld);if(tmpObjectOld){if(changes){for(var i in changes){if(!checkExist||tmpObjectOld[i]!==undefined){if(i!="notification"){tmpObjectOld[i]=changes[i]}}}}}OXCache.cachedObjects.set(tmpKeyOld,tmpObjectOld)}tmpFn()};OXInfoStoreMapping.deleteObjects=function(objects,callback){var oxMapping=OXInfoStoreMapping;var request=new Array();for(var i in objects){var tmpTime=objects[i]["timestamp"];if(!tmpTime){var tmpObject=OXCache.cachedObjects.get(objects[i]);
if(tmpObject){tmpTime=tmpObject.timestamp}}request.push({module:oxMapping.module,action:"delete",timestamp:tmpTime,data:[{folder:objects[i]["folder_id"],id:objects[i]["id"]}]})}json.put(AjaxRoot+"/multiple?session="+session+"&continue=true",request,null,function(reply){var tmpFn=OXCache.join.add();var error=new Array();for(var i=0;i<reply.length;i++){if(reply[i].error){newServerError(reply[i]);error.push(i)}}if(!error.length){oxMapping.deleteObjectsInternal(objects)}tmpFn();if(callback){callback()
}})};OXInfoStoreMapping.deleteObjectsInternal=function(objects){var tmpFn=OXCache.join.add();var oxMapping=OXInfoStoreMapping;for(var i in OXCache.modifiedCallbacks){var mc=OXCache.modifiedCallbacks[i];if(mc.module==oxMapping.module&&mc.before){mc.before()}}var tmpCollect=[];for(var mail=0;mail<objects.length;mail++){OXCache.cachedObjects.remove(objects[mail]);var collections=oxMapping.getSubCollectionsfromObject(objects[mail],true);for(var count=0;count<collections.length;count++){if(collections[count].check){continue
}var index=collections[count].map_objects.get(objects[mail]);if(index){collections[count].modified=true;if(!collections[count].tmpIndexes){collections[count].tmpIndexes=[]}collections[count].tmpIndexes.push(index);tmpCollect.push(collections[count]);collections[count].modifiedtmp=true}}}for(var count=0;count<tmpCollect.length;count++){if(tmpCollect[count].modifiedtmp){var indexes=tmpCollect[count].tmpIndexes;indexes.sort(function(a,b){return a-b});for(var i=indexes.length-1;i>=0;i--){tmpCollect[count].objects.splice(indexes[i]-1,1)
}delete tmpCollect[count].tmpIndexes;tmpCollect[count].map_objects=new LRUKeyList();for(var index=0;index<tmpCollect[count].objects.length;index++){tmpCollect[count].map_objects.set(tmpCollect[count].objects[index],index+1)}tmpCollect[count].modifiedtmp=false}}tmpFn()};OXInfoStoreMapping.createObject=function(newObject){setTimeout(function(){var tmpFn=OXCache.join.add();OXInfoStoreMapping.createObjectsInternal([newObject]);tmpFn()},0)};OXInfoStoreMapping.createObjectsInternal=function(newObjects){setTimeout(function(){var oxMapping=OXInfoStoreMapping;
for(var i in OXCache.modifiedCallbacks){var mc=OXCache.modifiedCallbacks[i];if(mc.module==oxMapping.module&&mc.before){mc.before()}}var tmpFn=OXCache.join.add();for(var object in newObjects){var collections=oxMapping.getSubCollectionsfromObject(newObjects[object],true);for(var i=0;i<collections.length;i++){if(!collections[i].search&&!collections[i].check){collections[i].check=true}}}tmpFn()},0)};OXInfoStoreMapping.setTag=OXAbstractMapping.setTag(OXInfoStoreMapping);OXCache.setMapping("infostore",OXInfoStoreMapping);
function OXAbstractObject(){var Self=this;this.type="OXObject"}OXAbstractObject.prototype.hasColumns=function(stringobjects,blacklist){blacklist=blacklist||{};for(var i in stringobjects){var path=stringobjects[i].split("/");if(path.length==1){if(this[stringobjects[i]]===undefined&&!(stringobjects[i] in blacklist)){return false}}else{if(!this[path[0]]){return false}}}return true};OXAbstractObject.prototype.getColumns=function(){var fields=new Array();if(this.mapping){for(var i in this.mapping.stringmapping){if(this.i){filledfields.push(i)
}}}return filledfields};function OXTaskObjectCache(){this.module="tasks";this.mapping=OXTaskMapping}OXTaskObjectCache.createfromObject=Key.createfromObject;OXTaskObjectCache.prototype.equals=Key.prototype.equals;OXTaskObjectCache.prototype.hashCode=Key.prototype.hashCode;OXTaskObjectCache.prototype.hasColumns=OXAbstractObject.prototype.hasColumns;OXTaskObjectCache.prototype.getColumns=OXAbstractObject.prototype.getColumns;function OXCalendarObjectCache(){this.module="calendar";this.mapping=OXCalendarMapping
}OXCalendarObjectCache.createfromObject=Key.createfromObject;OXCalendarObjectCache.prototype.equals=Key.prototype.equals;OXCalendarObjectCache.prototype.hashCode=Key.prototype.hashCode;OXCalendarObjectCache.prototype.hasColumns=OXAbstractObject.prototype.hasColumns;OXCalendarObjectCache.prototype.getColumns=OXAbstractObject.prototype.getColumns;function OXContactObjectCache(){this.module="contacts";this.mapping=OXContactMapping}OXContactObjectCache.createfromObject=Key.createfromObject;OXContactObjectCache.prototype.equals=Key.prototype.equals;
OXContactObjectCache.prototype.hashCode=Key.prototype.hashCode;OXContactObjectCache.prototype.hasColumns=OXAbstractObject.prototype.hasColumns;OXContactObjectCache.prototype.getColumns=OXAbstractObject.prototype.getColumns;function OXMailObjectCache(){this.module="mail";this.mapping=OXMailMapping}OXMailObjectCache.createfromObject=Key.createfromObject;OXMailObjectCache.prototype.equals=Key.prototype.equals;OXMailObjectCache.prototype.hashCode=Key.prototype.hashCode;OXMailObjectCache.prototype.hasColumns=OXAbstractObject.prototype.hasColumns;
OXMailObjectCache.prototype.getColumns=OXAbstractObject.prototype.getColumns;function OXInfoStoreObjectCache(){this.module="infostore";this.mapping=OXInfoStoreMapping}OXInfoStoreObjectCache.createfromObject=Key.createfromObject;OXInfoStoreObjectCache.prototype.equals=Key.prototype.equals;OXInfoStoreObjectCache.prototype.hashCode=Key.prototype.hashCode;OXInfoStoreObjectCache.prototype.hasColumns=OXAbstractObject.prototype.hasColumns;OXInfoStoreObjectCache.prototype.getColumns=OXAbstractObject.prototype.getColumns;
OXCache.forceRefresh=function(module,removeObjects){for(var i in OXCache.cachedCollections.cache){var col=OXCache.cachedCollections.cache[i].data;if(col.criteria&&col.criteria.folder_id&&ox.api.folder.get({folder:col.criteria.folder_id}).module==module){col.modified=true;col.check=true;if(removeObjects===true&&col.objects){for(var i in col.objects){OXCache.cachedObjects.remove(col.objects[i])}}}}};var first=false;function etest1(arg){for(var i=0;i<arg;i++){(new JSONX()).put(AjaxRoot+"/tasks?action=new&session="+session,{title:"Aufgabe Nr:"+i,folder_id:3009},null,function(cb){})
}}var tmptime=new Date().getTime();var times=new Array();var times2=new Array();register("OX_Refresh",function(){OXCache.update()});var internalCachejson=new JSONX();register("OX_Refresh",function(){internalCache.reset()});function Cache(size){this.size=size;this.executezaehler=0;this.cache_request_id=new Object();this.cache_allrequests=new Array();this.mrulist=new MRUList(size);this.openrequests=0;this.idsreturn=new Object();this.ressourcefromserver=new Array();this.userfromserver=new Array();this.groupfromserver=new Array();
this.updateCallbacks=[]}Cache.prototype={getUsers:function(ids,cb){ids=ox.util.isArray(ids)?ids:[ids];var i=0,$l=ids.length,tmp=[],obj;for(;i<$l;i++){if(!isNaN(ids[i])||ids[i]===null){tmp.push({id:ids[i]===null?null:parseInt(ids[i],10),type:1})}}var result;this.getObjects(tmp,function(data){result=data;ox.util.call(cb,data)});return result},getGroups:function(ids,cb){var newarray=new Array();for(var i=0;i<ids.length;i++){if(isNaN(ids[i])){continue}var newobject=new Object();newobject.id=parseInt(ids[i]);
newobject.type=2;newarray.push(newobject)}this.getObjects(newarray,cb)},getResources:function(ids,cb){var newarray=new Array();for(var i=0;i<ids.length;i++){if(isNaN(ids[i])){continue}var newobject=new Object();newobject.id=parseInt(ids[i]);newobject.type=3;newarray.push(newobject)}this.getObjects(newarray,cb)},getObjects:function(ids,cb){var Self=this;var myobject=new Object();myobject.ids=ids;myobject.cb=cb;Self.cache_allrequests.push(myobject);Self.ressourcefromserver=new Array();Self.userfromserver=new Array();
Self.groupfromserver=new Array();if(!ids){return}for(i=0;i<ids.length;i++){var myobject=ids[i];switch(myobject.type){case 1:var key=Self.mrulist.get(myobject.id);if(!key){if(!(Self.cache_request_id[myobject.id+":"+myobject.type])){Self.userfromserver.push(myobject.id)}}else{Self.idsreturn[myobject.id+":"+myobject.type]=key}break;case 2:var key=Self.mrulist.get(myobject.id);if(!key){if(!(Self.cache_request_id[myobject.id+":"+myobject.type])){Self.groupfromserver.push(myobject.id)}}else{if(!(Self.cache_request_id[myobject.id+":"+myobject.type])){Self.idsreturn[myobject.id+":"+myobject.type]=key
}}break;case 3:var key=Self.mrulist.get(myobject.id);if(!key){if(!(Self.cache_request_id[myobject.id+":"+myobject.type])){Self.ressourcefromserver.push(myobject.id)}}else{}break}Self.cache_request_id[myobject.id+":"+myobject.type]=true}if(Self.userfromserver.length>0){var cache_addUsers=function(allrequests){var daten=allrequests.data;for(var i=0;i<daten.length;i++){var myobject={id:daten[i][0],user_id:daten[i][3]||daten[i][0],display_name:daten[i][1],email1:daten[i][2]};myobject.type=1;Self.addObject(myobject.id,myobject);
Self.idsreturn[myobject.id+":1"]=myobject}Self.openrequests--;if(Self.openrequests==0){Self.executeCb()}};var requestArray=new Array();for(var zahl=0;zahl<Self.userfromserver.length;zahl++){requestArray.push(Self.userfromserver[zahl])}Self.openrequests++;ox.api.user.getMultiple(requestArray,{columns:"524,500,555,614",processData:false,success:cache_addUsers})}if(Self.groupfromserver.length>0){cache_addGroup=function(allrequests){for(var i=0;i<allrequests.length;i++){var myobject=allrequests[i].data;
if(myobject.id==0){myobject=check0GroupDisplayName(myobject)}myobject.type=2;Self.addObject(myobject.id,myobject);Self.idsreturn[myobject.id+":2"]=myobject}Self.openrequests--;if(Self.openrequests==0){Self.executeCb()}};var requestArray=new Array();for(zahl=0;zahl<Self.groupfromserver.length;zahl++){var requestObject=new Object();requestObject.module="group";requestObject.action="get";requestObject.id=Self.groupfromserver[zahl];requestArray.push(requestObject)}Self.openrequests++;internalCachejson.put(AjaxRoot+"/multiple?session="+session,requestArray,null,cache_addGroup)
}if(Self.ressourcefromserver.length>0){cache_addRessource=function(allobjects){for(var i=0;i<allobjects.length;i++){if(allobjects[i].data){var oneobject=allobjects[i].data;oneobject.type=3;Self.addObject(oneobject.id,oneobject)}}Self.openrequests--;if(Self.openrequests==0){Self.executeCb()}};var requestArray=new Array();for(var i=0;i<Self.ressourcefromserver.length;i++){var requestObject=new Object();requestObject.module="resource";requestObject.action="get";requestObject.id=Self.ressourcefromserver[i];
requestArray.push(requestObject)}Self.openrequests++;internalCachejson.put(AjaxRoot+"/multiple?session="+session,requestArray,null,cache_addRessource)}if(Self.openrequests==0){Self.executeCb()}},addObject:function(userid,newobject){this.mrulist.set(userid,newobject)},executeCb:function(){var Self=this;for(;this.executezaehler<this.cache_allrequests.length;){if(this.openrequests==0){var returnarray=new Object();var mycb=this.cache_allrequests[this.executezaehler].cb;for(var zaehler2=0;zaehler2<this.cache_allrequests[this.executezaehler].ids.length;
zaehler2++){var persid=this.cache_allrequests[this.executezaehler].ids[zaehler2].id;var perstype=this.cache_allrequests[this.executezaehler].ids[zaehler2].type;if(persid==0){var melem=Self.mrulist.get(persid)||Self.idsreturn[persid+":"+perstype];if(!melem){returnarray[this.cache_allrequests[this.executezaehler].ids[zaehler2].id]=check0GroupDisplayName({id:0})}else{returnarray[this.cache_allrequests[this.executezaehler].ids[zaehler2].id]=melem}}else{returnarray[this.cache_allrequests[this.executezaehler].ids[zaehler2].id]=Self.mrulist.get(persid)||Self.idsreturn[persid+":"+perstype]
}}this.executezaehler++;mycb(returnarray)}else{return}}if(this.openrequests==0){this.idsreturn=new Object()}this.cache_allrequests=new Array();this.cache_request_id=new Object();this.executezaehler=0},reset:function(){if(this.cache_allrequests.length==0){this.mrulist=new MRUList(this.size)}},updateUser:function(){var me=configGetKey("identifier");this.mrulist.remove(me);var Self=this;this.getObjects([{id:me,type:1}],function(data){for(var i=0;i<Self.updateCallbacks.length;i++){Self.updateCallbacks[i](data)
}})},registerUpdate:function(cb){this.updateCallbacks.push(cb)},unregisterUpdate:function(cb){for(var i=this.updateCallbacks.length-1;i>=0;--i){if(this.updateCallbacks[i]==cb){this.updateCallbacks.splice(i,1)}}}};var group0name="All users";function check0GroupDisplayName(object){if(object&&object.id==0){object.display_name=_(group0name).toString()}return object}var internalCache=new Cache(2000);function FSM(startState,transitions){var states={};for(var i in transitions){var t=transitions[i];if(!states[t.from]){states[t.from]={}
}t.from=states[t.from];for(var j in t.to){var s=t.to[j];if(!states[s]){states[s]={}}t.to[j]=states[s]}t.from[i]=t;t.fire=(function(t){return function(e){if(t.callback(e)===false){return}var ix=t.condition();var actions=t.actions[ix];for(var i=0;i<actions.length;i++){actions[i]()}current=t.to[ix]}})(t)}for(var i in transitions){var t=transitions[i];t.actions=new Array(t.to.length);for(var i=0;i<t.to.length;i++){var actions=t.actions[i]=[];var to=t.to[i];if(t.from==to){for(var j in t.from){if(t.from[j].reset){actions.push(t.from[j].reset)
}}}else{for(var j in t.from){actions.push(t.from[j].disable)}for(var j in to){actions.push(to[j].enable)}}}}var current=states[startState];var enabled=false;var fsm={enable:function(){if(!enabled){for(var i in current){current[i].enable()}}enabled=true},disable:function(){if(enabled){for(var i in current){current[i].disable()}}enabled=false},enter:function(state){this.disable();current=states[state];this.enable()},reset:function(){this.enter(startState)},getState:function(){for(var i in states){if(current==states[i]){return i
}}}};return fsm}FSM.Callback=function(callback){var enabled=false;return{callback:function(e){return enabled&&callback(e)},enable:function(){enabled=true},disable:function(){enabled=false}}};FSM.Event=function(node,name,callback){var Self={callback:callback,enable:function(){addDOMEvent(node,name,Self.fire)},disable:function(){removeDOMEvent(node,name,Self.fire)}};return Self};FSM.Timeout=function(delay,callback){var timer=null;var Self={callback:callback,enable:function(){if(timer!==null){clearTimeout(timer)
}timer=setTimeout(Self.fire,delay())},disable:function(){if(timer!==null){clearTimeout(timer)}timer=null}};return Self};FSM.Trans=function(from,to,transition){transition.from=from;transition.condition=FSM.zero;transition.to=[to];return transition};FSM.zero=function(){return 0};FSM.Condition=function(from,condition,to,transition){transition.from=from;transition.condition=condition;transition.to=to;return transition};FSM.Reset=function(transition){transition.reset=function(){transition.disable();transition.enable()
};return transition};FSM.MouseOut=function(callback){return function(e){for(var n=e.relatedTarget||e.toElement;n;n=n.parentNode){if(n==parent){return false}}return callback()}};if(window.ox===undefined){window.ox={}}ox.browser=(function(){var ua=navigator.userAgent,isOpera=Object.prototype.toString.call(window.opera)==="[object Opera]",isIE=!!window.attachEvent&&!isOpera,webkit=ua.indexOf("AppleWebKit/")>-1,chrome=ua.indexOf("Chrome/")>-1;return{IE:!!window.attachEvent&&!isOpera,IE9:isIE&&/MSIE 9/.test(ua),Opera:isOpera,WebKit:webkit,Safari:webkit&&!chrome,Chrome:webkit&&chrome,Gecko:ua.indexOf("Gecko")>-1&&ua.indexOf("KHTML")===-1,MacOS:ua.indexOf("Macintosh")>-1}
}());ox.test=(function(){var $=jQuery;return{evalScript:function(code){return eval(code)},trigger:function(guid,name){if(ox.api.window.exists(guid)){var args=$.makeArray(arguments);args.shift();var w=ox.api.window.get(guid).window;w.triggerEvent.apply(w,args)}},triggerSave:function(guid){this.trigger(guid,ox.api.event.common.SaveObject)},triggerCancel:function(guid){this.trigger(guid,ox.api.event.common.CancelObject)}}}());ox.util=(function(){var deserialize=function(str,delimiter){var pairs=(str||"").split(delimiter===undefined?"&":delimiter);
var i=0,$l=pairs.length,pair,obj={},d=decodeURIComponent;for(;i<$l;i++){pair=pairs[i];var keyValue=pair.split(/\=/),key=keyValue[0],value=keyValue[1];if(key!==""||value!==undefined){obj[d(key)]=d(value)}}return obj};var queryData=deserialize(document.location.search.substr(1),/&/);var hashData=deserialize(document.location.hash.substr(1),/&/);return{getHash:function(name){return name===undefined?hashData:hashData[name]},getParam:function(name){return name===undefined?queryData:queryData[name]},getArray:function(){return[]
},serialize:function(obj,delimiter){var tmp=[],e=encodeURIComponent,id;if(typeof obj==="object"){for(id in (obj||{})){if(obj[id]!==undefined){tmp.push(e(id)+"="+e(obj[id]))}}}return tmp.join(delimiter===undefined?"&":delimiter)},deserialize:deserialize,inspect:function(){var args=jQuery.makeArray(arguments);args.unshift("Inspect");console.debug.apply(console,args)},getAbsoluteURL:function(url){if(url.search(/^http/)!==-1){return url}else{var l=window.location;if(url.substr(0,1)==="/"){return l.protocol+"//"+l.host+url
}else{return l.href.replace(/\/[^\/]+$/,"/")+ox.api.window.core.oxProductInfo.build+"/"+url}}},isArray:function(obj){return obj&&obj.length!==undefined&&obj.splice!==undefined&&obj.push!==undefined},isFunction:(function(){return function(obj){return obj&&obj.apply!==undefined&&obj.call!==undefined}}()),isDOMObject:function(obj){return obj&&(obj.nodeType||obj.setInterval)},isPlainObject:function(obj){var toString=Object.prototype.toString;return obj&&toString.call(obj)==="[object Object]"&&!obj.nodeType&&!obj.setInterval
},call:function(fn){if(typeof fn==="function"||(ox.browser.IE===true&&ox.util.isFunction(fn))){var i=1,$l=arguments.length,args=[];for(;i<$l;i++){args.push(arguments[i])}return fn.apply(fn,args)}},create:function(){var Fn=function(){};var args=jQuery.makeArray(arguments);var Class=args.shift();Fn.prototype=Class.prototype;var obj=new Fn();Class.apply(obj,args);return obj},firstOf:function(){var args=jQuery.makeArray(arguments),i=0,$l=args.length;for(;i<$l;i++){if(args[i]!==undefined){return args[i]
}}return undefined},now:function(){return new Date().getTime()},keys:function(obj,list){var tmp=list||[],deep=list!==false,id,o;if(obj){for(id in obj){tmp.push(id);if(deep){o=obj[id];if(typeof o==="object"&&o!==null){ox.util.keys(o,tmp)}}}}return tmp},values:function(obj){var tmp=[],id;if(obj){for(id in obj){tmp.push(obj[id])}}return tmp},findInArray:function(array,property,value){var id=false;jQuery.each(array,function(i,elem){if(elem[property]!==undefined){if(elem[property]==value){id=i}}});return id
},clone:function clone(elem){if(typeof elem!=="object"){return elem}else{var isArray=ox.util.isArray;var isDOMObject=ox.util.isDOMObject;var subclone=function(elem){if(!elem){return null}else{var tmp=isArray(elem)?[]:{},prop,i;for(i in elem){prop=elem[i];tmp[i]=typeof prop==="object"&&!isDOMObject(prop)?subclone(prop):prop}return tmp}};return subclone(elem)}},identity:function(o){return o},modifyCSSClass:function(className){var stylesheet=document.styleSheets[0];for(var i=0;i<document.styleSheets.length;
i++){var stylesheet=document.styleSheets[i];var rules=stylesheet.cssRules||stylesheet.rules;for(var ia=0;ia<rules.length;ia++){var cssClass=rules[ia];if((cssClass.selectorText||"").match(className)){return cssClass}}}return{}}}}());if(ox.browser.IE){Function.prototype.apply=function(scope,list){scope=(scope===null||scope===undefined)?window:scope;scope.houdini=this;var i=0,args=[],$l=(list||[]).length;for(;i<$l;i++){args.push("list["+i+"]")}try{return eval("scope.houdini("+args.join(", ")+")")}catch(e){if(window.debug){console.error("Error in Function.prototype.apply! "+e)
}}}}ox.api=(function(){var $=jQuery;var Dispatcher=null;var that;var dispatcherRegistry=null;var debugEnabled=false;var debug=!debugEnabled?$.noop:function(){console.debug.apply(console,arguments)};var clone=ox.util.clone;var isFunction=ox.util.isFunction;var defaultWindowOptions={resizable:"yes",menubar:"no",toolbar:"no",status:"no",location:"no",scrollbars:"no"};var defaultWindowFactory,defaultWindowCloser,defaultWindowSelector;var windowFactory=defaultWindowFactory=function(opt){if(opt.guid!==undefined){var url=ox.util.getAbsoluteURL(opt.url);
triggerEvent("OX_Window_Open",{guid:opt.guid,url:url});var win=newWindow(ox.util.getAbsoluteURL(opt.url),that.window.serializeOptions(opt.options),opt.id);that.window.register(opt.guid,win);win.guid=opt.guid;win.focus();$(win).ready(function(){opt.success(win,opt.guid,opt);setTimeout(function(){win.focus()},0)})}else{console.error("windowFactory: guid is missing!")}};var windowCloser=defaultWindowCloser=function(obj){obj.window.close()};var windowSelector=defaultWindowSelector=function(obj,guid){obj.window.focus()
};var windowPositioner=function(){var width=screen.availWidth<=1024?800:1000;var height=screen.availHeight<=800?700:Math.max(700,$(document).height());return{x:Math.round((screen.width-width)/2),y:Math.round((screen.height-height)/2)-25,width:width,height:height}};var constructWindow=function(urlPrefix,o){var guid=o.params.guid=that.window.setData(o.data);var url=urlPrefix+"#"+ox.util.serialize(o.params);var opt={guid:guid,url:url,options:$.extend(o.bounds,o.options),success:o.success,closer:o.closer,id:o.id};
debug("constructWindow",opt);windowFactory(opt);return guid};var processOptions=function(d,o){var defaults={params:{},options:{},data:{},bounds:windowPositioner(),success:$.noop,closer:$.noop};return $.extend(true,defaults,d||{},o||{})};var processSelectOptions=function(module,o){var defaultFolder=module==="mail"?configGetKey("mail.folder.inbox"):configGetKey("folder")[module];var opt=$.extend({module:module,folder:defaultFolder,id:undefined,success:$.noop},o||{});opt.folder_id=opt.folder;return opt
};var processSelect=function(module,options){var o=processSelectOptions(module,options);var cont=function(){changeView("mail");triggerEvent("OX_Direct_Linking",module,o);o.success(o)};if(o.folder!==undefined){ox.api.folder.get({folder:o.folder,success:cont})}else{cont()}};var processHTTPOptions=function(module,defaultParams,options,defaultOptions){var o=$.extend(defaultOptions||{},options||{params:{}});o.params=$.extend(defaultParams||{},o.params||{});o.module=module;return o};var isNested=function(){return window.oxCoreWindow===true?false:true
};var getCore=function(){return isNested()?(window.opener||window.parent).ox.api.window.core:window};var modal=false;var once=(function(){var callbacks={};return function(options){if(ox.util.isFunction(options.success)){var name,tmp=[],id;for(name in options){if(typeof options[name]==="string"||typeof options[name]==="number"){tmp.push(options[name]+"")}}id=tmp.join("-");if(callbacks[id]===undefined){var success=options.success;options.success=function(){success.apply(window,arguments);var i=0,list=callbacks[id],$l=list.length;
for(;i<$l;i++){list[i].apply(window,arguments)}delete callbacks[id]};callbacks[id]=[];return false}else{callbacks[id].push(options.success);return true}}}}());that={event:{register:function(name,fn){register(name,fn)},unregister:function(name,fn){unregister(name,fn)},trigger:function(name){triggerEvent.apply(window,arguments)},common:{ViewChanged:"OX_View_Changed",Refresh:"OX_Refresh",ConfigurationLoadedComplete:"OX_Configuration_Loaded_Complete",ConfigurationChanged:"OX_Configuration_Changed",LanguageChanged:"LanguageChanged",Logout:"Logout",SaveObject:"OX_SAVE_OBJECT",CancelObject:"OX_Cancel_Object",NewUnreadMail:"OX_New_Unread_Mail",Ready:"Ready"},dispatcherRegistry:(function(){var DispatcherRegistry=function(){var dispatchers=[];
this.add=function(dispatcher){if($.inArray(dispatcher,dispatchers)===-1){dispatchers.push(dispatcher)}};this.list=function(){return dispatchers}};var fnUnload=function(){var i=0,list,$l,dispatcher,type,h,guid;list=ox.api.event.dispatcherRegistry.list();if(isNested()){list.concat(getCore().ox.api.event.dispatcherRegistry.list())}for($l=list.length;i<$l;i++){dispatcher=list[i];for(type in dispatcher.handlers){h=dispatcher.handlers[type];for(guid in h){if(h[guid].window===window){try{delete h[guid]}catch(e){}}}}}};
jQuery(window).unload(fnUnload);return(dispatcherRegistry=new DispatcherRegistry())}()),Dispatcher:(function(){var guid=1;var trim=function(type){return(type+"").toLowerCase().replace(/(^\s+|\s+$)/g,"")};var trimSplit=function(type){type=trim(type);return type.search(/\s/)>-1?type.split(/\s+/):type};Dispatcher=function(target){this.handlers={};this.data={};this.has=false;this.enabled=true;this.paused=false;this.queue={};this.queueTimer=null;this.getTarget=function(){return target||window};dispatcherRegistry.add(this)
};Dispatcher.prototype={bind:function(type,data,fn,win,atomic){type=trimSplit(type);var self=this;if($.isArray(type)){$.each(type,function(i,type){self.bind(type,data,fn)});return}if(isFunction(data)){atomic=win;win=fn;fn=data;data=undefined}if(this.handlers[type]===undefined){this.handlers[type]={}}var h=this.handlers[type];if(fn.oxGuid===undefined){fn.oxGuid=guid++}if(h[fn.oxGuid]===undefined){h[fn.oxGuid]={fn:fn,data:data||{},atomic:atomic!==undefined?atomic:true,window:win||window};this.has=true
}},unbind:function(type,fn){type=trimSplit(type);if($.isArray(trim)){var self=this;$.each(type,function(i,type){self.unbind(type,fn)});return}var h=this.handlers[type]||{};try{delete h[fn.oxGuid]}catch(e){}},trigger:function(type,data){if(this.has===false||this.enabled===false){return}var self=this,id;type=trimSplit(type);if($.isArray(type)){$.each(type,function(i,type){self.trigger(type,data)});return}var h=this.handlers[trim(type)]||{};var call=function(handler){if(handler.window.closed===false){var d=$.extend({},handler.data,data||{});
try{handler.fn.call(self.getTarget(),d,type)}catch(e){try{if(window.debug){console.error("Dispatcher.call() "+e)}}catch(e){}}}else{self.unbind(type,handler.fn)}};var process=function(handler){if(self.paused===false&&handler.atomic===true){call(handler)}else{var guid=handler.fn.oxGuid;if(self.queue[guid]){clearTimeout(self.queue[guid])}self.queue[guid]=setTimeout(function(){call(handler)},10)}};for(id in h){process(h[id])}},list:function(type){return type===undefined?this.handlers:this.handlers[type]
},numHandlers:function(){var i=0,id;for(id in this.handlers){i++}return i},disable:function(){this.enabled=false},enable:function(){this.enabled=true},pause:function(){},resume:function(){}};return Dispatcher}())},config:(function(){return{get:function(path,defaultValue){if(!path){return config}else{if(defaultValue===undefined){return configGetKey(path)}else{return this.contains(path)?configGetKey(path):defaultValue}}},set:function(path,value,permanent){if(path){configSetKey(path,value);if(permanent){return ox.api.http.PUT({module:"config/"+path,appendColumns:false,processData:false,data:value})
}}},remove:function(path){if(path){configRemoveKey(path)}},contains:function(path){return configContainsKey(path)},save:function(options){var opt=$.extend({force:true,silent:true,success:$.noop,error:$.noop},options||{});ox.api.event.trigger("OX_Save_Configuration",opt.force,opt.silent,opt.success,opt.error)},load:function(path,success){if(isFunction(path)){success=path;path=undefined}ox.api.http.GET({module:path!==undefined?path:"config",appendColumns:false,processData:false,success:function(data){if(path===undefined){config=data!==undefined?data.data:{};
disableByUrl()}ox.util.call(success,data.data)}})}}}()),ui:(function(){var registeredModules=[{name:"portal",title:_("Start"),priority:10,disabled:true},{name:"mail",title:_("E-Mail"),priority:20,disabled:true},{name:"calendar",title:_("Calendar"),priority:30,disabled:true,icons:["img/calendar/dayicons/mod_calendar-"+(new Date()).getUTCDate()+".png","img/calendar/mod_calendar_d.png"]},{name:"contacts",title:_("Contacts"),priority:40,disabled:true},{name:"tasks",title:_("Tasks"),priority:50,disabled:true},{name:"infostore",title:_("Infostore"),priority:60,disabled:true},{name:"configuration",title:_("Configuration"),priority:70,disabled:true}];
return{registerModule:function(module){if(module&&!this.moduleExists(module.name)){registeredModules.push(module);registeredModules.sort(function(a,b){return a.priority-b.priority})}},moduleExists:function(id){return this.getModule(id)!==null},listModules:function(){return registeredModules},getModule:function(id){var i;for(i in registeredModules){if(registeredModules[i].name===id){return registeredModules[i]}}return null},setModule:function(name,cont,folder){if(this.isModule(name)){var options={module:name,success:cont};
if(folder!==undefined){options.folder=folder}ox.UIController.setModule(options)}},isModule:function(name){var module=ox.api.config.get("modules."+name);return name==="configuration"||(module!==null&&module.module===true)},getActiveModule:function(){return ox.UIController.getModule()},setFolder:function(folder,cont,scrollTo){ox.api.folder.get({folder:folder,success:function(data){var options={folder:folder,success:cont};if(data.module!==activemodule){options.module=data.module}else{ox.UIController.setFolder(options)
}}})},getFolder:function(){return ox.UIController.getFolder()},logout:function(options){var opt=$.extend({location:logout_location.format(),force:false},options||{});var processLogout=function(){ox.api.http.GET({module:"login",params:{action:"logout"},complete:function(data){window.onbeforeunload=null;$(window).unbind("beforeunload");window.setTimeout(function(){window.location.replace(opt.location)},0)},error:function(data){return true}})};if(opt.force===true){processLogout()}else{var save=ox.api.config.get("gui.global.save",1);
if(save===0){processLogout()}else{ox.api.config.set("gui.global.save",1);ox.api.config.save({success:function(data){processLogout()},error:function(error){processLogout();return true}})}}}}}()),window:(function(){var GUID=1;var newGUID=function(){return"OX."+(GUID++)};var getGUID=function(obj){if(typeof obj==="string"){return obj==="OX.#"?"OX."+(GUID-1):obj}else{return obj?obj.guid:undefined}};var windows={"OX.0":{window:window}};var windowData={};var isEmbedded=false;return{isNested:isNested(),isEmbedded:function(){return isEmbedded
},core:getCore(),setFactory:function(opener,closer,selector,embedded){if(opener!==undefined&&closer!==undefined&&selector!==undefined){windowFactory=opener;windowCloser=closer;windowSelector=selector;isEmbedded=!!embedded}else{console.error("setFactory(opener, closer, selector): One function is missing")}},resetFactory:function(){windowFactory=defaultWindowFactory;windowCloser=defaultWindowCloser;windowSelector=defaultWindowSelector;isEmbedded=false},setPositioner:function(fn){windowPositioner=fn
},setDefaultOptions:function(options){defaultWindowOptions=options},serializeOptions:function(o){var opt=$.extend({},defaultWindowOptions,o||{});if(o){opt.width=o.width;opt.height=o.height;opt.left=o.x;opt.top=o.y}return ox.util.serialize(opt,",")},register:function(guid,window,options){windows[guid]=$.extend({window:window},options);return windows[guid]},exists:function(guid){return windows[getGUID(guid)]!==undefined},get:function(guid){guid=getGUID(guid);return windows[guid]!==undefined?windows[guid]:null
},getAll:function(){return windows},setData:function(data,guid){if(data!==undefined){guid=getGUID(guid);if(guid===undefined||windowData[guid]===undefined){guid=newGUID()}debug("setData",guid,data);windowData[guid]={data:data||{}}}return guid},getData:function(obj){var guid=getGUID(obj);if(guid!==undefined){if(isNested()){return this.core.ox.api.window.getData(guid)}else{var d=windowData[guid];debug("getData",guid,d.data,"identifiedBy",obj);return clone(d.data)}}else{console.error("getData: guid is missing in given window!")
}},open:function(path,options){return constructWindow(path,processOptions({},options))},close:function(obj,noConfirm){var guid=getGUID(obj),data=windows[guid];var ctrl=data.window.windowController;if(data!==undefined){if(ctrl&&!noConfirm){ctrl.close()}else{if(ctrl){ctrl.destruct()}windowCloser(data,guid);data.window=null;delete windows[guid];delete windowData[guid]}}},select:function(obj){var guid=getGUID(obj);if(windows[guid]!==undefined){windowSelector(windows[guid],guid)}},selectLast:function(){this.select("OX.#")
},getLastGUID:function(){return"OX."+(GUID-1)},getNextGUID:function(){return"OX."+(GUID)},count:function(){var i=0,id;for(id in windows){i++}return i}}}()),setModal:function(flag){showNode("modal-dialog-decorator");showNode("modal-dialog");if(flag){$("#modal-dialog-decorator").css("display","block");$("#modal-dialog").css("display","block");$("iframe").each(function(){var n=$(this),src=n.attr("src")+"";if(/^http/.test(src)){n.data("visibility",n.css("visibility")).css("visibility","hidden")}})}else{$("#modal-dialog-decorator").hide();
$("#modal-dialog").hide();$("iframe").each(function(){var n=$(this),src=n.attr("src")+"";if(/^http/.test(src)){n.css("visibility",n.data("visibility"))}})}modal=!!flag},isModal:function(){return modal},mail:(function(){var open=function(options){var opt=processOptions({params:{folder:ox.UIController.getFolder()===undefined?"default0/INBOX":ox.UIController.getFolder(),id:undefined,account:undefined,noimg:!corewindow.loadblockedimages,action:""},message:undefined,closer:function(opt){that.window.get(opt.guid).window.triggerEvent("OX_Cancel_Object")
}},options);var p=opt.params;if(opt.message!==undefined){p.folder=opt.message.folder_id;p.id=opt.message.id}if(p.account===undefined){p.account=ox.api.account.derive(p.folder)}if(String(p.id).match(/^default/)){p.account=ox.api.account.derive(p.id)}if(p.account===null){p.account=0}return constructWindow("newMail.html",opt)};return{select:function(options){processSelect("mail",options)},open:function(options){return open(options)},compose:function(options){return open($.extend(true,options||{},{params:{action:""}}))
},forward:function(options){return open($.extend(true,options||{},{params:{action:"forward"}}))},reply:function(options){return open($.extend(true,options||{},{params:{action:"reply"}}))},replyAll:function(options){return open($.extend(true,options||{},{params:{action:"replyall"}}))},draft:function(options){return open($.extend(true,options||{},{params:{action:"draft"}}))},view:function(options){var opt=processOptions({params:{id:undefined,folder:"default0/INBOX",sid:undefined},closer:function(opt){that.window.get(opt.guid).window.triggerEvent("OX_Cancel_Object")
}},options);return constructWindow("detailMail.html",opt)},showSource:function(options){var opt=processOptions({params:{triggerevent:"OX_Popup_Cb",folder:"default0/INBOX"},mail:undefined,options:{scrollbars:"yes"},closer:function(opt){that.window.close(that.window.get(opt.guid).window)}},options);var handler=function(win){json.get(AjaxRoot+"/mail?"+ox.util.serialize({action:"get",session:session,folder:opt.params.folder,id:opt.params.id,src:"true"}),null,function(response){unregister("OX_Popup_Cb",handler);
if(win.closed){return}if(opt.mail){OXMailMapping.editObjectsInternal([opt.mail],null,true,[{flag:32,bool:true}])}var text=_("Unable to display E-Mail source.");if(response.data){text=response.data.replace(/\r/g,IE===7?"\r\n":"")}var doc=win.document;var area;if(IE===7){area=$("<pre/>",doc).css({wordWrap:"break-word"}).text(text)}else{area=$("<textarea/>",doc).val(text)}area.css({width:"100%",height:"100%",backgroundColor:"lightyellow",border:"0px none",whiteSpace:"pre"});$("body",doc).css({margin:"0px",padding:"10px",backgroundColor:"lightyellow",fontFamily:"Arial, Helvetica, sans-serif",fontSize:"9pt",borderTop:"5px solid #fc0"}).append($("<div/>",doc).css({position:"absolute",top:"5px",left:"0px",right:"10px",height:"25px",lineHeight:"25px",textAlign:"right"}).append($("<a/>",doc).attr({href:"#"}).text(_("Close")+"").bind("click",function(e){ox.api.window.close(win.url.guid)
}))).append($("<div/>",doc).css({position:"absolute",top:"30px",left:"0px",right:"0px",bottom:"0px",padding:"10px"}).append(area));area.focus()})};register("OX_Popup_Cb",handler);return constructWindow("popup_trigger_cb.html",opt)},print:function(options){var opt=processOptions({id:undefined,folder:"default0/INBOX",closer:function(opt){ox.api.window.close(opt.guid)}},options);this.httpGet({params:{id:opt.id,folder:opt.folder,view:"noimg"},success:function(data){data.attachments_html_noimage=data.attachments;
mail_printSingleMail(data,opt.closer)}})},httpGet:function(options){var opt=options||{params:{}};ox.api.http.GET({module:"mail",params:{action:"get",id:opt.params.id,folder:opt.params.folder||"default0/INBOX",view:undefined},success:opt.success||$.noop,error:opt.error||$.noop,appendColumns:false})},get:function(folder,id,success){var cache=ox.api.cache.mail,key=folder+"."+id;if(!cache.contains(key)){ox.api.http.GET({module:"mail",params:{action:"get",folder:folder,id:id},success:function(data,timestamp){cache.add(data,timestamp);
ox.util.call(success,data)}})}else{var data=cache.get(folder);ox.util.call(success,data);return data}},all:function(folder,options){var opt=options||{params:{}};opt.params=$.extend({action:"all",folder:folder,columns:"600,601",sort:"610",order:"desc"},opt.params||{});var cache=ox.api.cache.mailFolder;var key=folder+".("+opt.params.columns+")."+opt.params.sort+"."+opt.params.order;if(!cache.contains(key)){ox.api.http.GET({module:"mail",params:opt.params,appendColumns:false,success:function(data,timestamp){if(opt.params.columns.search(/600/)>-1){cache.add(key,data)
}if(opt.params.columns===ox.api.http.getAllColumns("mail").join(",")){ox.api.cache.mail.addArray(data,timestamp)}ox.util.call(opt.success,data)}})}else{var data=cache.get(key);ox.util.call(opt.success,data);return data}},list:function(options){var opt=options||{data:[],params:{}};opt.data=opt.data||[];opt.params=$.extend({action:"list",columns:"600,601,602,603,604,605,606,607"},opt.params||{});ox.api.http.PUT({module:"mail",data:opt.data,params:opt.params,appendColumns:false,success:function(data,timestamp){var i=0,list=data.data,$i=list.length,tmp=[];
var columns=opt.params.columns.split(/,/);var make=ox.api.http.makeObject;for(;i<$i;i++){tmp.push(make(list[i],"mail",columns))}ox.util.call(opt.success,tmp)}})}}}()),calendar:(function(){var fix=function(o){var p=o.params;p.folder_id=p.folder_id!==undefined?o.folder_id:p.folder;delete p.folder;if(p.recurrence_position!==undefined&&p.recurrence_position>0){p.singleappointment="yes"}return o};var open=function(options){var opt=processOptions({params:{modul:"new",folder:config.folder.calendar,view:currentCalendarView,folderOwner:undefined,start_date:new Date().getTime(),end_date:"",full_time:false,id:undefined},closer:function(opt){that.window.get(opt.guid).window.triggerEvent("OX_Cancel_Object")
}},options);return constructWindow("newAppointment.html",fix(opt))};return{select:function(options){processSelect("calendar",options)},compose:function(options){var guid=ox.api.window.getNextGUID();var opt=$.extend(true,options||{},{params:{modul:"new"}});var cont=function(folder){if(ox.api.folder.is("private|shared",folder)){opt.params.folderOwner=folder.created_by}else{opt.params.folderOwner=configGetKey("identifier")}open(opt)};var id=opt.params.folder!==undefined?opt.params.folder:(activefolder?activefolder:config.folder.calendar);
ox.api.folder.get({folder:id,success:function(data){if(data.module==="calendar"){cont(data)}else{if(opt.params.folder!==undefined){triggerEvent("OX_New_Error",4,_("Can not create appointment in a folder other than appointment folder"))}else{ox.api.folder.get({folder:config.folder.calendar,success:cont})}}}});return guid},edit:function(options){return open($.extend(true,options||{},{params:{modul:"edit"}}))},print:function(options){var opt=processOptions({view:"day",day:activeDay,month:activeMonth+1,year:activeYear,options:{scrollbars:"yes"},closer:function(opt){ox.api.window.close(opt.guid)
}},options);var date=new Date(Date.UTC(opt.year,opt.month-1,opt.day)),start,days;var self=this;var print=function(template,start,end,numdays){var success=opt.success;opt.success=function(win,guid){self.httpPrint({params:{start:start,end:end,template:template,folder:calendar_getAllFoldersAttribute()?undefined:activefolder,work_week_day_amount:numdays?numdays:undefined},success:function(response){if(win&&!window.closed){win.document.open();response=response.replace(/window\.print\(\)/,"");if(ox.browser.Gecko){response=response.replace(/<\/html>/,'<script type="text/javascript">window.focus();window.print();<\/script>')
}win.document.write(response);win.document.close();if(ox.browser.IE||ox.browser.WebKit){setTimeout(function(){win.focus();win.print()},0)}success(win,guid)}}})};return constructWindow("newInfoItemHidden.html",opt)};switch(opt.view){case"day":start=date.getTime();return print("cp_dayview_table.tmpl",start,start+86400000,null);case"workweek":start=getDayInSameWeek(date,configGetKey("gui.calendar.workweek.startday"))*86400000;days=configGetKey("gui.calendar.workweek.countdays");return print("cp_weekview_table.tmpl",start,start+days*86400000,days);
case"week":start=getDayInSameWeek(date,1)*86400000;return print("cp_weekview_table.tmpl",start,start+604800000,null);case"month":return print("cp_monthview_table.tmpl",Date.UTC(opt.year,opt.month-1,1),Date.UTC(opt.year,opt.month,1),null)}},httpGet:function(options){ox.api.http.GET(processHTTPOptions("calendar",{action:"get",folder:config.folder.calendar,id:undefined},options))},httpGetAll:function(options){var now=(new Date()).getTime();ox.api.http.GET(processHTTPOptions("calendar",{action:"all",folder:config.folder.calendar,start:now,end:now+1000*3600*24*7},options))
},httpPrint:function(options){var now=(new Date()).getTime();ox.api.http.GET(processHTTPOptions("printCalendar",{start:now,end:now+86400000,template:"cp_dayview_table.tmpl",folder:undefined,work_day_start_time:getWWStartTime(),work_day_end_time:getWWEndTime(),work_week_day_amount:undefined},options,{dataType:"text",appendColumns:false}))}}}()),contact:(function(){var open=function(file,options){var opt=processOptions({params:{modul:"new",currentView:undefined,folder:config.folder.contacts,session:session},closer:function(opt){that.window.get(opt.guid).window.triggerEvent("OX_Cancel_Object")
}},options);return constructWindow(file,opt)};return{select:function(options){processSelect("contacts",options)},compose:function(options){return open("newContact.html",$.extend(true,options||{},{params:{modul:"new"}}))},composeDistributionList:function(options){return open("newDistributionList.html",$.extend(true,options||{},{params:{modul:"new"}}))},edit:function(options){return open("newContact.html",$.extend(true,options||{},{params:{modul:"edit"}}))},editDistributionList:function(options){return open("newDistributionList.html",$.extend(true,options||{},{params:{modul:"edit"}}))
},duplicate:function(options){return open("newContact.html",$.extend(true,options||{},{params:{modul:"duplicate"}}))},duplicateDistributionList:function(options){return open("newDistributionList.html",$.extend(true,options||{},{params:{modul:"duplicate"}}))},searchByMail:(function(){var addressMap={},contacts={};return function(opt){var columns=opt.columns||ox.api.http.getAllColumns("contacts");var list=opt.data||[];ox.api.http.pause();var success=function(responses){var i=0,data=responses.data,$i=data.length,r,key,contact;
var map=function(address,key){address=(address||"").toLowerCase();if(address!==""){if(addressMap[address]===undefined){addressMap[address]=[]}if(key.folder===6){addressMap[address].unshift(key)}else{addressMap[address].push(key)}}};for(;i<$i;i++){contact=ox.api.http.makeObject(data[i],"contacts",columns);key=contact.folder_id+"."+contact.id;contacts[key]=contact;map(contact.email1,key);map(contact.email2,key);map(contact.email3,key)}};var i=0,$i=list.length,address,count=0;for(;i<$i;i++){address=list[i];
if(addressMap[address]===undefined){ox.api.http.PUT({module:"contacts",params:{action:"search"},data:{email1:address,email2:address,email3:address,orSearch:true},success:success});count++}}ox.api.http.resume(function(){ox.util.call(opt.success,{map:addressMap,contacts:contacts})})}}())}}()),task:(function(){var open=function(options){var opt=processOptions({params:{modul:undefined,folder:configGetKey("folder.tasks"),session:session},closer:function(opt){that.window.get(opt.guid).window.triggerEvent("OX_Cancel_Object")
}},options);return constructWindow("newTask.html",opt)};return{select:function(options){processSelect("tasks",options)},compose:function(options){return open($.extend(true,options||{},{params:{modul:undefined}}))},edit:function(options){return open($.extend(true,options||{},{params:{modul:"edit"}}))},duplicate:function(options){return open($.extend(true,options||{},{params:{modul:"duplicate"}}))}}}()),infostore:(function(){var fix=function(options){options.params.edit_id=options.params.id;delete options.params.id;
return options};var open=function(options){var opt=processOptions({params:{id:undefined,folder:configGetKey("folder.infostore")},closer:function(opt){that.window.get(opt.guid).window.triggerEvent("OX_Cancel_Object")}},options);return constructWindow("newInfoItemMain.html",fix(opt))};return{select:function(options){processSelect("infostore",options)},compose:function(options){return open($.extend(true,options||{},{params:{id:-1}}))},composeFromAttachment:function(options){return open($.extend(true,options||{},{params:{id:-1}}))
},edit:function(options){return open(options)},download:function(options){var opt=$.extend({id:0,filename:""},options||{});var cont=function(){var parts=[AjaxRoot,"infostore",opt.filename];var params={action:"document",id:opt.id,content_type:"application/octet-stream",content_disposition:"attachment",session:session};if(ox.browser.Gecko){delete params.content_type}var url=parts.join("/")+"?"+ox.util.serialize(params);var iframe=$("<iframe/>",{src:url}).css({display:"none",width:"0px",height:"0px"}).one("load",function(e){setTimeout(function(){iframe.remove()
},10)}).appendTo(document.body)};if(ox.browser.IE&&opt.filename===undefined){ox.api.http.GET({module:"infostore",params:{action:"get",id:opt.id,columns:"702"},success:function(response){opt.filename=response.filename;cont()}})}else{cont()}},open:function(options){var opt=$.extend({id:0,filename:""},options||{});var cont=function(){var parts=[AjaxRoot,"infostore",opt.filename];var params={action:"document",id:opt.id,content_disposition:"inline",session:session};if(opt.content_type){params.content_type=opt.content_type
}var url=parts.join("/")+"?"+ox.util.serialize(params);var options=that.window.serializeOptions({width:1000,height:600,scrollbars:"yes"});var w=window.open(url,"",options);if(w&&w.moveTo){w.moveTo((screen.availWidth-1000)/2>>0,(screen.availHeight-600)/2>>0)}};if(ox.browser.IE&&opt.filename===undefined){ox.api.http.GET({module:"infostore",params:{action:"get",id:opt.id,columns:"702"},success:function(response){opt.filename=response.filename;cont()}})}else{cont()}}}}()),folder:(function(){register("OX_Refresh",function(){ox.api.folder.refresh()
});var perm=function(nBits,nOffset){return(nBits>>nOffset)&(nOffset>=28?1:127)};var TIME=(new Date()).getTime();var clock=function(){TIME=ox.util.now()};var blacklist=undefined;var applyBlacklist=function(mode,data){var id="",tmp=null;function process(array){return $.grep(array,function(o){return o!==undefined&&blacklist[String(o.data?o.data.id:o.id)]===undefined})}if(blacklist===undefined){if((tmp=ox.api.config.get("ui.folder.blacklist",null))){blacklist={};$.each(tmp,function(i,o){blacklist[String(o)]=true
})}else{blacklist=null}}if(blacklist!==null&&data){if(ox.util.isArray(data)){data=process(data)}else{if(data["private"]){for(id in data){data[id]=process(data[id])}}else{if(data.data||data.id){data=process([data])[0]}}}}return data};var clear=function(id,cont){ox.api.folder.get({folder:id,success:function(data){var module=data.module;if(ox.api[module]&&typeof ox.api[module].all==="function"){ox.api[module].all(id,{success:function(data){var list=$.map(data,function(o,i){return o.id});if(module==="mail"){ox.api.cache.mail.remove(list);
ox.api.cache.mailFolder.grepRemove(id)}ox.util.call(cont)}})}}})};var notExists={};var api={getRootFolders:function(options){var opt=options||{};opt.folder="0";this.getSubFolders(opt)},getSubFolders:function(options){var opt=$.extend({folder:"0",tree:ox.api.config.get("modules.folder.tree",0),all:false,event:true,cache:true,storage:undefined,defer:false},options||{});var cache=opt.storage||ox.api.cache["folder"+opt.tree];if(opt.cache===false||!cache.isComplete(opt.folder)){return ox.api.http.GET({module:"folders",appendColumns:true,params:{action:"list",parent:opt.folder,all:opt.all===true?1:0,tree:opt.tree},success:function(data,timestamp){var i=0,$l=data.length,obj;
for(;i<$l;i++){obj=data[i];obj.folder_id=opt.folder}data=applyBlacklist("subfolders",data);cache.removeChildren(opt.folder);cache.addArray(data);cache.setComplete(opt.folder);if(opt.event===true){api.dispatcher.trigger("update *",{why:"folder.subfolders",id:opt.folder})}return ox.util.call(opt.success,data)},error:function(error){if(error){switch(error.code){case"FLD-0008":case"FLD-0003":case"IMAP-1002":notExists[opt.folder]=true;cache.remove(opt.folder);cache.setComplete(opt.folder,false);break}}return ox.util.call(opt.error,error)
}})}else{if(!opt.defer){var data=cache.children(opt.folder);ox.util.call(opt.success,data);return data}else{}}},get:function(options){var opt=$.extend({folder:"0",tree:ox.api.config.get("modules.folder.tree",0),event:false,cache:true,storage:undefined},options||{});var cache=opt.storage||ox.api.cache["folder"+opt.tree];if(opt.cache===false||!cache.contains(opt.folder)){if(notExists[opt.folder]===true){ox.util.call(opt.error,{code:"FLD-0008",error:""})}else{ox.api.http.GET({module:"folders",params:{action:"get",id:opt.folder,tree:opt.tree},success:function(data,timestamp){if((data=applyBlacklist("get",data))){cache.add(data,opt.cache===false?undefined:timestamp);
if(opt.event===true){api.dispatcher.trigger("update *",{why:"folder.get",id:opt.folder})}return ox.util.call(opt.success,data)}else{notExists[opt.folder]=true}},error:function(error,status){if(error){switch(error.code){case"FLD-0008":case"FLD-0003":case"IMAP-1002":notExists[opt.folder]=true;cache.remove(opt.folder);cache.setComplete(opt.folder,false);break}}return ox.util.call(opt.error,error,status)}})}}else{var data=cache.get(opt.folder);ox.util.call(opt.success,data);return data}},exists:function(options){var opt=$.extend({folder:"0",tree:ox.api.config.get("modules.folder.tree",0),cache:true,storage:undefined,error:$.noop},options||{});
var yes=function(){ox.util.call(opt.success,true)};var no=function(error,status){if(!error.status&&(error.code==="FLD-0008"||error.code==="FLD-0003")){ox.util.call(opt.success,false);return true}ox.util.call(opt.error,error,status)};var cache=opt.storage||ox.api.cache["folder"+opt.tree];if(opt.cache===false||!cache.contains(opt.folder)){ox.api.folder.get({folder:opt.folder,tree:opt.tree,success:yes,error:no})}else{yes()}},getMultiple:function(options){var opt=$.extend({list:[],tree:ox.api.config.get("modules.folder.tree",0),cache:true,event:true,storage:undefined},options||{});
var result={};if(ox.util.isArray(opt.list)){var cache=opt.storage||ox.api.cache["folder"+(opt.tree||0)];var i=0,$l=opt.list.length,requests=[],id;var columns=ox.api.http.getAllColumns("folders").join(",");for(;i<$l;i++){id=opt.list[i]+"";if(opt.cache===true&&cache.contains(id)){result[id]=cache.get(id)}else{if(notExists[id]!==true){requests.push({action:"get",module:"folders",id:id,columns:columns,tree:opt.tree})}}}var cont=function(folders){folders=applyBlacklist("mutiple",folders);var i=0,$l=folders.length,folder,id;
for(;i<$l;i++){folder=folders[i];if(folder.error!==undefined){notExists[requests[i].id]=true}else{id=folder.data.id+"";if(result[id]===undefined){result[id]=folder.data;if(folder.data!==undefined){cache.add(folder.data,folder.timestamp)}}}}if(opt.event===true){api.dispatcher.trigger("update *",{why:"folder.get.multiple"})}return ox.util.call(opt.success,result)};if(requests.length>0){ox.api.http.PUT({module:"multiple",data:requests,appendColumns:false,params:{"continue":true},success:cont})}else{cont(result)
}}return result},getParents:function(options){var opt=$.extend({folder:"0",tree:ox.api.config.get("modules.folder.tree",0),cache:true,event:true,storage:undefined},options||{});var cache=opt.storage||ox.api.cache["folder"+opt.tree];var data=cache.get(opt.folder),cacheHit=false,tmp=[];while(data){tmp.push(data);if(data.folder_id==="0"){cacheHit=true;break}data=cache.get(data.folder_id)}if(opt.cache===true&&cacheHit===true){ox.util.call(opt.success,tmp)}else{ox.api.http.GET({module:"folders",appendColumns:true,params:{action:"path",id:opt.folder,tree:opt.tree},success:function(data,timestamp){cache.addArray(data,timestamp);
if(opt.event===true){api.dispatcher.trigger("update *",{why:"folder.parents",id:opt.folder})}return ox.util.call(opt.success,data)},error:function(data){return ox.util.call(opt.error,data)}})}},getAllVisible:function(type,success){if(typeof type==="string"){var tree=ox.api.config.get("modules.folder.tree",0);var cache=ox.api.cache["folder"+tree];var flat=ox.api.cache.folderFlat;if(!flat.contains(type)){ox.api.http.GET({module:"folders",appendColumns:true,params:{tree:tree,action:"allVisible",content_type:type},success:function(data,timestamp){var id;
for(id in data){var i=0,folders=data[id],$l=folders.length;for(;i<$l;i++){folders[i]=ox.api.http.makeObject(folders[i],"folders");if((folders[i]=applyBlacklist("allvisible.1",folders[i]))){cache.add(folders[i],timestamp)}}}data=applyBlacklist("allvisible.2",data);flat.add(type,data,timestamp);if(true){api.dispatcher.trigger("update *",{why:"folder.allVisible",type:type})}return ox.util.call(success,data)}})}else{return ox.call(success,flat.get(type))}}},rename:function(options){var tree=ox.api.config.get("modules.folder.tree",0),opt=$.extend({folder:undefined,title:"Unnamed"},options||{});
ox.api.folder.get({folder:opt.folder,success:function(data){var folder_id=data.folder_id,cache=ox.api.cache["folder"+tree],module=data.module;cache.setComplete(folder_id,false);ox.api.cache.folderFlat.remove(module);ox.api.folder.update({folder:opt.folder,data:{title:opt.title},success:function(data){ox.util.call(opt.success,data)},error:opt.error})},error:opt.error})},update:function(options){var opt=$.extend({folder:undefined,tree:ox.api.config.get("modules.folder.tree",0),data:undefined,event:true,local:false,storage:undefined,filter:ox.util.identity},options||{});
if(opt.folder!==undefined){ox.api.folder.get({folder:opt.folder,tree:opt.tree,cache:true,event:false,storage:opt.storage,success:function(folder){var cache=opt.storage||ox.api.cache["folder"+opt.tree];if(opt.local===true){folder=opt.filter($.extend(folder,opt.data));cache.add(folder);if(opt.event===true){api.dispatcher.trigger("update modify *",{why:"folder.update.local",id:opt.folder,folder:folder})}ox.util.call(opt.success,folder)}else{if(opt.data!==undefined){ox.api.http.PUT({module:"folders",params:{action:"update",id:opt.folder,tree:opt.tree},data:opt.data||{},appendColumns:false,processData:false,success:function(response){var id=response.data;
delete notExists[id];ox.api.folder.get({folder:id,event:false,cache:false,storage:opt.storage,success:function(data){var why,type;var oldId=opt.folder||opt.folder_id;if(oldId!==id){var cache=opt.storage||ox.api.cache["folder"+opt.tree];cache.removeChildren(oldId,true);cache.remove(oldId);why="folder.move";type="move modify *"}else{why="folder.update";type="update modify *"}if(opt.event===true){api.dispatcher.trigger(type,{why:why,id:id,oldId:oldId,folder:data})}return ox.util.call(opt.success,data)
}})},error:function(error){return ox.util.call(opt.error,error)}})}}}})}},refresh:function(options){var opt=$.extend({folders:[],tree:ox.api.config.get("modules.folder.tree",0),event:true,storage:undefined},options||{});var params={action:"updates",timestamp:TIME,tree:opt.tree};ox.api.http.GET({module:"folders",appendColumns:true,params:params,success:function(data,timestamp){var cache=opt.storage||ox.api.cache["folder"+opt.tree],i,$l;for(i=0,$l=data.length;i<$l;i++){if(typeof data[i]==="object"){cache.add(data[i],timestamp)
}else{var deleted=cache.get(data[i]);if(deleted){cache.setComplete(deleted.folder_id,false);cache.remove(deleted)}}}var values,keys,id;if(opt.folders.length===0){values=cache.values();for(i=0,$l=values.length;i<$l;i++){var f=values[i];if(f.id==="1"||/^default[1-9]/.test(f.id)||/^default0/.test(f.id)&&!f.subscribed&&!f.subscr_subflds){id=ox.util.firstOf(f.folder_id,f.folder);if(id!=="0"){cache.setComplete(id,false);cache.removeChildren(id,true)}}}values=$.grep(cache.values(),function(folder){return(folder.id==="1"||folder.id.match(/^default0/))&&folder.$===undefined&&(folder.subscribed===true||folder.subscr_subflds===true)
});keys=$.map(values,function(folder){return folder.id});ox.api.cache.folderFlat.remove("calendar");ox.api.cache.folderFlat.remove("contacts");ox.api.cache.folderFlat.remove("tasks")}else{keys=opt.folders}ox.api.http.pause();var refreshed={};var markAsRefreshed=function(i,folder){refreshed[folder.id]=true};for(i=0,$l=keys.length;i<$l;i++){id=keys[i];if(cache.isComplete(id)){ox.api.folder.getSubFolders({folder:id,tree:opt.tree,cache:false});$.each(cache.children(id),markAsRefreshed)}}for(i=0;i<$l;
i++){id=keys[i];if(refreshed[id]===undefined){ox.api.folder.get({folder:id,tree:opt.tree,cache:false})}}ox.api.http.resume(function(){clock();if(opt.event===true){api.dispatcher.trigger("refresh modify *",{why:"folder.refresh"})}ox.util.call(opt.success,{})})}})},move:function(folder,target){api.canMove(folder,target,function(){var id=folder.id;ox.api.folder.update({folder:id,data:{folder_id:target.id},event:false,success:function(data){var tree=ox.api.config.get("modules.folder.tree",0);var cache=ox.api.cache["folder"+tree];
cache.removeChildren(id,true);cache.remove(id);cache.removeChildren(folder.folder_id,true);cache.removeChildren(target.folder_id,true);var join=new Join(function(){ox.api.folder.dispatcher.trigger("move modify *",{why:"folder.move",oldId:id,id:data.id,folder:data,target:target.id})});var folderReady=join.add();var targetReady=join.add();ox.api.folder.get({folder:folder.folder_id,cache:false,success:folderReady});ox.api.folder.get({folder:target.folder_id,cache:false,success:targetReady})}})},$.noop)
},getFreeTitle:function(folder,success){ox.api.folder.getSubFolders({folder:folder,event:false,success:function(data){var titles=$.map(data,function(folder){return folder.title});var prefix=expectI18n(_("New folder")),title="",index=0;while(true){index++;title=prefix;if(index>1){title+=" "+index}if($.inArray(title,titles)===-1){ox.util.call(success,title);break}}},error:function(){ox.util.call(success,title)}})},create:function(options){var opt=$.extend({folder:undefined,tree:ox.api.config.get("modules.folder.tree",0),event:true},options||{});
opt.data=$.extend({module:"mail",title:expectI18n(_("New folder")),subscribed:1,permissions:undefined},opt.data||{});var cont=function(title){opt.data.title=title;ox.api.folder.get({folder:opt.folder,event:false,success:function(parent){if(opt.data.permissions===undefined){opt.data.permissions=getNewFolderPerms(parent,parent.type!==5)}if(parent.type!==3){var p=opt.data.permissions,i=0,$l=p.length;var entity=ox.api.config.get("identifier");for(;i<$l;i++){if(p[i].entity===entity){p.splice(i,1);break
}}p.push({group:false,bits:403710016,entity:entity})}ox.api.http.PUT({module:"folders",params:{action:"new",folder_id:opt.folder,tree:opt.tree},data:opt.data,appendColumns:false,success:function(data){ox.api.cache.folder0.removeChildren(opt.folder);ox.api.cache.folder0.setComplete(opt.folder,false);ox.api.cache.folder1.removeChildren(opt.folder);ox.api.cache.folder1.setComplete(opt.folder,false);ox.api.cache.folderFlat.remove(opt.data.module);ox.api.http.pause();ox.api.folder.get({folder:opt.folder,cache:false,event:false});
delete notExists[data.data];ox.api.folder.get({folder:data.data,tree:opt.tree,cache:false,event:false,success:function(data,timestamp){if(opt.event===true){ox.api.folder.dispatcher.trigger("create modify *",{why:"folder.create",id:data.id,folder:data})}ox.util.call(opt.success,data)}});ox.api.http.resume()},error:function(error){ox.util.call(opt.error,error)}})}})};cont(opt.data.title)},remove:function(options){var opt=$.extend({id:undefined,event:true,tree:ox.api.config.get("modules.folder.tree",0)},options||{});
ox.api.folder.get({folder:opt.id,tree:opt.tree,event:false,success:function(folder){ox.api.http.PUT({module:"folders",params:{action:"delete",tree:opt.tree},data:[opt.id],success:function(data){var parent=folder.folder_id||folder.folder;function updateHasChildren(cache){var parentObj=cache.get(parent);if(parentObj&&!cache.children(parent).length){parentObj.subfolders=false}}var cont=function(){ox.api.cache.folder0.removeChildren(opt.id,true);ox.api.cache.folder0.remove(opt.id);ox.api.cache.folder0.setComplete(opt.id,false);
ox.api.cache.folder0.setComplete(parent,false);updateHasChildren(ox.api.cache.folder0);ox.api.cache.folder1.removeChildren(opt.id,true);ox.api.cache.folder1.remove(opt.id);ox.api.cache.folder1.setComplete(opt.id,false);ox.api.cache.folder1.setComplete(parent,false);updateHasChildren(ox.api.cache.folder1);ox.api.cache.folderFlat.remove(folder.module);api.dispatcher.trigger("remove modify *",{why:"folder.remove",id:opt.id,oldId:opt.id,folder:folder});ox.util.call(opt.success,data,folder)};if(folder.module==="mail"){try{var accountId=ox.api.account.derive(parent),account=ox.api.account.get(accountId),trash=account.trash_fullname;
ox.api.folder.get({folder:trash,success:function(data){var trashParent=data.folder_id;ox.api.cache.folder0.remove(trash);ox.api.cache.folder0.setComplete(trash,false);ox.api.cache.folder0.setComplete(trashParent,false);ox.api.cache.folder1.remove(trash);ox.api.cache.folder1.setComplete(trash,false);ox.api.cache.folder1.setComplete(trashParent,false);cont()},error:function(error){ox.util.call(opt.error,error)}})}catch(e){cont()}}else{cont()}},error:function(error){ox.util.call(opt.error,error)}})}})
},clear:function(id,success){clear(id,function(){ox.api.http.PUT({module:"folders",appendColumns:false,params:{action:"clear",tree:ox.api.config.get("modules.folder.tree",0)},data:[id],success:function(data,timestamp){var caches=["folder0","folder1"],i=0,$i=caches.length;var cache,folder;for(;i<$i;i++){cache=ox.api.cache[caches[i]];if((folder=cache.get(id))){folder.subfolders=false}cache.removeChildren(id,true)}api.dispatcher.trigger("clear update *",{why:"folder.clear",id:id});ox.util.call(success,data)
}})})},canMove:function(folder,target,success,failure){if(folder.folder_id===target.id){return failure()}if(folder.id===target.id){return failure()}if(folder.type===3||target.type===3){return failure()}if(folder.type===5){return failure()}if(this.is("defaultfolder",folder)){return failure()}var defaultFolders=ox.api.config.get("folder");for(id in defaultFolders){if(defaultFolders[id]==folder.id){return failure()}}if(folder.type===1&&target.type!==1&&target.id!==1&&(configGetKey("modules.folder.tree")!==1||target.type!==7)){return failure()
}if(folder.type===2&&target.type!==2&&!(target.id in {2:1,10:1,15:1})){return failure()}if(folder.module!==target.module){if(folder.module==="infostore"){return failure()}var pim={tasks:1,calendar:1,contacts:1};if(configGetKey("modules.folder.tree")===1){pim.mail=1}else{if(folder.module==="mail"&&target.module!=="system"){return failure()}}if((folder.module in pim)&&!(target.module in pim)&&target.module!=="system"){return failure()}}if(perm(folder.own_rights,28)!==1||perm(target.own_rights,0)<4){return failure()
}this.getParents({folder:target.id,success:function(ancestors){var i;for(i=0;i<ancestors.length;i++){if(ancestors[i].id===folder.id){return failure()}}success()}})},can:function(action,data){var result=true;if(ox.util.isArray(data)){var i=0,$l=data.length;for(;i<$l&&result;i++){result=result&&ox.api.folder.can(action,data[i])}return result}var rights=data.own_rights;var isSystem=data.standard_folder||this.is("system",data);var isAdmin=perm(rights,28)===1;var isMail=data.module==="mail";switch(action){case"read":return perm(rights,7)>0;
case"write":return perm(rights,0)>=2;case"rename":if(!isAdmin||isSystem){result=false}else{if(perm(rights,30)===1){result=true}else{if(!isMail){result=true}else{result=!this.is("defaultfolder",data)}}}return result;case"delete":return isAdmin&&!isSystem&&!this.is("defaultfolder",data);case"import":return(rights&127)>=2&&this.is("calendar|contacts|tasks",data);case"export":return !this.is("shared",data)&&this.is("contacts|calendar",data);case"empty":return(rights>>21&127)&&this.is("mail",data);case"changepermissions":return isAdmin;
case"viewproperties":return !isMail&&!this.is("account",data)&&(data.capabilities&1);case"subscribe":return isMail&&Boolean(data.capabilities&Math.pow(2,4));default:return false}},is:function(type,data){var result,i=0,$i,id;if(ox.util.isArray(data)){for($i=data.length,result=true;i<$i&&result;i++){result=result&&ox.api.folder.is(type,data[i])}return result}else{if(type.search(/\|/)>-1){var types=type.split(/\|/);for($i=types.length,result=false;i<$i;i++){if(this.is(types[i],data)){result=true;break
}}return result}else{switch(type){case"private":return data.type===1;case"public":return data.type===2;case"shared":return data.type===3;case"system":return data.type===5;case"mail":return data.module==="mail";case"messaging":return data.module==="messaging";case"calendar":return data.module==="calendar";case"contacts":return data.module==="contacts";case"tasks":return data.module==="tasks";case"infostore":return data.module==="infostore";case"account":return data.module==="system"&&/^default(\d+)?/.test(String(data.id));
case"unifiedmail":id=data?(data.id!==undefined?data.id:data):"";var match=String(id).match(/^default(\d+)/);return match?!ox.api.cache.account.contains(match[1]):false;case"external":return/^default[1-9]/.test(String(data.id))&&!this.is("unifiedmail",data);case"defaultfolder":var folders=ox.api.config.get("mail.folder");for(id in folders){if(folders[id]===data.id){return true}}return false;case"published":if(data["com.openexchange.publish.publicationFlag"]){return true}if(data.permissions.length<=1){return false
}return data.type===1||data.type===7||(data.module==="infostore"&&data.created_by===ox.api.config.get("identifier"))}}}},getPathString:function(options){var opt=$.extend({folder:"0",tree:ox.api.config.get("modules.folder.tree",0),separator:"/",cache:true},options||{});this.getParents({folder:opt.folder,tree:opt.tree,cache:opt.cache,success:function(data){if(opt.tree===1){data.pop()}ox.util.call(opt.success,ox.api.folder.derive("path.string",data,opt.separator))},error:function(data){return ox.util.call(opt.error,data)
}})},derive:function(type,data){switch(type){case"path.string":return(function(){var separator=arguments[2]!==undefined?arguments[2]:"/";return ox.api.folder.derive("path.titles",data).join(separator)}());case"path.titles":return(function(){var i=0,$l=data.length,tmp=[];for(;i<$l;i++){tmp.push(data[i].title)}tmp.reverse();return tmp}());case"stats":return(function(tree){var total=0,unread=0,folders=0;var cache=ox.api.cache["folder"+tree];var i=0,keys=cache.keys(),$l=keys.length,folder;for(;i<$l;i++){folder=cache.get(keys[i]);
total+=folder.total||0;unread+=folder.unread||0;folders+=1}return{total:total,unread:unread,folders:folders}}(data!==undefined?data:ox.api.config.get("modules.folder.tree")));case"bits":return perm(ox.util.firstOf(data.own_rights,data,0),arguments[2]||0);case"permissions":return(function(nBits,nOffset){var f=function(mask,strings){nBits=(nBits>>nOffset)&mask;return{string:_(strings[nBits]),bit:nBits}};switch(nOffset){case 0:return f(127,{0:"None",1:"Visible folder",2:"Create objects",4:"Create subfolders",64:"Maximum"});
case 7:return f(127,{0:"None",1:"Read own",2:"Read all",64:"Maximum"});case 14:return f(127,{0:"None",1:"Modify own",2:"Modify all",64:"Maximum"});case 21:return f(127,{0:"None",1:"Delete own",2:"Delete all",64:"Maximum"});case 28:case 29:return f(1,{0:"No",1:"Yes"})}}(data.own_rights||data||0,arguments[2]||0));case"owner":return(function(folder,fn){internalCache.getUsers([folder.created_by],function(data){ox.util.call(fn,data[folder.created_by])})}(arguments[1],arguments[2]));case"accountId":return(function(folder){if(String(folder).match(/^default(\d+)?/)!==null){return parseInt(String(folder).match(/^default(\d+)?/)[1],10)
}else{return undefined}}(arguments[1]))}}};api.dispatcher=!isNested()?new Dispatcher(api):null;return api}()),user:(function(){return{get:function(id,success){if(isFunction(id)){success=id;id=undefined}if(id===undefined||id===null){id=ox.api.config.get("identifier")}ox.api.http.GET({module:"user",params:{action:"get",id:id},success:function(data,timestamp){ox.util.call(success,data)}})},getMultiple:function(list,options){var opt=$.extend({success:$.noop,columns:undefined},options||{});ox.api.http.PUT({module:"user",params:{action:"list",columns:opt.columns?opt.columns:ox.api.http.getAllColumns("user",true)},data:list,processData:opt.processData===false?false:true,success:function(data,timestamp){ox.util.call(opt.success,data)
},error:function(error){ox.util.call(opt.error,error)}})}}}()),account:(function(){var processAccounts=function(data){var isArray=$.isArray(data);if(!isArray){data=[data]}var separator=ox.api.config.get("modules.mail.defaultseparator","/"),rPath=/^default\d+/;var process=function(account,id,title){var prefix="default"+account.id+separator,field=id+"_fullname";if(account.id===0&&!account[field]){var folder=ox.api.config.get("mail.folder."+id);if(!folder){folder=ox.api.config.get("mail.folder.inbox")+separator+(account[id]||title)
}account[field]=folder}else{if(!account[field]){account[field]=prefix+(account[id]||title)}else{if(!rPath.test(account[field])){account[field]=prefix+account[field]}}}};var i=0,$l=data.length,account;for(;i<$l;i++){account=data[i];process(account,"trash","Trash");process(account,"sent","Sent");process(account,"drafts","Drafts");process(account,"spam","Spam");process(account,"confirmed_spam","Confirmed Spam");process(account,"confirmed_ham","Confirmed Ham")}return isArray?data:data[0]};var invalidateRoot=function(){ox.api.cache.folder0.setComplete("1",false);
ox.api.cache.folder1.setComplete("1",false)};var invalidateFolder=function(id){ox.api.cache.folder0.removeChildren(id,true);ox.api.cache.folder0.remove(id);ox.api.cache.folder1.removeChildren(id,true);ox.api.cache.folder1.remove(id)};var invalidateUnifiedMail=function(){var children=[].concat(ox.api.cache.folder0.children(1)).concat(ox.api.cache.folder1.children(1));$.each(children,function(i,obj){if(ox.api.folder.is("unifiedmail",obj.id)){invalidateFolder(obj.id);return false}})};return{derive:function(str,strict){if(typeof str==="number"){return str
}else{if(/^default(\d+)/.test(String(str))){if(!ox.api.folder.is("unifiedmail",str)){return parseInt(str.replace(/^default(\d+)(.*)$/,"$1"),10)}else{var sep=ox.api.config.get("modules.mail.defaultseparator","/"),regex=new RegExp("^default\\d+"+sep+"[^"+sep+"]+"+sep),tail=str.replace(regex,"");if(tail!==str&&/^default\d+/.test(tail)){return ox.api.account.derive(tail,strict)}else{if(!strict){return 0}else{var m=str.match(/^default(\d+)/);return m&&m.length?parseInt(m[1],10):0}}}}else{return 0}}},get:function(id,success){var cache=ox.api.cache.account;
if(!cache.contains(id)){ox.api.http.GET({module:"account",params:{action:"get",id:id},success:function(data,timestamp){data=processAccounts(data);cache.add(data,timestamp);ox.util.call(success,data)}})}else{var data=cache.get(id);ox.call(success,data);return data}},all:function(success){var cache=ox.api.cache.account;if(!cache.isComplete("all")){ox.api.http.GET({module:"account",appendColumns:true,params:{action:"all"},success:function(data,timestamp){data=processAccounts(data);cache.addArray(data,timestamp);
cache.setComplete("all");ox.util.call(success,data)}})}else{var data=cache.values();ox.util.call(success,data);return data}},create:function(options){var opt=$.extend({data:{},success:$.noop},options||{});ox.api.http.PUT({module:"account",appendColumns:false,params:{action:"new"},data:opt.data,success:function(data,timestamp){data=processAccounts(data.data);ox.api.cache.account.add(data,timestamp);invalidateRoot();ox.api.folder.dispatcher.trigger("modify");ox.util.call(opt.success,data)},error:opt.error})
},remove:function(options){var opt=$.extend({id:undefined,success:$.noop},options||{});ox.api.http.PUT({module:"account",appendColumns:false,params:{action:"delete"},data:[parseInt(opt.id,10)],success:function(data,timestamp){ox.api.cache.account.remove(opt.id);invalidateRoot();invalidateFolder("default"+opt.id);invalidateUnifiedMail();ox.api.folder.dispatcher.trigger("modify remove");ox.util.call(opt.success,data)}})},validate:function(data,success,error){ox.api.http.PUT({module:"account",appendColumns:false,params:{action:"validate"},data:data,success:success,error:error})
},update:function(options){var opt=$.extend({data:{},success:$.noop},options||{});ox.api.http.PUT({module:"account",appendColumns:false,params:{action:"update"},data:opt.data,success:function(response){invalidateUnifiedMail();invalidateRoot();var data=processAccounts(response.data);ox.api.cache.account.add(data);ox.api.folder.dispatcher.trigger("modify");ox.util.call(opt.success,data)},error:opt.error})}}}()),cache:(function(){var defaultKeyGenerator=function(data){if(typeof data==="object"&&data){return(data.folder||data.folder_id)+"."+data.id
}else{return""}};var CacheStorage=(function(){var hasLocalStorage=false;try{hasLocalStorage=ox.util.getParam("persistence")==="true"&&"localStorage" in window&&window.localStorage!==null}catch(e){}return function(name,persistent){var id="cache."+(name||"");var fast={};var persist=hasLocalStorage&&persistent===true;if(persist){var i=0,$i=localStorage.length;var reg=new RegExp("^cache\\."+name+"\\."),key;for(;i<$i;i++){key=localStorage.key(i);if(reg.test(key)){fast[key.replace(reg,"")]=JSON.parse(localStorage.getItem(key))
}}}this.clear=function(){fast={};if(persist){setTimeout(function(){var i=0,reg=new RegExp("^cache\\."+name+"\\."),key;while(i<localStorage.length){key=localStorage.key(i);if(reg.test(key)){localStorage.removeItem(key)}else{i++}}},0)}};this.get=function(key){return fast[key+""]};this.set=function(key,data){fast[key+""]=data;if(persist){var str=JSON.stringify(data);setTimeout(function(){localStorage.setItem(id+"."+key,str)},0)}};this.contains=function(key){return fast[key+""]!==undefined};this.remove=function(key){delete fast[key+""];
if(persist){setTimeout(function(){localStorage.removeItem(id+"."+key)},0)}};this.keys=function(){var tmp=[],key;for(key in fast){tmp.push(key)}return tmp}}}());var SimpleCache=function(name,persistent){var index=new CacheStorage(name+".index",persistent);var isComplete=new CacheStorage(name+".isComplete",persistent);var dispatcher=this.dispatcher=new Dispatcher(this);this.clear=function(){index.clear();isComplete.clear();dispatcher.trigger("clear *",{})};this.add=function(key,data,timestamp){timestamp=timestamp!==undefined?timestamp:ox.util.now();
if(!index.contains(key)||timestamp>=index.get(key).timestamp){var type=!index.contains(key)?"add modify *":"update modify *";index.set(key,{data:data,timestamp:timestamp});dispatcher.trigger(type,{key:key,data:data,timestamp:timestamp})}};this.get=function(key){var data=index.get(key);return data!==undefined?data.data:undefined};this.time=function(key){return index.contains(key)?index.get(key).timestamp:0};var remove=function(key){if(index.contains(key)){var o=index.get(key);index.remove(key);dispatcher.trigger("remove modify *",{key:key,data:o.data,timestamp:o.timestamp})
}};this.remove=function(key){if($.isArray(key)){var i=0,$l=key.length;for(;i<$l;i++){remove(key[i])}}else{remove(key)}};this.grepRemove=function(pattern){var i=0,keys=index.keys(),$i=keys.length;var key,reg=new RegExp(pattern);for(;i<$i;i++){key=keys[i];if(reg.test(key)){remove(key)}}};this.keys=function(){return index.keys()};this.grepKeys=function(pattern){var i=0,keys=index.keys(),$i=keys.length;var tmp=[],key,reg=new RegExp(pattern);for(;i<$i;i++){key=keys[i];if(reg.test(key)){tmp.push(key)}}return tmp
};this.grepContains=function(list){var i=0,$l=list.length,tmp=[];for(;i<$l;i++){if(this.contains(list[i])){tmp.push(list[i])}}return tmp};this.values=function(){var i=0,keys=index.keys(),$i=keys.length;var tmp=[],key;for(;i<$i;i++){key=keys[i];tmp.push(index.get(key).data)}return tmp};this.size=function(){return index.keys().length};this.contains=function(key){return index.contains(key)};this.setComplete=function(key,flag){isComplete.set(key,flag===undefined?true:!!flag)};this.isComplete=function(key){return isComplete.get(key)===true
};this.getClass=function(){return"SimpleCache"}};var FlatCache=function(name,persistent,keyGenerator){SimpleCache.call(this,name,persistent);this.keyGenerator=isFunction(keyGenerator)?keyGenerator:defaultKeyGenerator;var add=this.add;this.add=function(data,timestamp){var key=this.keyGenerator(data)+"";add.call(this,key,data,timestamp);return key};this.addArray=function(data,timestamp){if(ox.util.isArray(data)){timestamp=timestamp!==undefined?timestamp:ox.util.now();var i=0,$l=data.length;for(;i<$l;
i++){this.add(data[i],timestamp)}}};this.getClass=function(){return"FlatCache"}};var FolderCache=function(name,persistent){FlatCache.call(this,name,persistent,function(data){return data.id});var children=new CacheStorage(name+".children",persistent);var add=this.add;this.add=function(data,timestamp,prepend){var key=add.call(this,data,timestamp);var p=ox.util.firstOf(data.folder_id,data.folder)+"";var list=children.get(p)||[];if(data.id!==p){var pos=$.inArray(key,list);if(pos===-1){if(prepend===true){list.unshift(key)
}else{list.push(key)}}else{list.splice(pos,1,key)}children.set(p,list)}};this.prepend=function(data,timestamp){this.add(data,timestamp,true)};var clear=this.clear;this.clear=function(){children.clear();clear.call(this)};var remove=this.remove;var removeChild=function(key){var data=this.get(key),p,pos,list;if(data!==undefined){p=ox.util.firstOf(data.folder_id,data.folder)+"";list=children.get(p)||[];pos=$.inArray(key,list);if(pos>-1){list.splice(pos,1)}children.set(p,list)}this.removeChildren(key);
remove.call(this,key)};this.remove=function(key){if($.isArray(key)){var i=0,$l=key.length;for(;i<$l;i++){removeChild.call(this,key[i])}}else{removeChild.call(this,key)}};this.removeChildren=function(parent,deep){if(deep===true&&children.contains(parent)){var i=0,keys=children.get(parent),$l=keys.length;for(;i<$l;i++){if(keys[i]!==parent){this.removeChildren(keys[i],true)}remove.call(this,keys[i])}}children.remove(parent);this.setComplete(parent,false)};this.children=function(parent){var tmp=[];if(children.contains(parent)){var i=0,keys=children.get(parent),$l=keys.length;
for(;i<$l;i++){tmp.push(this.get(keys[i]))}}return tmp};this.parents=function(){return children.keys()};this.inspect=function(key){return{keys:this.grepKeys(key),children:this.children(key),complete:this.isComplete(key)}};this.getClass=function(){return"FolderCache"}};var caches={folder0:new FolderCache("folder0",true),folder1:new FolderCache("folder1",true),subscribe:new FolderCache("",false),folderFlat:new SimpleCache("folderFlat",true),mail:new FlatCache("",false),mailHeader:new SimpleCache("",false),mailFolder:new SimpleCache("",false),calendar:new FlatCache("",false),contacts:new FlatCache("",false),tasks:new FlatCache("",false),infostore:new FlatCache("",false),account:new FlatCache("account",true,function(data){return data&&data.id!==undefined?data.id:""
})};return !isNested()?caches:null}()),http:(function(){var idMapping={common:{"1":"id","2":"created_by","3":"modified_by","4":"creation_date","5":"last_modified","100":"categories","101":"private_flag","102":"color_label","104":"number_of_attachments","20":"folder_id"},mail:{"102":"color_label","600":"id","601":"folder_id","602":"attachment","603":"from","604":"to","605":"cc","606":"bcc","607":"subject","608":"size","609":"sent_date","610":"received_date","611":"flags","612":"level","613":"disp_notification_to","614":"priority","615":"msgref","651":"flag_seen","652":"account_name"},contacts:{"500":"display_name","501":"first_name","502":"last_name","503":"second_name","504":"suffix","505":"title","506":"street_home","507":"postal_code_home","508":"city_home","509":"state_home","510":"country_home","511":"birthday","512":"marital_status","513":"number_of_children","514":"profession","515":"nickname","516":"spouse_name","517":"anniversary","518":"note","519":"department","520":"position","521":"employee_type","522":"room_number","523":"street_business","525":"postal_code_business","526":"city_business","527":"state_business","528":"country_business","529":"number_of_employees","530":"sales_volume","531":"tax_id","532":"commercial_register","533":"branches","534":"business_category","535":"info","536":"manager_name","537":"assistant_name","538":"street_other","539":"city_other","540":"postal_code_other","541":"country_other","542":"telephone_business1","543":"telephone_business2","544":"fax_business","545":"telephone_callback","546":"telephone_car","547":"telephone_company","548":"telephone_home1","549":"telephone_home2","550":"fax_home","551":"cellular_telephone1","552":"cellular_telephone2","553":"telephone_other","554":"fax_other","555":"email1","556":"email2","557":"email3","558":"url","559":"telephone_isdn","560":"telephone_pager","561":"telephone_primary","562":"telephone_radio","563":"telephone_telex","564":"telephone_ttytdd","565":"instant_messenger1","566":"instant_messenger2","567":"telephone_ip","568":"telephone_assistant","569":"company","571":"userfield01","572":"userfield02","573":"userfield03","574":"userfield04","575":"userfield05","576":"userfield06","577":"userfield07","578":"userfield08","579":"userfield09","580":"userfield10","581":"userfield11","582":"userfield12","583":"userfield13","584":"userfield14","585":"userfield15","586":"userfield16","587":"userfield17","588":"userfield18","589":"userfield19","590":"userfield20","592":"distribution_list","594":"number_of_distribution_list","596":"contains_image1","597":"image_last_modified","598":"state_other","599":"file_as","104":"number_of_attachments","601":"image1_content_type","602":"mark_as_distributionlist","605":"default_address","524":"internal_userid","606":"image1_url"},calendar:{"200":"title","201":"start_date","202":"end_date","203":"note","204":"alarm","207":"recurrence_position","208":"recurrence_date_position","209":"recurrence_type","212":"days","213":"days_in_month","214":"month","215":"interval","216":"until","220":"participants","221":"users","400":"location","401":"full_time","402":"shown_as"},infostore:{"700":"title","701":"url","702":"filename","703":"file_mimetype","704":"file_size","705":"version","706":"description","707":"locked_until","708":"file_md5sum","709":"version_comment","710":"current_version","711":"number_of_versions"},task:{"200":"title","201":"start_date","202":"end_date","203":"note","204":"alarm","209":"recurrence_type","212":"days","213":"days_in_month","214":"month","215":"internal","216":"until","220":"participants","221":"users","300":"status","301":"percent_completed","302":"actual_costs","303":"actual_duration","305":"billing_information","307":"target_costs","308":"target_duration","309":"priority","312":"currency","313":"trip_meter","314":"companies","315":"date_completed"},folders:{"1":"id","2":"created_by","3":"modified_by","4":"creation_date","5":"last_modified","6":"last_modified_utc","20":"folder_id","300":"title","301":"module","302":"type","304":"subfolders","305":"own_rights","306":"permissions","307":"summary","308":"standard_folder","309":"total","310":"new","311":"unread","312":"deleted","313":"capabilities","314":"subscribed","315":"subscr_subflds","316":"standard_folder_type","3010":"com.openexchange.publish.publicationFlag","3020":"com.openexchange.subscribe.subscriptionFlag","3030":"com.openexchange.folderstorage.displayName"},user:{"610":"aliases","611":"timezone","612":"locale","613":"groups","614":"contact_id","615":"login_info"},account:{"1001":"id","1002":"login","1003":"password","1004":"mail_url","1005":"transport_url","1006":"name","1007":"primary_address","1008":"spam_handler","1009":"trash","1010":"sent","1011":"drafts","1012":"spam","1013":"confirmed_spam","1014":"confirmed_ham","1015":"mail_server","1016":"mail_port","1017":"mail_protocol","1018":"mail_secure","1019":"transport_server","1020":"transport_port","1021":"transport_protocol","1022":"transport_secure","1023":"transport_login","1024":"transport_passord","1025":"unified_inbox_enabled","1026":"trash_fullname","1027":"sent_fullname","1028":"drafts_fullname","1029":"spam_fullname","1030":"confirmed_spam_fullname","1031":"confirmed_ham_fullname","1032":"pop3_refresh_rate","1033":"pop3_expunge_on_quit","1034":"pop3_delete_write_through","1035":"pop3_storage ","1036":"pop3_path","1037":"personal","1038":"reply_to"}};
$.extend(idMapping.contacts,idMapping.common);$.extend(idMapping.calendar,idMapping.common);$.extend(idMapping.infostore,idMapping.common);delete idMapping.infostore["101"];delete idMapping.infostore["104"];$.extend(idMapping.task,idMapping.common);$.extend(idMapping.user,idMapping.contacts,idMapping.common);var getAllColumns=function(module,join){var ids=idMapping[module];var tmp=[],column;for(column in ids){tmp.push(column)}tmp.sort(function(a,b){return a-b});return join===true?tmp.join(","):tmp
};var makeObject=function(data,module,columns){if(typeof data!=="object"){return data}columns=columns!==undefined?columns:getAllColumns(module);var ids=idMapping[module];var obj={},i=0,$l=data.length;for(;i<$l;i++){var id=ids[columns[i]];obj[id]=data[i]}return obj};var processOptions=function(options,type){var o=$.extend({module:"",params:{},data:{},dataType:"json",success:$.noop,error:$.noop,complete:$.noop,appendColumns:type==="GET"?false:true,appendSession:true,processData:true,cursor:true},options||{});
var errorCallback=o.error;o.error=function(error,xhr){var handled;if(xhr){handled=errorCallback(xhr.statusText,xhr.status)}else{handled=errorCallback(error)}if(handled!==true){if(xhr){JSONX.errorHandler(xhr.statusText,xhr.status)}else{JSONX.errorHandler(error)}}};o.url=AjaxRoot+"/"+o.module;if(o.appendSession===true){o.params.session=session}if(o.appendColumns===true&&o.params.columns===undefined){o.params.columns=getAllColumns(o.module).join(",")}if(type==="GET"||type==="POST"){o.data=o.params}else{o.url+="?"+ox.util.serialize(o.params);
o.original=o.data;o.data=JSONX.serialize(o.data);o.processData=false;o.contentType="text/javascript"}return o};var processData=function(data,module,columns){if(!$.isArray(data)||!columns){return data}else{var i=0,$l=data.length,sanitized=[];var columnList=columns.split(",");for(;i<$l;i++){sanitized.push(makeObject(data[i],module,columnList))}return sanitized}};var processResponse=function(response,o){if(response&&response.error!==undefined&&response.data===undefined){o.error(response)}else{if(response&&response.error!==undefined){ox.UINotifier.warn(formatError(response))
}if(o.dataType==="json"&&o.processData===true){var data=[],timestamp;if(response){if(o.module==="multiple"){var i=0,$l=response.length,tmp;for(;i<$l;i++){timestamp=response[i].timestamp!==undefined?response[i].timestamp:ox.util.now();if(response[i].data!==undefined){tmp=processData(response[i].data,o.data[i].module,o.data[i].columns);data.push({data:tmp,timestamp:timestamp});if(response[i].error!==undefined){newServerError(response[i])}}else{data.push({error:response[i],timestamp:timestamp})}}o.success(data)
}else{data=processData(response.data,o.module,o.params.columns);timestamp=response.timestamp!==undefined?response.timestamp:ox.util.now();o.success(data,timestamp)}}else{o.success({},ox.util.now())}}else{o.success(response||"")}}};var paused=false;var queue=[];var ajax=function(options,type){var o=processOptions(options,type);if(paused===true){queue.push(o);return}if(++JSONX.count===1){setLoading(true)}if(o.cursor&&++JSONX.cursorCount===1){setLoadingCursor(true)}function handleSpinner(){if(--JSONX.count===0){setLoading(false)
}if(o.cursor&&--JSONX.cursorCount===0){setLoadingCursor(false)}}return $.ajax({type:type,url:o.url,data:o.data,dataType:o.dataType,contentType:o.contentType||"application/x-www-form-urlencoded",success:function(response){handleSpinner();processResponse(response,o)},error:function(xhr){handleSpinner();o.error({},xhr)},complete:function(xhr){o.complete({},xhr)}})};return{GET:function(options){return ajax(options,"GET")},POST:function(options){return ajax(options,"POST")},PUT:function(options){return ajax(options,"PUT")
},DELETE:function(options){return ajax(options,"DELETE")},getAllColumns:getAllColumns,makeObject:makeObject,pause:function(){paused=true},resume:function(cont,error){if(paused===true){var i=0,$l=queue.length,req,q=[],tmp,o,size=[];for(;i<$l;i++){req=queue[i];if(req.module==="multiple"){var j=0,$lj=req.original.length,sub;for(;j<$lj;j++){sub=req.original[j];o={module:sub.module,params:sub};delete o.params.module;delete o.params["continue"];o.success=j===0?req.success:$.noop;o.error=j===0?req.error:$.noop;
o.complete=j===0?req.complete:$.noop;q.push(o)}size.push($lj)}else{q.push(req);size.push(1)}}i=0;$l=q.length;tmp=[];for(;i<$l;i++){req=q[i];delete req.params.session;o=$.extend(req.params,{module:req.module,data:req.original});if(req.params.action!==undefined){o.action=req.params.action}tmp.push(o)}queue=[];paused=false;if(tmp.length>0){this.PUT({module:"multiple","continue":true,data:tmp,appendColumns:false,success:function(data){var i=0,j=0,$l=data.length,range;while(i<$l){range=size[j]>1?data.slice(i,i+size[j]):data[i];
processResponse(range,q[i]);i=i+size[j];j=j+1}ox.util.call(cont)},error:function(data){return ox.util.call(error,data)}})}else{ox.util.call(cont)}}}}}())};var local=(function(){var localFn={};return{add:function(){var args=$.makeArray(arguments),i=0,$l=args.length;for(;i<$l;i++){localFn[args[i]]=true}return this},has:function(fn){return localFn[fn]!==undefined}}}());local.add(that.window.getData,that.getHash,that.getParam,that.setModal,that.http,that.event.Dispatcher,that.event.dispatcherRegistry);
if(that.window.isNested){var wrap=function(fn,scope,getArray){return function(){var tmp=$.makeArray(arguments),i=0,$l=tmp.length;var args=getArray($l);for(;i<$l;i++){if(!ox.util.isDOMObject(tmp[i])){args[i]=clone(tmp[i])}}return fn.apply(scope,args)}};var recurse=function(here,there,getArray){if($.isPlainObject(here)&&there!==undefined){var id;for(id in here){if(here[id]===null&&there[id]!==undefined){here[id]=there[id]}else{if(!local.has(here[id])&&isFunction(here[id])&&there[id]!==undefined){here[id]=wrap(there[id],there,getArray)
}else{recurse(here[id],there[id],getArray)}}}}};var ref=that.window.core.ox;recurse(that,ref.api,ref.util.getArray)}return that}());var WindowController=function(){var $=jQuery,self=this;var handlers={beforeunload:$.noop,confirm:null,unload:$.noop,close:$.noop};this.set=function(name,fn){handlers[name]=fn};var unload=function(){ox.api.window.core.triggerEvent("OX_Window_Close",{handle:url.guid});handlers.unload()};var regexExcludeFromDestruct=/^(location|guid|close|jQuery)$/i;var destruct=function(){for(var id in window){if(!regexExcludeFromDestruct.test(id)){try{delete window[id]
}catch(e){}}}destruct=unload=null;handlers={}};this.close=function(noConfirm){if(!noConfirm&&handlers.confirm){handlers.confirm()}else{$(window).unbind("beforeunload unload");unload();handlers.close();ox.api.window.close(url.guid,true)}};this.destruct=function(){$(window).unbind("beforeunload unload");unload();destruct()};$(window).bind("beforeunload",function(){return handlers.beforeunload()});$(window).bind("unload",this.destruct)};var embeddedWindows=(function(){var dockVisible=true,titleVisible=true;
var setDockVisible=function(flag){if(flag===true){dockVisible=true;$(dock).show();$("#notheader").css("bottom","34px");$(".ox-embedded-container, .ox-embedded-decorator").css("bottom","32px")}else{dockVisible=false;$(dock).hide();$("#notheader").css("bottom","0px");$(".ox-embedded-container, .ox-embedded-decorator").css("bottom","0px")}};var setTitleVisible=function(flag){if(flag===true){titleVisible=true;$(".ox-embedded-title .ox-embedded-close").show();$(".ox-embedded-iframe").css({top:""})}else{titleVisible=false;
$(".ox-embedded-title .ox-embedded-close").hide();$(".ox-embedded-iframe").css({top:0})}};var $=jQuery;var count=0,current=null,initialize=true;var showDock,hideDock;var show,fnShow,add,remove,addToDock,fnClose;var row,table,dock;var openWindow,closeWindow,selectWindow;var getCurrent=function(){return current};var readyHandler=function(data){var w=ox.api.window.get(data.handle);if(w){w.container.children(":first").children().text(""+data.title);w.dock.children().find("div.ox-window-title").text(""+data.title);
w.dock.children().find("div.ox-window-module").css({backgroundImage:"url('"+getFullImgSrc("icons/16/mod_"+data.module+".png")+"')"})}};var disable=function(){$(dock).hide();$("#notheader").css("bottom","0px");$(".ox-embedded-container, .ox-embedded-decorator").css("bottom","0px");ox.api.event.unregister("OX_Window_Ready",readyHandler);ox.api.window.resetFactory()};var enable=function(){ox.api.event.register("OX_Window_Ready",readyHandler);if(initialize){showDock=function(){if(dockVisible===true){$("#notheader, .ox-embedded-container, .ox-embedded-decorator").css("bottom","34px");
dock.show()}};hideDock=function(){$("#notheader").css("bottom","0px");dock.hide()};dock=$("<div/>",{id:"ox-dock"}).addClass("ox-dock").appendTo("#everything").append(table=$("<table/>",{border:"0",cellPadding:"0",cellSpacing:"0"}).append($("<tbody/>").append(row=$("<tr/>"))));show=function(guid){if(current&&current.guid===guid){guid="OX.0"}if(current){current.lightbox.hide();current.container.hide();current.window.OX_UI_Visible=false;current.dock.find(".ox-dock-selected").removeClass("ox-dock-selected");
if(current.guid===guid){if(!current.minimized){current.minimized=true;return}else{delete current.minimized}}}if(guid!=="OX.0"){var w=ox.api.window.get(guid);w.lightbox.show();w.container.show();current={guid:guid,lightbox:w.lightbox,container:w.container,dock:w.dock,window:w.window};w.dock.children().first().addClass("ox-dock-selected");setTimeout(function(){if(w.window.triggerEvent){w.window.triggerEvent("OX_Visible")}else{if(w.window.content.triggerEvent){w.window.content.triggerEvent("OX_Visible")
}}w.window.OX_UI_Visible=true},0)}else{current=null}};fnShow=function(e){show(e.data.guid)};add=function(guid){addToDock(guid,"...");show(guid)};remove=function(guid){var w=ox.api.window.get(guid);w.dock.css("backgroundImage","none").remove();delete w.dock;var count=ox.api.window.count();table.css("width",(Math.min(count,5)*20)+"%");table.find("td").css("width",((100/count)>>0)+"%");if(current&&current.guid===guid){current=null}if(count<=2){hideDock()}};fnClose=function(e){ox.api.window.close(e.data.guid);
if(!current||current.guid!==e.data.guid){if(ox.api.window.get(e.data.guid)!==null){show(e.data.guid)}}return false};addToDock=function(guid,title){var count=ox.api.window.count()+1;table.css("width",(Math.min(count,5)*20)+"%");var dock=$("<td/>").css({minWidth:"100px"}).append($("<div/>").addClass("ox-dock-tab").append($("<div/>").addClass("ox-window-module").css({backgroundImage:"none",position:"absolute",top:"6px",width:"16px",height:"16px"})).append($("<div/>").addClass("ox-window-title").css({position:"absolute",right:"25px",left:"32px",overflow:"hidden",display:(titleVisible?"inline":"none")}).text(""+title)).append($("<div/>").addClass("ox-window-close").css({position:"absolute",right:"8px",top:"6px",width:"14px",height:"14px",display:(titleVisible?"inline":"none")}).bind("click",{guid:guid},fnClose)).bind("click",{guid:guid},fnShow)).appendTo(row);
table.find("td").css("width",((100/count)>>0)+"%");if(guid==="OX.0"){dock.find("div.ox-window-module").css("backgroundImage","none").remove();dock.find("div.ox-window-close").remove()}var w=ox.api.window.get(guid);w.dock=dock};openWindow=function(opt){if(ox.api.window.count()>=1){showDock()}count+=2;var iframe,lightbox,container;var css={border:"0px none",width:"100%"};if(!ox.browser.IE){css.height="100%"}iframe=$("<iframe/>",{src:urlify(opt.url),frameborder:"no",id:opt.guid}).addClass("ox-embedded-window").css(css).one("load",function(e){var win=this.contentWindow;
win.guid=opt.guid;ox.api.window.register(opt.guid,win,{iframe:$(this),lightbox:lightbox,container:container});lightbox.removeClass("busy-spinner-black");container.css("visibility","visible");add(opt.guid);opt.success(win,opt.guid);win=null});lightbox=$("<div/>").addClass("ox-embedded-decorator busy-spinner-black").css({zIndex:19+count,bottom:dockVisible?"34px":"0px"}).bind("click contextmenu",function(e){if(e.ctrlKey){opt.closer(opt)}else{show("OX.0")}}).appendTo("#everything");var w=opt.options.width,innerDiv;
container=$("<div/>").addClass("ox-embedded-container").css({zIndex:20+count,bottom:dockVisible?"34px":"0px",marginLeft:(-Math.floor(w/2))+"px",width:w+"px",backgroundColor:"white"});if(titleVisible===true){container.append($("<div/>").addClass("ox-embedded-title").append($("<div/>").css({overflow:"hidden",textOverflow:"ellipsis",marginRight:"10px"}).text("\u00a0"))).append($("<div/>").addClass("ox-embedded-close").append($("<img/>",{src:getFullImgSrc("img/dummy.gif"),alt:""}).bind("click",{guid:opt.guid},fnClose)))
}container.append(innerDiv=$("<div/>").addClass("ox-embedded-iframe").css("top",(titleVisible===true?"":0)).append(iframe)).appendTo("#everything");if(ox.browser.IE){iframe.css("height",innerDiv.height()+"px")}Hover.reset();setFocus(iframe.get(0));iframe=innerDiv=null};closeWindow=function(obj,guid){obj.iframe.remove();obj.container.remove();obj.lightbox.remove();delete obj.iframe;delete obj.container;delete obj.lightbox;count-=2;remove(guid)};selectWindow=function(obj,guid){show(guid);obj.window.focus()
};addToDock("OX.0",_("Main window"))}else{showDock()}ox.api.window.setFactory(openWindow,closeWindow,selectWindow,true);initialize=false};return{setDockVisible:setDockVisible,setTitleVisible:setTitleVisible,enable:enable,disable:disable,force:false,getCurrent:getCurrent}}());register("Ready",function(){if(embeddedWindows.force||ox.api.config.get("ui.global.windows.mode.value")==="embedded"){embeddedWindows.enable()}});ox.api.folder.viewProperties=function(id){ox.api.folder.get({folder:id,success:function(data){configuration_askforSave(function(){configfolder=id;
activefolder=id;configparentfolder=oChangedParentFolder=-1;triggerEvent("OX_Switch_View","configuration/folder/overview");unLoadFolderProps();loadFolderProps()})}})};ox.api.folder.exportContacts=function(id,action){$("dlIframe").src=AjaxRoot+"/export?action="+action+"&folder="+id+"&session="+session};(function(){var push=Array.prototype.push,slice=Array.prototype.slice,regReflect=/^(push|sort|slice|splice|reflect)$/;var col=function(arr){if(arr!==undefined){this.set(arr)}};col.fn=col.prototype={get:function(id){var self=this;
ox.api.folder.get({folder:id,success:function(data){self.set(data)}})},augment:function(){var tmp=[],i=0,$i=this.length,self=this;for(;i<$i;i++){tmp.push(this[i].id)}ox.api.folder.getMultiple({list:tmp,success:function(data){for(i=0,$i=tmp.length;i<$i;i++){if(data[tmp[i]]!==undefined){self[i]=data[tmp[i]]}}}})},children:function(id){var self=this;ox.api.folder.getSubFolders({folder:id,success:function(data){self.set(data)}})},length:0,set:function(arr){var args=[0,this.length].concat(arr);Array.prototype.splice.apply(this,args);
this.length=args.length-2},is:function(type){return ox.api.folder.is(type,this)},can:function(action){return ox.api.folder.can(action,this)},reflect:function(){var id,tmp=[];for(id in this.__proto__){if(!regReflect.test(id)){tmp.push(id)}}return tmp},push:push,sort:[].sort,splice:[].splice,slice:slice};window.FolderCollection=col}());ox.api.help={};(function($,window){$.highlight=(function(){var tmpl=$("<div/>").css({position:"absolute",top:"0px",right:"0px",bottom:"0px",left:"0px",backgroundColor:"black",opacity:0.5,zIndex:65000});
var overlays=$();var init=function(){overlays.remove();overlays=tmpl.clone().add(tmpl.clone()).add(tmpl.clone()).add(tmpl.clone()).add(tmpl.clone());overlays.eq(4).css({right:"",bottom:"",border:"0px none",backgroundColor:"transparent",opacity:1,MozBoxShadow:"0px 0px 40px white",webkitBoxShadow:"0px 0px 40px white",boxShadow:"0px 0px 40px white"})};var update=function(selector,cssCenter,cssOverlay){var node=$(selector).eq(0);var offset=node.offset()||{};var x=offset.left||0;var y=offset.top||0;var w=node.outerWidth()||0;
var h=node.outerHeight()||0;var b=0;overlays.eq(0).css($.extend({width:x+"px",right:""},cssOverlay||{}));overlays.eq(1).css($.extend({height:y+"px",left:x+"px"},cssOverlay||{}));overlays.eq(2).css($.extend({left:(x+w)+"px",top:y+"px",height:h+"px",bottom:""},cssOverlay||{}));overlays.eq(3).css($.extend({left:x+"px",top:(y+h)+"px"},cssOverlay||{}));overlays.eq(4).css($.extend({left:(x-b)+"px",top:(y-b)+"px",width:(w)+"px",height:(h)+"px"},cssCenter||{}))};var resize=function(e){update(e.data.selector)
};return function(selector,cssCenter,cssOverlay){$(window).unbind("resize",resize);if(selector===undefined){overlays.remove()}else{init();update(selector,cssCenter,cssOverlay);overlays.appendTo(document.body);$(window).bind("resize",{selector:selector},resize)}}}());$.fn.popup=(function(){var inset="20px",shadow="0px 0px 35px 1px #555";var underlay=$("<div/>",{id:"ox-popup-underlay"}).css({position:"absolute",top:"0px",left:"0px",right:"0px",bottom:"0px",zIndex:65001,opacity:0.01,backgroundColor:"white",display:"none"});
var container=$("<div/>",{id:"ox-popup-container"}).css({position:"absolute",top:"0px",left:"0px",width:"550px",height:"200px",backgroundColor:"white",border:"1px solid #111",borderWidth:ox.browser.IE?"3px":"1px",MozBorderRadius:inset,webkitBorderRadius:inset,borderRadius:"20px 20px 20px 20px",MozBoxShadow:shadow,webkitBoxShadow:shadow,boxShadow:shadow,zIndex:65002,display:"none"}).append($("<div/>").css({position:"absolute",top:"15px",right:"20px",bottom:"15px",left:"20px",overflow:"visible"}).append($("<div/>")));
return function(options,fn){container.stop().hide();if(options==="disable"){underlay.hide()}else{var opt=$.extend({top:"0px",left:"0px",width:"550px",modal:false,overflow:"visible",backgroundColor:"black",opacity:0.5},options||{});if(opt.modal){var css=$.extend({backgroundColor:"black",opacity:0.5},opt.overlay||{});underlay.css(css)}else{underlay.css({backgroundColor:"white",opacity:0.01})}var target=container.find("div").eq(1);target.children().detach();target.append(this);target.css("overflow",opt.overflow);
container.css({top:opt.top,left:opt.left,width:opt.width});underlay.appendTo(document.body).show();container.appendTo(document.body).show();var height=opt.height?parseInt(opt.height,10):target.outerHeight(true);container.css("height",(height+50)+"px");if(opt.center){var dw=$("body").width(),dh=$("body").height();var cw=container.outerWidth(),ch=container.outerHeight();container.css({top:(dh-ch>>1)+"px",left:(dw-cw>>1)+"px"})}if(ox.util.isFunction(fn)){fn(container)}}return this}}());ox.api.help.TourStep=function(options){var opt=options||{};
this.element=opt.selector;this.content=opt.content||$("<span/>").text("");this.width=opt.width;this.height=opt.height;this.align=opt.align||"center";this.onShow=opt.onShow||$.noop;this.options={module:opt.module,view:opt.view};var draw=function(tour,back,forward,stop){var opt={},self=this,content=this.content;if(typeof content==="string"||content instanceof I18nString){content=$("<div/>").html(String(dpgettext(tour.domain,"",String(content))))}if(this.align&&!this.element){opt.center=true}if(this.element){$.highlight(this.element,tour.options.highlight,tour.options.overlay)
}else{$.highlight();opt.modal=true;opt.overlay=tour.options.overlay}if(content&&content.popup){var page=tour.current(),numPages=tour.count();var position=numPages<=1?$():$("<div/>").css({fontSize:"8pt",color:"#888",textAlign:"right",margin:"0px 0px 5px 0px"}).text(page+" / "+numPages);var controls=$("<div/>").css({margin:"20px 0px 10px 0px",textAlign:"right"}),stopButton=stop?$.button({title:_("Close"),click:stop}).css("marginRight","5px"):$(),backButton=back?$.button({title:_("Back"),click:back}).css("marginRight","5px"):$(),forwardButton=forward?$.button({title:_("Next"),click:forward}).css("marginRight","5px"):$();
if(!forward){controls.append(backButton);controls.append(stopButton)}else{controls.append(stopButton);controls.append(backButton);controls.append(forwardButton)}var clonedContent=content.clone(true);clonedContent.find("a[rel=help]").unbind("click").bind("click",function(e){redirect2Help(help_location+$(this).attr("href"));return false});position.add(clonedContent).add(controls).addClass("ox-tour").popup(opt,function(node){var align=String(self.align);if(/^window\.(topleft|topright|bottomright|bottomleft)$/.test(align)){if(/top/.test(align)){node.css({top:"20px",bottom:""})
}else{node.css({top:"",bottom:"20px"})}if(/left/.test(align)){node.css({left:"20px",right:""})}else{node.css({left:"",right:"20px"})}}else{if(self.align&&self.element){var elem=$(self.element).eq(0);var offset=elem.offset()||{};var ew=elem.outerWidth()||0;var eh=elem.outerHeight()||0;var nw=node.outerWidth()||0;var nh=node.outerHeight()||0;switch(self.align){case"top":opt.left=(offset.left);opt.top=(offset.top-nh-20);break;case"right":opt.left=(offset.left+ew+20);opt.top=(offset.top);break;case"bottom":opt.left=(offset.left);
opt.top=(offset.top+eh+20);break;case"left":opt.left=(offset.left-nw-20);opt.top=(offset.top);break}opt.top=Math.max(20,Math.min(opt.top,$(document).height()-20));opt.left=Math.max(20,Math.min(opt.left,$(document).width()-20));node.css({top:opt.top+"px",left:opt.left+"px"})}}})}else{$().popup("disable")}};this.draw=function(tour,back,forward,stop){var module=this.options.module,view=this.options.view,self=this,cont=function(){$.proxy(draw,self)(tour,back,forward,stop)};if(module){if(module==="configuration"&&view){ox.UIController.configJump(view,cont)
}else{ox.UIController.setModule({module:module,folder:"auto",success:function(){if(view){changeView(view)}cont()}})}}else{cont()}}};var runningTour=null;ox.api.help.Tour=function(options){this.options=$.extend({overlay:{},start:$.noop,stop:$.noop,root:"",title:""},options||{});this.domain="";var steps=[];var current=0;var self=this;var helper={};var continuation=$.noop;var fnKey=function(e){switch(e.which){case 27:self.stop();return false;case 39:self.forward();return false;case 37:self.back();return false
}};this.current=function(){return current+1};this.count=function(){return steps.length};this.add=function(step){steps.push(step)};this.remove=function(index){if(typeof index==="number"){steps.splice(index,1)}};var show=function(index){if(index>=0&&index<steps.length){current=index;var back=index>0?self.back:undefined;var forward=index<steps.length-1?self.forward:undefined;var stop=self.stop;if(ox.util.isFunction(steps[index].onShow)){$.proxy(steps[index].onShow,self)()}steps[index].draw(self,back,forward,stop)
}};this.start=function(cont){if(runningTour!==this){if(runningTour){runningTour.stop()}runningTour=this;continuation=ox.util.isFunction(cont)?cont:$.noop;$.proxy(self.options.start,this)(helper);$(window).bind("keydown",fnKey);var showFirstStep=function(){show(0)};var module=this.options.module||undefined;var view=this.options.view||undefined;if(module){ox.UIController.setModule({module:module,folder:"auto",success:function(){if(view){changeView(view)}showFirstStep()}})}else{showFirstStep()}}};this.stop=function(){$(window).unbind("keydown",fnKey);
$.highlight();$().popup("disable");$.proxy(self.options.stop,this)(helper);var id;for(id in helper){helper[id].remove();delete helper[id]}runningTour=null;continuation()};this.back=function(){if(current>0){show(current-1)}};this.forward=function(){if(current<steps.length-1){show(current+1)}}};var tours={},tourCount=0;ox.api.help.Tour.register=function(options){if(options||options.id){tours[options.id]=options}};ox.api.help.Tour.list=function(){return tours};ox.api.help.Tour.exists=function(id){return tours[id]!==undefined
};ox.api.help.Tour.instances={};ox.api.help.Tour.load=function(id,cont){if(tours[id]!==undefined){var instances=ox.api.help.Tour.instances;if(instances[id]!==undefined){instances[id].start(cont)}else{var tour=tours[id];var domain=tour.plugin?tour.plugin+".tours":"";var src=tour.plugin?urlify("plugins/"+tour.plugin+"/tours/"+tour.src):"";var dev=!!ox.util.getHash("dev");var join=new Join(function(){if(instances[id]!==undefined){instances[id].domain=domain;triggerEvent("TourLoaded",id,instances[id]);
instances[id].start(cont)}});var lock=join.add();if(tour.plugin){bindtextdomain(domain,"plugins/"+tour.plugin+"/lang/tours/%s.po",join.add())}if(/\.js$/.test(src)){$.ajax({method:"GET",url:src,dataType:"text",cache:!dev,success:join.add(function(js){try{var Tour=function(){ox.api.help.Tour.apply(this,arguments);instances[id]=this};var _=function(id){return dpgettext(domain,"",id)};(new Function("$","_","Tour","Step",js))($,_,Tour,ox.api.help.TourStep)}catch(e){if(dev){ox.UINotifier.warn("Script error in tour '"+src+"': "+e)
}}})})}else{if(/\.xml$/.test(src)){$.ajax({method:"GET",url:src,dataType:"xml",cache:!dev,success:join.add(function(xml){var Tour=ox.api.help.Tour,Step=ox.api.help.TourStep;var options={module:$.trim($("module",xml).text()),view:$.trim($("view",xml).text())};if($("tour",xml).has("options")){try{var s="return {"+$("options",xml).text()+"}";var o=(new Function("$",s)($));options=$.extend(options,o)}catch(e){if(dev){ox.UINotifier.warn("JavaScript error in tour constructor. "+e)}}}var tour=instances[id]=new Tour(options);
$("step",xml).each(function(i,node){var step=$(node),module=step.attr("module")||"",requires=step.attr("requires")||"";if(requires===""&&module!==""){requires=module}if(requires===""||ox.upsell.matrix.hasFeature(requires)){tour.add(new Step({selector:step.attr("selector"),align:step.attr("align"),module:module,view:step.attr("view"),content:$.trim(step.text()+"").replace(/\n+/g,"\n").replace(/^ +(\S)/gm,"$1")}))}})}),error:function(xhr,status,error){if(dev){ox.UINotifier.warn("Tour '"+src+"' could not be loaded: "+error)
}}})}}lock()}}}}(jQuery,window));ox.UIController=(function(){var $=jQuery;var defaultFn=$.noop;var UIController=function(){var currentModule;var currentFolder={};var self=this;this.dispatcher=new ox.api.event.Dispatcher(this);this.initialModule="";this.initialView="";this.showExpertTree=false;this.setExpertTree=function(enabled){var name=self.getModule();self.showExpertTree=enabled;if(name==="portal"){ox.widgets.sidepanel.toggle(!self.showExpertTree);if(enabled&&this.firstSetExpertTree){ox.widgets.sidepanelViewControl.showView("ox-sidepanel-foldertree");
delete (this.firstSetExpertTree)}}if(self.showExpertTree){name="foldertree"}if(this.firstSetExpertTree===undefined){ox.widgets.sidepanelViewControl.showView("ox-sidepanel-"+name)}ox.api.config.set("gui.global.expert_tree",enabled?1:0);self.dispatcher.trigger("expertchanged",{enabled:enabled});delete (this.firstSetExpertTree)};this.presetModule=function(module){currentModule=module};this.getModule=function(){return currentModule};var processEvent=function(previous,options){var force=options.force;
var changedView=previous.view!==undefined&&previous.view!==currentpath2.join("/");var viewMismatch=currentModule!==currentpath2[0];var changedModule=previous.module!==currentModule||viewMismatch||changedView||force==="module"||force==="both";var changedFolder=previous.folder!==currentFolder[currentModule]||force==="folder"||force==="both";var change=changedModule&&changedFolder?"both":(changedModule?"module":"folder");if(changedModule){self.dispatcher.trigger("modulechange",{module:currentModule,folder:currentFolder[currentModule],view:options.view,change:change,force:force,previous:previous})
}if(changedFolder){self.dispatcher.trigger("folderchange",{module:currentModule,folder:currentFolder[currentModule],view:options.view,change:change,force:force,previous:previous})}};var setModule=function(options){var previous={module:currentModule,folder:currentFolder[currentModule],view:currentpath2.join("/")};var opt=$.extend({module:currentModule,event:true,success:defaultFn,folder:undefined,view:undefined,force:false},options||{});if(window.expertSelection){expertSelection.setVisible(opt.module!=="configuration")
}if(opt.folder===undefined){opt.folder=currentFolder[currentModule]}var success=function(){currentModule=opt.module+"";activemodule=opt.module+"";if(opt.event===true){processEvent(previous,opt);triggerEvent("OX_Switched")}ox.util.call(opt.success,options)};var cont=function(folder){if(folder!==undefined){currentModule=undefined;self.setFolder({folder:folder,success:function(){currentFolder[opt.module]=folder+"";success()},event:false})}else{success()}};if(opt.folder!==undefined){if(opt.folder==="default"||(opt.folder==="auto"&&currentFolder[opt.module]===undefined)){self.getDefaultFolder(opt.module,cont)
}else{if(opt.folder==="auto"){cont(currentFolder[opt.module])}else{cont(opt.folder)}}}else{cont()}};this.setModule=function(options){if(currentpath2[0]==="configuration"){configuration_askforSave(function(){setModule(options)})}else{setModule(options)}};this.getFolder=function(module){return currentFolder[module!==undefined?module:currentModule]};this.getDefaultFolder=function(module,success){success=ox.util.isFunction(success)?success:ox.util.inspect;var getDefaultMailFolder=function(){var separator=ox.api.config.get("modules.mail.defaultseparator","/");
var exists=function(id,success){if(id===0){success(true);return;return ox.api.folder.exists({folder:"default"+id+separator+"INBOX",success:success})}else{return ox.api.folder.exists({folder:"default"+id,success:success})}};ox.api.account.all(function(accounts){accounts.sort(function(a,b){return a.id-b.id});check(0);function check(i){if(i>=accounts.length){notFound();return}var id=accounts[i].id;exists(id,function(doesExist){if(doesExist){ox.util.call(success,"default"+id+separator+"INBOX")}else{check(i+1)
}})}});function notFound(){var rex=new RegExp("^default\\d+("+escapeRegExp(separator)+"INBOX)?$"),match;for(i in ox.api.cache.folder0.grepKeys("default")){if((match=rex.exec(i))){ox.util.call(success,match[1]?i:i+separator+"INBOX");return}}ox.util.call(success,undefined)}};if(module==="mail"){getDefaultMailFolder(success)}else{if(ox.api.config.contains("folder."+module)){ox.util.call(success,ox.api.config.get("folder."+module))}else{ox.util.call(success,undefined)}}};this.unsetFolder=function(module){module=module!==undefined?module:currentModule;
if(module!==undefined){currentFolder[module]=undefined}};this.setFolder=function(options){var previous={module:currentModule,folder:currentFolder[currentModule],view:currentpath2.join("/")};var opt=$.extend({module:undefined,folder:currentFolder[currentModule],view:undefined,event:true,success:defaultFn,force:false},options||{});ox.api.folder.get({folder:opt.folder,success:function(data){var cont=function(e){if(currentModule!==undefined){currentFolder[currentModule]=opt.folder+""}activefolder=opt.folder+"";
if(opt.event===true){processEvent(previous,opt)}ox.util.call(opt.success,data)};if(opt.module!==undefined){if(opt.module==="default"){if(data.module!=="system"){self.setModule({module:data.module,folder:undefined,event:false,success:cont})}}else{self.setModule({module:opt.module,folder:undefined,event:false,success:cont})}}else{cont({module:opt.module})}}})};this.getView=function(){return currentpath.join("/")};this.bind=function(){self.dispatcher.bind.apply(self.dispatcher,arguments)};this.configJump=function(path,cont){var rewrite=path,parts;
if(ox.Configuration.nodes[path]!==undefined){rewrite=ox.Configuration.nodes[path].id}parts=String(path).split(/\//);this.setModule({module:"configuration",success:function(){var folder=ox.widgets.configTree.get(parts.slice(0,2).join("/"));if(folder){folder.open()}ox.widgets.configTree.selection.click(rewrite);if(cont){cont()}}})}};return new UIController()}());ox.stage=(function(){var $=jQuery,stages={},callbacks={};var isHit=function(id){var ids=id.split(/\s+/),i=0,$i=ids.length,hit=true;for(;hit&&i<$i;
i++){hit=hit&&stages[ids[i]]===true}return hit};var wait=function(id,fn){if(callbacks[id]===undefined){callbacks[id]=[fn]}else{if($.inArray(fn,callbacks[id])===-1){callbacks[id].push(fn)}}};return{hit:function(stageId){stageId=$.trim(String(stageId)).toLowerCase();stages[stageId]=true;var id,list;for(id in callbacks){if(id.indexOf(stageId)>-1&&isHit(id)){list=callbacks[id];for(i=0,$i=list.length;i<$i;i++){ox.util.call(list[i],id)}delete callbacks[id]}}},proxy:function(id){return function(){ox.stage.hit(id)
}},requires:function(id,fn){id=$.trim(String(id)).toLowerCase();var cb=ox.util.isFunction(fn)?fn:function(){ox.stage.hit(String(fn))};if(isHit(id)){ox.util.call(cb,id)}else{wait(id,cb)}}}}());ox.UINotifier=(function($){var container;var isVisible={ok:true,log:true,info:true,note:true,warn:true,error:true};var history=[],isNested=ox.api.window.isNested,core;if(isNested){core=ox.api.window.core;history=core.ox.UINotifier.history;isVisible=core.ox.UINotifier.isVisible}var init=$.noop;init=function(){var o=$("#notheader").offset()||{top:0,left:0};
container=$("<div/>",{id:"notificationContainer"}).css({position:"absolute",top:(o.top+10)+"px",right:"10px",width:"450px",height:"auto",zIndex:65300}).appendTo(document.body);init=$.noop};var addLine,updateReport,report=null,lines=null;addLine=function(str){return $("<div/>").css({fontFamily:"monospace",fontSize:"12px",lineHeight:"15px",paddingLeft:"2em",textIndent:"-2em"}).text(String(str)).appendTo(lines)};updateReport=function(){if(lines!==null){lines.empty();var i=0,$i=history.length,obj,message,count=0;
for(;i<$i;i++){obj=history[i];if(obj.type==="error"||obj.type==="warn"){message=obj.data!==undefined?formatError(obj.data):obj.text;addLine((i+1)+". "+formatDate(obj.time,"datetime")+" GMT").css({color:"#555"});addLine(message).css({fontFamily:"Arial, Helvetica, sans-serif",fontWeight:"bold",fontSize:"14px",color:obj.type==="error"?"#800":"#c80",margin:"0 0 1em 0"});count++}}if(count===0){addLine(_("No error occured")).css({fontFamily:"Arial, Helvetica, sans-serif",fontWeight:"bold",fontSize:"14px",color:"#080",margin:"0 0 1em 0"})
}addLine("\u00a0");addLine("Date: "+new Date());addLine("Host: "+window.location.href);addLine("Version: "+oxProductInfo.pversion+" (UI), "+ox.api.config.get("serverVersion")+" (Server)");addLine("Browser: "+navigator.userAgent);addLine("\u00a0");var folders="";jQuery.each(ox.api.config.get("folder",false),function(module,folder_id){folders+=module+"="+folder_id});addLine("Module: "+ox.UIController.getModule()+", View: "+ox.UIController.getView()+", Folder: "+ox.UIController.getFolder()+", Default folders: "+folders+", Landing page: "+ox.api.config.get("gui.global.landing_page.module","")+", Tree: "+(ox.api.config.get("modules.folder.tree")===1?"New":"Classic")+", Expert: "+(ox.api.config.get("gui.global.expert_tree")===1?"Yes":"No")+", Language: "+ox.api.config.get("language"));
addLine("\u00a0");addLine("Loaded modules: "+ox.util.keys(ox.api.config.get("modules"),false).sort().join(", "))}};var template=$("<div/>").css({position:"relative",width:"450px",height:"60px",marginBottom:"10px"}).append($("<div/>").css({position:"absolute",top:"0px",right:"0px",bottom:"0px",left:"0px",backgroundColor:"black",opacity:0.85,borderRadius:"20px",MozBorderRadius:"20px",webkitBorderRadius:"20px",boxShadow:"5px 5px 15px #111",MozBoxShadow:"5px 5px 15px #111",webkitBoxShadow:"5px 5px 15px #111"})).append($("<div/>").css({position:"absolute",top:"0px",right:"0px",bottom:"0px",left:"0px",backgroundColor:"transparent",border:"3px solid #ccc",padding:"10px 15px 10px 15px",textAlign:"center",fontSize:"9pt",fontWeight:"bold",lineHeight:"1.5em",color:"white",overflow:"hidden",MozBorderRadius:"20px",webkitBorderRadius:"20px",borderRadius:"20px 20px 20px 20px",cursor:"default"}).append($("<span/>")).append($("<br/>")).append($("<span/>").css({color:"white"})).append($("<span/>").text("\u00a0 ")).append($("<a/>").css({color:"#ccc",fontWeight:"normal",textDecoration:"underline",whiteSpace:"nowrap",cursor:"pointer"})));
var styles={log:{color:"#ccc",borderColor:"#ccc #aaa #aaa #ccc"},ok:{color:"#688f42",borderColor:"#82b252 #688f42 #46602d #688f42"},note:{color:"#ff8700",borderColor:"#ffa400 #ff8700 #ff8700 #ffa400"},warn:{color:"#ff8700",borderColor:"#ffa400 #ff8700 #ff8700 #ffa400"},error:{color:"#c00",borderColor:"#c00 #800 #800 #a00"}};var labels={log:_("Info"),ok:_("Info"),note:_("Info"),warn:_("Warning"),error:_("Error")};var out=function(type,text,data,customLabel){if(isVisible[type]){init();var node,timer,fader;
node=template.clone(false);node.children().eq(1).css(styles[type]).children().eq(0).text(customLabel!==undefined?String(customLabel):labels[type]+": ").end().eq(2).text(String(text));if(type==="error"||type==="warn"){node.children().eq(1).children().eq(4).text(String(_("Open error report"))).bind("click",function(){ox.api.window.select("OX.0");ox.api.window.core.ox.UINotifier.showReport()})}else{node.children().eq(1).children().eq(4).remove()}container.append(node);var height=Math.max(60,node.children().get(1).scrollHeight+10);
node.css("height",height+"px");fader=function(){if(node){$(document).add(node).unbind("mousedown keydown",fader);clearTimeout(timer);node.fadeOut(500,function(){if(node!==null){node.remove();node=null}})}};if(type!=="ok"){history.push({type:type,text:labels[type]+": "+text,time:ox.util.now(),data:data!==null?data:{code:"UI-0000",error_id:"0",error:String(text)}});updateReport()}$(document).add(node).bind("mousedown keypress",fader);if(type==="ok"||type==="log"){timer=setTimeout(fader,7000)}}};var notifier={log:function(text,data,label){out("log",text,data,label)
},info:function(text,data,label){out("log",text,data,label)},error:function(text,data,label){out("error",text,data,label)},ok:function(text,data,label){out("ok",text,data,label)},warn:function(text,data,label){out("warn",text,data,label)},note:function(text,data,label){out("note",text,data,label)},history:history,isVisible:isVisible,getVisible:function(){return isVisible},setVisible:function(type,state){if(isVisible.hasOwnProperty(type)){isVisible[type]=state}else{return false}},updateReport:updateReport,showReport:function(){var fnSend=function(){var sendHTML=!ox.api.config.get("gui.mail.formatmessage").match(/text\/plain/i),mailtext="",tmp=[];
if(sendHTML){mailtext=lines.html()}else{lines.children().each(function(i){tmp.push($(this).text())});mailtext=tmp.join("<br/>")}ox.api.mail.compose({data:{to:ox.api.config.get("ui.global.notifier.report.mailAddress",""),subject:"Automatic bug report for "+oxProductInfo.pversion,mailtext:mailtext}});mailtext=tmp=null};var fnClose=function(){report.popup("disable");report=lines=null};if(report===null){report=$("<div/>",{id:"error-report"}).css({color:"black"}).append($("<div/>").css({fontSize:"16pt",color:"#888",margin:"0.5em 0 1em 0"}).text(String(_("History of error messages")))).append(lines=$("<div/>").css({paddingRight:"1em",height:"300px",overflow:"auto"})).append($("<div/>").css({height:"30px",margin:"10px 0 0 0"}).append($.button({title:_("Close"),click:fnClose}).css({marginLeft:"1em","float":"right"})).append(function(){if(ox.api.config.get("ui.global.notifier.report.sendEnabled",true)===false){return""
}return $.button({title:_("Send as E-Mail"),click:function(){fnSend();fnClose()}}).css("float","right")}))}updateReport();report.popup({center:true,modal:true,width:"700px",height:"380px",overflow:"hidden"})}};var eventHandler=function(type){return function(priority,message,data){if(type==="error"){var trigger=isNested?core.triggerEvent:triggerEvent;trigger("OX_Global_Error",priority,message||"",data)}notifier[type](message||"",data)}};register("OX_New_Error",eventHandler("error"));register("OX_New_Info",eventHandler("ok"));
return notifier}(jQuery));var loadPlugins,registerPlugin,isPluginLoaded;(function(){var modules=null;var getModules=function(){if(modules!==null){return}modules=ox.api.config.get("availableModules",[]);if(configGetKey("ui.global.toolbar.mode.value")==="simple"){modules.push("com.openexchange.toolbar")}if(url&&url.plugins!==undefined){var i=0,plugins=url.plugins.split(/,/),$i=plugins.length,plugin,pos;for(;i<$i;i++){plugin=plugins[i];if(plugin.indexOf("-")===0){pos=jQuery.inArray(plugin.substr(1),modules);
if(pos>-1){modules.splice(pos,1)}}else{pos=jQuery.inArray(plugin,modules);if(pos===-1){modules.push(plugin)}}}}};var loadCorePlugins=function(join){var file=urlify("plugins/register_concat.jsz");jQuery.ajax({url:file,dataType:"script",success:join.add(),cache:url.dev!=="plugin"});loadCorePlugins=jQuery.noop};var isCore=function(id){return internalPlugins[id]!==undefined};loadPlugins=function(cont){getModules();var join=new Join(function(){temporary.services.finish();if(cont){cont()}});var lock=join.add();
var i=0,$i=modules.length,name;for(;i<$i;i++){name=modules[i];if(isCore(name)&&debugPlugins===false){loadCorePlugins(join)}else{loadModule(name,join)}}lock()};registerPlugin=function(id,fn){getModules();if(jQuery.inArray(id,modules)>-1){var path=oxProductInfo.build+"/plugins/"+id,domain=isCore(id)?"":id,gt=function(text){return dpgettext(domain,"",text)},pgt=function(context,text){return dpgettext(domain,context,text)},ngt=function(singular,plural,n){return dnpgettext(domain,"",singular,plural,n)
},npgt=function(context,singular,plural,n){return dnpgettext(domain,context,singular,plural,n)};fn(gt,gt,pgt,ngt,npgt,id,path,JSONX)}};isPluginLoaded=function(id){return loadedModules[id]===true||(url.plugins||"").indexOf(id)>-1};var TRUE=function(){return true};defineDeferredFunction=function(namespace,name,pluginId){if(namespace&&name){var fn=namespace[name]=function(){if(fn.loading===false){fn.loading=true;var path="plugins/"+pluginId;jQuery.ajax({dataType:"text",url:urlify(path+"/code.js"),cache:ox.util.getHash("dev")!=="plugin"}).done(function(js){loadI18n(js,pluginId,pluginId,path,function(){namespace[name].available=TRUE;
namespace[name]();fn=null})})}};fn.loading=false;fn.available=function(){return isPluginLoaded(pluginId)}}}}());function loadModule(name,join,noI18n){if(name in loadedModules){return}loadedModules[name]=true;if(!join){join=new Join(emptyFunction)}var nocache=ox.util.getHash("dev")==="plugin"?"?"+(new Date().getTime()):"";var path=oxProductInfo.build+"/plugins/"+name;var url=path+"/register.js"+nocache;var context=internalPlugins[name]||noI18n===true?"":name;(new JSONX()).get(url,null,join.add(function(js){if(internalPlugins[name]===undefined&&noI18n!==true){bindtextdomain(context,"plugins/"+name+"/lang/%s.po")
}loadI18n(js,context,name,path,join.add())}),join.alt(function(result,status){delete loadedModules[name];return status==404}),true)}function loadI18n(js,domain,name,path,cb){if(debugPlugins){loadI18n.params[++loadI18n.index]=[gt,gt,pgt,ngt,npgt,name,path,JSONX,cb];var src=["(function(_,gettext,pgettext,ngettext,npgettext,NAME,PATH,","JSON,$done){delete loadI18n.params[",loadI18n.index,"];try{var $retval=(function(){",js,"})()}finally{$done($retval);}})("];var params=[];var prefix="loadI18n.params["+loadI18n.index+"][";
for(var i=0;i<loadI18n.params[loadI18n.index].length;i++){params.push(prefix+i+"]")}src.push(params.join());src.push(");");document.getElementsByTagName("head")[0].appendChild(newnode("script",0,{type:"text/javascript",src:"data:text/javascript;charset=utf-8,"+encodeURIComponent(src.join(""))}))}else{cb((Function("_","gettext","pgettext","ngettext","npgettext","NAME","PATH","JSON",js))(gt,gt,pgt,ngt,npgt,name,path,JSONX))}function gt(text){return dpgettext(domain,"",text)}function pgt(context,text){return dpgettext(domain,context,text)
}function ngt(singular,plural,n){return dnpgettext(domain,"",singular,plural,n)}function npgt(context,singular,plural,n){return dnpgettext(domain,context,singular,plural,n)}}loadI18n.params={};loadI18n.index=0;var internalPlugins={"com.openexchange.settings.folder":true,"com.openexchange.toolbar":true,"com.openexchange.group":true,"com.openexchange.mail.filter":true,"com.openexchange.oxupdater":true,"com.openexchange.publish":true,"com.openexchange.resource":true,"com.openexchange.secret.recovery":true,"com.openexchange.subscribe":true,"com.openexchange.user.passwordchange":true,"com.openexchange.user.personaldata":true,"com.openexchange.threadview":true,"com.openexchange.upsell.demo":true,uwaWidgets:true};
var loadedModules={calendar:true,contacts:true,folder:true,infostore:true,interfaces:true,mail:true,mailaccount:true,messaging:true,portal:true,tasks:true,themes:true,folderstorage:true};(function(){var $=jQuery;ox=ox!==undefined?ox:{};ox.gui={themePath:getFullImgSrc("")};(function(){var constructing=false,fnTest=/xyz/.test(function(xyz){return xyz})?/\b_super\b/:/.*/;this.Class=function(){};this.Class.extend=function(prop){var _super=this.prototype;constructing=true;var prototype=new this();constructing=false;
if(typeof prop==="function"){var obj={};$.proxy(prop,obj)();prop=obj}var factory=function(name,fn){return function(){var tmp=this._super;this._super=_super[name];var ret=fn.apply(this,arguments);this._super=tmp;return ret}};for(var name in prop){prototype[name]=$.isFunction(prop[name])&&$.isFunction(_super[name])&&fnTest.test(prop[name])?factory(name,prop[name]):prop[name]}prototype.getConstructor=function(){return Class};var Class=function(){if(!constructing&&this.construct){this.construct.apply(this,arguments)
}};Class.prototype=prototype;Class.constructor=Class;Class.extend=arguments.callee;return Class}}());var $handleContextMenu=function(e){var tag=e.target.tagName;var type=e.target.type||"";if(tag==="INPUT"&&type.search(/^(text|password)$/i)>=0){return true}else{e.preventDefault();e.stopPropagation();return false}};var $handleSelection=function(event){var e=$.event.fix(event||window.event);var tag=e.target.tagName;var type=e.target.type||"";if(tag==="INPUT"&&type.search(/^(text|password)$/i)>=0){return true
}else{e.preventDefault();e.stopPropagation();return false}};ox.call=function(){var args=$.makeArray(arguments);var callback=args.shift();if(typeof callback==="function"){callback.apply(this,args)}};$.fn.intoViewport=function(node){if(!node){return this}try{var pane=$(node);var height=pane.height();var y1=pane.scrollTop();var y2=y1+height;var pos=this.position();var top=pos.top+y1;if(top<y1){top=top<50?0:top;pane.scrollTop(top)}else{if(top>y2){pane.scrollTop(top)}}}catch(e){console.error(e)}return this
};(function($){var handler=function(event){var e=event||window.event;e=$.event.fix(e);e.type="mousewheel";e.delta=0;e.deltaSign=0;if(e.wheelDelta){e.delta=e.wheelDelta/120}if(e.detail){e.delta=-e.detail/3}if(e.delta!==0){e.deltaSign=e.delta/Math.abs(e.delta)}return $.event.handle.apply(this,[e])};var type=ox.browser.Gecko?"DOMMouseScroll":"mousewheel";$.event.special.mousewheel={setup:function(){if(this.addEventListener){this.addEventListener(type,handler,false)}else{this.onmousewheel=handler}},teardown:function(){if(this.removeEventListener){this.removeEventListener(type,handler,false)
}else{this.onmousewheel=null}}}}(jQuery));(function($){var tmpl=$("<div/>").css({position:"absolute",top:"0px",left:"0px",width:"0px",height:"0px",opacity:0.01,backgroundColor:"white"});$.fn.overlay=function(flag){if(flag===undefined||flag===true){this.each(function(i,n){var node=$(n),p=node.parent();var w=node.outerWidth(),h=node.outerHeight();var pos=node.position();var overlay=tmpl.clone(false).css({top:pos.top+"px",left:pos.left+"px",width:w+"px",height:h+"px"});p.append(overlay);node.data("overlay",overlay)
})}else{this.each(function(i,n){var node=$(n),overlay=node.data("overlay");if(overlay){overlay.remove();node.removeData("overlay")}})}return this}}(jQuery));$.fixIFrames=(function(){var overlays=$();return function(flag){overlays.remove();overlays=$();if(flag){var iframes=$("iframe:visible"),i=0,$i=iframes.length;var iframe,offset,width,height,fix;for(;i<$i;i++){iframe=iframes.eq(i);offset=iframe.offset();width=iframe.outerWidth();height=iframe.outerHeight();overlays=overlays.add($("<div/>").css({position:"absolute",top:offset.top,left:offset.left,width:width,height:height,zIndex:5000,backgroundColor:"white",opacity:0.01}).text(" ").appendTo(document.body))
}}}}());$.quickConfig=(function(){return function(containerSelector,configSelector,linkSelector,textClosed,textOpen){var container=$(containerSelector);var config=$(configSelector);var link=$(linkSelector);textClosed=textClosed!==undefined?textClosed:"Quick config";textOpen=textOpen!==undefined?textOpen:"Close quick config";if(!config.hasClass("ox-quick-config")){container.css({position:"absolute",zIndex:2});container.data("top",parseInt(container.css("top")||0,10));config.addClass("ox-quick-config").css({position:"absolute",zIndex:1,top:(config.css("top")||0)+"px",right:"0px",height:"auto",left:"0px",minHeight:"25px"});
link.css({color:"#00f",textDecoration:"underline",whiteSpace:"nowrap"}).data("open",false).append(addTranslated(textClosed))}link.unbind("click").bind("click",function(e){var top=container.data("top");if(link.data("open")===false){link.data("open",true).empty().append(addTranslated(textOpen));config.show();var h=Math.max(config.outerHeight(),25);container.stop().animate({top:(top+h)+"px"},500)}else{link.data("open",false).empty().append(addTranslated(textClosed));container.stop().animate({top:top+"px"},500,function(){config.hide()
})}return false})}}());$.checkbox=function(id,value,checked,label,fn,data,enabled){var text=label.nodeType===3?label:document.createTextNode(label+""),input=$("<input/>",{type:"checkbox",id:id,value:value,defaultChecked:!!checked,checked:!!checked}).css("border","0px none"),label=$("<label/>").append(text);if(enabled===false){var fnChange=function(e){e.preventDefault();e.stopPropagation();$(this).unbind("change",fnChange).removeAttr("checked").bind("change",fnChange)};input.bind("change",fnChange)
}else{label.attr("for",id);input.bind("change",data!==undefined?data:{},fn)}return $().add(input).add(label)};$.radio=function(name,value,checked,label,fn,data){var text=label.nodeType===3?label:document.createTextNode(label+"");return $().add($("<input/>",{type:"radio",name:name,id:name+"-"+value,value:value,defaultChecked:!!checked,checked:!!checked}).css("border","0px none").bind("change",data,fn)).add($("<label/>",{"for":name+"-"+value}).append(text))};$.button=function(options){var opt=$.extend({title:"",click:$.noop,enabled:true,data:{},theme:"bright",css:{}},options||{});
var className="ox-button"+(!opt.enabled?" ox-button-disabled":"");if(opt.theme==="dark"){className+=" dark"}if(ox.browser.Gecko){className+=" firefox"}else{if(ox.browser.WebKit){className+=" webkit"}}var text;if(opt.title.nodeType===3){text=opt.title}else{text=addTranslated(opt.title)}var button=$("<button/>").addClass(className).append($("<span/>").append(text)).bind("click",opt.data,opt.click);if(opt.id!==undefined){button.attr("id",opt.id)}if(opt.tabIndex!==undefined){button.attr("tabindex",opt.tabIndex)
}if(IE<=7&&/\S/.test(String(opt.title))){button.css({width:"auto",overflow:"visible"})}return button};var oxWidgetFactory={};ox.gui.Widget=Class.extend({construct:function(id){this.id=this.autoId(id,"widget");if(ox.desktop&&this.id){ox.desktop.registerWidget(this);ox.desktop.removeWidgetListener({id:this.id})}this.parent=null;this.position=0;this.layout={};this.data={};this.clonable=this.clonable||false;this.statusLoaded=false;this.statusVisible=true;this.statusEnabled=true;this.statusFocused=false;
this.statusDraggable=false;this.statusDropzone=false;this.requiresPaint=true;this.requiresRepaint=false;this.requiresResize=true;this.requiresNanny=false;this.requiresValidation=true;this.dom={};this.dom.node=null;this.listeners={};this.statusAllowContextMenu=false;this.statusAllowSelect=false;this.numHovers=0;this.nodeCreate()},getClass:function(){return"ox.gui.Widget"},autoId:function(id,prefix){return id||((prefix||"widget")+"-"+(ox.desktop.globalCounter++))},nodeCreate:function(tagName){if(!this.dom){this.dom={node:null,placeholder:null}
}if(!this.dom.node){var widgetClass=this.getClass();if(this.clonable&&oxWidgetFactory[widgetClass]){this.dom.node=oxWidgetFactory[widgetClass].cloneNode(true)}else{this.dom.node=document.createElement(tagName||"div");this.dom.node.style.cursor="default";this.nodePreventSelection();this.nodePreventContextMenu();this.nodeInit();if(this.clonable){oxWidgetFactory[widgetClass]=this.dom.node.cloneNode(true)}}if(this.id){this.dom.node.id=this.id}this.dom.node.setAttribute("oxWidgetClass",this.getClass());
this.nodeListeners()}},nodePreventContextMenu:function(){$(this.dom.node).bind("contextmenu",$handleContextMenu)},nodePreventSelection:function(){if(ox.browser.Gecko){this.dom.node.style.MozUserSelect="-moz-none"}else{$(this.dom.node).bind("selectstart",$handleSelection)}},nodeInit:function(){},nodeListeners:function(){},addTo:function(parent){if(parent&&parent.add){parent.add(this)}return this},setParentDOMNode:function(parentDOMNode){var vStatus=this.statusVisible;if(this.dom.node.parentNode){this.removeFromDOM()
}parentDOMNode.appendChild(this.dom.node);this.statusVisible=vStatus;return this},removeFromDOM:function(){for(var name in this.dom){var node=this.dom[name],p=node.parentNode;if(p){p.removeChild(node)}}this.requiresValidation=true;this.requiresRepaint=true;return this},remove:function(){var p=this.parent;if(p){p.removeChild(this)}},replaceBy:function(widget){var p=this.parent;if(p){p.replace(this,widget)}},paint:function(){},clear:function(){$(this.dom.node).empty()},repaint:function(cont){this.clear();
this.paint(cont)},isShowing:function(){return this.statusVisible&&(this.parent===null||this.parent.isShowing())},invalidate:function(){this.requiresValidation=true;if(this.parent){this.parent.invalidate()}},invalidateFamily:function(){this.requiresNanny=true;this.triggerWidgetEvent("familychanged");this.invalidateSize()},invalidateVisibility:function(){var p=this.parent;if(p){p.requiresRepaint=true;p.invalidateSize()}},invalidateSize:function(){this.requiresResize=true;this.requiresValidation=true;
if(this.parent){this.parent.invalidateSize()}},validate:function(force){if(force||(this.requiresValidation&&this.isShowing())){this.validateTree();this.resize()}return this},validateTree:function(){if(this.requiresValidation&&this.statusVisible){if(this.requiresPaint||this.requiresNanny){this.paint();this.requiresNanny=false;this.requiresPaint=false;this.requiresRepaint=false}else{if(this.requiresRepaint){this.repaint();this.requiresRepaint=false}}this.requiresValidation=false;this.triggerWidgetEvent("valid")
}},isValid:function(){return this.requiresValidation===false&&this.statusVisible===true&&this.requiresPaint===false&&this.requiresNanny===false&&this.requiresRepaint===false},show:function(){return this.setVisible(true)},hide:function(){return this.setVisible(false)},setVisible:function(flag,cont){var prev=this.statusVisible;flag=!!flag;if(flag!=prev){this.statusVisible=flag;this.invalidateVisibility();if(this.isShowing()){this.validateTree()}if(this.statusVisible){this.paintVisible(cont);ox.desktop.triggerEvent("visible",this,null)
}else{this.paintInvisible(cont);ox.desktop.triggerEvent("invisible",this,null)}}else{ox.call(cont)}return this},paintVisible:function(cont){this.dom.node.style.display="block";ox.call(cont)},paintInvisible:function(cont){this.dom.node.style.display="none";ox.call(cont)},setDraggable:function(flag,options){var defaults={type:"generic",handle:null,helper:"clone",customize:null,drop:"window",clone:function(){return this.clone()}};this.dragOptions=$.extend(defaults,options);if($.isFunction(this.dragOptions.helper)){this.dragOptions.helper=$.proxy(this.dragOptions.helper,this)
}if($.isFunction(this.dragOptions.clone)){this.dragOptions.clone=$.proxy(this.dragOptions.clone,this)}this.statusDraggable=!!flag;this.paintDraggable();return this},paintDraggable:function(){var self=this;if(this.statusDraggable){$(this.dom.node).attr("dragtype",this.dragOptions.type).draggable({addClasses:false,appendTo:"body",scroll:false,zIndex:65000,cursorAt:{left:10,top:10},helper:this.dragOptions.helper,grid:[10,10],distance:10,iframeFix:true,revert:"invalid",start:function(event,ui){$(ui.helper).css({width:"auto",height:"auto",right:"auto",bottom:"auto"});
ui.helper.addClass("oxDragHelper");if($.isFunction(self.dragOptions.customize)){$.proxy(self.dragOptions.customize,self)(ui.helper)}ui.helper.data("widget",self)},stop:function(event,ui){}});if(this.dragOptions.handle){$(this.dom.node).draggable("option","handle",this.dragOptions.handle)}if(!this.statusDropzone){this.setDropzone(true)}}else{$(this.dom.node).removeAttr("dragtype").draggable("destroy")}},setDropzone:function(flag,options){var defaults={accept:ox.True};this.dropOptions=$.extend(defaults,options);
var accept=this.dropOptions.accept;this.dropOptions.accept=$.isFunction(this.dropOptions.accept)?this.dropOptions.accept:function(d){return d.is(accept)};this.statusDropzone=!!flag;this.paintDropzone();return this},paintDropzone:function(){var self=this;if(this.statusDropzone){$(this.dom.node).droppable({accept:this.dropOptions.accept,greedy:true,over:function(event,ui){if(ui.helper.hasClass("oxDragHelper")){ui.helper.addClass("oxOverDropzone")}},out:function(event,ui){if(ui.helper.hasClass("oxDragHelper")){ui.helper.removeClass("oxOverDropzone")
}},drop:function(event,ui){if(ui.helper.hasClass("oxDragHelper")){var widget=ui.helper.data("widget");var opt=widget.dragOptions;if(opt.drop=="window"&&$.isFunction(opt.clone)){var offset=ui.helper.offset();var width=Math.max(400,Math.min(ui.helper.width()+20,800));var height=Math.min(ui.helper.width()+20,300);var win=ox.desktop.createWindow(self.autoId(null,widget.id+"-clone-window")).setTitle("A clone").setSize(width,height).setPosition(offset.left,offset.top);var ret=opt.clone(win);if(ret){win.add(ret).show()
}}}}})}else{$(this.dom.node).droppable("destroy")}},clone:function(id){var constructor=this.getConstructor();var clone=new constructor(id||(this.id+"-clone"));clone.layout=ox.cloneObject(this.layout);for(var fn in this){if(typeof(this[fn])=="function"&&this[fn]!=clone[fn]){clone[fn]=this[fn]}}var listeners=this.getListeners();for(var i in listeners){var listener=listeners[i];clone.addListener("widget:"+listener.type,listener.callback)}this.cloneDeep(clone);return clone},cloneDeep:function(clone){},setCSSClass:function(className){$(this.dom.node).removeClass().addClass(className);
return this},addCSSClass:function(className){$(this.dom.node).addClass(className);return this},removeCSSClass:function(className){$(this.dom.node).removeClass(className);return this},css:function(){var tmp=$(this.dom.node);tmp.css.apply(tmp,arguments);return this},setStyle:function(){if(this.dom.node){var args=$.makeArray(arguments);switch(args.length){case 1:$(this.dom.node).css(args[0]);break;case 2:$(this.dom.node).css(args[0],args[1]);break}}return this},addListener:function(){var opt=this.prepareListener.apply(this,arguments);
switch(opt.domain){case"ox":ox.desktop.addGlobalListener(opt);break;case"widget":opt.target=opt.target||this;ox.desktop.addWidgetListener(opt);break;case"dom":opt.target=opt.target||this.dom.node;ox.desktop.addDOMListener(opt);break;default:console.error("addListener() Unkown domain",opt.domain);break}return this},removeListener:function(){var opt=this.prepareListener.apply(this,arguments);switch(opt.domain){case"ox":ox.desktop.removeGlobalListener(opt);break;case"widget":opt.target=opt.target||this;
ox.desktop.removeWidgetListener(opt);break;case"dom":opt.target=opt.target||this.dom.node;ox.desktop.removeDOMListener(opt);break}return this},getListeners:function(){return ox.desktop.getWidgetListeners(this)},prepareListener:function(){var type,target,callback,args=arguments,domain,pair;switch(args.length){case 1:type=args[0];target=null;callback=null;break;case 2:type=args[0];target=null;callback=args[1];break;case 3:type=args[0];target=args[1];callback=args[2];break;default:return{}}pair=type.search(/:/)!=-1?type.split(":"):["dom",type];
domain=pair[0].toLowerCase();type=pair[1].toLowerCase();return{type:type,target:target,callback:callback,domain:domain,scope:this}},triggerEvent:function(eventName,eventData){if(this.statusEnabled){ox.desktop.triggerGlobalEvent(eventName,eventData!==undefined?eventData:{})}return this},triggerWidgetEvent:function(eventName,eventData){if(this.statusEnabled){ox.desktop.triggerEvent(eventName,this,eventData!==undefined?eventData:{})}return this},trigger:function(){var self=this;var trigger=function(options){var namespace="",name="";
var index=options.name.indexOf(":");if(index>0){namespace=options.name.substr(0,index);name=options.name.substr(index+1)}else{namespace="global";name=options.name}switch(namespace){case"widget":ox.desktop.triggerEvent(name,self,options.data||null,options.callback||$.noop);break;case"global":ox.desktop.triggerGlobalEvent(name,options.data||null,options.callback||$.noop);break}};var args=$.makeArray(arguments);if(args.length==1&&typeof(args[0])=="string"){trigger({name:args[0],data:null})}else{if(args.length==2&&typeof(args[0])=="string"&&typeof(args[1])!="function"){trigger({name:args[0],data:args[1]})
}else{if(args.length==2&&typeof(args[0])=="string"&&typeof(args[1])=="function"){trigger({name:args[0],data:null,callback:args[1]})}else{if(args.length==3&&typeof(args[0])=="string"&&typeof(args[1])!="function"&&typeof(args[2])=="function"){trigger({name:args[0],data:args[1],callback:args[2]})}}}}},disable:function(){this.triggerWidgetEvent("disable",null);this.statusEnabled=false;this.paintDisabled();return this},paintEnabled:function(){this.removeCSSClass("disabled")},paintDisabled:function(){this.addCSSClass("disabled")
},setEnabled:function(state){if(this.statusEnabled!==state){if(state===true){this.enable()}else{this.disable()}}},enable:function(){this.statusEnabled=true;this.paintEnabled();this.triggerWidgetEvent("enable",null);return this},paintEnable:function(){this.removeCSSClass("disabled")},isEnabled:function(){return this.statusEnabled},isVisible:function(){return this.statusVisible},hasFocus:function(){return this.statusFocused},setFocus:function(flag){this.statusFocused=!!flag;if(this.statusFocused){this.triggerWidgetEvent("focus",null)
}else{this.triggerWidgetEvent("blur",null)}},override:function(name,fn){if($.isFunction(fn)){this[name]=fn}return this},setLayoutParam:function(name,value){if(typeof name==="object"){$.extend(this.layout,name)}else{this.layout[name]=value}this.invalidate();return this},resize:function(){},hasValue:function(){return false},getSize:function(){var width=0,height=0;if(!this.requiresPaint){var $node=$(this.dom.node);width=$node.width();height=$node.height()}else{width=this.layout.width||this.layout.defaultWidth||0;
height=this.layout.height||this.layout.defaultHeight||0}return{width:width,height:height}},phantomize:function(invisible){$(this.dom.node).phantomize(invisible)},materialize:function(){$(this.dom.node).materialize()},destroy:function(){var p=this.parent;ox.desktop.unregisterWidget(this);if(this.parent!==null){this.parent.removeChild(this);this.parent=null}this.layout=null;ox.desktop.removeListenerByScope(this);this.removeFromDOM();for(var id in this.dom){$(this.dom[id]).unbind().empty().remove()}this.dom.node=null
},getData:function(key){return this.data[key]},setData:function(key,value){this.data[key]=value;return this},enableI18n:function(){if(!this.i18nEnabled){this.addListener("ox:LanguageChanged",this.i18nHandler);this.i18nEnabled=true}},disableI18n:function(){if(this.i18nEnabled){this.removeListener("ox:LanguageChanged",this.i18nHandler);this.i18nEnabled=false}},i18nHandler:function(){}});ox.gui.DebugWidget=ox.gui.Widget.extend({getClass:function(){return"ox.gui.DebugWidget"},construct:function(id){this._super(id);
this.currentState=""},nodeInit:function(){this.dom.node.style.cssText="background-color: lightyellow; border: 1px solid #fc0; padding: 5px; line-height: 11pt;"},paint:function(){this.dom.node.innerHTML="I am a debug widget! My name is: <b>"+this.id+"</b>"}});ox.gui.Canvas=ox.gui.Custom=ox.gui.Widget.extend({getClass:function(){return"ox.gui.Custom"},construct:function(paint,id){this._super(id);if($.isFunction(paint)){this.paint=paint}},nodeInit:function(){},paint:function(){}});ox.gui.Template=ox.gui.Widget.extend({getClass:function(){return"ox.gui.Template"
},construct:function(id){this._super(this.autoId(id,"template"));this.src="";this.content="";this.loading=false;this.data={}},nodeInit:function(){$(this.dom.node).addClass("oxStretch")},setSrc:function(src){this.src=src;return this},paint:function(){var self=this;if(!this.loading){this.loading=true;$.ajax({method:"GET",url:this.src,success:function(response){self.loading=false;self.content=response;var frag=self.getFragment(response);self.dom.node.appendChild(self.prePaint(frag));self.postPaint(self.dom.node)
},error:function(response){self.loading=false}})}},getFragment:function(html){var frag=newfrag();var div=newnode("div");div.innerHTML=html;var $c=div.childNodes;for(;$c.length;){frag.appendChild($c[0])}return frag},postPaint:function(node){},prePaint:function(frag){return frag},clear:function(){this.dom.node.innerHTML=""},repaint:function(){this.clear();var frag=this.getFragment(this.content);this.dom.node.appendChild(this.prePaint(frag));this.postPaint(this.dom.node)}});ox.gui.Image=ox.gui.Widget.extend({getClass:function(){return"ox.gui.Image"
},construct:function(src,title){this._super(this.autoId(0,"image"));this.src=src||"";this.title=title;this.image=$("<img/>");this.setSrc(this.src);this.setTitle(title)},setSrc:function(src){this.src=src;this.image.attr({src:this.src});return this},setTitle:function(title){this.title=title;if(!this.title){this.disableI18n();this.image.removeAttr("title")}else{this.enableI18n()}return this},i18nHandler:function(){if(this.title){this.image.attr("title",expectI18n(this.title))}},paint:function(){$(this.dom.node).append(this.image)
},disable:function(){this._super();this.image.css({opacity:0.6})}});ox.gui.Atomic=ox.gui.Widget.extend({getClass:function(){return"ox.gui.Atomic"},construct:function(){this._super(this.autoId(0,"atomic"))}});ox.gui.Container=ox.gui.Widget.extend({construct:function(id){this.kindergarten=null;this.children=[];this.firstChild=null;this.lastChild=null;this.layoutManager=null;this._super(this.autoId(id,"container"));this.kindergarten=this.dom.node},getClass:function(){return"ox.gui.Container"},nodeInit:function(){this.setStyle({overflow:"hidden"})
},add:function(widget){var children=this.getChildren();children.push(widget);widget.position=children.length-1;this.addPost(widget);return this},addPost:function(widget){if(widget.parent!==null){widget.parent.removeChild(widget)}if(this.firstChild===null){this.firstChild=widget}this.lastChild=widget;widget.parent=this;this.invalidateFamily()},addRange:function(list){var $i=0,$l=list.length;for(;$i<$l;$i++){this.add(list[$i])}return this},insert:function(widget,index){var children=this.getChildren();
index=index||0;children.splice(index,0,widget);if(index===0){this.firstChild=widget}widget.parent=this;var $c=this.getChildren(),$i=$c.length;for(;$i--;){var child=$c[$i];child.position=$i}this.lastChild=$c[$c.length-1]||null;this.invalidateFamily();return this},removeChildren:function(){this.firstChild=null;this.lastChild=null;var $c=this.getChildren(),$i=$c.length;for(;$i--;){var child=$c[$i];child.removeFromDOM()}var children=this.getChildren();children.splice(0,this.numChildren());this.invalidateFamily();
return this},moveChild:function(widget,index){var $c=this.getChildren(),$i=$c.length,child;for(;$i--;){child=$c[$i];if(child==widget){$c.splice($i,1);$c.splice(index,0,widget);$c=this.getChildren();$i=$c.length;for(;$i--;){child=$c[$i];child.position=$i}break}}},removeChild:function(widget){var $c=this.getChildren(),$i=$c.length,child;for(;$i--;){child=$c[$i];if(child==widget){child.removeFromDOM();$c.splice($i,1);$c=this.getChildren();$i=$c.length;for(;$i--;){child=$c[$i];child.position=$i}this.invalidateFamily();
break}}return this},removeFromDOM:function(){var $c=this.getChildren(),$i=$c.length;for(;$i--;){var child=$c[$i];child.removeFromDOM()}ox.gui.Widget.prototype.removeFromDOM.call(this);return this},indexOf:function(widget){var $c=this.getChildren(),$i=$c.length;for(;$i--;){var child=$c[$i];if(child==widget){return $i}}return -1},hasChild:function(widget){return this.indexOf(widget)!=-1},replace:function(formerWidget,newWidget){var pos=this.indexOf(formerWidget);if(pos!=-1){this.removeChild(formerWidget);
this.insert(newWidget,pos);formerWidget.destroy();return true}else{return false}},getChildren:function(){return this.children},getVisibleChildren:function(){var i=0,$c=this.getChildren(),$l=$c.length,tmp=[],child;for(;i<$l;i++){child=$c[i];if(child.statusVisible===true){tmp.push(child)}}return tmp},numChildren:function(){return this.getChildren().length},hasChildren:function(){return this.getChildren().length>0},each:function(callback){callback=$.proxy(callback,this);var children=this.getChildren();
var childCount=children.length;for(var i=0;i<childCount;i++){callback(children[i],i,childCount)}},eachVisible:function(callback){if(callback){var children=this.getVisibleChildren();var i=0,$l=children.length;for(;i<$l;i++){callback.call(this,children[i],i,$l)}}},setLayout:function(layoutManager){this.layoutManager=layoutManager||new ox.gui.BlockFlowLayout(this);if(this.layoutManager.container===null){this.layoutManager.container=this}return this},requireLayout:function(){if(this.layoutManager===null){this.layoutManager=new ox.gui.BlockFlowLayout(this)
}else{if(this.layoutManager.container===null){this.layoutManager.container=this}}},clear:function(){var $c=this.getChildren(),$i=$c.length;for(;$i--;){var child=$c[$i];child.removeFromDOM()}if(this.dom.node){this.dom.node.innerHTML=""}return this},setKindergarten:function(DOMNode){this.kindergarten=DOMNode;return this},invalidateTree:function(){var $c=this.getChildren(),$i=$c.length,child;for(;$i--;){child=$c[$i];child.requiresValidation=true;if(child.invalidateTree){child.invalidateTree()}}return this
},validateTree:function(){if(this.requiresValidation&&this.statusVisible){var $c=this.getVisibleChildren(),$i=$c.length;for(;$i--;){var child=$c[$i];child.validateTree()}this.paint();this.requiresValidation=false;this.triggerWidgetEvent("valid")}},resize:function(){if(this.statusVisible){var $c=this.getVisibleChildren(),$i=$c.length;for(;$i--;){var child=$c[$i];child.resize()}if(this.layoutManager){this.layoutManager.resize();this.triggerWidgetEvent("resize")}}},paint:function(){this.requireLayout();
this.layoutManager.doLayout();return this},repaint:function(){this.requireLayout();this.layoutManager.update();return this},disable:function(){var $c=this.getChildren(),$i=$c.length;for(;$i--;){var child=$c[$i];child.disable()}ox.gui.Widget.prototype.disable.call(this);return this},enable:function(){var $c=this.getChildren(),$i=$c.length;for(;$i--;){var child=$c[$i];child.enable()}ox.gui.Widget.prototype.enable.call(this);return this},hideHovers:function(){var $c=this.getChildren(),$i=$c.length;for(;
$i--;){var child=$c[$i];if(child.numHovers>0){child.hideHovers();child.numHovers=0}}return this},hasHover:function(flag){this.numHovers=Math.max(0,this.numHovers+(flag===true?1:-1));if(this.parent){this.parent.hasHover(flag)}},getValues:function(){var values={};var $c=this.getChildren(),$i=$c.length;for(;$i--;){var child=$c[$i];if($.isFunction(child.getValues)){values=$.extend(values,child.getValues())}else{if(child.hasValue()){values[child.getName()]=child.getValue()}}}return values},getSerializedValues:function(){return $.param(this.getValues())
},i18nHandler:function(){if(this.layoutManager){this.layoutManager.i18nHandler()}},destroy:function(){var p=this.parent;$(this.dom.node).remove();var $c=this.getChildren();if($c){var $i=$c.length;for(;$i--;){var child=$c[$i];child.destroy()}}this.children=[];this.firstChild=null;this.lastChild=null;this.kindergarten=null;if(this.layoutManager){this.layoutManager.destroy();this.layoutManager=null}ox.gui.Widget.prototype.destroy.call(this)}});ox.gui.LayoutManager=Class.extend({getClass:function(){return"ox.gui.LayoutManager"
},construct:function(container){this.container=container||null;this.nannies={};this.decorator=null;this.firstRun=true},doLayout:function(){},update:function(){this.doLayout()},resize:function(){},i18nHandler:function(){},getNanny:function(id){return typeof this.nannies[id]=="undefined"?null:this.nannies[id]},createNanny:function(id,parentNode){var nanny=this.nannies[id]={node:$("<div/>"),processed:false};if(typeof parentNode!="undefined"){nanny.node.appendTo(parentNode)}return nanny},setUnprocessed:function(){for(var id in this.nannies){this.nannies[id].processed=false
}},removeUnprocessed:function(){for(var id in this.nannies){if(this.nannies[id].processed===false){this.nannies[id].node.remove();delete this.nannies[id]}}},destroy:function(){this.container=null;if(this.decorator){this.decorator.remove()}for(var id in this.nannies){this.nannies[id].node.remove();delete this.nannies[id]}},park:function(child){if(child===undefined){if(this.container){var park=$("<div/>");this.container.each(function(child){park.append(child.dom.node)})}}else{if(child){var park=$("<div/>").append(child.dom.node)
}}}});ox.gui.FlowLayout=ox.gui.LayoutManager.extend({getClass:function(){return"ox.gui.FlowLayout"},construct:function(container){this._super(container)},doLayout:function(){var con=this.container;var targetDOMNode=con.kindergarten;var $i=0,$c=con.getChildren(),$l=$c.length;for(;$i<$l;$i++){var child=$c[$i];targetDOMNode.appendChild(child.dom.node)}}});ox.gui.HBoxLayout=ox.gui.LayoutManager.extend({getClass:function(){return"ox.gui.HBoxLayout"},construct:function(container){this._super(container)
},doLayout:function(){var con=this.container,tr=$("<tr/>"),table=$("<table/>").attr("width","100%");$(con.kindergarten).append(table.append(tr));for(var attr in con.layout){var tattr="";switch(attr){case"twidth":table.attr("width",con.layout[attr]);break;case"theight":table.attr("height",con.layout[attr]);break;default:break}}var $i=0,$c=con.getChildren(),$l=$c.length;for(;$i<$l;$i++){var child=$c[$i];var td=$("<td/>");tr.append(td.attr(child.layout||{}).append(child.dom.node))}}});ox.gui.BlockFlowLayout=ox.gui.LayoutManager.extend({getClass:function(){return"ox.gui.BlockFlowLayout"
},construct:function(container){this._super(container);this.inheritHeight=true},doLayout:function(){var con=this.container;var targetDOMNode=con.kindergarten;var top=0;var $i=0,$c=con.getChildren(),$l=$c.length;for(;$i<$l;$i++){var child=$c[$i];var div=newnode("div",{position:"absolute",top:top+"px",left:"0px",right:"0px"});div.appendChild(child.dom.node);targetDOMNode.appendChild(div);var h=$(child.dom.node).height();div.style.height=h+"px";top+=h}if(con.layout.inheritHeight){targetDOMNode.style.height=top+"px"
}},resize:function(){var con=this.container;var targetDOMNode=con.kindergarten;var kinder=targetDOMNode.childNodes;var top=0;var $i=0,$c=con.getChildren(),$l=$c.length;for(;$i<$l;$i++){var child=$c[$i];if(kinder[$i]){var h=$(child.dom.node).height();kinder[$i].style.top=top+"px";kinder[$i].style.height=h+"px";top+=h}}if(con.layout.inheritHeight){targetDOMNode.style.height=top+"px"}}});ox.gui.ZeroLayout=ox.gui.LayoutManager.extend({getClass:function(){return"ox.gui.ZeroLayout"},construct:function(container){this._super(container)
},doLayout:function(){var con=this.container,z=0;var $i=0,$c=con.getChildren(),$l=$c.length,child,p;for(;$i<$l;$i++){child=$c[$i];p=child.dom.node.parentNode;if(p===null||p.nodeType===11){con.kindergarten.appendChild(child.dom.node);child.dom.node.style.zIndex=z++}}}});ox.gui.BorderLayout=ox.gui.LayoutManager.extend({getClass:function(){return"ox.gui.BorderLayout"},construct:function(container){this._super(container);this.nannies={};this.decorator=null},getOrderedChildrenX:function(){var con=this.container;
var children=[null,null,null,null,null];var $i=0,$c=con.getChildren(),$l=$c.length;for(;$i<$l;$i++){var child=$c[$i];if(child.layout.position){switch(child.layout.position){case"top":children[0]=child;break;case"bottom":children[1]=child;break;case"left":children[2]=child;break;case"right":children[3]=child;break;case"center":children[4]=child;break}}}return children},getOrderedChildren:function(){var con=this.container;var center=[],nonCenter=[];var $i=0,$c=con.getChildren(),$l=$c.length;for(;$i<$l;
$i++){var child=$c[$i];if(child.layout.position){switch(child.layout.position){case"top":case"right":case"bottom":case"left":nonCenter.push(child);break;case"center":center.push(child);break}}}return $.merge(nonCenter,center)},doLayout:function(){var con=this.container,kindergarten=con.kindergarten,nanny;var top=0,bottom=0,left=0,right=0,height=0,width=0;con.addCSSClass("oxStretch");if(this.decorator===null){this.decorator=$("<div/>").addClass("oxStretch");if(con.layout.padding){this.decorator.css("margin",con.layout.padding)
}this.decorator.appendTo(kindergarten)}this.setUnprocessed();var numerize=function(value,defaultValue){var n=parseInt(value,10);return isNaN(n)?(defaultValue||0):n};var $i=0,$c=this.getOrderedChildren(),$l=$c.length;for(;$i<$l;$i++){var child=$c[$i];if(child){var css=null;switch(child.layout.position){case"top":height=numerize(child.layout.height,25);css={top:top+"px",left:left+"px",right:right+"px",height:height+"px"};top+=height;break;case"bottom":height=numerize(child.layout.height,25);css={bottom:bottom+"px",left:left+"px",right:right+"px",height:height+"px"};
bottom+=height;break;case"left":width=numerize(child.layout.width,25);css={top:top+"px",bottom:bottom+"px",left:left+"px",width:width+"px"};left+=width;break;case"right":width=numerize(child.layout.width,25);css={top:top+"px",bottom:bottom+"px",right:right+"px",width:width+"px"};right+=numerize(width,0);break;case"center":css={top:top+"px",left:left+"px",right:right+"px",bottom:bottom+"px"};break}if(css!==null){nanny=this.getNanny(child.id);if(nanny===null){nanny=this.createNanny(child.id,this.decorator)
}if(nanny.node.get(0).firstChild!=child.dom.node){nanny.node.empty().append(child.dom.node)}nanny.node.css($.extend({position:"absolute",overflow:"hidden"},css));nanny.processed=true}}}this.removeUnprocessed()},resize:function(){var con=this.container,kinderkarten=con.kindergarten;var top=0,bottom=0,left=0,right=0;var outerDIVs=con.kindergarten.childNodes;return}});ox.gui.StatefulContainer=ox.gui.Container.extend({getClass:function(){return"ox.gui.StatefulContainer"},construct:function(id){this._super(this.autoId(id,"statContainer"));
this.currentState="";this.currentChild=null;this.childIndex={}},getState:function(){var states=[],widget=this;states=states.concat(this.getChildState(this));while(widget){if(widget instanceof ox.gui.StatefulContainer&&widget.currentState!=""){states.push(widget.id+":"+widget.currentState)}widget=widget.parent}return states.join(";")},getChildState:function(widget){var states=[];if(widget instanceof ox.gui.Container||widget==ox.gui){for(var i=0;i<widget.children.length;i++){var child=widget.children[i];
if(child instanceof ox.gui.StatefulContainer&&child.currentState!=""){states.push(child.id+":"+child.currentState)}states=states.concat(this.getChildState(child))}}return states},setState:function(state){var stateDescriptor=[];if(Object.isString(state)){var pairs=state.split(";");for(var i=0;i<pairs.length;i++){var pair=pairs[i].split(":");var key=pair[0]||"",value=pair[1]||"";stateDescriptor[key.toLowerCase()]=value}}else{stateDescriptor=state}var lowerID=this.id.toLowerCase();if(stateDescriptor[lowerID]!==undefined){this.currentState=stateDescriptor[lowerID];
delete stateDescriptor[lowerID]}this.setStateRec(this,stateDescriptor)},setStateRec:function(widget,stateDescriptor){if(widget instanceof ox.gui.Container||widget==ox.gui){for(var i=0;i<widget.children.length;i++){var child=widget.children[i];if(child instanceof ox.gui.StatefulContainer){child.setState(stateDescriptor)}else{this.setStateRec(child,stateDescriptor)}}}}});ox.gui.ViewControl=ox.gui.StatefulContainer.extend({getClass:function(){return"ox.gui.ViewControl"},construct:function(id){this._super(this.autoId(id,"viewControl"));
this.setLayout(new ox.gui.ZeroLayout());this.addCSSClass("oxStretch");this.activeView=null;this.lastView=null;this.views={}},add:function(view){if(view instanceof ox.gui.Widget){view.statusVisible=true;view.setVisible(false);ox.gui.StatefulContainer.prototype.add.call(this,view);if(!this.activeView){this.activeView=view;this.activeView.setVisible(true);this.triggerWidgetEvent("viewchanged",this.activeView)}this.views[view.id]=view}else{console.error("ox.gui.ViewControl.add(<view>)","<view> must be an instance of ox.gui.Widget!")
}return this},getState:function(){this.currentState=this.activeView.id;return ox.gui.StatefulContainer.prototype.getState.call(this)},setState:function(state){ox.gui.StatefulContainer.prototype.setState.call(this,state);this.showView(this.currentState)},getPosition:function(){return this.activeView.position},setPosition:function(position){if(position<=this.children.length-1){this.showView(this.children[position].id)}},hideActiveView:function(){if(this.activeView!==null){this.activeView.setVisible(false);
this.currentState="";this.validate()}},showView:function(id){if(this.views[id]!==undefined&&this.currentState!==id){this.hideActiveView();this.lastView=this.activeView;this.activeView=this.views[id];this.activeView.setVisible(true);this.currentState=id;this.triggerWidgetEvent("viewchanged",this.activeView);this.validate()}},showLastView:function(){if(this.lastView){this.showView(this.lastView.id)}}});ox.gui.View=ox.gui.Container.extend({getClass:function(){return"ox.gui.View"},construct:function(id){this._super(id);
this.addCSSClass("oxStretch");this.statusVisible=false}});ox.gui.Desktop=ox.gui.StatefulContainer.extend({getClass:function(){return"ox.gui.Desktop"},construct:function(){this.globalCounter=0;this.globalTabIndex=1;this.listeners={};this.globalListeners={};this.registry={widget:{list:{},observer:{}},window:{list:{},observer:{}}};this.themePath="img";this.windowManager=null;this._super("ox.gui.desktop");this.setLayout(new ox.gui.ZeroLayout(this))},nodeInit:function(){this._super();this.addCSSClass("oxContainer");
this.addCSSClass("oxStretch")},paint:function(){ox.gui.StatefulContainer.prototype.paint.call(this)},getWindowManager:function(){return this.windowManager},setWindowManager:function(windowManager){this.windowManager=windowManager;return this},createWindow:function(id,widgetClass,windowManager){widgetClass=widgetClass?widgetClass:ox.gui.Window;var w=new widgetClass(id);if(windowManager===undefined){if(this.windowManager){this.windowManager.add(w);w.windowManager=this.windowManager}}else{w.windowManager=windowManager
}return w},getWidget:function(id,callback){return this.getObject("widget",id,callback)},getWindow:function(id,callback){return this.getObject("window",id,callback)},showWindow:function(id){this.getObject("window",id,function(window){window.show()})},getObject:function(type,id,callback){var reg=this.registry[type];if(reg.list[id]!==undefined){ox.call(callback,reg.list[id]);return reg.list[id]}else{if(reg.observer[id]===undefined){reg.observer[id]=[]}reg.observer[id].push(callback);return undefined
}},registerWidget:function(widget){this.registerObject("widget",widget)},unregisterWidget:function(widget){this.unregisterObject("widget",widget)},registerWindow:function(window){this.registerObject("window",window)},unregisterWindow:function(window){this.unregisterObject("window",window)},registerObject:function(type,obj){var reg=this.registry[type],id=obj.id||"";reg.list[id]=obj;if(reg.observer[id]!==undefined){var observers=reg.observer[id];for(var i=0;i<observers.length;i++){observers[i](obj)
}delete reg.observer[id]}},unregisterObject:function(type,obj){var reg=this.registry[type],id=obj.id||"";delete reg.list[id]},oops:function(e){var message=Object.isString(e)?e:(e.message||e)+"\n\n"+ox.desktop.oops.caller;alert("Oops! This sould not happen:\n\n"+message)},oopsFunc:function(functionSignature,message){alert("Oops!\n"+functionSignature+"\n"+message)},setRootDOMNode:function(DOMNode){this.setParentDOMNode(DOMNode);return this},addDOMListener:function(options){var defaults={type:"click",target:document,callback:$.noop,scope:null};
var opt=$.extend(defaults,options);$(opt.target).bind(opt.type,$.proxy(opt.callback,opt.scope||opt.target))},removeDOMListener:function(options){var defaults={type:"click",target:document,callback:$.noop,scope:null};var opt=$.extend(defaults,options);$(opt.target).unbind(opt.type,$.proxy(opt.callback,opt.scope||opt.target))},addGlobalListener:function(options){var defaults={type:"default",callback:$.noop,scope:this};var opt=$.extend(defaults,options);var types=opt.type.toLowerCase().split(/\s+/);
delete opt.type;for(var i in types){var type=types[i];if(this.globalListeners[type]===undefined){this.globalListeners[type]=[]}this.globalListeners[type].push({callback:opt.callback,scope:opt.scope})}},removeGlobalListener:function(options){var defaults={type:"default",callback:$.noop};var opt=$.extend(defaults,options);var type=opt.type.toLowerCase();var removeAll=opt.callback==$.noop;if(this.globalListeners[type]){var queue=this.globalListeners[type],i=0;while(i<queue.length){if(removeAll||queue.callback==opt.callback){queue.splice(i,1)
}else{i++}}}},addWidgetListener:function(options){var defaults={type:"valid",target:this,callback:$.noop,scope:this};var opt=$.extend(defaults,options);var types=opt.type.toLowerCase().split(/\s+/);delete opt.type;for(var i in types){var type=types[i];var target=opt.target;if(this.listeners[target.id]===undefined){this.listeners[target.id]=[]}this.listeners[target.id].push({callback:opt.callback,type:type,scope:opt.scope})}},removeWidgetListener:function(options){var defaults={type:null,target:this,callback:$.noop};
var opt=$.extend(defaults,options);if(!opt.type){var id=opt.id!==undefined?opt.id:opt.target;delete this.listeners[id]}else{var removeAll=opt.callback==$.noop;var target=opt.target;if(this.listeners[target.id]){var queue=this.listeners[target.id],i=0;var type=opt.type.toLowerCase();while(i<queue.length){var listener=queue[i];if(listener.type==opt.type&&(removeAll||listener.callback==opt.callback)){queue.splice(i,1)}else{i++}}}}},getWidgetListeners:function(widget){var id,listeners,tmp=[];if(widget){id=widget.id;
listeners=this.listeners[id];if(listeners){for(var i in listeners){tmp.push(listeners[i])}}}return tmp},getAllListeners:function(){var tmp=[],widget,queue,i,type,listener;for(widget in this.listeners){queue=this.listeners[widget];for(i in queue){listener=queue[i];tmp.push({domain:"widget",type:listener.type,scope:listener.scope,callback:listener.callback})}}for(type in this.globalListeners){queue=this.globalListeners[type];for(i in queue){listener=queue[i];tmp.push({domain:"ox",type:type,scope:listener.scope,callback:listener.callback})
}}return tmp},removeListenerByScope:function(scope){var id,queue,i,type,listener;for(id in this.listeners){queue=this.listeners[id];i=0;while(i<queue.length){listener=queue[i];if(listener.scope==scope){queue.splice(i,1)}else{i++}}}for(type in this.globalListeners){queue=this.globalListeners[type];for(i in queue){listener=queue[i];if(listener.scope==scope){queue.splice(i,1)}else{i++}}}},triggerEvent:function(type,source,data,callback){source=source||null;type=type.toLowerCase();var joint=new Join(callback||$.noop);
var conts=[];var i,item;if(this.listeners[source.id]!==undefined){var queue=this.listeners[source.id],$l=queue.length;for(i=0;i<$l;i++){item=queue[i];if(type==item.type){conts[i]=joint.add($.noop)}}for(i=0;i<$l;i++){item=queue[i];if(type==item.type){var ret=($.proxy(item.callback,item.scope)({name:type,source:source,data:data,cont:conts[i]}));if(ret!==false){conts[i]()}}}}if(conts.length===0){ox.call(callback)}},triggerGlobalEvent:function(type,data){type=type.toLowerCase();if(this.globalListeners[type]!==undefined){var queue=this.globalListeners[type];
for(var i=0;i<queue.length;i++){var item=queue[i];($.proxy(item.callback,item.scope)(data||null))}}},shutdown:function(options){options=$.extend({animate:$.noop,complete:$.noop},options);this.destroy();window.ox={call:ox.call};window.oxWidgetFactory=null;options.animate(function(){$(document.body).css({background:"#111 none"}).empty();setTimeout(function(){var headTag=document.getElementsByTagName("HEAD").item(0);var $c=headTag.childNodes,i=0;while(i<$c.length){if($c[i].tagName=="SCRIPT"){headTag.removeChild($c[i])
}else{i++}}options.complete()},10)})},destroy:function(){$(document.body).unbind();$(document).unbind();$(window).unbind();this.windowManager=null;ox.gui.Container.prototype.destroy.call(this)}});ox.desktop=new ox.gui.Desktop();ox.$w=function(id){return ox.desktop.registry.widget.list[id]||null};ox.gui.Selection=Class.extend({getClass:function(){return"ox.gui.Selection"},construct:function(){this.multiple=true;this.selectedItems={};this.observedItems=[];this.observedItemsIndex={};this.preselectedItem=null;
this.auto=true;this.onChangeCallback=null;this.onRenameHandler=$.noop;this.clickHandler=$.noop;this.contextMenuHandler=null;this.lastSelectedItem=null;this.statusEnabled=true;this.focusIndex=0;this.container=null;this.classFocus="oxFocus";this.classSelected="oxSelected";this.dispatcher=new ox.api.event.Dispatcher()},setMultiple:function(flag){this.multiple=!!flag;return this},onChange:function(fn){this.onChangeCallback=fn;return this},onRename:function(fn){this.onRenameHandler=fn;return this},triggerChangedEvent:function(){if(typeof this.onChangeCallback==="function"){this.onChangeCallback(this.getSelectedItems())
}},observe:function(container){this.container=container;this.focusIndex=0;this.processNodes();var contains=function(node,list){var i=0,$l=list.length;for(;i<$l;i++){if(node===list[i]){return true}}return false};var self=this;var fnClick=function(e){var node=e.originalTarget||e.target,id=undefined,selectable=false;var con=this.container,p;if(contains(node,$("*",con))){try{while(node){id=ox.util.firstOf(node.oxID,$(node).attr("oxid"));selectable=ox.util.firstOf(node.oxSelectable,true);if(id!==undefined){break
}p=node.parentNode;node=p!=con?p:null}}catch(e){}}if(id!==undefined){var click=function(option){if(option==="quiet"){self.clickQuiet(id,e.ctrlKey,e.shiftKey)}else{if(option==="force"){self.clickQuiet(id,e.ctrlKey,e.shiftKey);self.triggerChangedEvent()}else{self.click(id,e.ctrlKey,e.shiftKey)}}};var context=function(){if(self.contextMenuHandler!==null){setTimeout(function(){self.contextMenuHandler(id,e)},10)}};e.rightClick=e.which===3||(e.ctrlKey&&ox.browser.MacOS);var result=self.clickHandler({id:id,event:e,selectable:selectable,click:click,context:context});
if(result!==false){if(selectable===true){click()}if(e.rightClick){context()}}}else{}};var fnFocus=$.proxy(function(e){if(this.statusEnabled){$(document).bind("keydown",$.proxy(this.handleKey,this));this.paintFocus();this.selectFocus()}},this);var fnBlur=$.proxy(function(e){$(document).unbind("keydown",this.handleKey);this.paintBlur()},this);$(container).bind("mousedown",fnClick).attr("tabindex",-1);return this},setNodeFinder:function(fn){this.findNodes=$.proxy(fn,this);return this},findNodes:function(){return this.container.childNodes
},update:function(){this.processNodes()},processNodes:function(){this.observedItems=[];this.observedItemsIndex={};var nodes=this.findNodes(),$l=nodes.length,node,id,foundLastItem=false;for(var i=0;i<$l;i++){node=nodes[i];id=ox.util.firstOf(node.oxID,$(node).attr("oxid"));if(id!==undefined&&this.observedItemsIndex[id]===undefined){var index=this.observedItemsIndex[id]=this.observedItems.length;this.observedItems.push({id:id,node:node});foundLastItem=!foundLastItem&&this.lastSelectedItem===id}}for(id in this.selectedItems){if(this.observedItemsIndex[id]===undefined){delete this.selectedItems[id]
}}if(!foundLastItem){this.lastSelectedItem=null}else{this.clickQuiet(this.lastSelectedItem)}if(this.preselectedItem!==null){this.clickQuiet(this.preselectedItem);this.preselectedItem=null;this.scrollIntoView()}},lookUp:function(index,item,cont){cont(this.focusIndex>0?this.focusIndex-1:this.focusIndex)},lookDown:function(index,item,cont){cont(this.focusIndex<this.numItems()-1?this.focusIndex+1:this.focusIndex)},lookLeft:function(index,item,cont){cont(index)},lookRight:function(index,item,cont){cont(index)
},handleKey:function(e){var index=this.focusIndex,item=this.observedItems[index],id=item.id;var self=this,cont=function(newIndex,newId){if(newIndex!==null){self.processChange(index,newIndex,e)}else{newIndex=self.observedItemsIndex[newId];self.processChange(index,newIndex,e)}};switch(e.which){case 37:this.lookLeft(index,id,cont);return false;case 38:this.lookUp(index,id,cont);return false;case 39:this.lookRight(index,id,cont);return false;case 40:this.lookDown(index,id,cont);return false;case 16:case 32:item=this.observedItems[this.focusIndex];
if(item){this.click(item.id,e.ctrlKey,e.shiftKey)}return false;case 113:item=this.observedItems[this.focusIndex];if(item){this.onRenameHandler(item.id,item)}return false}},disable:function(){if(this.statusEnabled===true){this.statusEnabled=false;$(document).unbind("keydown",this.handleKey);for(var id in this.selectedItems){this.deselect(id)}}},enable:function(){if(this.statusEnabled===false){this.statusEnabled=true;if(this.lastSelectedItem!==null){this.clickQuiet(this.lastSelectedItem,true)}$(this.container).focus()
}},processChange:function(oldFocusIndex,newFocusIndex,e){if(oldFocusIndex!=newFocusIndex&&newFocusIndex!==undefined){this.paintBlur();this.focusIndex=newFocusIndex;this.paintFocus();if(!e.ctrlKey){this.selectFocus()}}},paintBlur:function(){var item=this.observedItems[this.focusIndex],self=this;if(item){$(item.node).removeClass(this.classFocus)}},paintFocus:function(){var item=this.observedItems[this.focusIndex];if(item){$(item.node).addClass(this.classFocus).intoViewport(this.container)}},selectFocus:function(){var item=this.observedItems[this.focusIndex];
if(item){this.click(item.id)}},selectOne:function(){if(this.numSelected()===0){var item=this.observedItems[0];if(item){this.click(item.id)}}},clickQuiet:function(id,multiple,range){this.click(id,multiple,range,true)},click:function(id,multiple,range,noEvent){if(this.observedItemsIndex[id]!==undefined){var pre={l:this.numSelected(),item:this.lastSelectedItem};if(!this.multiple||!multiple){this.clear()}var self=this,updateFocus=function(){self.paintBlur();self.focusIndex=self.observedItemsIndex[id];
self.paintFocus()};if(range&&this.lastSelectedItem){this.selectRange(this.lastSelectedItem,id);updateFocus()}else{this.toggle(id);if(this.lastSelectedItem!==id){updateFocus();this.lastSelectedItem=id}}var post={l:this.numSelected(),item:id};if(noEvent!==true&&(pre.l!=post.l||pre.item!=post.item)){this.triggerChangedEvent()}}},selectRange:function(lastId,newId){var fromIndex=this.observedItemsIndex[lastId];var toIndex=this.observedItemsIndex[newId];if(fromIndex>toIndex){var tmp=fromIndex;fromIndex=toIndex;
toIndex=tmp}for(var i=fromIndex;i<=toIndex;i++){var item=this.observedItems[i];this.select(item.id)}},getItemById:function(id){var index=this.observedItemsIndex[id];return this.observedItems[index]},scrollIntoView:function(){var items=this.getSelectedItems();if(items.length>0){$(items[0].node).intoViewport(this.container);if(ox.browser.IE){window.scrollTo(0,0)}}},preselect:function(id){this.preselectedItem=id},select:function(id){if(!this.isSelected(id)){var item=this.getItemById(id);if(item!==undefined){this.selectedItems[id]=item;
this.selectedItems[id].selectionId=id;var node=$(item.node).addClass(this.classSelected);this.dispatcher.trigger("selected",{id:id,item:item,node:node})}}},deselect:function(id){if(this.isSelected(id)){delete this.selectedItems[id];var item=this.getItemById(id);if(item){var node=$(item.node).removeClass(this.classSelected);this.dispatcher.trigger("deselected",{id:id,item:item,node:node})}}},isSelected:function(id){return this.selectedItems[id]!==undefined},toggle:function(id){if(this.isSelected(id)){this.deselect(id)
}else{this.select(id)}},clear:function(quiet){for(var id in this.selectedItems){this.deselect(id)}if(quiet!==true){this.triggerChangedEvent()}},numItems:function(){return this.observedItems.length},numSelected:function(){var count=0;for(var id in this.selectedItems){count++}return count},getSelectedItems:function(){var list=[];for(var id in this.selectedItems){list.push(this.selectedItems[id])}return list},getSelection:function(){var list=[];for(var id in this.selectedItems){list.push(id)}return list
},override:function(name,fn){if($.isFunction(fn)){this[name]=fn}return this},setClickHandler:function(handler){this.clickHandler=handler},setContextMenuHandler:function(handler){this.contextMenuHandler=handler},triggerContextMenu:function(id,e){var self=this;if(self.contextMenuHandler!==null){setTimeout(function(){self.contextMenuHandler(id,e)},10)}}});ox.gui.Tree=ox.gui.Widget.extend(function(){var TreeNode=function(node,data,tree){this.data=data;this.id=node.id;this.parent=node.parent;this.name=node.name;
this.type=node.type;this.hasChildren=node.hasChildren;this.children=[];this.parentNode=null;this.dom={node:null,kindergarten:null};this.depth=0;this.position=0;this.statusOpen=false;this.loading=false;this.tree=tree;this.isCut=false;this.selectable=true;if(tree.get(this.id)!==undefined){var i=0,$c=tree.get(this.id).children,$l=$c.length;for(;i<$l;i++){this.add($c[i])}$c=[]}tree.set(this.id,this)};TreeNode.prototype.add=function(node){node.parentNode=this;node.depth=this.depth+1;node.position=this.children.length;
this.children.push(node);this.hasChildren=true};TreeNode.prototype.remove=function(){var i=0,$c=this.children,$l=$c.length;for(;i<$l;i++){$c[i].remove()}if(this.dndSource){unregisterSource(this.dom.node,this.dndSource)}if(this.dndTarget){unregisterTarget(this.dom.node,this.dndTarget)}$(this.dom.node).remove();$(this.dom.kindergarten).remove();delete this.tree.nodeIndex[String(this.id)];if(this.parentNode){var p=this.parentNode;$l=p.children.length;for(i=0;i<$l;i++){if(p.children[i]===this){p.children.splice(i,1);
break}}}this.tree.selection.update()};TreeNode.prototype.paintHeader=function(div){var skipRoot=this===this.tree.rootNode&&this.tree.showRootNode===false;this.dom.toggler=newnode("img");this.dom.icon=newnode("img");if(!skipRoot){this.depth=this.parentNode?this.parentNode.depth+1:this.depth;var width=20*(this.depth-(this.tree.showRootNode?0:1));var tab=newtab({emptyCells:"show",width:"100%",tableLayout:"fixed"},{className:"oxTreeNode"},[newnode("tbody",0,0,[newnode("tr",0,0,[this.dom.spacer=newnode("td",{width:width+"px"}),newnode("td",0,{className:"oxTreeNodeToggler"},[this.dom.toggler]),newnode("td",0,{className:"oxTreeNodeIcon"},[this.dom.icon]),this.dom.title=newnode("td",0,{className:"oxTreeNodeTitle"})])])]);
this.dom.kindergarten=newnode("div",{display:"none"});if(this.dom.node===null&&div!==undefined){div.appendChild(tab);div.appendChild(this.dom.kindergarten)}else{$(this.dom.node).replaceWith(tab)}this.dom.node=tab;var self=this;$(this.dom.toggler).bind("mousedown",function(){self.toggle();return false});$(this.dom.title).bind("dblclick",function(){self.toggle()});$(this.dom.title).bind("click",function(){clickNode(self);function clickNode(node){if(node.selectable===false){node.open(function(){var next=node.next();
if(next){if(next.selectable){self.tree.selection.click(next.id)}else{clickNode(next)}}})}}});this.enableDnD()}else{this.dom.node=newnode("div");this.dom.kindergarten=newnode("div");div.appendChild(this.dom.node);div.appendChild(this.dom.kindergarten)}};TreeNode.prototype.update=function(){this.dom.toggler.src=ox.gui.themePath+(!this.hasChildren?"img/dummy.gif":(this.statusOpen?"img/folderminus.png":"img/folderplus.png"));var defaults={src:ox.gui.themePath+"icons/16/folder_closed.gif",name:this.name,html:undefined};
$.extend(defaults,this.tree.customize(this)||{});this.dom.node.oxSelectable=this.selectable;this.dom.node.oxID=this.id;this.dom.icon.src=defaults.src;var title=$(this.dom.title);if(defaults.html!==undefined){if(typeof defaults.html==="string"){title.html(defaults.html)}else{if(defaults.html.nodeType===1){title.empty().get(0).appendChild(defaults.html)}else{title.empty().append($(defaults.html))}}}else{if(typeof defaults.name==="object"&&defaults.name.nodeType===3){title.empty().append(defaults.name)
}else{title.text(defaults.name)}}this.dom.kindergarten.style.display=this.statusOpen?"block":"none"};TreeNode.prototype.paint=function(div,cont){var skipRoot=this===this.tree.rootNode&&this.tree.showRootNode===false;if(this.dom.node===null){if(div===undefined&&!this.parentNode){if(cont){cont()}return}this.paintHeader(div||this.parentNode.dom.kindergarten)}if(!skipRoot){this.update()}if((this.tree.openNodes[this.id]||skipRoot)&&this.statusOpen===false){delete this.tree.openNodes[this.id];this.open(cont)
}else{var join=new Join(cont||$.noop);var lock=join.add();var i=0,$c=this.children,$l=$c.length;for(;i<$l;i++){$c[i].paint(this.dom.kindergarten,join.add())}lock()}};TreeNode.prototype.repaint=function(){var self=this,repaint=function(){self.paint();self.tree.selection.update()};if(this.tree.painter.running===true){this.tree.painter.queue.push(repaint)}else{repaint()}};TreeNode.prototype.enableDnD=function(){if(!this.dom.node){return}var self=this;if(this.tree.dndSource){this.tree.dndSource(this.data,function(type,callback){self.dndSource=registerSource(self.dom.node,type,callback,null,null,foldertreedisable,defaultdisabledremove)
})}if(this.tree.dndTarget){this.tree.dndTarget(this.data,function(callbacks){var cbs={};for(var i in callbacks){cbs[i]=(function(cb){return function(a,b,c,d,e,f){legacyOut(a,b,c,d,null,f);cb(a,b,c,d,e,f)}})(callbacks[i])}self.dndTarget=registerTarget(self.dom.node,cbs,null,null,legacyIn,legacyIn,legacyOut,true,true)})}var TImeOutOpen;function legacyIn(e,type,objects,position,targetNode){foldertreeenable(e,type,objects,position,targetNode,self.data);var mynode=e.currentTarget||e.srcElement||false;
if(!mynode.className.match(/dndOver/)){mynode.className+=" dndOver"}function setOpenFN(){self.open()}if(TImeOutOpen){clearTimeout(TImeOutOpen)}return(TImeOutOpen=setTimeout(setOpenFN,1000))}function legacyOut(e,type,objects,position,OutOpen,dropNode){if(TImeOutOpen){clearTimeout(TImeOutOpen)}if(dropNode){dropNode.className=removeClass(dropNode.className,"dndOver")}else{if(e){var mynode=e.currentTarget||e.srcElement||false;if(mynode){mynode.className=removeClass(mynode.className,"dndOver")}}}}};TreeNode.prototype.toggle=function(){if(this.statusOpen){this.close()
}else{this.open()}};TreeNode.prototype.close=function(){delete this.tree.openNodes[this.id];if(this.statusOpen){this.statusOpen=false;this.update();this.tree.trigger("widget:close",{id:this.id,node:this})}};TreeNode.prototype.open=function(cont){if(!this.statusOpen){var self=this;var showKindergarten=function(){self.statusOpen=true;self.paint(self.dom.kindergarten,function(){self.tree.selection.update();if(cont){cont()}});self.tree.trigger("widget:open",{id:self.id,node:self})};if(this.hasChildren&&this.children.length===0){$(this.dom.kindergarten).css({height:"30px",display:"block"}).addClass("oxBusySmall");
this.loadChildren(function(data){data=$.grep(data,self.tree.grep);$(self.dom.kindergarten).css({height:""}).removeClass("oxBusySmall");if(data!==false){self.tree.addMultiple(data);showKindergarten()}else{if(cont){cont()}}})}else{showKindergarten()}}};TreeNode.prototype.numChildren=function(){return this.children.length};TreeNode.prototype.loadChildren=function(cont){if(!this.loading){this.loading=true;var self=this;this.tree.loadChildren(this.id,function(data){self.loading=false;cont(data)})}};TreeNode.prototype.first=function(){return this.children[0]||null
};TreeNode.prototype.last=function(){var c=this.children;return c.length>0?c[c.length-1]:null};TreeNode.prototype.left=function(){return this.statusOpen&&this.numChildren()?this.last().left():this};TreeNode.prototype.right=function(){return this.statusOpen&&this.numChildren()?this.first().right():this};TreeNode.prototype.prevSibling=function(){var p=this.parentNode,pos=this.position;return p&&pos>0?p.children[pos-1]:null};TreeNode.prototype.nextSibling=function(){var p=this.parentNode,pos=this.position;
return p&&pos<p.children.length?p.children[pos+1]:null};TreeNode.prototype.next=function(skipChildren){if(!skipChildren&&this.statusOpen&&this.children.length>0){return this.first()}else{if(this.parentNode){var sibling=this.nextSibling();if(sibling){return sibling}else{return this.parentNode.next(true)}}else{return null}}};TreeNode.prototype.prev=function(){if(!this.parentNode){return null}else{var sibling=this.prevSibling();if(sibling){return sibling.left()}else{return this.parentNode}}};TreeNode.prototype.startEdit=function(success,abort){var self=this;
if(success===undefined){success=function(value){self.tree.trigger("widget:edited",{node:self,data:self.data,id:self.data.id,value:value},function(){self.tree.selection.enable()})}}if(abort===undefined){abort=function(){self.repaint();self.tree.selection.enable()}}this.tree.selection.disable();var node=$(this.dom.title);ox.gui.util.inlineEdit.call(this,node,this.name||"",success,abort)};this.getClass=function(){return"ox.gui.Tree"};this.construct=function(id){this._super(this.autoId(id,"tree"));this.rootNode=null;
this.nodeIndex={};this.openNodes={};this.showRootNode=true;this.loadRootNode=false;this.loadRootNodeId=0;this.cutNode=null;this.painter={running:false,queue:[]};var tree=this;var s=this.selection=new ox.gui.Selection();s.setMultiple(false);s.setNodeFinder(function(){return $(".oxTreeNode",this.container)});s.observe(this.dom.node);s.override("lookUp",function(index,id,cont){var prev=tree.get(id).prev();cont(null,prev!==null?prev.id:null)});s.override("lookDown",function(index,id,cont){var next=tree.get(id).next();
cont(null,next!==null?next.id:null)});s.override("lookRight",function(index,id,cont){var node=tree.get(id);if(node.hasChildren){if(node.statusOpen){cont(null,node.first().id);return}else{node.open()}}cont(index)});s.override("lookLeft",function(index,id,cont){var node=tree.get(id);if(node.hasChildren&&node.statusOpen){node.close();cont(index)}else{if(node.parentNode){cont(null,node.parentNode.id)}else{cont(index)}}});s.onChange(function(selection){if(selection.length){tree.trigger("widget:select",selection[0].id)
}});s.onRename(function(id,item){tree.startEdit(id)})};this.nodeInit=function(){this.setStyle({background:"white",overflow:"auto"});this.addCSSClass("oxStretch")};this.setRootNode=function(data){this.rootNode=new TreeNode(this.nodeParser(data),data,this);this.rootNode.parent=null;return this};this.setNodeParser=function(fn){this.nodeParser=fn;return this};this.nodeParser=function(data){return{id:String(data.id!==undefined?data.id:1),parent:data.parent!==undefined?String(data.parent):null,name:data.name||"default",type:"default",hasChildren:data.hasChildren?true:false}
};this.grep=function(data){return true};this.enableDnD=function(source,target){this.dndSource=source;this.dndTarget=target;for(var i in this.nodeIndex){this.nodeIndex[i].enableDnD()}var node=this.dom.node,interval,scrollSpeed=0,yMax;function canScroll(){return scrollSpeed<0&&node.scrollTop>0||scrollSpeed>0&&node.scrollTop<yMax}var RANGE=20;var MAX=1;var scale=MAX/RANGE;function scroll(speed){scrollSpeed=speed;if(canScroll()){var t0=(new Date).getTime(),y0=node.scrollTop;if(interval!==undefined){clearInterval(interval)
}interval=setInterval(function(){if(canScroll()){var dt=(new Date).getTime()-t0;var y=y0+scrollSpeed*dt;if(y<0){y=0}else{if(y>yMax){y=yMax}else{node.scrollTop=y;return}}node.scrollTop=y}clearInterval(interval);interval=undefined},10)}else{if(interval!==undefined){clearInterval(interval)}interval=undefined}}$(node).mousemove(function(e){if(!isDragging()){return}if(e.target!=node){stopDnDPropagation(e)}var y=e.pageY-$(node).offset().top;yMax=node.scrollHeight-node.clientHeight;if(y<RANGE){scroll((y-RANGE)*scale)
}else{if(node.clientHeight-y<RANGE){scroll((RANGE-node.clientHeight+y)*scale)}else{scroll(0)}}}).mouseleave(function(e){scroll(0)})};this.add=function(data){var node=this.nodeParser(data),parent=node.parent;if(parent!==null){if(this.get(parent)===undefined){(new TreeNode({id:String(parent),parent:null,name:"dummy",type:"default",hasChildren:true},{},this))}this.get(parent).add(new TreeNode(node,data,this))}return node};this.get=function(id){return this.nodeIndex[String(id)]};this.set=function(id,obj){this.nodeIndex[String(id)]=obj
};this.remove=function(id){if(this.get(id)!==undefined){this.get(id).remove()}};this.addMultiple=function(list){var i=0,$l=list.length;for(;i<$l;i++){this.add(list[i])}};this.loadChildren=function(id,cont){cont()};this.loadNode=function(id,cont){cont()};this.customize=function(node){return{}};this.getRootNode=function(){return this.rootNode};this.clearNodes=function(includeRoot){this.nodeIndex={};var root=this.rootNode;if(root!==null&&includeRoot!==true){this.set(root.id,root);root.children=[];root.dom={node:null};
root.statusOpen=false}else{this.rootNode=null}};this.repaint=function(fn){var self=this;var cont=function(){self.triggerWidgetEvent("painted");ox.util.call(fn)};if(this.painter.running===false){var open=this.getOpen();var item=this.selection.getSelection();this.clearNodes(false);this.setOpen(open);this.clear();this.paint(cont);if(item.length>0){this.select(item[0])}}else{this.painter.queue.push(cont)}};this.paint=function(fn){var self=this;var cont=function(){self.triggerWidgetEvent("painted");ox.util.call(fn)
};var done=function(){self.painter.running=false;var i=0,fn=self.painter.queue,$l=fn.length;for(;i<$l;i++){ox.util.call(fn[i])}self.painter.queue=[]};var paintRoot=function(){if(self.rootNode){self.rootNode.paint(self.dom.node,done);self.selection.update()}};if(this.painter.running===false&&(this.loadRootNode===true||this.rootNode)){this.painter.running=true;this.painter.queue.push(cont);if(this.loadRootNode===true){this.loadNode(this.loadRootNodeId,function(data){self.setRootNode(data);self.loadRootNode=false;
paintRoot()})}else{paintRoot()}}else{done()}};var cloneChildNodes=function(node,clone){var $i=0,$c=node.children,$l=$c.length;for(;$i<$l;$i++){clone.add($c[$i].data);cloneChildNodes($c[$i],clone)}};var openChildNodes=function(original,clone){for(var id in original.nodeIndex){if(clone.get(id)){clone.get(id).statusOpen=original.get(id).statusOpen}}};this.cloneDeep=function(clone){if(this.rootNode){clone.setRootNode(this.rootNode.data);cloneChildNodes(this.rootNode,clone);openChildNodes(this,clone)}};
this.setOpen=function(list,flag){var i=0,$l=list.length;for(;i<$l;i++){if(flag===undefined||flag===true){this.openNodes[list[i]]=true}else{delete this.openNodes[list[i]]}}return this};this.getOpen=function(){var tmp=[],id;for(id in this.nodeIndex){if(this.get(id).statusOpen===true){tmp.push(id)}}return tmp};this.select=function(id){if(this.get(id)!==undefined){this.selection.select(id)}};this.startEdit=function(id,ok,abort){if(this.get(id)!==undefined){this.get(id).startEdit(ok,abort)}};this.cut=function(id){if(this.cutNode){this.cutNode.isCut=false;
this.cutNode.paint()}if(id!==undefined&&this.get(id)!==undefined){this.cutNode=this.get(id);this.cutNode.isCut=true;this.cutNode.paint()}else{this.cutNode=null}}});ox.gui.Button=ox.gui.Widget.extend({getClass:function(){return"ox.gui.Button"},construct:function(id,text,clickListener){this.clonable=true;this._super(this.autoId(id,"ox.gui.Button"));this.text=text;this.textNode=$("<span/>");this.enableI18n();this.i18nHandler();if(clickListener){this.addListener("dom:click",clickListener)}},i18nHandler:function(){this.textNode.attr("title",expectI18n(this.text)).text(expectI18n(this.text))
},paint:function(){$(this.dom.node).append($("<div/>").addClass("fakeButton background-color-default cursorPointer logoutground").append($("<div/>").addClass("fakeButtonBottom").append($("<div/>").addClass("fakeButtonLeft").append($("<div/>").addClass("fakeButtonRight").append($("<div/>").addClass("fakeButtonTopLeft").append($("<div/>").addClass("fakeButtonTopRight").append($("<div/>").addClass("fakeButtonBottomLeft").append($("<div/>").addClass("fakeButtonBottomRight").append(this.textNode)))))))));
if(!this.isEnabled()){this.paintDisabled()}},paintVisible:function(){this.dom.node.style.display="inline"},paintEnabled:function(){if(this.dom.node.firstChild){this.dom.node.firstChild.disabled=false}},paintDisabled:function(){if(this.dom.node.firstChild){this.dom.node.firstChild.disabled=true}},setEvent:function(eventName){this.addListener("dom:click",function(){this.triggerEvent(eventName)})},setWidgetEvent:function(eventName,eventSource){this.addListener("dom:click",function(){var source=eventSource||this;
source.triggerWidgetEvent(eventName)})}});ox.gui.SearchField=ox.gui.Widget.extend(function(){var searchImg,searchMenuImg,cancelImg,textChanged;this.getClass=function(){return"ox.gui.SearchField"};this.construct=function(id,options){this._super(this.autoId(id,"ox.gui.SearchField"));var Self=this;this.options=$.extend({defaultText:_("Please enter your search"),width:188},options);this.firstPaint=true;this.p={};this.p.input=$("<input/>").attr({type:"text",value:expectI18n(_("Please enter your search")),role:"textbox"}).css({border:"none",color:"silver",width:this.options.width+"px",background:"transparent",outline:"none",display:"inline-block",height:"17px",marginLeft:"3px",marginTop:"0px"}).bind("keyup focusin focusout",this.options,function(event){if(event.type=="focusin"&&!Self.p.textChanged){$(this).attr({value:""}).css({color:"black"})
}else{if(event.type=="focusout"&&$(this).attr("value")==""){$(this).attr({value:expectI18n(event.data.defaultText)}).css({color:"silver"});$(Self.p.cancelImg).css({visibility:"hidden"})}else{switch(event.which){case 27:Self.p.textChanged=false;$(this).attr("value","");$(this).blur();break;case 13:Self.trigger("widget:search",{value:$(this).attr("value")});default:Self.p.textChanged=true;$(Self.p.cancelImg).css({visibility:"visible"})}}}});this.p.input.bind("mousedown",function(event){event.stopPropagation()
});this.p.searchMenuImg=$("<div/>").css({"float":"left",height:"1.6em",width:"16px",verticalAlign:"middle",textAlign:"center",backgroundColor:"#65769B"}).append($("<img/>").attr({src:getFullImgSrc("img/arrows/search_arrow.png"),align:"absmiddle"}));this.p.searchImg=$("<img/>").attr({src:getFullImgSrc("icons/16/search.png"),align:"absmiddle"}).css({cursor:"pointer","float":"right",marginTop:"2px",marginRight:"3px",marginLeft:"3px"}).click(function(){if(Self.p.textChanged&&Self.p.input.attr("value")!=""){Self.trigger("widget:search",{value:Self.p.input.attr("value")})
}return false});this.searchMenu=new PulldownMenu(this.p.searchMenuImg[0]);this.searchMenu.setFields=function(fields,names,checked){this.removeAllItems();this.onChange=emptyFunction;if(fields&&fields.length){this.checked=checked;for(var i=0;i<fields.length;i++){var item=new MenuItem(names[i],function(){Self.searchMenu.checked[this.searchField]=this.getChecked();Self.searchMenu.onChange()});item.searchField=fields[i];item.setChecked(checked[fields[i]]);Self.searchMenu.addItem(item)}Self.p.searchMenuImg.css({display:""})
}else{Self.p.searchMenuImg.css({display:"none"})}};this.p.cancelImg=$("<img/>").attr({id:"delete_search",src:getFullImgSrc("img/search_x.png"),align:"absmiddle"}).css({marginTop:"2px",marginRight:"5px",cursor:"pointer",visibility:"hidden","float":"right"}).bind("click",this.options,function(event){$(this).css({visibility:"hidden"});$(Self.p.input).attr("value","");$(Self.p.input).blur();Self.p.textChanged=false;triggerEvent("OX_Delete_Search")})};this.paint=function(){var Self=this;if(this.firstPaint){var input=IE?$('<form onsubmit="return false"></form>').append(this.p.input):this.p.input;
$(this.dom.node).addClass("border-color-design").css({backgroundColor:"white",border:"1px inset silver",borderRadius:"5px 5px 5px 5px",MozBorderRadius:"5px",WebkitBorderRadius:"5px",lineHeight:"1.5em"}).append($("<div/>").css({overflow:"hidden",height:"18px",whiteSpace:"nowrap"}).append(this.p.searchMenuImg).append(this.p.searchImg).append(this.p.cancelImg).append(input));if(this.options.disabled){this.disable()}this.firstPaint=false}this.p.input.css("width",this.options.width+"px")};this.disable=function(){this._super();
this.options.disabled=true;if(this.p.input!==undefined){this.p.input.attr({disabled:"disable",value:""});this.p.searchImg.css({cursor:"default",opacity:".2"});$(this.dom.node).css({backgroundColor:"transparent"})}return this};this.enable=function(){this._super();if(this.p.input!==undefined){$(this.dom.node).css({backgroundColor:"white"});this.p.searchImg.css({cursor:"pointer",opacity:""});this.p.input.attr({disabled:null,value:expectI18n(this.options.defaultText)}).css({color:"silver"});this.p.cancelImg.css({visibility:"hidden"});
this.p.textChanged=false}return this};this.getValue=function(){return this.p.input.value()};this.setValue=function(value){this.p.input.focus();this.p.input.value(value)}});ox.gui.Bar=ox.gui.Widget.extend({getClass:function(){return"ox.gui.Bar"},construct:function(options){this._super(this.autoId(0,"bar"));this.options=$.extend({max:100,width:"100%",height:"10px",showText:true,textFormat:"percentage",title:"%1$s / %2$s",boxBGImage:getFullImgSrc("img/pg_bg.png"),barImage:{0:getFullImgSrc("img/pg_green.png"),75:getFullImgSrc("img/pg_orange.png"),90:getFullImgSrc("img/pg_red.png")}},options);
this.barNode=$("<div>").css({background:"url("+this.options.barImage["0"]+")",position:"absolute",width:0,left:0,top:0,bottom:0});this.barText=$("<span>").css({position:"relative",lineHeight:"1em",fontSize:"9pt",margin:"0px 5px"});this.descriptionNode=$("<div>").css({whiteSpace:"nowrap",fontSize:"7pt",position:"absolute",lineHeight:"10px",top:"0px",left:"3px"});this.enableI18n();this.i18nHandler()},i18nHandler:function(){if(this.options.description){this.descriptionNode.text(expectI18n(this.options.description))
}},paint:function(){$(this.dom.node).empty();$(this.dom.node).append($("<table/>").attr({width:"100%",cellSpacing:"0",cellPadding:"0"}).append($("<tr/>").append($("<td/>").css({width:this.options.width}).append($("<div/>").css({background:"url("+this.options.boxBGImage+")",height:this.options.height,border:"1px solid gray",position:"relative",margin:"0px 5px",overflow:"hidden"}).append(this.barNode).append(this.descriptionNode))).append($("<td/>").css({whiteSpace:"nowrap"}).append(this.barText))))
},setMax:function(max){this.options.max=max},progress:function(used){var percent=Math.round((used/this.options.max)*100);this.barNode.css("width",percent+"%");var img=this.options.barImage["0"];for(var i in this.options.barImage){if(i>percent){break}img=this.options.barImage[i]}this.barText.css({display:this.options.showText?"":"none"});if(ox.util.isFunction(this.options.textFormat)){this.barText.text(this.options.textFormat(used,this.options.max))}else{if(this.options.textFormat==="percentage"){this.barText.text(percent+"%")
}else{this.barText.text(used+" / "+this.options.max)}}if(ox.util.isFunction(this.options.title)){$(this.dom.node).attr("title",this.options.title(used,this.options.max))}else{$(this.dom.node).attr("title",format(this.options.title,used,this.options.max))}this.barNode.css("background","url("+img+")")}});(function($){var Draggable=function(node,options){var helper=null,fast=null;var offset={top:0,left:0};var delta={top:0,left:0};var origin={top:0,left:0};var dropzone=null;var o=$.extend({helper:"clone",zIndex:65000,revert:true,opacity:1,shadow:false,handle:undefined,over:function(flag,helper){helper.css("backgroundColor",flag?"#a6c37d":"white")
},out:function(helper){helper.css("backgroundColor","white")},scope:{},start:$.noop,stop:$.noop,drag:$.noop},options||{});o.hover=$.proxy(o.hover,node);var remove=function(){if(helper!==null){helper.remove();helper=null;fast=null}};var revert=function(){if(o.revert===true){helper.empty().css({MozBoxShadow:"",border:"1px solid #ccc"}).animate({top:offset.top+"px",left:offset.left+"px"},500,remove)}else{remove()}};var move=(function(){var px=0,py=0,x,y,abs=Math.abs;return function(e){x=e.pageX+delta.left;
y=e.pageY+delta.top;if(abs(px-x)>=5||abs(py-y)>=5){fast.top=y+"px";fast.left=x+"px";px=x;py=y;o.drag(e,x,y)}}}());var hover=function(e){switch(e.type){case"mouseover":var zone=$(this).data("dropzone"),accept=zone.accept(o.scope);o.over(accept,helper);dropzone=accept?zone:null;break;case"mouseout":dropzone=null;o.out(helper);break}};var drag=function(e){$(document).unbind("mousemove",drag);if(o.helper==="clone"){offset=node.offset();if(o.cursorAt){delta={top:o.cursorAt.top,left:o.cursorAt.left}}else{delta={top:offset.top-origin.top,left:offset.left-origin.left}
}var clone=node.clone(false).css({position:"static",top:"",left:"",right:"",bottom:"",width:node.width()+"px",height:node.height()+"px",margin:0});var css={position:"absolute",top:(e.pageY-delta.top)+"px",left:(e.pageX-delta.left)+"px",zIndex:o.zIndex,opacity:o.opacity};if(o.shadow===true){css.MozBoxShadow="2px 2px 20px 3px #000";css.webkitBoxShadow="2px 2px 20px 3px #000"}else{css.MozBoxShadow="none";css.webkitBoxShadow="none"}clone.find("iframe").remove();helper=$("<div/>").css(css).append(clone)
}else{helper=node}fast=helper[0].style;o.start(e,{helper:helper,original:node});move(e);helper.appendTo(document.body);$(".dropzone").bind("mouseover mouseout",hover);$(document).bind("mousemove",move)};var stop=function(e){$(".dropzone").unbind("mouseover mouseout",hover);$(document).unbind("mousemove",move);$(document).unbind("mousemove",drag);$(document).unbind("mouseup",stop);if(helper!==null){if(dropzone===null){o.out(helper);revert()}else{remove();dropzone.drop(o.scope)}o.stop(e)}};var start=function(e){origin={top:e.pageY,left:e.pageX};
$(document).bind("mousemove",drag);$(document).bind("mouseup",stop)};this.disable=function(){(o.handle?node.find(o.handle):node).unbind("mousedown",start);return this};this.enable=function(){(o.handle?node.find(o.handle):node).bind("mousedown",start);return this}};$.fn.dndDraggable=function(options){return this.each(function(){var node=$(this),instance=node.data("draggable");if(typeof options==="string"){if(instance){switch(options){case"destroy":instance.disable();node.removeData("draggable");break;
case"disable":instance.disable();break;case"enable":instance.enable();break}}}else{if(instance){node.draggable("destroy")}node.data("draggable",new Draggable(node,options).enable())}})};var Dropzone=function(node,options){var o=$.extend({accept:function(){return true},drop:function(scope){console.log("Drop!",scope)}},options||{});this.accept=function(scope){return o.accept(scope)};this.drop=function(scope){o.drop(scope)};this.disable=function(){node.removeClass("dropzone");return this};this.enable=function(){node.addClass("dropzone");
return this}};$.fn.dropzone=function(options){return this.each(function(){var node=$(this),instance=node.data("dropzone");if(typeof options==="string"){if(instance){switch(options){case"destroy":instance.disable();node.removeData("dropzone");break;case"disable":instance.disable();break;case"enable":instance.enable();break}}}else{if(instance){node.dropzone("destroy")}node.data("dropzone",new Dropzone(node,options).enable())}})}}(jQuery));ox.gui.Menu=ox.gui.Container.extend({getClass:function(){return"ox.gui.Menu"
},construct:function(id){this._super(id);this.statusActive=false;this.openHover=null},getTopOfPropagation:function(){var current=this;while(current.parent&&current.parent.openHover){current=current.parent}return current},propagateOpenHover:function(item){var p=this.hoverParent||this.parent;if(p.openHover!==undefined){if(p.openHover&&p.openHover!=item){p.openHover.closeHover()}p.openHover=item}else{if($.isFunction(p.propagateOpenHover)){p.propagateOpenHover(item)}}},closeHover:function(){},isParentActive:function(){return(this.parent.statusActive=!!this.parent.statusActive)
}});(function(){var radios={};ox.gui.MenuItem=ox.gui.Menu.extend({getClass:function(){return"ox.gui.MenuItem"},construct:function(options){this.options=$.extend({id:undefined,title:noI18n(""),icons:[],pathPrefix:undefined,big:false,action:$.noop,enabled:true,requires:[],behavior:"button",group:"",widget:this,parts:"both"},options||{});this.clonable=true;this._super(this.options.id);this.options.id=this.id;this.text=this.options.title;this.icon=this.options.icons.length>0?this.options.icons[0]:"";
this.iconDisabled=this.options.icons.length>1?this.options.icons[1]:"";this.bigIcon=!!this.options.big;this.statusEnabled=!!this.options.enabled;this.forceSmallIcon=false;this.menuStrip=null;this.menuStripAlign="bottom";this.onClickCallback=null;this.timeoutShow=null;this.timeoutHide=null;if(this.options.behavior==="radio"){var group=this.options.group+"";if(radios[group]===undefined){radios[group]=[]}radios[group].push(this)}},i18nHandler:function(){this.paint()},nodeInit:function(){this.addCSSClass("menu-item")
},nodeListeners:(function(){var fnOver=function(e){if(this.isEnabled()){this.addCSSClass("menu-item-over");if(this.options.behavior!=="split"&&this.isParentActive()&&this.isEnabled()){this.activate()}}};var fnDown=function(e){e=$.event.fix(e||window.event);if(this.options.mousedown){this.options.mousedown(this.options,e)}if(this.isEnabled()){this.addCSSClass("menu-item-down")}};var fnUp=function(e){if(this.isEnabled()){this.removeCSSClass("menu-item-down")}};var fnOut=function(e){if(this.isEnabled()){this.removeCSSClass("menu-item-down")
}window.clearTimeout(this.showTimeout);this.removeCSSClass("menu-item-over")};var fnClick=function(e){e=$.event.fix(e||window.event);if(this.isEnabled()){var action=false;if(this.options.behavior==="radio"){this.setChecked(true);action=true}else{if(this.options.behavior==="checkbox"){this.setChecked(!this.stateChecked);action=true}}if(this.options.action!==$.noop){e.widget=this;action=this.options.action(e)||action}if(action===true){ox.desktop.hideHovers()}else{this.toggleActive()}e.stopPropagation()
}};if(ox.browser.IE){return function(){var node=this.dom.node;node.onmouseover=$.proxy(fnOver,this);node.onmousedown=$.proxy(fnDown,this);node.onmouseup=$.proxy(fnUp,this);node.onmouseout=$.proxy(fnOut,this);node.onclick=$.proxy(fnClick,this)}}else{return function(){var node=$(this.dom.node),click=false,self=this;node.bind("mouseover",$.proxy(fnOver,this));node.bind("mouseout",$.proxy(fnOut,this));node.bind("mousedown",function(e){click=true;$.proxy(fnDown,self)(e)});node.bind("mouseup",function(e){$.proxy(fnUp,self)(e);
if(click){$.proxy(fnClick,self)(e);click=false}})}}}()),validate:function(force){if(this.menuStrip){this.menuStrip.requiresValidation=!!(this.requiresValidation||force);this.menuStrip.validate()}ox.gui.Widget.prototype.validateTree.call(this)},paintVisible:function(cont){this.dom.node.style.display="block";this.paintState();ox.call(cont)},paintEnabled:function(){this.paintState()},paintDisabled:function(){this.paintState()},getPath:function(path){var prefix=this.options.pathPrefix;return prefix===undefined?ox.gui.themePath+path:urlify(path)
},paint:function(){this.enableI18n();var node=$(this.dom.node).empty(),self=this;var text=(this.text||"").replace(/&/,"");if(this.bigIcon&&!this.forceSmallIcon){this.menuStripAlign="bottom";node.css({textAlign:"center"});var matches=text.match(/([^\s]+\s|[^\s]+$)/g);var escaped="";if(matches&&matches.length>1){var splitIndex=Math.ceil(matches.length/2);var half1=matches.slice(0,splitIndex);var half2=matches.slice(splitIndex);text=half1.join("")+"\n"+half2.join("")+"\u200B";escaped=text.replace(/</g,"&lt;").replace(/\s*\n\s*/g,"<br/>")
}else{escaped=text.replace(/</g,"&lt;").replace(/\s*\n\s*/g,"<br/>")+"<br/>&nbsp;"}if(this.icon){var icon=$("<img/>",{src:this.getPath(this.icon),alt:"",title:String(this.options.tooltip||text)});node.append(icon.addClass("menu-item-icon-large"));this.dom.icon=icon[0]}var div=$("<div/>").css("whiteSpace","nowrap").html(escaped).appendTo(node);if(this.hasChildren()){div.append($("<img/>",{src:ox.gui.themePath+"img/arrows/menu_arrow_down.gif",alt:""}).addClass("menu-item-arrow"))}}else{node.css({textAlign:"left",whiteSpace:"nowrap"});
var parts=this.options.parts;var hasIcon=this.icon&&(parts==="icon"||parts==="both");var hasText=parts==="text"||parts==="both";if(hasIcon){var icon=$("<img/>",{src:this.getPath(this.icon),alt:"",title:String(this.options.tooltip||text)});node.append(icon.addClass("menu-item-icon"));this.dom.icon=icon[0]}if(this.options.behavior==="split"){if(hasText){node.append($("<span/>").text("\u00a0\u00a0"+text+"\u00a0"))}if(this.hasChildren()){node.append($("<img/>",{src:ox.gui.themePath+"img/arrows/menu_arrow_down.gif",alt:""}).addClass("menu-item-arrow menu-item-split").bind("mousedown mouseup",function(e){e.stopPropagation()
}).bind("click",function(e){self.toggleActive();return false}))}}else{if(hasText){node.append($("<span/>").text(hasIcon?"\u00a0\u00a0"+text:text))}if(this.hasChildren()){node.append($("<img/>",{src:ox.gui.themePath+"img/arrows/menu_arrow_down.gif",alt:""}).addClass("menu-item-arrow"))}}}this.paintState()},toggleActive:function(){if(this.statusActive){this.deactivate()}else{this.activate()}},activate:function(){this.statusActive=true;this.open()},deactivate:function(){this.statusActive=false;this.close();
this.each(function(child){if(child.deactivate){child.deactivate()}})},closeHover:function(){this.deactivate()},onClick:function(callback){this.onClickCallback=callback},hide:function(){this._super();this.deactivate()},hideHovers:function(){this.deactivate()},open:function(delay){this.propagateOpenHover(this);if(this.hasChildren()){if(!this.menuStrip){this.menuStrip=new ox.gui.MenuStrip();this.menuStrip.parent=this}if(!this.menuStrip.statusOpen){delay=delay||50;if(this.showTimeout!=null){window.clearTimeout(this.showTimeout)
}var self=this;this.showTimeout=window.setTimeout(function(){self.menuStrip.open()},delay)}}},close:function(){if(this.menuStrip){this.menuStrip.close()}},setChecked:function(state){if(state!==this.stateChecked){if(state===true&&this.options.behavior==="radio"){var i=0,items=radios[this.options.group]||[],$l=items.length,item;for(;i<$l;i++){item=items[i];if(item!==this){item.setChecked(false)}}}this.stateChecked=state;this.paintState()}},paintState:function(){if(this.statusVisible===false){return
}var node=$(this.dom.node);if(this.stateChecked===true){node.addClass("menu-item-checked");node.removeClass("menu-item-disabled");return}else{node.removeClass("menu-item-checked")}if(this.statusEnabled===false){node.addClass("menu-item-disabled")}else{node.removeClass("menu-item-disabled")}},setIcon:function(icon){this.icon=icon;if(this.dom.icon){this.dom.icon.src=this.getPath(icon)}},setTitle:function(title){this.options.title=title;this.text=title;this.paint()}})}());ox.gui.MainMenu=ox.gui.Menu.extend({getClass:function(){return"ox.gui.MainMenu"
},construct:function(id){this._super(id);this.setLayout(new MenuBarLayout(this))},add:function(item){item.menuStripAlign="bottom";ox.gui.Container.prototype.add.call(this,item)}});(function(){ox.gui.MenuStrip=ox.gui.Menu.extend({getClass:function(){return"ox.gui.MenuStrip"},construct:function(id){this.clonable=true;this.isHover=true;this._super(id);this.setLayout(new ox.gui.MenuStripLayout(this));this.statusOpen=false;this.statusActive=true;this.inDOM=false;var self=this;this.fnLocalEvent=$.proxy(function(e){e.stopPropagation()
},this);this.fnGlobalEvent=$.proxy(function(e){this.parent.deactivate();this.close()},this);var overlays=$();this.fixIFrames=function(flag){if(flag){var iframes=$("iframe:visible"),i=0,$i=iframes.length;var iframe,offset,width,height,fix;for(;i<$i;i++){iframe=iframes.eq(i);offset=iframe.offset();width=iframe.outerWidth();height=iframe.outerHeight();overlays=overlays.add($("<div/>").css({position:"absolute",top:offset.top,left:offset.left,width:width,height:height,zIndex:5000,backgroundColor:"white",opacity:0.001}).text(" ").appendTo(document.body))
}}else{overlays.remove();overlays=$()}}},nodeInit:function(){this.addCSSClass("menustrip")},nodeListeners:function(){this.addListener("dom:resize",window,function(e){this.parent.deactivate()})},getChildren:function(){return this.parent.getChildren()},setPosition:function(){var parent=this.parent;var parenNode=$(parent.dom.node);var parentPos=parenNode.offset();var parentDim={width:parenNode.outerWidth(true),height:parenNode.outerHeight(true)};var node=$(this.dom.node);var dim={width:node.outerWidth(true)||0,height:node.outerHeight(true)||0};
var maxLeft=$(document).width()-dim.width-10,maxTop=$(document).height()-dim.height-10;var style=this.dom.node.style;switch(parent.menuStripAlign){case"right":style.left=Math.max(0,Math.min(parentPos.left+parentDim.width-5,maxLeft))+"px";style.top=Math.max(0,Math.min(parentPos.top,maxTop))+"px";break;case"bottom":style.left=Math.max(0,Math.min(parentPos.left,maxLeft))+"px";style.top=Math.max(0,Math.min(parentPos.top+parentDim.height,maxTop))+"px";break}var p=parent.parent;if(p&&p.menuStrip){style.zIndex=(p.menuStrip.dom.node.style.zIndex||10001)+1
}else{style.zIndex=10001}},open:function(delay){if(!this.statusOpen){this.statusOpen=true;if(this.hasChildren()){if(!this.inDOM){document.body.appendChild(this.dom.node)}this.fixIFrames(true);this.setPosition();this.validate(true);$(this.dom.node).bind("click",this.fnLocalEvent);$(document.body).bind("click",this.fnGlobalEvent);this.dom.node.style.display="block";this.dom.node.style.visibility="visible";this.hasHover(true)}}},close:function(){this.statusOpen=false;this.fixIFrames(false);$(this.dom.node).unbind("click",this.fnLocalEvent);
$(document.body).unbind("click",this.fnGlobalEvent);this.dom.node.style.display="none";this.dom.node.style.visibility="hidden";this.hasHover(false)}})}());ox.gui.ContextMenu=ox.gui.Menu.extend({getClass:function(){return"ox.gui.ContextMenu"},construct:function(id){this._super(id)},paint:function(){this.dom.node.innerHTML="[ContextMenu] "+this.id}});function MenuBarLayout(targetDOMNode){this.targetDOMNode=targetDOMNode||null}MenuBarLayout.prototype.doLayout=function(container){var targetDOMNode=this.targetDOMNode||container.dom.node;
targetDOMNode.innerHTML="";var table=document.createElement("table");var tbody=document.createElement("tbody");var tr=document.createElement("tr");for(var i=0;i<container.children.length;i++){var child=container.children[i];var td=document.createElement("td");child.setParentDOMNode(td);child.validate();tr.appendChild(td)}tbody.appendChild(tr);table.appendChild(tbody);targetDOMNode.appendChild(table)};ox.gui.MenuStripLayout=ox.gui.LayoutManager.extend({getClass:function(){return"ox.gui.MenuStripLayout"
},construct:function(container){this._super(container)},doLayout:function(){var target=this.container.dom.node;this.container.each(function(child){child.validate();target.appendChild(child.dom.node)})}});ox.gui.TabControl=ox.gui.StatefulContainer.extend({getClass:function(){return"ox.gui.TabControl"},construct:function(id){this._super(id);this.setLayout(new ox.gui.TabControlLayout(this));this.expanded=true;this.expandable=false;this.inHover=false;this.lastClickedChild=null;this.tabContainer=document.createElement("div");
this.tabContainer.className="oxTabControl";this.tabPageContainer=document.createElement("div");this.tabPageContainer.className="oxTabControlPageContainer";var target=$("#everything");this.dom.hover=document.createElement("div");this.dom.hover.className="oxTabControlPageHover";target.append(this.dom.hover);this.dom.hoverUnderlay=document.createElement("div");this.dom.hoverUnderlay.className="oxTabControlPageHoverUnderlay";target.append(this.dom.hoverUnderlay);var self=this;$(this.dom.hoverUnderlay).add(document.body).bind("click",function(e){if(self.inHover&&self.expanded){self.collapse()
}});this.accesskeys={};this.defaultTargetDOMNodeForChildren=this.tabPageContainer;this.enableI18n()},i18nHandler:function(){this.layoutManager.doLayout()},nodeInit:function(){this.setStyle("overflow: visible")},nodeListeners:function(){var fnWheel=function(e){var p=0+this.currentChild.position;var children=this.getChildren();p=Math.max(0,Math.min(p-e.deltaSign,children.length-1));this.showChild(children[p].id);return false};this.addListener("dom:dblclick",this.tabContainer,function(e){if(e.target===this.tabContainer){this.toggleHover();
return false}})},add:function(widget){if(widget.id&&widget instanceof ox.gui.Widget){widget.statusVisible=true;widget.setVisible(false);ox.gui.StatefulContainer.prototype.add.call(this,widget);if(!this.currentChild&&!this.inHover){this.currentChild=widget;this.currentState=widget.id;this.currentChild.setVisible(true);this.triggerWidgetEvent("tabchanged",this.currentChild)}this.childIndex[widget.id]=widget}else{ox.desktop.oopsFunc(this.getClass()+"(<widget>)","<widget> must be an instance of ox.gui.Widget and it MUST have an id!")
}return this},hideCurrentChild:function(){if(this.currentChild!=null){this.currentChild.hide();this.currentState="";this.hideHovers()}},setPosition:function(position){if(typeof position==="number"&&position>0&&this.children.length>position){this.showChild(this.children[position].id)}},showChild:function(childID){if(this.childIndex[childID]!==undefined&&this.currentState!=childID){this.hideCurrentChild();this.currentChild=this.childIndex[childID];this.currentState=childID;this.layoutManager.update(this);
this.currentChild.show()}},toggle:function(){if(this.expandable){if(this.expanded){this.collapse()}else{this.expand()}}},expand:function(){if(this.expandable&&!this.expanded){if(this.inHover){var o=$(this.dom.node).offset();o.top+=$(this.tabContainer).height();$(this.dom.hover).css({top:o.top+"px",left:o.left+"px"});$(this.dom.hoverUnderlay).css({top:o.top+"px"}).show();$(this.dom.hover).show();this.hasHover(true)}$(this.tabPageContainer).show();this.expanded=true;this.layoutManager.update(this);
this.triggerWidgetEvent("tabexpanded",this);this.triggerWidgetEvent("tabtoggled",this)}},collapse:function(){if(this.expandable&&this.expanded){$(this.dom.hoverUnderlay).hide();$(this.tabPageContainer).hide();$(this.dom.hover).hide();this.expanded=false;this.layoutManager.update(this);this.hasHover(false);this.triggerWidgetEvent("tabcollapsed",this);this.triggerWidgetEvent("tabtoggled",this)}},toggleHover:function(flag,event){flag=flag===undefined?!this.inHover:flag;event=event===undefined||event===true;
if(flag!==this.inHover){if(flag===false){this.hasHover(false);$(this.tabPageContainer).removeClass("oxTabControlPageContainerInHover").appendTo(this.dom.node);this.inHover=false;$(this.dom.hoverUnderlay).hide();if(event){this.triggerWidgetEvent("togglehover",false)}this.expand()}else{this.hasHover(true);$(this.tabPageContainer).addClass("oxTabControlPageContainerInHover").appendTo(this.dom.hover);this.inHover=true;if(event){this.triggerWidgetEvent("togglehover",true)}this.collapse()}}},hideHovers:function(){if(this.inHover){this.collapse();
$(this.dom.hoverUnderlay).hide()}ox.gui.StatefulContainer.prototype.hideHovers.call(this)}});ox.gui.TabPage=ox.gui.Container.extend({getClass:function(){return"ox.gui.TabPage"},construct:function(id,title){this._super(id);this.title=title||_("No title")},initNode:function(){this._super();this.setStyle("overflow: hidden")}});ox.gui.TabControlLayout=ox.gui.LayoutManager.extend({getClass:function(){return"ox.gui.TabControlLayout"},construct:function(container){this._super(container);this.tds=[];this.firstRun=true
},doLayout:function(){var layoutmanager=this;var tabControl=this.container;tabControl.tabContainer.innerHTML="";tabControl.accesskeys={};layoutmanager.tds=[];var button=document.createElement("div");button.className=tabControl.inHover?"oxTabControlToggleReverse":"oxTabControlToggle";tabControl.tabContainer.appendChild(button);tabControl.addListener("dom:click",button,function(e){if(this.expanded){this.collapse()}else{this.showChild(this.children[0].id);this.expand()}this.lastClickedChild=null;this.toggleHover();
return false});tabControl.addListener("widget:togglehover",function(e){button.className=e.data?"oxTabControlToggleReverse":"oxTabControlToggle"});var table=document.createElement("table");table.border=table.cellPadding=table.cellSpacing=0;var tbody=document.createElement("tbody");var tr=document.createElement("tr");tabControl.each(function(child,i,childCount){var td=document.createElement("td");var className=i<childCount-1?"oxTab":"oxTabLast";className+=child==tabControl.currentChild?" oxTabCurrent":"";
td.className=className;var a=document.createElement("a");var title=escapeHTML(expectI18n(child.title));a.innerHTML=title.replace(/&amp;(.)/,"<u>$1</u>");a.href="#";a.tabIndex=ox.gui.globalTabIndex++;td.appendChild(a);tr.appendChild(td);layoutmanager.tds.push(td);if(title.search(/&amp;\w/)!=-1){var matches=title.match(/&amp;(.)/);child.shortcutKey=matches[1].toUpperCase();child.shortcutKeyCode=child.shortcutKey.charCodeAt(0);if(tabControl.accesskeys[child.shortcutKey]===undefined){tabControl.accesskeys[child.shortcutKey]={pages:[],position:0,lock:false}
}tabControl.accesskeys[child.shortcutKey].pages.push({tabPage:child,link:a,key:matches[1].toLowerCase()})}child.addListener("dom:focus",a,function(e){var tab=this.parent;if(tab.currentChild!=this){this.parent.showChild(this.id);if(!tab.expanded){tab.expand()}}if(ox.browser.WebKit||ox.browser.IE){var access=tab.accesskeys[tab.currentChild.shortcutKey];if(access){var l=access.pages.length;var current=access.position;var next=(access.position+1)%l;var currentPage=access.pages[current];currentPage.link.accessKey="";
var nextPage=access.pages[next];nextPage.link.accessKey=nextPage.key;access.position=next}}return false});var fnClick=function(e){var tab=this.parent;if(tab.inHover&&tab.lastClickedChild==this&&tab.expanded){tab.collapse()}else{track({type:"Click/Tab",text:'Change to tab "'+this.title.replace(/&/,"")+'" ('+this.id+")"});tab.showChild(this.id);tab.expand()}tab.lastClickedChild=this;return false};child.addListener("dom:click",td,fnClick)});tbody.appendChild(tr);table.appendChild(tbody);tabControl.tabContainer.appendChild(table);
tabControl.addListener("dom:click",document,function(e){if(this.inHover&&this.expanded){this.lastClickedChild=null;this.collapse()}});for(var key in tabControl.accesskeys){var page=tabControl.accesskeys[key].pages[0];page.link.accessKey=page.key}if(ox.browser.Gecko){tabControl.addListener("dom:keydown",document,function(e){var ascii=e.charCode||e.which||e.keyCode;var keyChar=String.fromCharCode(ascii);if(this.statusVisible&&e.altKey){var access=this.accesskeys[keyChar];if(access&&!access.lock){access.lock=true;
var l=access.pages.length;var next=(access.position+1)%l;this.showChild(access.pages[next].tabPage.id);if(!this.expanded){this.expand()}access.position=next;return false}}});tabControl.addListener("dom:keyup",document,function(e){var ascii=e.charCode||e.which||e.keyCode;var keyChar=String.fromCharCode(ascii);var access=this.accesskeys[keyChar];if(access){access.lock=false}})}tabControl.each(function(child){tabControl.tabPageContainer.appendChild(child.dom.node)});if(this.firstRun){tabControl.dom.node.appendChild(tabControl.tabContainer);
if(tabControl.expandable&&tabControl.inHover){tabControl.dom.hover.appendChild(tabControl.tabPageContainer)}else{tabControl.dom.node.appendChild(tabControl.tabPageContainer)}this.firstRun=false}if(tabControl.currentChild){tabControl.currentChild.show()}},update:function(){var tds=this.tds;var tabControl=this.container;tabControl.each(function(child,i,childCount){if(tds[i]!==undefined){var className=i<(childCount-1)?"oxTab":"oxTabLast";if(tabControl.expanded&&child==tabControl.currentChild){className+=" oxTabCurrent";
tds[i].className=className;try{tds[i].firstChild.focus()}catch(e){}}else{tds[i].className=className}}})}});ox.gui.PanelMenu=ox.gui.Container.extend({getClass:function(){return"ox.gui.PanelMenu"},construct:function(id,title){this._super(this.autoId(id));this.title=title||noI18n("");this.rows=3;this.dynamicResizing=false;this.hasCollapsedSections=false;this.setLayout(new ox.gui.PanelMenuLayout(this));this.addListener("widget:show",function(){this.layoutManager.resize()})},nodeInit:function(){this._super();
this.setStyle("overflow: hidden")},propagateOpenHover:function(item){var p=this.parent;if(p.openHover!==undefined){if(p.openHover&&p.openHover!=item){p.openHover.deactivate()}p.openHover=item}else{if($.isFunction(p.propagateOpenHover)){p.propagateOpenHover(item)}}},setTitle:function(title){this.title=title;if(this.parent){this.parent.layoutManager.doLayout()}}});ox.gui.PanelMenuSection=ox.gui.Container.extend({getClass:function(){return"ox.gui.PanelMenuSection"},construct:function(text,id){this._super(id);
this.text=text||noI18n("");this.collapsed=false;this.dropdown=null;this.maxWidth=0;this.setLayout(new ox.gui.PanelMenuSectionLayout(this))},add:function(){var target=this.collapsed?this.dropdown:this;ox.gui.Container.prototype.add.apply(target,arguments)},insert:function(){var target=this.collapsed?this.dropdown:this;ox.gui.Container.prototype.insert.apply(target,arguments)},propagateOpenHover:function(item){var p=this.parent;if(p&&p.openHover!==undefined){if(p.openHover&&p.openHover!=item){p.openHover.deactivate()
}p.openHover=item}else{if(p&&$.isFunction(p.propagateOpenHover)){p.propagateOpenHover(item)}}},expand:function(){if(this.collapsed){this.removeChildren();this.dropdown.each(function(child){child.forceSmallIcon=false;if(child.bigIcon){child.menuStripAlign="bottom";child.statusValid=false}else{child.menuStripAlign="right"}ox.gui.Container.prototype.add.call(this.parent,child)});this.dropdown.removeChildren();this.collapsed=false;this.statusValid=false;this.validate()}},collapse:function(){if(!this.collapsed&&this.hasChildren()){var icon=this.getChildren()[0].icon;
if(this.dropdown==null){this.dropdown=new ox.gui.MenuItem(this.text||_("Dropdown"),icon,true)}this.each(function(child){if(child.bigIcon){child.forceSmallIcon=true;child.menuStripAlign="right";child.statusValid=false;this.dropdown.add(child)}});this.each(function(child){if(!child.bigIcon){child.forceSmallIcon=true;child.menuStripAlign="right";this.dropdown.add(child)}});this.removeChildren();ox.gui.Container.prototype.add.call(this,this.dropdown);this.collapsed=true;this.dropdown.statusValid=false;
this.statusValid=false;this.validate()}}});ox.gui.PanelMenuLayout=ox.gui.LayoutManager.extend({construct:function(container){this._super(container);this.table=null;this.tbody=null;this.tfoot=null;this.maxWidth=0},getClass:function(){return"ox.gui.PanelMenuLayout"},doLayout:function(){var container=this.container;var showNames=this.container.parent.options.showSectionNames;var target=$(this.container.dom.node);var self=this;if(this.table===null){this.table=$("<table/>",{border:0,cellPadding:0,cellSpacing:0}).addClass("panelMenu").append($("<tbody/>").append(this.tbody=$("<tr/>"))).append($("<tfoot/>").append(this.tfoot=$("<tr/>")))
}this.park();this.tbody.empty();container.eachVisible(function(child,i,childCount){var td=$("<td/>");td.addClass("panelSectionContainer"+(i===childCount-1?" last":""));td.appendTo(self.tbody).append(child.dom.node)});this.tfoot.empty();if(showNames===true){container.eachVisible(function(child){$("<td/>").text(expectI18n(child.text)).addClass("panelMenuSectionName").appendTo(self.tfoot)})}target.css("height","64px").append(this.table);container.addListener("dom:resize",window,function(e){var manager=this.layoutManager;
manager.maxWidth=$(this.dom.node).width();this.layoutManager.resize()});var current=container;while(current.parent&&!current.parent.statusValid){current=current.parent}container.addListener("widget:valid",current,function(event){var manager=this.layoutManager;manager.maxWidth=$(this.dom.node).width();this.eachVisible(function(child){child.maxWidth=child.dom.node.clientWidth});this.dynamicResizing=true;this.layoutManager.resize()});if(container!=current){container.layoutManager.resize()}},resize:function(){return;
var container=this.container;var children=container.getVisibleChildren();var maxWidth=this.maxWidth;if(container.dynamicResizing&&(this.table.clientWidth>maxWidth||container.hasCollapsedSections)){if(container.hasCollapsedSections&&this.table.clientWidth<maxWidth){for(var i=0;i<children.length;i++){var child=children[i];if(child.collapsed&&(this.table.clientWidth+child.maxWidth)<maxWidth){child.expand()}}}if(this.table.clientWidth>=maxWidth){for(var i=children.length-1;i>=0;i--){var child=children[i];
if(this.table.clientWidth>=maxWidth){child.collapse()}else{break}}}}for(var i=children.length-1;i>=0;i--){if(children[i].collapsed){container.hasCollapsedSections=true;break}}}});ox.gui.PanelMenuSectionLayout=ox.gui.LayoutManager.extend({construct:function(container){this._super(container);this.table=null;this.tbody=null},getClass:function(){return"ox.gui.PanelMenuSectionLayout"},doLayout:function(){if(this.table===null){this.table=$("<table/>",{border:0,cellPadding:0,cellSpacing:0}).addClass("panelMenuSection").append(this.tbody=$("<tbody/>"))
}this.renderPartial();this.table.appendTo(this.container.dom.node)},renderPartial:function(){var park=$("<div/>");this.container.each(function(child){park.append(child.dom.node)});this.tbody.empty();var bigIcons=[],smallIcons=[];this.container.each(function(child){if(child.bigIcon){bigIcons.push(child)}else{smallIcons.push(child)}});var hasBigIcons=bigIcons.length>0;var rows=2;var columns=Math.ceil(smallIcons.length/rows);var trs=[],r=0;for(;r<rows;r++){trs.push($("<tr/>").appendTo(this.tbody))}var i,c,r,td;
for(i=0;i<bigIcons.length;i++){var child=bigIcons[i];td=$("<td/>",{rowSpan:rows}).addClass("panelMenuItem large").append(child.dom.node);trs[0].append(td)}for(c=0,i=0;c<columns;c++){for(r=0;r<rows;r++,i++){td=$("<td/>").addClass("panelMenuItem").css({height:Math.floor(100/rows)+"%"});if(r===rows-1){td.addClass("bottom")}trs[r].append(td);if(smallIcons[i]){td.append(smallIcons[i].dom.node)}else{td.html("&nbsp;")}}}}});ox.gui.TabMenu=ox.gui.TabControl.extend({getClass:function(){return"ox.gui.TabMenu"
},construct:function(options){this.options=$.extend({id:undefined,action:$.noop,showSectionNames:true,inHover:false},options||{});this._super(this.options.id);this.setLayout(new ox.gui.TabMenuLayout(this));this.expanded=true;this.expandable=true;this.inHover=this.options.inHover;this.openHover=null;if(this.options.inHover){this.expanded=false;$(this.tabPageContainer).addClass("oxTabControlPageContainerInHover").appendTo(this.dom.hover)}}});ox.gui.TabMenuLayout=ox.gui.TabControlLayout.extend({getClass:function(){return"ox.gui.TabMenuLayout"
}});ox.gui.morph=function(){ox.widgets={};ox.desktop.setLayout(new ox.gui.ZeroLayout());var sidenode=$("#sidesplit");ox.gui.initController();ox.gui.initToppanel();ox.gui.initSidepanel(sidenode);ox.gui.initFolderTree();ox.gui.initConfigTree();if(true){var $p=ox.gui.initToolBar();ox.gui.initToolBarCore();ox.gui.initToolBarPortal($p);ox.gui.initToolBarMail($p);ox.gui.initToolBarCalendar($p);ox.gui.initToolBarContacts($p);ox.gui.initToolBarTasks($p);ox.gui.initToolBarInfoStore($p);ox.gui.initToolBarConfig($p);
ox.gui.initToolBarMessaging($p);ox.gui.initToolBarPermissions($p);$p.postInit()}register("LanguageChanged",function(){ox.desktop.triggerGlobalEvent("LanguageChanged")})};ox.gui.initToppanel=function(){var modules=ox.api.ui.listModules();var moduleNodes={},selectedModule;$("#header").css({height:"30px",backgroundImage:"url('"+getFullImgSrc("img/toolbar/toolbar30.png")+"')"}).empty();$("#notheader").css({top:"30px"});var topPanel=ox.widgets.toppanel=new ox.gui.Container("ox-top").addTo(ox.desktop).setParentDOMNode($("#header")[0]).css({position:"absolute",right:"18px",bottom:"0px",left:"0px",top:"0px"}).setLayout(new ox.gui.BorderLayout());
ox.widgets.toppanel.hide=function(){this.setVisible(false);jQuery("#header").hide();jQuery("#notheader").css({top:"0px"})};ox.widgets.toppanel.show=function(){this.setVisible(true);jQuery("#notheader").css({top:"30px"});jQuery("#header").show()};var moduleContainer=ox.widgets.moduleNavigation=new ox.gui.Container("ox-modules").addTo(topPanel).setLayout(new ox.gui.ZeroLayout()).setLayoutParam({position:"center"});var changeIconState=ox.UIController.changeIconState=function(name){var select=function(name){$(moduleNodes[name].dom.node).css({borderLeft:"1px inset silver",borderRight:"1px inset silver"}).addClass("background-color-PMG-selection-elements")
};var deselect=function(name){$(moduleNodes[name].dom.node).css({border:""}).removeClass("background-color-PMG-selection-elements")};if(selectedModule===name){return}for(var i in moduleNodes){deselect(i)}if(ox.api.ui.moduleExists(name)){select(name);selectedModule=name}};expertSelection=new ox.gui.Custom(function(){var input=this.input=$("<input/>").css({"float":"left",border:"0px none"}).attr({type:"checkbox",id:"expert-tree"}).bind("click",function(event){var flag=$(this).attr("checked");track({type:"Changed expert mode ",text:flag?"Change to expert mode":"Change to non-expert mode"});
ox.UIController.setExpertTree(flag)});$(this.dom.node).append(input).append($("<div/>").css({"float":"left"}).append($("<label/>").attr({"for":"expert-tree"}).append(addTranslated(_("Expert mode")))));if(ox.UIController.showExpertTree){input.attr("checked","checked")}});ox.UIController.dispatcher.bind("expertchanged",function(e){if(expertSelection&&expertSelection.input&&expertSelection.input.attr("checked")!=e.enabled){expertSelection.input.attr("checked",e.enabled)}});ox.UIController.bind("modulechange",function(e){changeIconState(e.module==="messaging"?"mail":e.module)
});var i=0,$l=modules.length;var factory=function(module){if(module.icons===undefined){module.icons=["icons/24/mod_"+module.name+".png"]}if(module.name==="calendar"){module.icons[0]="img/calendar/dayicons/mod_calendar-"+(new Date(now())).getUTCDate()+".png"}var img=new ox.gui.Image().addCSSClass("ox-top-module-icons top-icon-"+module.name).setSrc(getFullImgSrc(module.icons[0])).setTitle(module.title);if(module.disabled){if(ox.upsell.isVisible(module.name)){img.disable();jQuery(img.dom.node).append(jQuery("<div>").addClass("top-icon-disabled").css({backgroundImage:"url("+getFullImgSrc("icons/16/lock.png")+")",position:"absolute",width:"16px",height:"16px",bottom:"2px",right:"0px"}));
img.addListener("click",function(e){triggerEvent("Feature_Not_Available","modules/"+module.name,window)});moduleContainer.add(img);moduleNodes[module.name]=img}}else{img.css({cursor:"pointer"}).addListener("click",function(e){track({type:"Click on module icon",text:"Change to module "+module.name});ox.UIController.setModule({module:module.name,folder:"auto"})});moduleContainer.add(img);moduleNodes[module.name]=img}};for(;i<$l;i++){factory(modules[i])}if(ox.api.config.get("ui.global.expert.mode.configurable",true)===true){moduleContainer.add(expertSelection.setLayoutParam({position:"center"}).setCSSClass("top-icon-expert-selection").css({margin:"5px 0 0 20px","float":"left"}))
}new ox.gui.Button("ox-topbar-logout",_("Logout"),function(){triggerEvent("Logout")}).addTo(topPanel).setLayoutParam({position:"right",width:120,valign:"top",align:"right"}).css({position:"absolute",top:"5px",right:"0px"});ox.widgets.searchField={active:function(){if(this[ox.api.ui.getActiveModule()]){return this[ox.api.ui.getActiveModule()]}else{return this.top}}};ox.widgets.searchField.top=new ox.gui.SearchField("ox-topbar-search",{disabled:true}).addTo(topPanel).setLayoutParam({position:"right",width:"260px"}).css({position:"absolute",top:"5px",bottom:"4px",left:"0px",right:"0px"}).addListener("widget:search",function(e){var module=ox.UIController.getModule(),id="",tmp=this.searchMenu.checked;
trigger=function(){triggerEvent("OX_New_Search",ox.api.ui.getActiveModule(),e.data.value)};if(module==="mail"||module==="contacts"){for(id in tmp){if(tmp[id]===true){trigger();break}}}else{trigger()}});var buttons=new ox.gui.Container("ox-buttons").addTo(topPanel).setLayout(new ox.gui.HBoxLayout()).setLayoutParam({position:"right",width:"200px",twidth:""}).css({position:"absolute",top:"3px",right:"10px"});var loading=new ox.gui.Image().addCSSClass("ox-top-module-buttons").css({cursor:"pointer"}).setLayoutParam({width:"20px",align:"right"}).setSrc(getFullImgSrc("img/toolbar/tb_loading.gif")).setTitle(_("Refresh")).addListener("click",function(e){triggerEvent("OX_Refresh")
});buttons.add(loading);setLoading=function(enabled){loading.setSrc(getFullImgSrc(enabled?"img/toolbar/ox_animated.gif":"img/toolbar/tb_loading.gif"));loading.setTitle(enabled?_("Loading..."):_("No activity"))};var cursor=null;setLoadingCursor=function(enabled){if(IE){return}if(enabled){if(!cursor){cursor=setMouseCursor("wait")}}else{if(cursor){removeMouseCursor(cursor);cursor=null}}};register("Loading",function(isLoading){setLoading(enabled);setLoadingCursor(enabled)});var help=new ox.gui.Image().addCSSClass("ox-top-module-buttons").css({cursor:"pointer"}).setLayoutParam({width:"20px",align:"right"}).setSrc(getFullImgSrc("img/toolbar/help.gif")).setTitle(_("Help"));
buttons.add(help);var _faq_guid=null;var faq=new MenuItem(_("FAQ"),function(){var uri=ox.api.config.get("ui.global.help.faq_path");var win=window.open(uri,"faq");win.focus()});faq.setVisible(ox.api.config.contains("ui.global.help.faq_path"));var menu=globalContextMenus.help=new PulldownMenu(help.dom.node);menu.addItem(new MenuItem(_("Help"),function(){triggerEvent("OX_Show_Help",help_location)}));menu.addItem(faq);menu.addItem(new MenuItem(_("Error messages"),function(){ox.UINotifier.showReport()
}));menu.addItem(new MenuItem(_("About"),function(){triggerEvent("OX_Show_About")}))};ox.gui.initSidepanel=function(sidenode){var newFolderIcon=null;$("<div/>",{id:"ox-sidesplit"}).addClass("oxStretch").append($("<div/>").css({position:"absolute",top:"24px",right:"-12px",width:"12px",height:"24px"}).addClass("sp-toggle").append($("<img/>").attr("src",getFullImgSrc("img/arrows/arrow_double_gray_right.gif")).css({marginTop:"8px"})).click(function(){ox.widgets.sidepanel.toggle();delete ox.widgets.sidepanel.userToggle
}).hide()).appendTo(sidenode[0]);var sidepanel=ox.widgets.sidepanel=new ox.gui.Container("ox-sidepanel-container").setLayout(new ox.gui.BorderLayout()).css({background:"white"}).addTo(ox.desktop).setParentDOMNode(sidenode[0]);sidepanel.oldWidth=229;$("#sidepanel_dragpoint_background").mousedown(function(e){return false});sidepanel.toggle=function(state){if(state!==undefined){if(state===this.toggled){return}this.toggled=state}else{this.toggled=!this.toggled}$("div.sp-toggle").css({display:this.toggled?"":"none"});
$(".sp-toggle-img img").css({display:this.toggled?"none":""});$("#sidepanel_dragpoint").css({display:this.toggled?"none":""});if(newFolderIcon!==null){newFolderIcon.setVisible(!this.toggled)}if(this.toggled){this.oldWidth=$("#sidesplit").outerWidth()}resizeSplit("sidesplit",this.toggled?"3px":this.oldWidth+"px");triggerEvent("OX_Sidepanel_Collapse",this.toggled)};if((ox.api.config.get("gui.global.landing_page.module")||"portal")==="portal"){sidepanel.toggle(true)}var view=ox.widgets.sidepanelViewControl=new ox.gui.ViewControl("ox-side-view").setLayoutParam({position:"center"}).css({background:"white"}).setCSSClass("oxStretch");
resizeEvents.register("Resized",function(){sidepanel.resize()});var v=ox.widgets.sidepanelViews={};var meta={portal:{title:_("Portal")},mail:{title:_("E-Mail")},calendar:{title:_("Calendar"),module:"calendar",icon:getFullImgSrc("icons/16/calendar.png"),sections:{"private":_("Private calendars"),shared:_("Shared calendars"),"public":_("Public calendars")}},contacts:{title:_("Contacts"),module:"contacts",icon:getFullImgSrc("icons/16/contacts.png"),sections:{"private":_("Private contacts"),shared:_("Shared contacts"),"public":_("Public contacts")}},tasks:{title:_("Tasks"),module:"tasks",icon:getFullImgSrc("icons/16/tasks.png"),sections:{"private":_("Private tasks"),shared:_("Shared tasks"),"public":_("Public tasks")}},infostore:{title:_("Infostore"),sections:{"private":_("Private folders"),all:_("All folders")}},configuration:{title:_("Configuration")},foldertree:{title:_("Folders")}};
ox.gui.util={};ox.gui.util.createFolder=function(options){var opt=$.extend({widget:null,success:$.noop,folder:0,module:ox.UIController.getModule(),data:{}},options);ox.api.folder.getFreeTitle(opt.folder,function(title){var defaultData={folder_id:opt.folder,id:"",module:opt.module,own_rights:1883275524,permissions:[],standard_folder:0,subscribed:true,subfolders:false,title:title,total:0,unread:0};if(opt.module==="mail"){defaultData.id=opt.folder+"/"+defaultData.title}else{defaultData.id="-1"}opt.data=$.extend(defaultData,opt.data);
opt.data.$={creating:true};var tree=ox.api.config.get("modules.folder.tree",0),expert=ox.UIController.showExpertTree,cache,cleanup,removeFromCache,cont,ok,abort,widget=opt.widget,parent,revert=false;cleanup=function(){widget.selection.enable();ox.api.folder.dispatcher.bind("modify",widget.onModify);widget=opt.widget=opt.data=null;opt=null};ok=function(title){removeFromCache();ox.api.folder.dispatcher.bind("modify",widget.onModify);ox.api.folder.create({folder:opt.folder,data:{title:title,module:opt.data.module},success:function(data){cleanup()
},error:function(){widget.repaint(cleanup)}})};abort=function(){removeFromCache();if(revert){parent.subfolders=false;cache.setComplete(opt.folder,false)}widget.repaint(function(){widget.selection.clickQuiet(opt.folder);cleanup()})};cont=function(){if(widget.setOpen){widget.setOpen([opt.folder])}widget.repaint(function(){setTimeout(function(){widget.selection.clickQuiet(opt.data.id);widget.startEdit(opt.data.id,ok,abort)},10)})};if(widget!==null){ox.api.folder.getSubFolders({folder:opt.folder,success:function(){ox.api.folder.dispatcher.unbind("modify",widget.onModify);
cache=ox.api.cache["folder"+tree];if((parent=cache.get(opt.folder))){if(parent.subfolders===false){parent.subfolders=true;cache.setComplete(opt.folder,true);revert=true}}if(opt.module==="mail"||opt.module==="infostore"||expert===true){cache.prepend(opt.data);removeFromCache=function(){cache.remove(opt.data.id)};cont()}else{var flatCache=ox.api.cache.folderFlat.get(opt.module);if(flatCache){(function(){var section,id,i,$i,item;for(id in flatCache){section=flatCache[id];for(i=0,$i=section.length;i<$i;
i++){item=section[i];if(item.id===opt.folder){section.splice(i+1,0,opt.data);removeFromCache=function(){var pos=$.inArray(opt.data,section);section.splice(pos,1)};cont();return}}}}())}}}})}})};ox.gui.util.inlineEdit=function(node,value,success,abort,selector){if(this.tree&&this.tree.selection){this.tree.selection.disable()}else{if(this.selection){this.selection.disable()}}var self=this,innerNode,input=$("<input/>",{type:"text",value:""}).bind("keydown",function(e){e.stopPropagation()}).bind("selectstart",function(e){e.stopPropagation()
}),unbind=function(value){$("body").unbind("mousedown",fnOk);input.unbind("blur keydown selectstart mousedown").remove();innerNode.text(value||"");input=innerNode=null},fnAbort=function(e){unbind();ox.util.call(abort)},fnOk=function(e){var value=input.val();if($.trim(value)!==""){unbind(value);ox.util.call(success,value)}else{fnAbort(e)}};input.css({width:"100%",border:"1px solid #555",borderWidth:"1px 0px 1px 0px",background:"#eee"}).val(value||"").bind("mousedown",function(){return false}).bind("keydown",function(e){switch(e.which){case 13:fnOk(e);
return false;case 27:fnAbort(e);return false}});input.bind("blur",fnOk);$("body").bind("mousedown",fnOk);innerNode=selector!==undefined?$(selector,node):$(node);innerNode.empty().append(input);input.focus();input.select()};var addRootFolder=configGetKey("modules.folder.tree")==1;if(addRootFolder){newFolderIcon=new ox.gui.Image().setSrc(getFullImgSrc("img/folder/newfolder.gif")).setTitle(_("New folder")).css({verticalAlign:"middle",cursor:"pointer",marginLeft:"5px",marginTop:"4px"}).setVisible(false).setLayoutParam({position:"left",width:4});
if(newFolderIcon.image){jQuery(newFolderIcon.image).css({width:"16px",height:"16px"})}ox.UIController.dispatcher.bind("expertchanged",function(e){newFolderIcon.setVisible(e.enabled);newFolderIcon.layout.width=e.enabled?"30px":"4px";ox.widgets.sidepanel.title.paint()})}(function(){if(addRootFolder){var rootMenu=new PulldownMenu(newFolderIcon.dom.node);rootMenu.getContext=constant({data:{id:1},widget:ox.widgets.sidepanelViews.folderTree})}globalContextMenus.newFolderType=new PopupMenu();var PIM={calendar:1,tasks:1,contacts:1,system:1};
var mail={mail:1};if(addRootFolder){PIM.mail=1;mail=PIM}var items={mail:{name:_("E-Mail"),when:mail},calendar:{name:_("Calendar"),when:PIM},tasks:{name:_("Tasks"),when:PIM},contacts:{name:_("Contacts"),when:PIM},infostore:{name:_("InfoStore"),when:{infostore:1}}};for(var i in items){if(ox.upsell.isVisible(i)&&ox.upsell.isVisible(i+"-new-folder")){(function(type){function createHandler(context){var widget=context.widget!==undefined?context.widget:ox.widgets.sidepanelViews.folderTree;ox.gui.util.createFolder({widget:widget,module:type,folder:context.data.id})
}var def=items[type];var key="modules."+type+".module";var item=new MenuItem(def.name,createHandler);item.onShow=function(){var ctx=this.getContext();if(ox.UIController.showExpertTree){if(ctx.data&&ctx.data.id==="2"&&type==="mail"){this.setEnabled(false)}else{this.setEnabled((ctx.type in def.when)&&configGetKey(key))}}else{if(ox.api.folder.is("unifiedmail",ctx.data)){this.setEnabled(false)}else{this.setEnabled(type===ox.UIController.getModule())}}};globalContextMenus.newFolderType.addItem(item);if(addRootFolder){item=new MenuItem(def.name,createHandler);
item.onShow=function(){this.setEnabled(("system" in def.when)&&configGetKey(key))};rootMenu.addItem(item)}})(i)}}var menu=new ContextMenu();globalContextMenus.simpleFolderMenu=menu;var new_folder=new MenuItem(_("New folder"),globalContextMenus.newFolderType);new_folder.setIcon("img/folder/newfolder.gif","img/folder/newfolder_d.gif");new_folder.onShow=function(){var module=ox.UIController.getModule();this.setEnabled(ox.upsell.isVisible(module+"-new-folder"))};menu.addItem(new_folder);var link=new MenuItem(_("Send as link"),function(context){ox.api.folder.get({folder:context.data.id,success:function(data){infostore_sendLink([{data:{folder_id:data.id,module:data.module}}])
}})});menu.addItem(link);var subscribe=new MenuItem(_("Subscribe folder"),function(context){SubscribeFolder.openWindow({selected:ox.api.account.derive(context.data.id,true)})});menu.addItem(subscribe);var extended=globalContextMenus.extended_folder_menu=new PopupMenu();var import_data=new MenuItem(_("Import"),function(context){ox.api.folder.get({folder:context.data.id,success:function(data){importFolderDestination=data;triggerEvent("OX_Switch_View","configuration/import")}})});extended.addItem(import_data);
var export_submenu=new PopupMenu();var export_submenu_ical=new MenuItem(_("iCalendar"),function(ctx){ox.api.folder.exportContacts(ctx.data.id,"ICAL")});export_submenu.addItem(export_submenu_ical);var export_submenu_vcard=new MenuItem(_("vCard"),function(ctx){ox.api.folder.exportContacts(ctx.data.id,"VCARD")});export_submenu.addItem(export_submenu_vcard);var export_submenu_csv=new MenuItem(_("CSV"),function(ctx){ox.api.folder.exportContacts(ctx.data.id,"CSV")});export_submenu.addItem(export_submenu_csv);
var export_contact=new MenuItem(_("Export"),export_submenu);extended.addItem(export_contact);menu.addItem(new MenuItem(_("Extended"),extended));menu.addItem(new MenuSeparator());var del=new MenuItem(_("Delete"),function(context){removeFolder(context.data.id)});del.setIcon("img/menu/delete_folder.gif","img/menu/delete_folder_d.gif");menu.addItem(del);var rename=new MenuItem(_("Rename"),function(context){context.widget.startEdit(context.data.id)});rename.setIcon("img/folder/renamefolder.gif","img/folder/renamefolder_d.gif");
menu.addItem(rename);var cut=new MenuItem(_("Cut"),function(context){context.widget.cut(context.data.id)});cut.setIcon("img/folder/cutfolder.gif","img/folder/cutfolder_d.gif");menu.addItem(cut);var paste=new MenuItem(_("Paste"),function(context){ox.api.folder.get({folder:context.data.id,success:function(target){ox.api.folder.move(context.widget.cutNode.data,target);context.widget.cut()}})});paste.setIcon("img/folder/pastefolder.gif","img/folder/pastefolder_d.gif");menu.addItem(paste);var folder_read=new MenuItem(_("Mark folder read"),function(context){triggerEvent("OX_Folder_Mark_Read",context.data.id)
});folder_read.setIcon("icons/16/mark_as.png","icons/16/mark_as.png");menu.addItem(folder_read);var empty=new MenuItem(_("Empty folder"),function(context){var text="Are you sure you want to delete all E-Mails from this folder? The deleted E-Mails will be moved to the Trash folder.";if(configGetKey("mail.deletemail")||(context.data.id==configGetKey("mail.folder.trash"))){text="Are you sure you want to permanently delete all E-Mails from this folder? The deleted E-Mails will be irrevocably lost."}function cbok(){ox.UIController.setFolder({folder:context.data.id,module:"default",success:function(){ox.api.folder.clear(context.data.id,function(){ox.api.http.pause();
ox.api.folder.get({folder:context.data.id,cache:false});ox.api.folder.getSubFolders({folder:context.data.id,cache:false});ox.api.http.resume(function(){triggerEvent("OX_Folder_Cleared",context.data.id);ox.api.folder.dispatcher.trigger("modify")})})}})}newConfirm(_("Empty folder"),_(text),AlertPopup.YESNO,null,null,cbok,null,null)});empty.setIcon("img/folder/empty_folder.gif","img/folder/propertiesfolder_d.gif");menu.addItem(empty);menu.addItem(new MenuSeparator());var props=new MenuItem(_("Properties"),function(context){ox.api.folder.viewProperties(context.data.id,false)
});props.setIcon("img/folder/propertiesfolder.gif","img/folder/propertiesfolder_d.gif");menu.addItem(props);menu.onShow=function(context){var id=context.data.id,api=ox.api.folder;api.get({folder:id,success:function(folder){new_folder.setEnabled((folder.own_rights&127)>=4);context.type=api.is("account",folder)?"mail":folder.module;subscribe.setEnabled(api.can("subscribe",folder));subscribe.setVisible(api.is("mail",folder));link.setEnabled(folder.own_rights&(127<<7)&&folder.module!="mail"&&("infostore_sendLink" in window));
link.setVisible(!api.is("system",folder)&&context.type!=="mail");del.setEnabled(api.can("delete",folder));rename.setEnabled(api.can("rename",folder));cut.setVisible(context.widget.cut!==undefined);if(cut.visible){cut.setEnabled(del.enabled&&(!context.widget.cutNode||context.widget.cutNode.id!=id))}paste.setVisible(context.widget.cut!==undefined);if(paste.visible){paste.disable();if(context.widget.cutNode){api.canMove(context.widget.cutNode.data,folder,function(){paste.enable()},function(){paste.disable()
})}}empty.setVisible(api.can("empty",folder));folder_read.setVisible(api.is("mail",folder));import_data.setEnabled(api.can("import",folder));export_contact.setEnabled(api.can("export",folder));export_submenu_ical.setVisible(api.is("calendar",folder));export_submenu_vcard.setVisible(api.is("contacts",folder));export_submenu_csv.setVisible(api.is("contacts",folder))}})};ox.gui.TypedFolderTree=ox.gui.Tree.extend({construct:function(id,options){ox.gui.Tree.prototype.construct.call(this,id);this.options=$.extend({type:"mail",icon:"mail.png",root:"1",tree:ox.api.config.get("modules.folder.tree","0"),showRootNode:false,loadRootNode:false},options||{});
this.css({padding:"10px 0px 10px 0px"});this.firstPaint=true;this.showRootNode=this.options.showRootNode;this.loadRootNode=this.options.loadRootNode;this.loadRootNodeId=this.options.root;var TYPE=this.options.type;var self=this;this.setNodeParser(function(data){return{id:data.id,parent:data.folder_id,name:data.title,type:data.module,hasChildren:data.subfolders}});this.addListener("widget:select",function(e){var api=ox.api.folder;api.get({folder:e.data,success:function(data){if(api.can("read",data)){if(TYPE==="mail"){if(api.is("mail",data)){ox.UIController.setFolder({folder:data.id,module:"mail"})
}else{if(api.is("messaging",data)){ox.UIController.setFolder({folder:data.id,module:"messaging"})}}}else{ox.UIController.setFolder({folder:data.id})}}}})});this.selection.onRename(function(id,item){ox.api.folder.get({folder:id,success:function(data){if(ox.api.folder.can("rename",data)){self.startEdit(id)}}})});this.selection.dispatcher.bind("selected",function(e){if(e.node.find(".context-button").length===0){var button=$.button({title:"\u00a0\u00a0"}).bind("click",function(event){self.selection.triggerContextMenu(e.id,event);
return false});if(IE<=7){button.css("width","")}if(IE){button=$('<form onsubmit="return false"></form>').css("margin","0").append(button)}var td=$("<td/>").css({width:"20px",textAlign:"right",paddingRight:"5px"}).addClass("context-button").append(button);if(IE<=7){td.css({width:"20px"})}e.node.find("tr").append(td)}else{e.node.find(".context-button").show()}});this.selection.dispatcher.bind("deselected",function(e){e.node.find(".context-button").hide()});this.addListener("widget:edited",function(e){ox.api.folder.rename({folder:e.data.id,title:e.data.value,success:function(data){var ID=self.id+"/"+ox.api.config.get("modules.folder.tree",0);
if(configGetKey(["gui","tree",ID,"state",e.data.id])===true){configRemoveKey(["gui","tree",ID,"state",e.data.id]);configSetKey(["gui","tree",ID,"state",data.id],true);self.setOpen([data.id])}ox.util.call(e.cont,data)},error:function(){self.repaint();self.selection.select(e.data.id);ox.util.call(e.cont)}});return false});var displayName="";this.customize=function(node){var messagingServices={"com.openexchange.messaging.facebook":{icon:"facebook.png"},"com.openexchange.messaging.rss":{icon:"rss.png"},"com.openexchange.messaging.twitter":{icon:"twitter.png"}};
var data=node.data,api=ox.api.folder,id;var name=data.title;$(node.dom.title).parent().css({fontWeight:""}).removeClass("font-color-disabled font-style-low");$(node.dom.icon).css({backgroundImage:""});var processUnread=function(meta){if(data.unread!==null&&data.unread>0){$(node.dom.title).parent().css({fontWeight:"bold"});meta.name=meta.name;meta.html=meta.name+" ("+data.unread+")"}return meta};if((this.options.tree===0&&data.folder_id===this.options.root)||(ox.api.folder.is("account",data))){src=this.options.icon
}else{var src="folder_closed",accountId,a={};accountId=/^default(\d*)\b/.exec(data.id);if($.isArray(accountId)){if(accountId[1]==="0"){var f=config.mail.folder;a.inbox_fullname=f.inbox;a.trash_fullname=f.trash;a.sent_fullname=f.sent;a.drafts_fullname=f.drafts;a.spam_fullname=f.spam}else{a=ox.api.cache.account.get(accountId[1]);id="default"+accountId[1];if(!a){a={inbox_fullname:id+"/INBOX",trash_fullname:id+"/Trash",sent_fullname:id+"/Sent",drafts_fullname:id+"/Drafts",spam_fullname:id+"/Spam"}}if(a.inbox_fullname===undefined){a.inbox_fullname=id+"/INBOX"
}}}switch(data.id){case a.inbox_fullname:src="inbox.png";break;case a.trash_fullname:src="garbage.png";break;case a.sent_fullname:src="outbox.png";break;case a.drafts_fullname:src="draft.png";break;case a.spam_fullname:src="spam.png";break;case a.confirmed_ham_fullname:src="ham.png";break;case a.confirmed_spam_fullname:src="spam.png";break;default:if((api.is("system",data)||api.can("read",data))&&node.isCut!==true){src=node.statusOpen?"folder_opened.png":"folder_closed.png";$(node.dom.title.parentNode).removeClass("font-color-disabled")
}else{src=node.statusOpen?"folder_opened_dis.png":"folder_closed_dis.png";$(node.dom.title.parentNode).addClass("font-color-disabled")}}switch(data.module){case"infostore":if(data.folder_id==="10"){src="user"}else{src="infostore"}if(!api.can("read",data)){if(data.folder_id==="1"){src=src+"_dis.gif";$(node.dom.title.parentNode).addClass("font-color-disabled font-style-low")}else{src=src+".png"}node.selectable=false}else{src=src+".png";node.selectable=true}case"messaging":var service=/^(.*?):/.exec(data.id);
if(service){src=messagingServices[service[1]].icon}break}if(ox.api.folder.is("published",data)){$(node.dom.icon).css({backgroundImage:"url("+ox.gui.themePath+"icons/16/"+src+")"});src="shared_globe.png"}}if(data.id==="default0"){var identifier=config.identifier;var user=internalCache.getUsers([identifier],function(data){displayName=data[identifier].display_name});if(user&&user[identifier]){name=displayName=user[identifier].display_name}else{name=displayName}}return processUnread({src:ox.gui.themePath+"icons/16/"+src,name:name})
};this.selection.classSelected="background-color-PMG-selection-elements";var fnToggle=function(){var ID=this.id+"/"+ox.api.config.get("modules.folder.tree",0);var state={};$.each(self.getOpen(),function(i,id){state[id]=true});configSetKey(["gui","tree",ID,"state"],state)};this.addListener("widget:open",fnToggle);this.addListener("widget:close",fnToggle);this.selection.setClickHandler(function(e){if(self.selection.statusEnabled===false){return false}if(e.event.rightClick){track({type:"ContextMenu/Tree",id:e.id,text:"Right click on folder "+e.id});
e.click("quiet");e.context()}else{if(e.selectable===true&&e.id!=="-1"){if(currentpath[0]==="configuration"){ox.UIController.setFolder({folder:e.id,module:"default"})}else{ox.api.folder.get({folder:e.id,success:function(data){track({type:"Click/Tree",id:e.id,text:"Select "+data.module+' folder "'+data.title+'" ('+e.id+")"})}});if(ox.UIController.getFolder()!==e.id){e.click("force")}else{e.click()}}}}return false});this.selection.setContextMenuHandler(function(id,e){var menu=globalContextMenus.simpleFolderMenu;
menu.display(e.pageX,e.pageY,{data:{id:id},api:true,simple:true,module:TYPE,widget:self})});if(this.loadRootNode===false){this.setRootNode({id:this.options.root,folder_id:null,title:"Root",module:"root",subfolders:true})}this.onModify=function(data){var finalOpenNodes=[];if(data.why==="folder.remove"||data.why==="folder.move"){if(ox.api.folder.is("mail",data.folder)){var key=data.oldId;$.each(ox.util.keys(self.openNodes).concat(self.getOpen()),function(i,id){if((new RegExp("^"+key)).test(id)){var node=self.get(id);
if(node){finalOpenNodes.push(id.replace(key,data.id));node.close()}}})}ox.UIController.unsetFolder()}else{if(data.why!=="folder.refresh"){var folder=ox.UIController.getFolder("mail"),tree=ox.api.config.get("modules.folder.tree",0),cache=ox.api.cache["folder"+tree];if(folder!==undefined&&!cache.contains(folder)){ox.UIController.unsetFolder("mail")}}}if(data.why==="folder.update.local"){var node=self.get(data.id);if(node){node.repaint()}}else{if(data.why==="folder.create"){self.repaint(function(){self.selection.update();
self.selection.click(data.id)})}else{if(data.why==="folder.move"){ox.UIController.setFolder({folder:data.id,module:"default",success:function(){self.setOpen(finalOpenNodes);self.repaint(function(){finalOpenNodes=null})}})}else{self.repaint()}}}}},loadChildren:function(id,cont){var self=this;var type=this.options.type;var getFolders=function(){ox.api.folder.getSubFolders({folder:id,tree:ox.api.config.get("modules.folder.tree","0"),success:function(data){data=$.grep(data,function(elem,i){if(type==="mail"){var isMessaging=elem.module==="messaging",isMail=elem.module==="mail",isMailFolder=/^default/.test(elem.id),isSubscribed=elem.subscribed===true||elem.subscr_subflds===true,isSystem=elem.module==="system",isProperFolder=isMailFolder||isMessaging;
return isProperFolder&&isSubscribed&&(isMail||isMessaging||isSystem)}else{return(elem.subscribed===true||elem.subscr_subflds===true)&&(elem.module===type||elem.module==="system")}});cont(data)},error:function(){cont(false)}})};if(ox.api.config.get("modules.mail.module")===true){ox.api.account.all(getFolders)}else{getFolders()}},loadNode:function(id,cont){var self=this;ox.api.folder.get({folder:id,tree:ox.api.config.get("modules.folder.tree","0"),success:function(data){ox.util.call(cont,data)}})},clear:function(){},expandToFolder:function(folderID){var open=this.getOpen();
var self=this;var getParentIDs=function(data,callback){var i=1,$l=data.length,list=[],id;for(;i<$l;i++){id=data[i].id;if($.inArray(id,open)===-1){list.push(id)}}callback(list)};var expandTreeNodes=function(list){if(list.length>0){self.setOpen(list);self.repaint(function(){self.selection.clickQuiet(folderID)})}else{self.selection.clickQuiet(folderID)}};ox.api.folder.getParents({folder:folderID,success:function(data){getParentIDs(data,expandTreeNodes)}})},paint:function(cont){if(this.painter.running===false){this.painter.running=true;
if(this.firstPaint===true){var ID=this.id+"/"+ox.api.config.get("modules.folder.tree",0);if(configContainsKey(["gui","tree",ID,"state"])){this.setOpen(ox.util.keys(configGetKey(["gui","tree",ID,"state"])))}else{this.setOpen(this.options.open||[])}$(this.dom.node).css({background:""}).addClass("oxBusySmall");this.firstPaint=false}ox.api.folder.dispatcher.unbind("modify",this.onModify);var self=this;var step2=function(){var list=$.grep(ox.util.keys(self.openNodes),function(key){return/^(\d+|default0)/.test(key)
});ox.api.http.pause();var pssst=function(){return true};var i=0,$l=list.length;for(;i<$l;i++){ox.api.folder.getSubFolders({folder:list[i],tree:self.options.tree,error:pssst})}ox.api.http.resume(function(){$(self.dom.node).empty().removeClass("oxBusySmall");self.painter.running=false;ox.gui.Tree.prototype.paint.call(self,function(){self.openNodes={};if(self.selection!==undefined){self.selection.preselect(currentFolder);self.selection.clickQuiet(currentFolder)}ox.api.folder.dispatcher.bind("modify",self.onModify,window);
ox.util.call(cont)})},pssst)};var currentFolder=ox.UIController?ox.UIController.getFolder():undefined;if(currentFolder!==undefined){ox.api.folder.getParents({folder:currentFolder,tree:this.options.tree,success:function(data){data.shift();var list=$.map(data,function(folder){return folder.id});if($.inArray(self.options.root,list)>-1){self.setOpen(list)}step2()}})}else{step2()}}else{this.painter.queue.push(cont)}}});var tree=ox.api.config.get("modules.folder.tree",0);v.mail=new ox.gui.Container("ox-sidepanel-mail").setLayout(new ox.gui.BorderLayout());
var mail_tree=ox.widgets.sidepanelViews.mailTree=new ox.gui.TypedFolderTree("ox-sidepanel-mail-tree",{type:"mail",icon:"mail.png",root:"1",tree:tree,open:tree===0?["default0"]:[]}).setLayoutParam({position:"center"});mail_tree.enableDnD(ox.gui.initSidepanel.dndSource,ox.gui.initSidepanel.dndTarget);v.mail.add(mail_tree);if(ox.api.config.get("modules.mail.module")===true&&ox.mail.addAccount.available()){mail_tree.addListener("widget:painted",function(){var node=$(this.dom.node);if(node.find(".add-account-button").length===0){node.append($.button({title:_("Add email account..."),click:function(){if(ox.api.config.get("modules.mailaccount.module",false)){ox.mail.addAccount()
}else{triggerEvent("Feature_Not_Available","configuration/mail/accounts/new",window,"foldertree")}return false},enabled:ox.api.config.get("modules.mailaccount.module",false)}).addClass("add-account-button").css({margin:"15px 0 5px 20px"}))}})}v.infostore=new ox.gui.Container("ox-sidepanel-infostore").setLayout(new ox.gui.BorderLayout());var infostore_tree=ox.widgets.sidepanelViews.infostoreTree=new ox.gui.TypedFolderTree("ox-sidepanel-infostore-tree",{type:"infostore",icon:"infostore.png",root:"9",open:["9","10",ox.api.config.get("folder.infostore")]}).setLayoutParam({position:"center"});
infostore_tree.enableDnD(ox.gui.initSidepanel.dndSource,ox.gui.initSidepanel.dndTarget);v.infostore.add(infostore_tree);var flatView=ox.gui.Custom.extend({construct:function(paint,id,module){ox.gui.Custom.prototype.construct.call(this,paint,id);this.module=module;this.folders={};var self=this;var s=this.selection=new ox.gui.Selection();s.setMultiple(false);s.setNodeFinder(function(){return $(".ox-sidepanel-flat-folder",this.container)});s.classSelected="background-color-PMG-selection-elements";s.onChange(function(items){if(self.isVisible()&&items.length){var id=String(items[0].id);
setTimeout(function(){ox.UIController.setFolder({folder:id})},10)}});s.onRename(function(id,item){ox.api.folder.get({folder:id,success:function(data){if(ox.api.folder.can("rename",data)){self.startEdit(id)}}})});s.observe(self.dom.node,"ox-sidepanel-view-wrapper");s.setClickHandler(function(e){if(self.selection.statusEnabled===false){return false}if(e.event.rightClick){track({type:"ContextMenu/FlatView",where:self.id,id:e.id,text:"Right click on folder "+e.id});e.click("quiet");e.context()}else{if(e.selectable===true){if(currentpath[0]==="configuration"){ox.UIController.setFolder({folder:e.id,module:"default"})
}else{if(e.id!=="-1"){ox.api.folder.get({folder:e.id,success:function(data){track({type:"ContextMenu/Tree",id:e.id,text:"Select "+data.module+' folder "'+data.title+'" ('+e.id+")"})}});if(ox.UIController.getFolder()!==e.id){e.click("force")}else{e.click()}}}}}return false});s.setContextMenuHandler(function(id,e){var menu=globalContextMenus.simpleFolderMenu;menu.display(e.pageX,e.pageY,{data:{id:id},api:true,simple:true,module:module,widget:self})});this.addListener("widget:edited",function(e){ox.api.folder.update({folder:e.data.id,data:{title:e.data.value},success:function(data){ox.api.cache.folderFlat.remove(data.module);
self.selection.select(data.id);ox.util.call(e.cont)},error:function(){self.paint();self.selection.select(e.data.id);ox.util.call(e.cont)}});return false});this.addListener("widget:invisible",function(){s.disable()});this.addListener("widget:visible",function(){s.enable()});$(this.dom.node).addClass("ox-sidepanel-view");this.onModify=function(data){if(data.why==="folder.remove"||data.why==="folder.move"){ox.UIController.unsetFolder()}if(data.why==="folder.update.local"){var node=self.get(data.id);
if(node){node.repaint()}}else{if(data.why==="folder.create"){self.repaint(function(){self.selection.update();self.selection.click(data.id)})}else{if(data.why==="folder.move"){ox.UIController.setFolder({folder:data.id,module:"default",success:function(){self.setOpen([data.id]);self.repaint()}})}else{self.repaint()}}}};s.dispatcher.bind("selected",function(e){if(e.node.find(".context-button").length===0){var button=$.button({title:"\u00a0\u00a0"}).css({position:"absolute",right:"5px",zIndex:2}).bind("click",function(event){s.triggerContextMenu(e.id,event);
return false}).addClass("context-button");if(IE){button=$('<form onsubmit="return false"></form>').css("margin","0").append(button)}e.node.prepend(button)}else{e.node.find(".context-button").show()}});s.dispatcher.bind("deselected",function(e){e.node.find(".context-button").hide()})}});flatView.prototype.startEdit=function(id,success,abort){if(this.folders[id]!==undefined){var self=this;ox.api.folder.dispatcher.unbind("modify",this.onModify);if(success===undefined){success=function(value){self.trigger("widget:edited",{node:self,id:id,value:value},function(){self.repaint()
})}}if(abort===undefined){abort=function(){self.repaint()}}this.selection.disable();var node=this.folders[id].node;ox.gui.util.inlineEdit.call(this,node,node.data("title"),success,abort,"span")}};var sections={"private":{title:_("Private folders")},"public":{title:_("Public folders")},shared:{title:_("Shared folders")}};var paintFlatView=function(cont){var self=this;ox.api.folder.dispatcher.unbind("modify",this.onModify);function addDnD(folder,node,out){if(self.dndSource){self.dndSource(folder,function(type,callback){out.dndSource=registerSource(node,type,callback,null,null,foldertreedisable,defaultdisabledremove)
})}if(self.dndTarget){self.dndTarget(folder,function(callbacks){var cbs={};for(var i in callbacks){cbs[i]=(function(cb){return function(a,b,c,d,e,f){legacyOut(a,b,c,d,null,f);cb(a,b,c,d,e,f)}})(callbacks[i])}out.dndTarget=registerTarget(node,cbs,null,null,legacyIn,legacyIn,legacyOut,true)})}function legacyIn(e,type,objects,position,targetNode){foldertreeenable(e,type,objects,position,targetNode,folder);var mynode=e.currentTarget||e.srcElement||false;if(!mynode.className.match(/dndOver/)){mynode.className+=" dndOver"
}}function legacyOut(e,type,objects,position,OutOpen,dropNode){if(dropNode){dropNode.className=removeClass(dropNode.className,"dndOver")}else{if(e){var mynode=e.currentTarget||e.srcElement||false;if(mynode){mynode.className=removeClass(mynode.className,"dndOver")}}}}}var paintFolders=function(folders,node,section){var id=String(ox.api.config.get("folder."+self.module));if(section!=="shared"){folders.sort(function(a,b){return a.id===id?-1:a.title.toLowerCase()>b.title.toLowerCase()?+1:-1})}var addOwner=function(folder,node){if(ox.api.folder.is("shared",folder)){var displayName=folder["com.openexchange.folderstorage.displayName"]||"";
node.append("<br/>");node.append($("<span/>").css({color:"#666",fontStyle:"italic"}).text("("+displayName+")"))}};var i=0,$l=folders.length,folder,div,count=0;for(i=0;i<$l;i++){folder=folders[i];if(ox.api.folder.can("read",folder)){var img=$("<img/>").attr({src:meta[self.module].icon}).css({backgroundRepeat:"no-repeat",position:"absolute",left:"3px"});if(ox.api.folder.is("published",folder)){img.css({"background-image":"url("+img.attr("src")+")"});img.attr("src",ox.gui.themePath+"icons/16/shared_globe.png")
}node.append(div=$("<div/>",{oxID:folder.id}).data("title",_(folder.title||"")).addClass("ox-sidepanel-flat-folder").css({position:"relative"}).append(img).append($("<span/>").text(folder.title||"")));addOwner(folder,div);var out=self.folders[folder.id]={id:folder.id,node:div};addDnD(folder,div[0],out);count++}}return count};setTimeout(function(){for(var i in self.folders){f=self.folders[i];if(f.dndSource){unregisterSource(f.node[0],f.dndSource)}if(f.dndTarget){unregisterSource(f.node[0],f.dndTarget)
}delete self.folders[i]}$(self.dom.node).empty();if(!ox.browser.IE){$(self.dom.node).addClass("busy-spinner-white")}ox.api.folder.getAllVisible(self.module,function(data){if(!ox.browser.IE){$(self.dom.node).removeClass("busy-spinner-white")}for(var id in sections){$(self.dom.node).append(self.dom[id]=$("<div/>").addClass("ox-sidepanel-section").append($("<div/>").addClass("ox-sidepanel-section-title").append(addTranslated(meta[self.module].sections[id]))));var count=paintFolders(data[id]||[],self.dom[id],id);
if(count===0){self.dom[id].remove()}}self.selection.enable();self.selection.update();self.selection.clickQuiet(ox.UIController.getFolder());ox.api.folder.dispatcher.bind("modify",self.onModify,window);ox.util.call(cont)})},10)};flatView.prototype.dndTarget=ox.gui.initSidepanel.dndTarget;v.calendar=new flatView(paintFlatView,"ox-sidepanel-calendar","calendar");v.contacts=new flatView(paintFlatView,"ox-sidepanel-contacts","contacts");v.tasks=new flatView(paintFlatView,"ox-sidepanel-tasks","tasks")}());
var title=ox.widgets.sidepanel.title=new ox.gui.Container("ox-sidebar-title").setLayout(new ox.gui.BorderLayout()).css({height:"26px"}).setLayoutParam({position:"top",height:27}).addCSSClass("ox-sidepanel-title topheader-color").addTo(sidepanel).add(new ox.gui.Custom(function(){$(this.dom.node).empty().append(addTranslated(this.title))},"ox-sidepanel-title").setLayoutParam({position:"center"}).css({marginLeft:"6px"}).addListener("widget:viewchanged",view,function(e){$("#folder_tree").show();var match=e.data.id.match(/(\w+)$/);
this.title=meta[match[1]].title;if(newFolderIcon!==null){newFolderIcon.setVisible(match[1]!=="configuration")}this.paint()})).add(new ox.gui.Image().css({cursor:"pointer"}).addCSSClass("sp-toggle-img").setLayoutParam({position:"right",width:13}).setSrc(getFullImgSrc("img/arrows/arrow_double_white_left.png")).setTitle(_("Collapse sidepanel")).addListener("click",function(e){ox.widgets.sidepanel.toggle();ox.widgets.sidepanel.userToggle=true}));if(addRootFolder){title.insert(newFolderIcon,0)}sidepanel.add(view);
v.portal=new ox.gui.Widget("ox-sidepanel-portal").addTo(view);v.mail.addTo(view);v.calendar.addTo(view);v.contacts.addTo(view);v.tasks.addTo(view);v.infostore.addTo(view);v.folder=new ox.gui.Container("ox-sidepanel-foldertree").addTo(view).setLayout(new ox.gui.BorderLayout());var quotaContainer={mail:[],filestore:[]},quotaReq=[];if(!ox.widgets.sidepanel.quota){ox.widgets.sidepanel.quota={}}function createMailBars(container,qContainer){var bar=ox.widgets.sidepanel.quota.mail=new ox.gui.Bar({textFormat:function(used,max){return bytesToString(used)+" / "+bytesToString(max)
},title:function(used,max){return _("E-Mail")+" "+bytesToString(used)+" / "+bytesToString(max)},description:_("E-Mail")}).setLayoutParam({position:"bottom",height:18}).hide();container.add(bar);var bar2=ox.widgets.sidepanel.quota.mail_count=new ox.gui.Bar({textFormat:"fraction",description:_("E-Mail")}).setLayoutParam({position:"bottom",height:18}).hide();container.add(bar2);qContainer.push({id:"mail_storage",field_map:{usage:"use",quota:"quota"},bar:bar});qContainer.push({id:"mail_count",field_map:{usage:"countuse",quota:"countquota"},bar:bar2})
}function createInfoStoreBars(container,qContainer){var bar=ox.widgets.sidepanel.quota.infostore=new ox.gui.Bar({textFormat:function(used,max){return bytesToString(used)+" / "+bytesToString(max)},title:function(used,max){return _("Infostore")+" "+bytesToString(used)+" / "+bytesToString(max)},description:_("Infostore")}).setLayoutParam({position:"bottom",height:18}).hide();container.add(bar);qContainer.push({id:"filestore",field_map:{usage:"use",quota:"quota"},bar:bar})}if(ox.api.config.get("modules.infostore.module")){createInfoStoreBars(v.infostore,quotaContainer.filestore);
createInfoStoreBars(v.folder,quotaContainer.filestore);quotaReq.push({module:"quota",action:"filestore"})}if(ox.api.config.get("modules.mail.module")){createMailBars(v.mail,quotaContainer.mail);createMailBars(v.folder,quotaContainer.mail);quotaReq.push({module:"quota",action:"mail"})}function checkQuota(){function removeFromContainer(id){for(var i in quotaContainer){for(var ia in quotaContainer[i]){if(quotaContainer[i][ia].id==id){if(quotaContainer[i][ia].bar){var parent=quotaContainer[i][ia].bar.parent;
quotaContainer[i][ia].bar.destroy();parent.validate()}delete (quotaContainer[i][ia])}}}}ox.api.http.PUT({module:"multiple",data:quotaReq,appendColumns:false,success:function(data){for(var i=0;i<data.length;i++){for(ia in quotaContainer[quotaReq[i].action]){var quota=quotaContainer[quotaReq[i].action][ia];if(!quota){continue}if(data[i]==undefined||data[i].data==undefined){removeFromContainer(quota.id);continue}var tQuota=data[i].data[quota.field_map.quota];var tUsage=data[i].data[quota.field_map.usage];
if(tQuota==undefined||tQuota==-1024||tQuota==-1){removeFromContainer(quota.id);continue}quota.data={quota:tQuota,usage:tUsage};quota.bar.setMax(tQuota);quota.bar.progress(tUsage);if(quota.bar.isVisible()==false){quota.bar.show()}}}}})}checkQuota();register("OX_Refresh",checkQuota);register("OX_Folder_Cleared",function(folder_id){if(ox.api.config.get("mail.deletemail")===true||ox.api.config.get("mail.folder.trash")===folder_id){checkQuota()}});var minical=ox.widgets.miniCalendar=new ox.gui.Widget("ox-sidepanel-view-minical");
minical.expanded=ox.api.config.get("gui.global.minicalendar.expanded",false);minical.hide=function(){this.setVisible(false);this.layout.height=this.getHeight();this.invalidate();ox.widgets.sidepanel.validate()};minical.getHeight=function(){return this.statusVisible?(this.expanded?(13*pxPerEm+6):(2*pxPerEm+4)):0};minical.show=function(){if(this.isEnabled()===false){return}this.setVisible(true);this.layout.height=this.getHeight();this.invalidate();ox.widgets.sidepanel.validate()};minical.refreshState=function(){this.toggle(ox.api.config.get("gui.global.minicalendar.expanded",false))
};minical.toggle=function(state){if(this.isEnabled()===false){return}this.expanded=!this.expanded;if(typeof state=="boolean"){this.expanded=state}if(this.expanded===false||ox.UIController.getModule()!=="calendar"){ox.api.config.set("gui.global.minicalendar.expanded",this.expanded)}$("img.mini-toggle",this.dom.node).attr("src",getFullImgSrc("img/"+(this.expanded?"minus.gif":"plus.gif")));this.layout.height=this.getHeight();this.invalidate();ox.widgets.sidepanel.validate()};minical.paint=function(){var Self=this;
$(this.dom.node).empty().addClass("oxStretch");var content=$("<div/>").css({height:"11.3em",width:"18em",overflow:"hidden",position:"absolute"}).append($("<div/>").attr("id","mini-content").addClass("calminimainCSS"));var header=$("<table/>").addClass("headercontenttable border-color-design").css({height:"2em",backgroundImage:"url('"+getFullImgSrc("img/toolbar/toolbar30.png")+"')"}).append($("<tr/>").append($("<td/>").css({width:"50%"}).text(" ")).append($("<td/>").attr("align","right").css({cursor:"pointer",width:"10px"}).append($("<img/>").attr("src",getFullImgSrc("img/arrows/arrow_darkgrey_left.gif"))).bind("click",function(){oMiniCalendar.back(1)
})).append($("<td/>").attr("align","center").append($("<div/>").addClass("mini-month").attr("id","mini-month"))).append($("<td/>").attr("align","left").css({cursor:"pointer",width:"10px"}).append($("<img/>").attr("src",getFullImgSrc("img/arrows/arrow_darkgrey_right.gif"))).bind("click",function(){oMiniCalendar.next(1)})).append($("<td/>").css({width:"50%"}).attr("align","left").append($("<div/>").addClass("mini-year").attr("id","mini-year"))).append($("<td/>").css({width:"20px"}).attr("align","right").append($("<img/>").addClass("mini-toggle").attr("src",getFullImgSrc("img/minus.gif")).css({cursor:"pointer"}).click(function(){ox.widgets.miniCalendar.userToggle=true;
ox.widgets.miniCalendar.toggle()}))));$(this.dom.node).append(header);$(this.dom.node).append(content);oMiniCalendar=new cAnimMiniCalendar(fn_minicalendar_action,null,[$("#mini-content",content)[0],$(".mini-month",header)[0],$(".mini-year",header)[0]]);b3xViewLoaded=false};function fn_minicalendar_action(){oMiniCalendar.setSelected(this.id);activeDay=oMiniCalendar.selectedDate;activeMonth=oMiniCalendar.selectedMonth;activeYear=oMiniCalendar.selectedYear;track({type:"DatePicked/MiniCalendar ",text:"Select date "+activeYear+"-"+activeMonth+"-"+activeDay});
triggerEvent("OX_Mini_Calendar_Date_Picked",activeYear,activeMonth,activeDay);if(currentpath[0]=="calendar"){if(currentpath[1]!="team"&&currentpath[2]=="month"){loadMonthView()}ox.UIController.setModule({module:"calendar",view:currentpath.join("/"),folder:"auto",force:"module"})}else{if(configContainsKey("folder.calendar")){ox.UIController.setModule({module:"calendar",folder:"auto",view:"calendar/calendar/day",force:"module"})}}}function updateMiniCalData(){oMiniCalendar.update()}register("OX_Refresh_Mini_Calendar",updateMiniCalData);
register("OX_Refresh",updateMiniCalData);minical.css({background:"white",border:"1px solid",borderWidth:"1px 0px 0px 0px"}).addCSSClass("border-color-design").setLayoutParam({position:"bottom",height:(13*pxPerEm+6)}).addTo(sidepanel)};ox.gui.initSidepanel.dndSource=function(data,cont){cont("folder/"+data.type,constant(data.id))};ox.gui.initSidepanel.dndTarget=function(subfolder,cont){function folderHandler(e,t,data,p,n,d){ox.api.folder.get({folder:data,success:function(data){ox.api.folder.move(data,subfolder)
}})}var tObj={};if((subfolder.own_rights&127)>=4||subfolder.module=="mail"){if(subfolder.type==5){if(subfolder.id==1){tObj["folder/1"]=folderHandler}else{if(subfolder.id in {2:1,10:1,15:1}){tObj["folder/2"]=folderHandler}else{tObj["folder/"+subfolder.type]=folderHandler}}}else{if((subfolder.type==7||subfolder.type==1)&&configGetKey("modules.folder.tree")==1){tObj["folder/1"]=tObj["folder/7"]=folderHandler}else{tObj["folder/"+subfolder.type]=folderHandler}}}var tmp_module=subfolder.module;if((subfolder.own_rights&127)>=2&&!(subfolder.type==3&&tmp_module=="tasks")){tObj[subfolder.module]=function(e,dragType,data,mouseposition,targetNode,dropNode){if(subfolder.type==2){for(var i in data.currentObjects){if(data.currentObjects[i].private_flag){return
}}}data.endMoving(subfolder.id)}}else{tObj[subfolder.module]=$.noop}if(subfolder.module!="contacts"){tObj.contacts=$.noop}if(subfolder.module!="tasks"){tObj.tasks=$.noop}if(subfolder.module!="calendar"){tObj.calendar=$.noop}if(subfolder.module!="infostore"){tObj.infostore=$.noop}if(subfolder.module!="mail"){tObj.mail=$.noop}if(subfolder.module=="contacts"){tObj.mailaddress=function(e,t,objects){createNewContactfromMail(objects,subfolder.id)}}else{tObjmailaddress=$.noop}cont(tObj)};ox.gui.FolderTree=ox.gui.Tree.extend({construct:function(id,options){ox.gui.Tree.prototype.construct.call(this,id);
this.options=$.extend({tree:ox.api.config.get("modules.folder.tree")||0},options||{});if(this.options.root===undefined){this.options.root=this.options.tree===1?"1":"0"}if(ox.util.isFunction(this.options.grep)){this.grep=this.options.grep}var TYPE=this.options.type;var self=this;this.css({padding:"10px 0px 10px 0px"});this.setNodeParser(function(data){if(data){var parent=data.id===self.options.root?null:data.folder_id}return{id:data.id,parent:parent,name:data.title,type:data.module,hasChildren:data.subfolders}
});this.customize=function(node){var messagingServices={"com.openexchange.messaging.facebook":{icon:"facebook.png"},"com.openexchange.messaging.rss":{icon:"rss.png"},"com.openexchange.messaging.twitter":{icon:"twitter.png"}};var data=node.data,api=ox.api.folder,id;var name=data.title;$(node.dom.title).parent().css({fontWeight:""});$(node.dom.icon).css({backgroundImage:""});var processUnread=function(meta){if(data.unread!==null&&data.unread>0){$(node.dom.title).parent().css({fontWeight:"bold"});meta.name=meta.name;
meta.html=newtext(meta.name+" ("+data.unread+")")}return meta};var src="folder_closed",accountId,a={};accountId=/^default(\d*)\b/.exec(data.id);if($.isArray(accountId)){if(accountId[1]==="0"){var config=ox.api.config.get();var f=config.mail.folder;if(f){a.inbox_fullname=f.inbox;a.trash_fullname=f.trash;a.sent_fullname=f.sent;a.drafts_fullname=f.drafts;a.spam_fullname=f.spam}}else{a=ox.api.cache.account.get(accountId[1]);id="default"+accountId[1];if(!a){a={inbox_fullname:id+"/INBOX",trash_fullname:id+"/Trash",sent_fullname:id+"/Sent",drafts_fullname:id+"/Drafts",spam_fullname:id+"/Spam"}
}if(a.inbox_fullname===undefined){a.inbox_fullname=id+"/INBOX"}}}switch(data.module){case"system":if(ox.api.folder.is("account",data)){src="mail"}else{switch(data.id){case"1":src="user";break;case"2":src="public";node.selectable=false;break;case"3":src="shared";node.selectable=false;break}}if(/u:/.test(data.id)){src="user"}break;case"mail":switch(data.id){case a.inbox_fullname:src="inbox";break;case a.trash_fullname:src="garbage";break;case a.sent_fullname:src="outbox";break;case a.drafts_fullname:src="draft";
break;case a.spam_fullname:src="spam";break;case a.confirmed_ham_fullname:src="ham";break;case a.confirmed_spam_fullname:src="spam";break;default:if((api.is("system",data)||api.can("read",data))&&node.isCut!==true){src=node.statusOpen?"folder_opened":"folder_closed"}else{src=node.statusOpen?"folder_opened":"folder_closed"}}break;case"contacts":src="contacts";$(node.dom.title.parentNode).removeClass("font-style-low");break;case"tasks":src="tasks";$(node.dom.title.parentNode).removeClass("font-style-low");
break;case"calendar":src="calendar";$(node.dom.title.parentNode).removeClass("font-style-low");break;case"infostore":if(data.folder_id==="10"){src="user"}else{src="infostore";$(node.dom.title.parentNode).removeClass("font-style-low");if(data.id==="9"||data.id==="10"||data.id==="14"||data.id==="15"){node.selectable=false}}break;case"messaging":var service=/^(.*?):/.exec(data.id);if(service){src=messagingServices[service[1]].icon}break;default:break}if(this.options.type===undefined||(this.options.type=="")||(data.module===this.options.type)||(data.folder_id==="0")||(data.module==="system"&&src==="mail"&&this.options.type==="mail")){var sufficientPermissions=api.can("read",data);
if(this.options.minPerms!==undefined){var perms=data.own_rights;var mask=this.options.minPerms||0;if((perms&127)<(mask&127)||(perms>>7&127)<(mask>>7&127)||(perms>>14&127)<(mask>>14&127)||(perms>>21&127)<(mask>>21&127)||(perms>>28&1)<(mask>>28&1)){sufficientPermissions=false}}if(!sufficientPermissions&&data.module!=="system"&&data.module!=="infostore"||node.isCut){src=src+"_dis.png";$(node.dom.title.parentNode).addClass("font-color-disabled font-style-low")}else{if(data.module!="messaging"){src=src+".png"
}$(node.dom.title.parentNode).removeClass("font-color-disabled");if(ox.api.folder.is("published",data)){$(node.dom.icon).css({"background-image":"url("+ox.gui.themePath+"icons/16/"+src+")"});src="shared_globe.png"}}}else{if(data.module!="messaging"){src=src+"_dis.png"}$(node.dom.title.parentNode).addClass("font-color-disabled")}if(data.id==="default0"){var titlenode=newtext(name);internalCache.getUsers([config.identifier],function(users){titlenode.data=users[config.identifier].display_name});return{src:ox.gui.themePath+"icons/16/"+src,html:titlenode}
}else{return processUnread({src:ox.gui.themePath+"icons/16/"+src,name:name})}};this.selection.classSelected="background-color-PMG-selection-elements";this.showRootNode=false;this.setRootNode({id:this.options.root,folder_id:null,title:"Root",module:"root",subfolders:true});var ID=this.id+"/"+this.options.tree;var fnToggle=function(){var state={};$.each(self.getOpen(),function(i,id){state[id]=true});configSetKey(["gui","tree",ID,"state"],state)};this.addListener("widget:open",fnToggle);this.addListener("widget:close",fnToggle);
if(configContainsKey(["gui","tree",ID,"state"])){this.setOpen(ox.util.keys(configGetKey(["gui","tree",ID,"state"])))}else{this.setOpen(this.options.open||[])}this.onModify=function(data){var finalOpenNodes=[];if(data.why==="folder.remove"||data.why==="folder.move"){if(ox.api.folder.is("mail",data.folder)){var key=data.oldId;$.each(ox.util.keys(self.openNodes).concat(self.getOpen()),function(i,id){if((new RegExp("^"+key)).test(id)){var node=self.get(id);if(node){finalOpenNodes.push(id.replace(key,data.id));
node.close()}}})}ox.UIController.unsetFolder()}else{if(data.why!=="folder.refresh"){var folder=ox.UIController.getFolder("mail"),tree=ox.api.config.get("modules.folder.tree",0),cache=ox.api.cache["folder"+tree];if(folder!==undefined&&!cache.contains(folder)){ox.UIController.unsetFolder("mail")}}}if(data.why==="folder.update.local"){var node=self.get(data.id);if(node){node.repaint()}}else{if(data.why==="folder.create"){self.repaint(function(){self.selection.update();self.selection.click(data.id)})
}else{if(data.why==="folder.move"){ox.UIController.setFolder({folder:data.id,module:"default",success:function(){self.setOpen(finalOpenNodes);self.repaint(function(){finalOpenNodes=null})}})}else{self.repaint()}}}}},loadChildren:function(id,cont){var self=this;ox.api.folder.getSubFolders({folder:id,tree:this.options.tree,success:function(data){data=$.grep(data,function(elem,i){return elem.subscribed===true||elem.subscr_subflds===true});cont(data)},error:function(error){cont(false)}})},expandToFolder:function(folderID){var open=this.getOpen();
var self=this;var getParentIDs=function(data,callback){var i=1,$l=data.length,list=[],id;for(;i<$l;i++){id=data[i].id;if($.inArray(id,open)===-1){list.push(id)}}callback(list)};var expandTreeNodes=function(list){if(list.length>0){self.setOpen(list);self.repaint(function(){self.selection.clickQuiet(folderID)})}else{self.selection.clickQuiet(folderID)}};ox.api.folder.getParents({folder:folderID,success:function(data){getParentIDs(data,expandTreeNodes)}})},paint:function(cont){if(this.painter.running===false){this.painter.running=true;
if(this.firstPaint===true){var ID=this.id+"/"+ox.api.config.get("modules.folder.tree",0);if(configContainsKey(["gui","tree",ID,"state"])){this.setOpen(ox.util.keys(configGetKey(["gui","tree",ID,"state"])))}else{this.setOpen(this.options.open||[])}$(this.dom.node).css({background:""}).addClass("oxBusySmall");this.firstPaint=false}ox.api.folder.dispatcher.unbind("modify",this.onModify);var self=this;var step2=function(){var list=$.grep(ox.util.keys(self.openNodes),function(key){return/^(\d+|default0)/.test(key)
});ox.api.http.pause();var pssst=function(){return true};var i=0,$l=list.length;for(;i<$l;i++){ox.api.folder.getSubFolders({folder:list[i],tree:self.options.tree,error:pssst})}ox.api.http.resume(function(){$(self.dom.node).empty().removeClass("oxBusySmall");self.painter.running=false;ox.gui.Tree.prototype.paint.call(self,function(){self.openNodes={};if(self.selection!==undefined&&self.selection.auto!==false){self.selection.preselect(currentFolder);self.selection.clickQuiet(currentFolder)}ox.api.folder.dispatcher.bind("modify",self.onModify,window);
ox.util.call(cont)})},pssst)};var currentFolder=ox.UIController?ox.UIController.getFolder():undefined;if(currentFolder!==undefined){ox.api.folder.getParents({folder:currentFolder,tree:this.options.tree,success:function(data){data.shift();var list=$.map(data,function(folder){return folder.id});if($.inArray(self.options.root,list)>-1){self.setOpen(list)}step2()}})}else{step2()}}else{this.painter.queue.push(cont)}}});ox.api.ui.selectFolder=(function(){return function(options){var opt=$.extend({root:ox.api.config.get("modules.folder.tree",0),callback:jQuery.noop},options||{});
removeChildNodes(opt.node);var tree=new ox.gui.FolderTreePopup(opt);tree.setParentDOMNode(opt.node);tree.selection.auto=false;tree.paint()}}());ox.gui.FolderTreePopup=ox.gui.FolderTree.extend({construct:function(options){var opt=$.extend({},options||{});ox.gui.FolderTree.prototype.construct.call(this,opt.id||null,opt);var callback=opt.callback;this.addListener("widget:select",function(e){var api=ox.api.folder;api.get({folder:e.data,success:function(data){if(opt.type!==undefined){if(opt.type===data.module){callback(data)
}}else{if(data.module!=="system"){callback(data)}}}})})}});ox.gui.initFolderTree=function(){var tree=ox.widgets.folderTree=new ox.gui.FolderTree("ox-sidepanel-foldertree",{type:"",root:ox.api.config.get("modules.folder.tree")===1?"1":"0"});tree.enableDnD(ox.gui.initSidepanel.dndSource,ox.gui.initSidepanel.dndTarget);ox.widgets.sidepanelViews.folderTree=tree;tree.addListener("widget:select",function(e){var api=ox.api.folder;var self=this;api.get({folder:e.data,success:function(data){if(data.id!==2&&data.id!==3&&data.id!==9&&data.id!==10&&data.id!==14&&data.id!==15){if(!api.is("system",data)&&api.can("read",data)){ox.UIController.setModule({folder:data.id,module:data.module})
}else{if(e.data==="1"){ox.UIController.setModule({module:"portal"})}else{if(e.data==="6"){ox.UIController.setModule({folder:"6",module:"contacts"})}}}}}})});tree.selection.onRename(function(id,item){ox.api.folder.get({folder:id,success:function(data){if(ox.api.folder.can("rename",data)){tree.startEdit(id)}}})});tree.selection.dispatcher.bind("selected",function(e){if(e.node.find(".context-button").length===0){var button=$.button({title:"\u00a0\u00a0"}).bind("click",function(event){tree.selection.triggerContextMenu(e.id,event);
return false});if(IE<=7){button.css("width","")}if(IE){button=$('<form onsubmit="return false"></form>').css("margin","0").append(button)}var td=$("<td/>").css({width:"20px",textAlign:"right",paddingRight:"5px"}).addClass("context-button").append(button);if(IE<=7){td.css({width:"20px"})}e.node.find("tr").append(td)}else{e.node.find(".context-button").show()}});tree.selection.dispatcher.bind("deselected",function(e){e.node.find(".context-button").hide()});tree.addListener("widget:edited",function(e){var self=this;
ox.api.folder.update({folder:e.data.id,data:{title:e.data.value},success:function(data){var ID=self.id+"/"+ox.api.config.get("modules.folder.tree",0);if(configGetKey(["gui","tree",ID,"state",e.data.id])===true){configRemoveKey(["gui","tree",ID,"state",e.data.id]);configSetKey(["gui","tree",ID,"state",data.id],true);self.setOpen([data.id])}ox.api.folder.refresh({folders:[e.data.data.folder_id],success:e.cont})},error:function(){self.repaint();self.selection.select(e.data.id);ox.util.call(e.cont)}});
return false});tree.selection.setClickHandler(function(e){if(this.statusEnabled===false){return false}if(e.event.rightClick){track({type:"ContextMenu/Tree",id:e.id,text:"Right click on folder "+e.id});e.click("quiet");e.context()}else{if(e.selectable===true&&e.id!=="-1"){if(currentpath[0]==="configuration"){ox.UIController.setFolder({folder:e.id,module:"default"})}else{ox.api.folder.get({folder:e.id,success:function(data){track({type:"ContextMenu/Tree",id:e.id,text:"Select "+data.module+' folder "'+data.title+'" ('+e.id+")"})
}});if(ox.UIController.getFolder()!==e.id){e.click("force")}else{e.click()}}}}return false});tree.selection.setContextMenuHandler(function(id,e){var menu=globalContextMenus.simpleFolderMenu;menu.display(e.pageX,e.pageY,{data:{id:id},api:true,simple:true,module:tree.options.type,widget:tree})});tree.showRootNode=false;ox.widgets.sidepanelViews.folder.insert(tree,0);tree.setLayoutParam({position:"center"});if(ox.api.config.get("modules.mail.module")===true&&ox.mail.addAccount.available()){tree.addListener("widget:painted",function(){var node=$(this.dom.node);
if(node.find(".add-account-button").length===0){node.append($.button({title:_("Add email account..."),click:function(){if(ox.api.config.get("modules.mailaccount.module",false)){ox.mail.addAccount()}else{triggerEvent("Feature_Not_Available","configuration/mail/accounts/new",window,"foldertree")}return false},enabled:ox.api.config.get("modules.mailaccount.module",false)}).addClass("add-account-button").css({margin:"15px 0 5px 20px"}))}})}};ox.gui.initConfigTree=function(){var configTree=ox.widgets.configTree=new ox.gui.Tree("ox-sidepanel-configuration").css({padding:"10px 0px 10px 0px"}).addTo(ox.widgets.sidepanelViewControl);
ox.widgets.sidepanelViews.configuration=configTree;configTree.showRootNode=false;configTree.customize=function(node){var icon;if(node.data.innerNode){node.selectable=false;icon="/img/folder/settings_folder_"+(node.statusOpen?"open.gif":"closed.gif")}else{icon="/img/folder/settings.gif"}return{src:ox.gui.themePath+icon,html:node.data.domNode||addTranslated(node.name)}};configTree.addListener("widget:select",function(event){var data=this.nodeIndex[event.data].data;if(data.onClick){data.onClick()}else{configuration_askforSave(function(){triggerEvent("OX_Switch_View",event.data)
})}});configTree.setRootNode({id:"configuration",name:"Configuration",innerNode:true});configTree.add({parent:"configuration",id:"configuration/import",name:"Import"});configTree.add({parent:"configuration",id:"configuration/settings",name:"Options"});configTree.add({parent:"configuration",id:"configuration/tags",name:"Categories"});if(configGetKey("modules.portal.module")){configTree.add({parent:"configuration",id:"configuration/portal",name:"Start Page",innerNode:true});configTree.add({parent:"configuration/portal",id:"configuration/portal/layout",name:"Layout"});
if(ox.api.config.get("modules.uwaWidgets.enabled")===true){configTree.add({parent:"configuration/portal",id:"configuration/portal/external",name:"UWA Modules"})}}if(configGetKey("modules.mail.module")===true||configGetKey("modules.mail.module")!==null&&configGetKey("modules.mailaccount.module")){configTree.add({parent:"configuration",id:"configuration/mail",name:"E-Mail",innerNode:true});if(configGetKey("modules.mail.module")){configTree.add({parent:"configuration/mail",id:"configuration/mail/preferences",name:"Preferences"});
configTree.add({parent:"configuration/mail",id:"configuration/mail/signatures",name:"Signatures"})}}if(configGetKey("modules.calendar.module")){configTree.add({parent:"configuration",id:"configuration/calendar",name:"Calendar",innerNode:true});configTree.add({parent:"configuration/calendar",id:"configuration/calendar/preferences",name:"Preferences"});if(configGetKey("modules.calendar.calendar_teamview")){configTree.add({parent:"configuration/calendar",id:"configuration/calendar/teams",name:"Teams"})
}}if(configGetKey("modules.contacts.module")){configTree.add({parent:"configuration",id:"configuration/contacts",name:"Contacts",innerNode:true});configTree.add({parent:"configuration/contacts",id:"configuration/contacts/preferences",name:"Preferences"})}if(configGetKey("modules.tasks.module")){configTree.add({parent:"configuration",id:"configuration/tasks",name:"Tasks",innerNode:true});configTree.add({parent:"configuration/tasks",id:"configuration/tasks/preferences",name:"Preferences"})}if(configGetKey("modules.infostore.module")){configTree.add({parent:"configuration",id:"configuration/infostore",name:"InfoStore",innerNode:true});
configTree.add({parent:"configuration/infostore",id:"configuration/infostore/preferences",name:"Preferences"})}configTree.selection.classSelected="background-color-PMG-selection-elements"};ox.gui.initController=function(){if(false){ox.UIController.dispatcher.bind("modulechange",function(e){console.warn("modulechange",e)});ox.UIController.dispatcher.bind("folderchange",function(e){console.warn("folderchange",e)})}ox.UIController.dispatcher.bind("modulechange",function(e){var module=e.module;var folder=e.folder;
var view;ox.widgets.searchField.active().searchMenu.setFields();if(module==="portal"){ox.widgets.miniCalendar.show();ox.widgets.searchField.top.disable();view=ox.UIController.showExpertTree?"foldertree":"portal";ox.widgets.sidepanelViewControl.showView("ox-sidepanel-"+view);ox.widgets.sidepanel.toggle(!ox.UIController.showExpertTree)}else{if(module==="configuration"){ox.widgets.miniCalendar.hide();ox.widgets.searchField.top.disable();ox.widgets.sidepanel.toggle(false)}else{if(ox.widgets.sidepanel.userToggle===true){ox.widgets.sidepanel.toggle(true)
}else{ox.widgets.sidepanel.toggle(false)}ox.widgets.miniCalendar.show();ox.widgets.searchField.top.enable()}}if(module==="calendar"){ox.widgets.miniCalendar.toggle(true)}else{ox.widgets.miniCalendar.refreshState()}var module=ox.UIController.getModule();var folder=ox.UIController.getFolder();if(module==="mail"&&folder===ox.api.config.get("mail.folder.spam")){changeView(ox.api.config.get("gui.mail.view_spam","mail/list/unthreaded"),"newfolder")}else{if(e.view!==undefined){changeView(e.view,module==="configuration"?"samefolder":"newfolder")
}else{if(menulastviews[module]!==undefined){changeView(menulastviews[module],module==="configuration"?"samefolder":"newfolder")}else{alert("Unknown Module: "+module)}}}if(e.change==="module"||e.change=="both"){if(module==="configuration"){ox.widgets.sidepanelViewControl.showView("ox-sidepanel-configuration");ox.widgets.configTree.selection.click(menulastviews[module],false,false,true)}else{if(e.previous.module==="configuration"){ox.widgets.sidepanelViewControl.showView("ox-sidepanel-"+(ox.UIController.showExpertTree?"foldertree":module))
}}}ox.ToolBarController.initialResize()});ox.UIController.dispatcher.bind("folderchange",function(e){var module=ox.UIController.getModule();var folder=ox.UIController.getFolder();if(e.change==="folder"){if(module==="mail"&&folder===ox.api.config.get("mail.folder.spam")){changeView(ox.api.config.get("gui.mail.view_spam","mail/list/unthreaded"),"newfolder")}else{if(e.view!==undefined){changeView(e.view,module==="configuration"?"samefolder":"newfolder")}else{if(menulastviews[module]!==undefined){changeView(menulastviews[module],e.change==="folder"||e.change==="both"?"newfolder":"samefolder")
}else{alert("Unknown Module: "+module)}}}}var id=ox.UIController.showExpertTree&&module!=="configuration"?"foldertree":module;var viewControl=ox.widgets.sidepanelViewControl;viewControl.showView("ox-sidepanel-"+id);var views=ox.widgets.sidepanelViews;var map={mail:views.mailTree,calendar:views.calendar,contacts:views.contacts,tasks:views.tasks,infostore:views.infostoreTree,foldertree:views.folderTree};if(map[id]!==undefined){if(map[id].expandToFolder){map[id].expandToFolder(folder)}else{map[id].selection.clickQuiet(folder)
}}})};ox.gui.initToolBar=function(){ox.widgets.toolBar={viewControl:undefined,views:{},meta:{},tabs:{},sections:{},menuItems:{}};var upsell=ox.api.window.core.ox.upsell;var meta=ox.widgets.toolBar.meta={create:{mail:{title:_("New E-Mail"),abbr:_("E-Mail"),icons:["mod_mail.png"],big:true,requires:["mail"],mousedown:function(options){if(ox.api.ui.getModule("mail").disabled){triggerEvent("Feature_Not_Available","modules/mail",window)}},visible:upsell.visible("mail")},calendar:{title:_("New appointment"),abbr:_("Appointment"),icons:["mod_calendar.png"],big:true,requires:["calendar"],mousedown:function(options){if(ox.api.ui.getModule("calendar").disabled){triggerEvent("Feature_Not_Available","modules/calendar",window)
}},visible:upsell.visible("calendar")},contact:{title:_("New contact"),abbr:_("Contact"),icons:["mod_contacts.png"],big:true,requires:["contacts"],mousedown:function(options){if(ox.api.ui.getModule("contacts").disabled){triggerEvent("Feature_Not_Available","modules/contacts",window)}},visible:upsell.visible("contacts")},distributionlist:{title:_("New distribution list"),abbr:_("Distribution list"),icons:["distributionlist.png"],big:true,requires:["contacts"],mousedown:function(options){if(ox.api.ui.getModule("contacts").disabled){triggerEvent("Feature_Not_Available","modules/contacts",window)
}},visible:upsell.visible("contacts")},task:{title:_("New task"),abbr:_("Task"),icons:["mod_tasks.png"],big:true,requires:["tasks"],mousedown:function(options){if(ox.api.ui.getModule("tasks").disabled){triggerEvent("Feature_Not_Available","modules/tasks",window)}},visible:upsell.visible("tasks")},file:{title:_("New Infoitem"),abbr:_("Infoitem"),icons:["mod_infostore.png"],big:true,requires:["infostore"],mousedown:function(options){if(ox.api.ui.getModule("infostore").disabled){triggerEvent("Feature_Not_Available","modules/infostore",window)
}},visible:upsell.visible("infostore")}},view:{vsplit:{title:_("V-Split"),icons:["v_split_view.png"],big:true,behavior:"radio",group:"split-views",checked:function(){return currentpath[1]==="vsplit"}},hsplit:{title:_("H-Split"),icons:["h_split_view.png"],big:true,behavior:"radio",group:"split-views",checked:function(){return currentpath[1]==="hsplit"}},list:{title:_("List"),icons:["list_view.png"],big:true,behavior:"radio",group:"split-views",checked:function(){return currentpath[1]==="list"}}}};
meta.flags={};meta.flags["0"]={title:_("Remove flag"),icons:["tag_remove.png"],big:true,requires:["some","modify"]};for(var i=1;i<=10;i++){meta.flags[""+i]={number:i,title:format(_("Flag #%d"),i),icons:["tag_"+i+".png"],big:true,requires:["some","modify"],behaviour:"radio",group:"flags-radio",checked:function(ability,selection){if(currentpath[0]==="mail"&&ability.one){return selection[0].color_label==this.number}else{false}}}}meta.socialOX={refresh:{title:_("Refresh"),icons:["img/toolbar/tb_loading.gif"],group:"social-ox",requires:function(){return false
},mousedown:function(options,e){if(ox.api.config.get(["modules","com.openexchange.subscribe"])!==true){corewindow.triggerEvent("Feature_Not_Available","modules/"+activemodule+"/social/refresh",window)}}},publish:{title:_("Publish"),icons:["dummy.gif"],group:"social-ox",requires:function(){return(ox.api.config.get(["modules","com.openexchange.publish"])===true)},action:function(){triggerEvent("Feature_Publications");return true},mousedown:function(options,e){if(ox.api.config.get(["modules","com.openexchange.publish"])!==true){corewindow.triggerEvent("Feature_Not_Available","modules/"+activemodule+"/social/publish",window)
}}},subscribe:{title:_("Subscribe"),icons:["dummy.gif"],group:"social-ox",requires:function(){return(ox.api.config.get(["modules","com.openexchange.subscribe"])===true)},mousedown:function(options,e){if(ox.api.config.get(["modules","com.openexchange.subscribe"])!==true){corewindow.triggerEvent("Feature_Not_Available","modules/"+activemodule+"/social/subscribe",window)}}}};var items=ox.widgets.toolBar.menuItems={};var add=function(target,namespace,prefix,ids){prefix=prefix!==""?prefix+"-":"";var fnAction=function(e){return ox.ToolBarController.trigger(e.widget.id)
};var i=0,$l=ids.length,id,options;var j,icons,$k,icon;for(;i<$l;i++){id=ids[i];if((options=namespace[id])){options.id=prefix+id;if(options.selection===undefined){options.selection="default"}if(options.action===undefined){options.action=fnAction}if(options.icons!==undefined){for(j=0,icons=options.icons,$k=icons.length;j<$k;j++){if(!/[\/]/.test(icons[j])){icons[j]="icons/"+(options.big===true?"24/":"16/")+icons[j]}}}target.add((items[options.id]=new ox.gui.MenuItem(options)))}else{console.error("Cannot find meta data for",id,namespace)
}}};ox.ToolBarController=(function(){var getItems=function(namespace,selection,keysOnly){var id,tmp=[],m,regex=new RegExp("^"+namespace+"-"),item;for(id in items){m=id.match(regex);if(m&&m.length){item=items[id];if(selection===undefined||(selection===item.options.selection)){tmp.push(keysOnly===true?id:item)}}}return tmp};var satisfies=function(requires,ability,selection,cont){if(ox.util.isFunction(requires)){var result=requires(ability,selection,cont);if(result!==undefined){cont(result)}}else{if(requires===undefined||requires.length===0){cont(true)
}else{var i=0,$l=requires.length,result=true;for(;i<$l&&result;i++){result=result&&(!!ability[requires[i]])}cont(result)}}};var applySelection=function(name,ability,selection,folders){var list=getItems(ox.UIController.getModule(),name);var isFunction=ox.util.isFunction;var asyncEnable=function(item){return function(flag){item.setEnabled(flag)}};var i=0,$l=list.length,item,options;for(;i<$l;i++){item=list[i];options=item.options;if(options.selection===name||(options.selection===undefined&&name==="default")){if(options.checked!==undefined){if(isFunction(options.checked)){item.setChecked(options.checked(ability,selection))
}else{item.setChecked(!!options.checked)}}if(options.visible!==undefined){item.setVisible(options.visible(ability,selection))}satisfies(options.requires,ability,selection,asyncEnable(item))}}};var modules={};var tmp=ox.api.ui.listModules();for(var i in tmp){modules[tmp[i].name]=!tmp[i].disabled}var getAbility=function(selection){var myself=ox.api.config.get("identifier");var $l=selection.length;var ability={read:true,modify:true,"delete":true,none:$l===0,some:$l>0,one:$l===1,multiple:$l>1};$.extend(ability,modules);
var api=ox.api.folder;var getRight=function(folder,owner,offset){var bits=api.derive("bits",folder,offset);if(bits===0){return false}else{if(bits===1){return owner===myself}else{return true}}};var i=0,item,folder,id;for(;i<$l;i++){item=selection[i];if(item){id=item.folder||item.folder_id;folder=id===undefined?undefined:ox.api.folder.get({folder:id})}if(item&&folder){ability.read=ability.read&&getRight(folder,item.created_by,7);ability.modify=ability.modify&&getRight(folder,item.created_by,14);ability["delete"]=ability["delete"]&&getRight(folder,item.created_by,21)
}else{ability.unknown=true;ability.read=false;ability.modify=false;ability["delete"]=false;break}}return ability};var defaultTab={};var switchToDefaultTab=function(){var id,d;for(id in defaultTab){d=defaultTab[id];if(d.widget.isVisible()){d.widget.setPosition(d.position)}}};var current={};ox.api.event.register("OX_View_Changed",function(){current={}});var processSelection=function(name,hasFolders,selection,force){var view=ox.UIController.getView();if(force===true||current[view+":"+name]===undefined||!equals(current[view+":"+name].selection,selection)){var i=0,$l=selection.length,obj,ids={};
if(hasFolders===true){for(;i<$l;i++){obj=selection[i];ids[obj.folder||obj.folder_id]=true}}if($l>0){switchToDefaultTab()}current[view+":"+name]={ids:ox.util.keys(ids),count:$l,selection:selection,hasFolders:hasFolders,name:name};var cont=function(data){var folders=ox.util.values(data);var ability=getAbility(selection);applySelection(name,ability,selection,folders)};if(hasFolders===true){ox.api.folder.getMultiple({list:current[view+":"+name].ids,success:cont})}else{cont({})}}};var handlers=[];return{addHandler:function(fn){if(ox.util.isFunction(fn)){handlers.push(fn)
}else{console.error("ToolBarController.addHandler() Not a function: ",fn)}},trigger:function(id){id=String(id);var name,obj,selections={},view=ox.UIController.getView(),len=(view||"").length;for(name in current){if(name.substr(0,len)===view){obj=current[name];selections[obj.name]=obj.selection}}if(ox.widgets.toolBar.menuItems[id]!==undefined){track({type:"MenuItem ",text:'Click on menu item "'+ox.widgets.toolBar.menuItems[id].text+'" ('+id+")"})}var i=0,$l=handlers.length,result=false;for(;i<$l;i++){result=handlers[i](id,selections);
if(result===true){return true}}return false},getItems:function(namespace,selection){return getItems(namespace,selection,false)},getItemIds:function(namespace,selection){return getItems(namespace,selection,true)},getAbility:function(selection){return getAbility(selection)},applyCurrentSelection:function(){var name,item;for(name in current){item=current[name];processSelection(item.name,item.hasFolders,item.selection,true)}},getCurrentSelection:function(name){if(name===undefined){return current}else{var view=ox.UIController.getView();
return current[view+":"+name]}},clearCurrentSelection:function(){for(var name in current){$.extend(current[name],{ids:[],count:0,selection:[]})}},processSelection:function(name,hasFolders,selection,force){return processSelection(name,hasFolders,selection,force)},setDefaultTab:function(tabControl,position){if(tabControl!==undefined){defaultTab[tabControl.id]={widget:tabControl,position:position}}},showDefaultTab:function(){switchToDefaultTab()},initialResize:function(){var collapsed=ox.api.window.isNested?false:ox.api.config.get("gui.menu.collapsed",false);
var ctrl=ox.UIController;var module=ctrl.getModule()||ctrl.initialModule;var height=collapsed||(module==="portal"&&currentpath[0]!=="configuration")?"26px":"90px";jQuery("#toolbar_container, #window_toolbar_container").height(height);resizeSplit("all_of_menu",height)},resizeCurrent:function(e){var collapsed=e.data===true;var height=collapsed?"26px":"90px";$("#toolbar_container, #window_toolbar_container").height(height);resizeSplit("all_of_menu",height)},resize:function(e){var views=ox.widgets.toolBar.views;
var collapsed=e&&e.data===true;var height=collapsed?"26px":"90px";$("#toolbar_container, #window_toolbar_container").height(height);resizeSplit("all_of_menu",height);ox.api.config.set("gui.menu.collapsed",collapsed);for(var id in views){if(views[id]!==this&&id!=="portal"){views[id].toggleHover(collapsed,false)}}}}}());var resizeCurrent=function(e){ox.ToolBarController.resizeCurrent(e)};var resize=function(e){ox.ToolBarController.resize(e)};var postInit=function(){var views=ox.widgets.toolBar.views;
for(var id in views){views[id].addListener("widget:togglehover",id==="portal"?resizeCurrent:resize)}};return{resize:resize,add:add,postInit:postInit,getOptions:function(options){return $.extend({showSectionNames:false,inHover:ox.api.window.isNested?false:ox.api.config.get("gui.menu.collapsed",false)},options||{})}}};ox.gui.initToolBarCore=function(){var events={"create-mail":"OX_NEW_MAIL","create-calendar":"OX_Before_Create_Calendar","create-contact":"OX_Before_Create_Contact","create-distributionlist":"OX_Before_Create_Distributionlist","create-task":"OX_Before_Create_Task","create-file":"OX_Before_Create_InfoStore"};
ox.ToolBarController.addHandler(function(id){var m;m=id.match(/^\w+-(create-\w+)(-clone)?$/);if(m&&m.length&&events[m[1]]!==undefined){triggerEvent(events[m[1]]);return true}m=id.match(/^\w+-flag-(\d+)$/);if(m&&m.length){triggerEvent("OX_Add_Flag",m[1]);return true}});var root=$("#toolbar_container")[0];var control=ox.widgets.toolBar.viewControl=new ox.gui.ViewControl("toolbar-view-control").removeCSSClass("oxStretch").setParentDOMNode(root).addTo(ox.desktop);ox.UIController.dispatcher.bind("modulechange",function(e){var view=ox.widgets.toolBar.views[e.module];
if(view!==undefined){control.showView(view.id);ox.ToolBarController.showDefaultTab()}});ox.api.event.register("Selected",function(selection){ox.ToolBarController.processSelection("default",true,selection);ox.widgets.toolBar.viewControl.validate()});ox.ToolBarController.processSelection("default",true,[])};ox.gui.initToolBarPortal=function($p){var tabs=ox.widgets.toolBar.tabs;var sections=ox.widgets.toolBar.sections;var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;var add=$p.add;toolbar=ox.widgets.toolBar.views.portal=new ox.gui.TabMenu($p.getOptions({id:"toolbar-portal",showSectionNames:false,inHover:true}));
tab=tabs.portalCreate=new ox.gui.PanelMenu("toolbar-portal-create",_("&New")).addTo(toolbar);section=sections.portalCreate=new ox.gui.PanelMenuSection(_("New"),"portalCreateSection").addTo(tab);add(section,ox.widgets.toolBar.meta.create,"portal-create",["mail","calendar","contact","distributionlist","task","file"]);toolbar.addTo(ox.widgets.toolBar.viewControl);ox.ToolBarController.setDefaultTab(toolbar,0)};ox.gui.initToolBarMail=function($p){var meta=$.extend(ox.widgets.toolBar.meta,{mail:{compose:{title:_("New E-Mail"),icons:["mail_write.png"],big:true,visible:function(){return !isStdFolder("drafts")
}},"quick-read":{title:_("Mark as read"),icons:["mark_as_done.png"],big:true,requires:["multiple","modify"],visible:function(ability){return ability.multiple}},reply:{title:_("Reply"),icons:["reply.png"],big:true,requires:["one"],visible:function(ability){return !ability.multiple}},"reply-all":{title:_("Reply all"),icons:["reply_all.png"],big:true,requires:["one"],visible:function(ability){return !ability.multiple}},forward:{title:_("Forward"),icons:["forward.png"],big:true,requires:["some"]},"delete":{title:_("Delete"),icons:["delete.png"],big:true,requires:["some","delete"]},edit:{title:_("Edit draft"),icons:["draft.png"],big:true,requires:function(ability){return ability.one&&isStdFolder("drafts")
},visible:function(){return isStdFolder("drafts")}},copy:{title:_("Copy"),icons:["mail_copy.png"],requires:["some"]},move:{title:_("Move"),icons:["mail_move.png"],requires:["some","delete"]},save:{title:_("Save"),icons:["send_as_link.png"],requires:["some"]},"view-source":{title:_("Show source"),icons:["mail_source.png"],requires:["one"]},print:{title:_("Print"),icons:["print.png"],requires:["some"]},"mark-as":{title:_("Mark as"),icons:["mark_as.png"],requires:["some"]},"mark-as-read":{title:_("Read"),requires:["some","modify"]},"mark-as-unread":{title:_("Unread"),requires:["some","modify"]},"mark-as-answered":{title:_("Answered"),requires:["some","modify"]},"mark-as-unanswered":{title:_("Unanswered"),requires:["some","modify"]},"mark-as-deleted":{title:_("Deleted"),requires:["some","modify"]},"mark-as-undeleted":{title:_("Undeleted"),requires:["some","modify"]},"attachment-open":{title:_("Open attachment"),icons:["attachment_open.png"],selection:"mail-attachment",requires:["one"]},"attachment-save":{title:_("Save as"),icons:["send_as_attachment.png"],selection:"mail-attachment",requires:["one"]},"attachment-save-infostore":{title:_("Save in InfoStore"),icons:["save.png"],selection:"mail-attachment",requires:["one","infostore"],mousedown:function(options,e){if(ox.api.config.get("modules.infostore.module")==false){corewindow.triggerEvent("Feature_Not_Available","modules/mail/save_to_infostore",window)
}},visible:ox.upsell.visible("infostore")}}});(function(){var spamButton=ox.api.config.get("mail.spambutton",false);var spamFolder=ox.api.config.get("mail.folder.spam");meta.mail.spam={title:_("Spam"),icons:["spam.png"],requires:function(ability,selection){var folder=ox.UIController.getFolder();var accountId=ox.api.folder.derive("accountId",folder);return ability.some&&spamButton===true&&accountId===0&&folder!==spamFolder},visible:function(ability,selection){var folder=ox.UIController.getFolder();
var accountId=ox.api.folder.derive("accountId",folder);return spamButton===true&&accountId===0&&folder!==spamFolder}};meta.mail.ham={title:_("Not Spam"),icons:["ham.png"],requires:function(ability,selection){var folder=ox.UIController.getFolder();var accountId=ox.api.folder.derive("accountId",folder);return ability.some&&spamButton===true&&accountId===0&&folder===spamFolder},visible:function(ability,selection){return spamButton===true&&ox.UIController.getFolder()===spamFolder}}}());var toggleAttachmentSection=function(visible){if(currentpath[0]==="mail"){var tab=ox.widgets.toolBar.tabs.mailEdit;
var section=tab.children[2];if(section.isVisible()!=visible){section.setVisible(visible);tab.validate()}}};var tabs=ox.widgets.toolBar.tabs;var sections=ox.widgets.toolBar.sections;var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;var add=$p.add;toolbar=ox.widgets.toolBar.views.mail=new ox.gui.TabMenu($p.getOptions({id:"toolbar-mail",showSectionNames:false}));tab=tabs.mailCreate=new ox.gui.PanelMenu("toolbar-mail-create",_("&New")).addTo(toolbar);section=sections.mailCreate=new ox.gui.PanelMenuSection(_("New"),"mailCreateSection").addTo(tab);
add(section,meta.create,"mail-create",["mail","calendar","contact","distributionlist","task","file"]);ox.api.event.register("SubSelected",function(selection){ox.ToolBarController.processSelection("mail-attachment",false,selection,true)});tab=tabs.mailEdit=new ox.gui.PanelMenu("toolbar-mail-edit",_("&Edit")).addTo(toolbar);section=sections.mailCompose=new ox.gui.PanelMenuSection(_("Compose"),"mailComposeSection").addTo(tab);add(section,meta.mail,"mail-compose",["compose","edit"]);section=sections.mailEdit=new ox.gui.PanelMenuSection(_("Edit"),"mailEditSection").addTo(tab);
add(section,meta.mail,"mail-edit",["quick-read","reply","reply-all","forward","delete","print","mark-as","copy","move","save","view-source","spam","ham"]);add(items["mail-edit-mark-as"],meta.mail,"mail-edit",["mark-as-read","mark-as-unread","mark-as-answered","mark-as-unanswered","mark-as-deleted","mark-as-undeleted"]);tab=tabs.mailAttachment=new ox.gui.PanelMenu("toolbar-mail-attachment",_("&Attachment")).addTo(toolbar);section=sections.mailAttachment=new ox.gui.PanelMenuSection(_("Attachment"),"mailAttachmentSection").addTo(tab);
add(section,meta.mail,"mail-attachment",["attachment-open","attachment-save","attachment-save-infostore"]);tab=tabs.mailView=new ox.gui.PanelMenu("toolbar-mail-view",_("&View")).addTo(toolbar);section=sections.mailView=new ox.gui.PanelMenuSection(_("View"),"mailViewSection").addTo(tab);add(section,meta.view,"mail-view",["vsplit","hsplit","list"]);tab=tabs.mailTagging=new ox.gui.PanelMenu("toolbar-mail-tag",_("&Flags")).addTo(toolbar);section=sections.mailFlags=new ox.gui.PanelMenuSection(_("Flags"),"mailFlagsSection").addTo(tab);
add(section,meta.flags,"mail-flag",["0","1","2","3","4","5","6","7","8","9","10"]);if(corewindow.embedded){ox.widgets.searchField.mail=new ox.gui.SearchField("ox-topbar-search-mail").addListener("widget:search",function(e){triggerEvent("OX_New_Search",ox.api.ui.getActiveModule(),e.data.value)});tab=tabs.mailSearch=new ox.gui.PanelMenu("toolbar-mail-search",_("&Search")).addTo(toolbar);section=sections.mailSearch=new ox.gui.PanelMenuSection(_("Search"),"mailSearchSection").addTo(tab);section.add(ox.widgets.searchField.mail)
}var events={"mail-compose-compose":"OX_NEW_MAIL","mail-compose-compose-clone":"OX_NEW_MAIL","mail-compose-edit":"OX_Mail_Edit_Draft","mail-edit-reply":"OX_Mail_Reply","mail-edit-reply-all":"OX_Mail_ReplyAll","mail-edit-forward":"OX_Mail_Forward","mail-edit-delete":"OX_Mail_Delete","mail-edit-copy":"OX_Mail_Copy","mail-edit-move":"OX_Mail_Move","mail-edit-save":"OX_Mail_SaveMail","mail-edit-view-source":"OX_Mail_Show_Source","mail-edit-print":"OX_Print","mail-edit-spam":"OX_Mail_Spam","mail-edit-ham":"OX_Mail_Ham","mail-attachment-attachment-save":"OX_Attachment_Save","mail-attachment-attachment-save-infostore":"OX_Attachment_SaveInfoStore"};
var mailFlags={read:"seen",unread:"unseen",answered:"answer",unanswered:"answered",deleted:"delete",undeleted:"undelete"};ox.ToolBarController.addHandler(function(id){var m;if(events[id]!==undefined){triggerEvent(events[id]);return true}m=id.match(/^(mail-edit-quick|mail-edit-mark-as)-(\w+)$/);if(m&&m.length){triggerEvent("OX_Mail_Flag",mailFlags[m[2]]);return true}switch(id){case"mail-view-vsplit":menuswitchMailView("vsplit");return true;case"mail-view-hsplit":menuswitchMailView("hsplit");return true;
case"mail-view-list":menuswitchMailView("list");return true;case"mail-attachment-attachment-open":triggerEvent(menunestedmessage?"OX_Attachment_Open_Nested":"OX_Attachment_Open");return true}});toolbar.addTo(ox.widgets.toolBar.viewControl);ox.ToolBarController.setDefaultTab(toolbar,1)};ox.gui.initToolBarCalendar=function($p){var upsell=ox.api.window.core.ox.upsell;var meta=$.extend(ox.widgets.toolBar.meta,{calendar:{compose:{title:_("New Appointment"),icons:["mod_calendar.png"],big:true},edit:{title:_("Edit"),icons:["edit.png"],big:true,requires:["one","modify"]},"delete":{title:_("Delete"),icons:["delete.png"],big:true,requires:["some","delete"]},print:{title:_("Print"),icons:["print.png"],big:true,requires:function(ability,selection){switch(currentpath[1]){case"team":return false;
case"detail":return ability.one;case"list":return true;default:return Boolean(ox.api.config.get("modules.calendar.printing"))}}},move:{title:_("Move"),icons:["calendar_move.png"],big:true,requires:["some","delete"]},"confirmation-change":{title:_("Confirmation"),icons:["confirmation_change.png"],big:true,requires:function(ability,selection,cont){if(ability.some&&!AcceptDeny.visible){var myself=ox.api.config.get("identifier");var anyPrivate=false,allParticipant=true;if("title" in selection[0]){for(var i=0;
i<selection.length;i++){check(i,selection[i])}done()}else{if(convertAppointmentArray!=identity&&storageCache.current){storageCache.current.newIterate(selection,emptyFunction,check,done)}else{var collection={columns:["private_flag","users","participants"],objects:[]};for(var i in selection){var myObj=selection[i];collection.objects.push(OXCalendarMapping.createKeyFromObject({module:"calendar",folder_id:myObj.folder||myObj.folder_id,id:myObj.id,recurrence_position:myObj.recurrence_position||0}))}OXCache.newRequest(null,"calendar",collection,null,function(data){var oldConvert=convertAppointmentArray;
convertAppointmentArray=identity;for(var i=0;i<data.objects.length;i++){check(0,data.objects[i])}convertAppointmentArray=oldConvert;done()})}}}else{cont(false)}function check(n,item){item=convertAppointmentArray(item);anyPrivate=anyPrivate||item.private_flag;var users=item.users||item.participants;var $l=users.length;var participant=false;for(var i=0;i<$l;i++){if(users[i].id===myself){participant=true}}allParticipant=allParticipant&&participant}function done(){cont(!anyPrivate&&allParticipant)}}},"attachment-open":{title:_("Open attachment"),icons:["attachment_open.png"],selection:"attachments",requires:function(ability){return ability.one
}},"attachment-save":{title:_("Save as"),icons:["send_as_attachment.png"],selection:"attachments",requires:function(ability){return ability.one}},"attachment-save-infostore":{title:_("Save in InfoStore"),icons:["save.png"],selection:"attachments",requires:function(ability){return ability.one},mousedown:function(options,e){if(ox.api.config.get("modules.infostore.module")==false){corewindow.triggerEvent("Feature_Not_Available","modules/calendar/save_to_infostore",window)}}},calendar:{title:_("Calendar"),icons:["mod_calendar.png"],big:true,behavior:"radio",group:"calendar-view-type",checked:function(){return currentpath[1]==="calendar"
}},team:{title:_("Team"),icons:["teamchange.png"],big:true,behavior:"radio",group:"calendar-view-type",requires:function(ability){return ox.api.config.get("modules.calendar.calendar_teamview")},checked:function(){return currentpath[1]==="team"},mousedown:function(options,e){if(ox.api.config.get("modules.calendar.calendar_teamview")==false){corewindow.triggerEvent("Feature_Not_Available","modules/calendar/team",window)}}},list:{title:_("List"),icons:["list_view.png"],big:true,behavior:"radio",group:"calendar-view-type",checked:function(){return currentpath[1]==="list"
}},detail:{title:_("Detail"),icons:["detail_view.png"],big:true,requires:["one"],behavior:"radio",group:"calendar-view-type",checked:function(){return currentpath[1]==="detail"}},day:{title:_("Day"),icons:["dummy.gif"],behavior:"radio",group:"calendar-view-interval",checked:function(){return currentpath[2]==="day"}},workweek:{title:_("Work Week"),icons:["dummy.gif"],behavior:"radio",group:"calendar-view-interval",checked:function(){return currentpath[2]==="workweek"}},month:{title:_("Month"),icons:["dummy.gif"],behavior:"radio",group:"calendar-view-interval",checked:function(){return currentpath[2]==="month"
}},week:{title:_("Week"),icons:["dummy.gif"],behavior:"radio",group:"calendar-view-interval",checked:function(){return currentpath[2]==="week"}},custom:{title:_("Custom"),icons:["dummy.gif"],behavior:"radio",group:"calendar-view-interval",checked:function(){return currentpath[2]==="custom"}},add:{title:_("Add"),icons:["member_add.png"],selection:"team-member",requires:function(ability){return currentpath[1]==="team"}},remove:{title:_("Remove"),icons:["member_remove.png"],selection:"team-member",requires:function(ability){return currentpath[1]==="team"&&ability.some
}},"choose-team":{title:_("Choose Team"),icons:["teamchange.png"],selection:"team-member",requires:function(ability){return currentpath[1]==="team"&&(ox.api.config.get("gui.calendar.teams")||[]).length>0}},"create-team":{title:_("Create Team"),icons:["teamchange.png"],selection:"team-member",requires:function(ability){return currentpath[1]==="team"}}},teams:{}});var toggleAttachmentSection=function(){if(currentpath[0]==="calendar"){var tab=ox.widgets.toolBar.tabs.calendarEdit;var section=tab.children[3];
var visible=section.isVisible();if(currentpath[2]==="attachment"){if(!visible){section.setVisible(true);tab.validate()}}else{if(visible){section.setVisible(false);tab.validate()}}}};var toggleTeamviewSection=function(){if(currentpath[0]==="calendar"){var tab=ox.widgets.toolBar.tabs.calendarEdit;var section=tab.children[2];var visible=section.isVisible();if(currentpath[1]==="team"){if(!visible){section.setVisible(true);tab.validate()}}else{if(visible){section.setVisible(false);tab.validate()}}}};var addTeams=function(){var teams=ox.api.config.get("gui.calendar.teams");
if(teams){meta.teams={};var teamItems=[];var i=0,$l=teams.length;for(;i<$l;i++){teamItems.push("team-#"+i);meta.teams["team-#"+i]={title:teams[i].name,behavior:"radio",group:"calendar-teamview-teams-internal"}}add(items["calendar-teamview-choose-team"],meta.teams,"calendar-teamview",teamItems)}};register("OX_Calendar_Teamlist_Changed",function(){var item=ox.widgets.toolBar.menuItems["calendar-teamview-choose-team"];item.removeChildren();addTeams();item.validate()});var tabs=ox.widgets.toolBar.tabs;
var sections=ox.widgets.toolBar.sections;var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;var add=$p.add;toolbar=ox.widgets.toolBar.views.calendar=new ox.gui.TabMenu($p.getOptions({id:"toolbar-calendar",showSectionNames:false}));tab=tabs.calendarCreate=new ox.gui.PanelMenu("toolbar-calendar-create",_("&New")).addTo(toolbar);section=sections.calendarCreate=new ox.gui.PanelMenuSection(_("New"),"calendarCreateSection").addTo(tab);add(section,meta.create,"calendar-create",["mail","calendar","contact","distributionlist","task","file"]);
tab=tabs.calendarEdit=new ox.gui.PanelMenu("toolbar-calendar-edit",_("&Edit")).addTo(toolbar);section=sections.calendarCompose=new ox.gui.PanelMenuSection(_("New"),"calendarComposeSection").addTo(tab);add(section,meta.calendar,"calendar-edit",["compose"]);section=sections.calendarEdit=new ox.gui.PanelMenuSection(_("Edit"),"calendarEditSections").addTo(tab);add(section,meta.calendar,"calendar-edit",["edit","delete","confirmation-change","print","move"]);section=sections.calendarTeam=new ox.gui.PanelMenuSection(_("Teams"),"calendarTeamSection").addTo(tab);
add(section,meta.calendar,"calendar-teamview",["add","remove","choose-team","create-team"]);if(upsell.isVisible("infostore")){section=sections.calendarAttachment=new ox.gui.PanelMenuSection(_("Attachments"),"calendarAttachmentSections").addTo(tab);add(section,meta.calendar,"calendar-attachments",["attachment-open","attachment-save","attachment-save-infostore"])}addTeams();tab=tabs.calendarView=new ox.gui.PanelMenu("toolbar-calendar-view",_("&View")).addTo(toolbar);section=sections.calendarView=new ox.gui.PanelMenuSection(_("View"),"calendarViewSection").addTo(tab);
add(section,meta.calendar,"calendar-view",["calendar","team","list","detail"]);section=sections.calendarInterval=new ox.gui.PanelMenuSection(_("Time Range"),"calendarIntervalSection").addTo(tab);add(section,meta.calendar,"calendar-view-interval",["day","workweek","month","week","custom"]);tab=tabs.calendarTagging=new ox.gui.PanelMenu("toolbar-calendar-tag",_("&Flags")).addTo(toolbar);section=sections.calendarFlags=new ox.gui.PanelMenuSection(_("Flags"),"calendarFlagSection").addTo(tab);add(section,meta.flags,"calendar-flag",["0","1","2","3","4","5","6","7","8","9","10"]);
if(ox.api.config.get(["modules","com.openexchange.subscribe"])===true||ox.api.config.get("ui.upsell.features.social")===true){tab=tabs.calendarSocial=new ox.gui.PanelMenu("toolbar-calendar-socialOX",_("&Social")).addTo(toolbar);section=sections.calendarSocialOX=new ox.gui.PanelMenuSection(_("Social"),"calendarSocialOXSections").addTo(tab);add(section,meta.socialOX,"calendar-socialOX",["refresh","subscribe"])}if(corewindow.embedded){ox.widgets.searchField.calendar=new ox.gui.SearchField("ox-topbar-search-calendar").addListener("widget:search",function(e){triggerEvent("OX_New_Search",ox.api.ui.getActiveModule(),e.data.value)
});tab=tabs.calendarSearch=new ox.gui.PanelMenu("toolbar-calendar-search",_("&Search")).addTo(toolbar);section=sections.calendarSearch=new ox.gui.PanelMenuSection(_("Search"),"calendarSearchSection").addTo(tab);section.add(ox.widgets.searchField.calendar)}var events={"calendar-edit-compose":"OX_Before_Create_Calendar","calendar-edit-compose-clone":"OX_Before_Create_Calendar","calendar-edit-delete":"OX_Calendar_Delete","calendar-edit-edit":"OX_Calendar_Edit","calendar-edit-move":"OX_Calendar_Move","calendar-edit-print":"OX_Print","calendar-attachments-attachment-save":"OX_Attachment_Save","calendar-attachments-attachment-save-infostore":"OX_Attachment_SaveInfoStore"};
ox.ToolBarController.addHandler(function(id,selections){if(id==="calendar-edit-confirmation-change"){var selection=selections["default"];var tmp=[];if("title" in selection[0]){var i=0,$l=selection.length;for(;i<$l;i++){tmp.push(new AcceptDenyObject("calendar",selection[i]))}showConfirmation()}else{if(storageCache.current&&convertAppointmentArray!=identity){storageCache.current.newIterate(selection,emptyFunction,function(n,item){tmp.push(new AcceptDenyObject("calendar",convertAppointmentArray(item)))
},showConfirmation)}else{var collection={columns:null,objects:[]};for(var i in selection){var myObj=selection[i];collection.objects.push(OXCalendarMapping.createKeyFromObject({module:"calendar",folder_id:myObj.folder||myObj.folder_id,id:myObj.id,recurrence_position:myObj.recurrence_position||0}))}OXCache.newRequest(null,"calendar",collection,null,function(data){for(var i=0;i<data.objects.length;i++){tmp.push(new AcceptDenyObject("calendar",data.objects[i]))}showConfirmation()})}}}function showConfirmation(){(new AcceptDeny(true)).showConfirmation(tmp)
}var m;if(events[id]!==undefined){triggerEvent(events[id]);return true}m=id.match(/^\w+-flag-(\d+)$/);if(m&&m.length){triggerEvent("OX_Add_Flag",m[1]);return true}var teamindex;if(id.match(/#[0-9]/)){teamindex=id.substr(id.indexOf("#")+1,id.length);var grid=getCalendarGrid("teamview");setTimeout(function(){grid.loadTeamByIndex(teamindex)},10);return true}switch(id){case"calendar-view-calendar":menuswitchCalendarView("calendar");return true;case"calendar-view-list":menuswitchCalendarView("list");return true;
case"calendar-view-team":menuswitchCalendarView("team");return true;case"calendar-view-detail":menuswitchCalendarView("detail");return true;case"calendar-view-interval-day":menuswitchCalendarTimerange("day");return true;case"calendar-view-interval-workweek":menuswitchCalendarTimerange("workweek");return true;case"calendar-view-interval-month":menuswitchCalendarTimerange("month");return true;case"calendar-view-interval-week":menuswitchCalendarTimerange("week");return true;case"calendar-view-interval-custom":menuswitchCalendarTimerange("custom");
return true;case"calendar-teamview-add":triggerEvent("OX_Calendar_Teammember_Add");return true;case"calendar-teamview-remove":triggerEvent("OX_Calendar_Teammember_Remove");return true;case"calendar-teamview-create-team":triggerEvent("OX_Calendar_Team_Add_Team");triggerEvent("OX_Switch_View","configuration/calendar/teams");return true;case"calendar-attachments-attachment-open":triggerEvent("OX_Attachment_Open");return true}});toolbar.addTo(ox.widgets.toolBar.viewControl);ox.api.event.register("SubSelected",function(selection){ox.ToolBarController.processSelection("team-member",false,selection,true);
if(currentpath[2]==="attachments"){ox.ToolBarController.processSelection("attachments",false,[selection],true)}});ox.api.event.register("OX_View_Changed",function(){toggleTeamviewSection();toggleAttachmentSection();if(currentpath[0]==="calendar"){if(currentpath[1]!=="detail"){ox.ToolBarController.processSelection("default",false,[],true);ox.ToolBarController.processSelection("detailappointment",false,[],true)}else{ox.ToolBarController.processSelection("default",false,[selectedAppointment],true)}if(currentpath[2]!=="attachments"){ox.ToolBarController.processSelection("attachments",false,[],true)
}}});ox.api.event.register("Confirmation_Changed",function(en){ox.widgets.toolBar.menuItems["calendar-edit-confirmation-change"].setEnabled(Boolean(en))});ox.ToolBarController.processSelection("team-member",false,[],true);ox.ToolBarController.processSelection("detailappointment",false,[],true);ox.ToolBarController.processSelection("attachments",false,[],true);ox.ToolBarController.setDefaultTab(toolbar,1)};ox.gui.initToolBarTasks=function($p){var upsell=ox.api.window.core.ox.upsell;var meta=$.extend(ox.widgets.toolBar.meta,{tasks:{compose:{title:_("New task"),icons:["mod_tasks.png"],big:true},edit:{title:_("Edit"),icons:["edit.png"],big:true,requires:["one","modify"]},"delete":{title:_("Delete"),icons:["delete.png"],big:true,requires:["some","delete"]},print:{title:_("Print"),icons:["print.png"],big:true,requires:["some"]},change:{title:_("Confirmation"),icons:["confirmation_change.png"],big:true,requires:function(ability,selection,cont){if(!ability.one||AcceptDeny.visible){return false
}OXCache.newRequest(null,"tasks",{columns:["users"],objects:selection},null,processTask);function processTask(data){var task=data.objects[0];if(!task){cont(false)}else{if(ox.util.isArray(task.users)){var myself=ox.api.config.get("identifier");var i=0,users=task.users,$l=users.length;for(;i<$l;i++){if(users[i].id===myself){cont(true);return}}}}}}},move:{title:_("Move"),icons:["task_move.png"],requires:["some","delete"]},"mark-as-done":{title:_("Mark as Done"),icons:["dummy.gif"],requires:["some","modify"]},"use-as-template":{title:_("Use as template"),icons:["task_copy.png"],requires:["one"]},"attachment-open":{title:_("Open attachment"),icons:["attachment_open.png"],selection:"attachments",requires:function(ability){return ability.one
}},"attachment-save":{title:_("Save as"),icons:["send_as_attachment.png"],selection:"attachments",requires:function(ability){return ability.one}},"attachment-save-infostore":{title:_("Save in InfoStore"),icons:["save.png"],selection:"attachments",requires:function(ability){return ability.one},mousedown:function(options,e){if(ox.api.config.get("modules.infostore.module")==false){corewindow.triggerEvent("Feature_Not_Available","modules/tasks/save_to_infostore",window)}},visible:ox.upsell.visible("infostore")},hsplit:{title:_("H-Split"),icons:["h_split_view.png"],big:true,behavior:"radio",group:"split-views",checked:function(){return currentpath[1]==="split"
}},list:{title:_("List"),icons:["list_view.png"],big:true,behavior:"radio",group:"split-views",checked:function(){return currentpath[1]==="list"}}}});var toggleAttachmentSection=function(){if(currentpath[0]==="tasks"){var tab=ox.widgets.toolBar.tabs.tasksEdit;var section=tab.children[2];var visible=section.isVisible();if(currentpath[2]==="attachment"){if(!visible){section.setVisible(true);tab.validate()}}else{if(visible){section.setVisible(false);tab.validate()}}}};var tabs=ox.widgets.toolBar.tabs;
var sections=ox.widgets.toolBar.sections;var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;var add=$p.add;toolbar=ox.widgets.toolBar.views.tasks=new ox.gui.TabMenu($p.getOptions({id:"toolbar-tasks",showSectionNames:false}));tab=tabs.tasksCreate=new ox.gui.PanelMenu("toolbar-tasks-create",_("&New")).addTo(toolbar);section=sections.tasksCreate=new ox.gui.PanelMenuSection(_("New"),"tasksCreateSection").addTo(tab);add(section,meta.create,"tasks-create",["mail","calendar","contact","distributionlist","task","file"]);
tab=tabs.tasksEdit=new ox.gui.PanelMenu("toolbar-tasks-edit",_("&Edit")).addTo(toolbar);section=sections.tasksCompose=new ox.gui.PanelMenuSection(_("Compose"),"tasksComposeSection").addTo(tab);add(section,meta.tasks,"tasks-edit",["compose"]);section=sections.tasksEdit=new ox.gui.PanelMenuSection(_("Edit"),"tasksEditSection").addTo(tab);add(section,meta.tasks,"tasks-edit",["edit","delete","print","change","move","mark-as-done","use-as-template"]);if(upsell.isVisible("infostore")){section=section.tasksAttachment=new ox.gui.PanelMenuSection(_("Attachments"),"tasksAttachmentSection").addTo(tab);
add(section,meta.tasks,"tasks-edit",["attachment-open","attachment-save","attachment-save-infostore"])}tab=tabs.tasksView=new ox.gui.PanelMenu("toolbar-tasks-view",_("&View")).addTo(toolbar);section=sections.tasksView=new ox.gui.PanelMenuSection(_("View"),"tasksViewSection").addTo(tab);add(section,meta.tasks,"tasks-view",["hsplit","list"]);tab=tabs.tasksTagging=new ox.gui.PanelMenu("toolbar-tasks-tag",_("&Flags")).addTo(toolbar);section=sections.tasksFlags=new ox.gui.PanelMenuSection(_("Flags"),"tasksFlagsSection").addTo(tab);
add(section,meta.flags,"tasks-flag",["0","1","2","3","4","5","6","7","8","9","10"]);if(corewindow.embedded){ox.widgets.searchField.tasks=new ox.gui.SearchField("ox-topbar-search-tasks").addListener("widget:search",function(e){triggerEvent("OX_New_Search",ox.api.ui.getActiveModule(),e.data.value)});tab=tabs.tasksSearch=new ox.gui.PanelMenu("toolbar-tasks-search",_("&Search")).addTo(toolbar);section=sections.tasksSearch=new ox.gui.PanelMenuSection(_("Search"),"tasksSearchSection").addTo(tab);section.add(ox.widgets.searchField.tasks)
}ox.api.event.register("OX_View_Changed",toggleAttachmentSection);var events={"tasks-edit-compose":"OX_Before_Create_Task","tasks-edit-compose-clone":"OX_Before_Create_Task","tasks-edit-edit":"OX_Task_Edit","tasks-edit-delete":"OX_Task_Delete","tasks-edit-print":"OX_Print","tasks-edit-change":"OX_Confirmation_Change","tasks-edit-move":"OX_Task_Move","tasks-edit-mark-as-done":"OX_Task_MarkAsDone","tasks-edit-use-as-template":"OX_Task_Duplicate","tasks-edit-attachment-save":"OX_Attachment_Save","tasks-edit-attachment-save-infostore":"OX_Attachment_SaveInfoStore"};
ox.ToolBarController.addHandler(function(id){if(events[id]!==undefined){triggerEvent(events[id]);return true}switch(id){case"tasks-view-hsplit":if(currentpath[1]!=="split"){switchtoView("tasks/split")}return true;case"tasks-view-list":if(currentpath[1]!=="list"){switchtoView("tasks/list")}return true;case"tasks-edit-attachment-open":triggerEvent("OX_Attachment_Open");return true}});toolbar.addTo(ox.widgets.toolBar.viewControl);ox.ToolBarController.processSelection("attachments",false,[],true);ox.ToolBarController.setDefaultTab(toolbar,1)
};ox.gui.initToolBarInfoStore=function($p){var NAME="infostore";var meta=$.extend(ox.widgets.toolBar.meta,{infostore:{compose:{title:_("New Infoitem"),icons:["mod_infostore.png"],big:true},edit:{title:_("Edit"),icons:["edit.png"],big:true,requires:function(ability,selection){return ability.one&&ability.modify&&selection.length==menucountlockable+menucounteditable}},"delete":{title:_("Delete"),icons:["delete.png"],big:true,requires:function(ability,selection){return ability.some&&ability["delete"]&&selection.length==menucountlockable+menucounteditable
}},print:{title:_("Print"),icons:["print.png"],big:true,requires:function(ability,selection){return ability.some&&isPrintableView(currentpath2.join("/"))}},move:{title:_("Move"),icons:["infostore_move.png"],requires:function(ability,selection){return ability.some&&ability["delete"]&&selection.length==menucountlockable+menucounteditable}},lock:{title:_("Lock"),icons:["lock.png"],selection:"lockable",requires:function(ability,selection){return ability.some&&ability.modify&&menucountlockable==selection.length
}},unlock:{title:_("Unlock"),icons:["unlock.png"],selection:"lockable",requires:function(ability,selection){return ability.some&&ability.modify&&menucountunlockable==selection.length}},"as-link":{title:_("Send as link"),icons:["send_as_attachment.png"],requires:function(ability){return ox.api.config.get("modules.mail.module")&&ability.some},mousedown:function(options,e){if(ox.api.config.get("modules.mail.module")==false){corewindow.triggerEvent("Feature_Not_Available","modules/infostore/send_as_link",window)
}}},"as-attachment":{title:_("Send as attachment"),icons:["send_as_attachment.png"],requires:function(ability,selection,cont){if(ox.api.config.get("modules.mail.module")===false){return false}if(!selection.length){return false}OXCache.newRequest(null,"infostore",{objects:selection,columns:["filename"]},null,function(data){for(var i in data.objects){if(data.objects[i].filename==undefined){cont(false);return}}cont(true)})},mousedown:function(options,e){if(ox.api.config.get("modules.mail.module")===false){corewindow.triggerEvent("Feature_Not_Available","modules/infostore/send_as_attachment",window)
}}},"version-current":{title:_("Current"),icons:["current_version.png"],selection:"version",requires:function(ability){return ability.one&&ability.modify&&menucountselected==menucountlockable+menucounteditable}},"version-delete":{title:_("Delete"),icons:["delete.png"],selection:"version",requires:function(ability){return ability.some&&ability["delete"]&&menucountselected==menucountlockable+menucounteditable}},hsplit:{title:_("H-Split"),icons:["h_split_view.png"],big:true,behavior:"radio",group:"split-views",checked:function(){return currentpath[1]==="split"
}},list:{title:_("List"),icons:["list_view.png"],big:true,behavior:"radio",group:"split-views",checked:function(){return currentpath[1]==="list"}}}});var toggleVersionSection=function(){if(currentpath[0]==="infostore"){var tab=ox.widgets.toolBar.tabs.infostoreEdit;var section=tab.children[3];var visible=section.isVisible();if(currentpath[2]==="version"){if(!visible){section.setVisible(true);tab.validate()}}else{if(visible){section.setVisible(false);tab.validate()}}}};var tabs=ox.widgets.toolBar.tabs;
var sections=ox.widgets.toolBar.sections;var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;var add=$p.add;toolbar=ox.widgets.toolBar.views[NAME]=new ox.gui.TabMenu($p.getOptions({id:"toolbar-"+NAME,showSectionNames:false}));tab=tabs[NAME+"Create"]=new ox.gui.PanelMenu("toolbar-"+NAME+"-create",_("&New")).addTo(toolbar);section=sections.infostoreCreate=new ox.gui.PanelMenuSection(_("New"),"infostoreCreateSection").addTo(tab);add(section,meta.create,NAME+"-create",["mail","calendar","contact","distributionlist","task","file"]);
tab=tabs[NAME+"Edit"]=new ox.gui.PanelMenu("toolbar-"+NAME+"-edit",_("&Edit")).addTo(toolbar);section=sections.infostoreCompose=new ox.gui.PanelMenuSection(_("Compose"),"infostoreComposeSection").addTo(tab);add(section,meta[NAME],NAME+"-edit",["compose"]);section=sections.infostoreEdit=new ox.gui.PanelMenuSection(_("Edit"),"infostoreEditSection").addTo(tab);add(section,meta[NAME],NAME+"-edit",["edit","delete","print","lock","unlock","move"]);section=sections.infostoreSend=new ox.gui.PanelMenuSection(_("Send"),"infostoreSendSection").addTo(tab);
add(section,meta[NAME],NAME+"-send",["as-attachment","as-link"]);section=sections.infostoreVersion=new ox.gui.PanelMenuSection(_("Version"),"infostoreVersionSection").addTo(tab);add(section,meta[NAME],[NAME]+"-version",["version-current","version-delete"]);ox.api.event.register("OX_View_Changed",function(){toggleVersionSection();if(currentpath[0]==="infostore"&&currentpath[2]!=="version"){ox.ToolBarController.processSelection("version",false,[],true)}});ox.api.event.register("SubSelected",function(selection){var sel=new Array(selection.length);
for(var i=0;i<sel.length;i++){sel[i]=$.extend({},selection[i],{folder_id:activefolder})}ox.ToolBarController.processSelection("version",false,sel,true)});tab=tabs[NAME+"View"]=new ox.gui.PanelMenu("toolbar-"+NAME+"-view",_("&View")).addTo(toolbar);section=sections.infostoreView=new ox.gui.PanelMenuSection(_("View"),"infostoreViewSection").addTo(tab);add(section,meta[NAME],NAME+"-view",["hsplit","list"]);tab=tabs[NAME+"Tagging"]=new ox.gui.PanelMenu("toolbar-"+NAME+"-tag",_("&Flags")).addTo(toolbar);
section=sections.infostoreFlags=new ox.gui.PanelMenuSection(_("Flags"),"infostoreFlagsSection").addTo(tab);add(section,meta.flags,NAME+"-flag",["0","1","2","3","4","5","6","7","8","9","10"]);if(ox.api.config.get(["modules","com.openexchange.subscribe"])===true||ox.api.config.get(["modules","com.openexchange.publish"])===true||ox.api.config.get("ui.upsell.features.social")===true){tab=tabs.infostoreSocial=new ox.gui.PanelMenu("toolbar-infostore-socialOX",_("&Social")).addTo(toolbar);section=sections.infostoreSocialOX=new ox.gui.PanelMenuSection(_("Social"),"infostoreSocialOXSections").addTo(tab);
add(section,meta.socialOX,"infostore-socialOX",["refresh","publish","subscribe"])}if(corewindow.embedded){ox.widgets.searchField.infostore=new ox.gui.SearchField("ox-topbar-search-infostore").addListener("widget:search",function(e){triggerEvent("OX_New_Search",ox.api.ui.getActiveModule(),e.data.value)});tab=tabs.infostoreSearch=new ox.gui.PanelMenu("toolbar-infostore-search",_("&Search")).addTo(toolbar);section=sections.infostoreSearch=new ox.gui.PanelMenuSection(_("Search"),"infostoreSearchSection").addTo(tab);
section.add(ox.widgets.searchField.infostore)}var events={"infostore-edit-compose":"OX_Before_Create_InfoStore","infostore-edit-compose-clone":"OX_Before_Create_InfoStore","infostore-edit-edit":"OX_InfoStore_Edit","infostore-edit-delete":"OX_InfoStore_Delete","infostore-edit-print":"OX_Print","infostore-edit-move":"OX_InfoStore_Move","infostore-edit-lock":"OX_InfoStore_Lock","infostore-edit-unlock":"OX_InfoStore_Unlock","infostore-send-as-attachment":"OX_InfoStore_Send_Attachment","infostore-send-as-link":"OX_InfoStore_Send_Link","infostore-version-version-current":"OX_InfoStore_Version_Current","infostore-version-version-delete":"OX_InfoStore_Version_Delete"};
ox.ToolBarController.processSelection("version",false,[],true);ox.ToolBarController.addHandler(function(id){if(events[id]!==undefined){triggerEvent(events[id]);return true}switch(id){case"infostore-view-hsplit":if(currentpath[1]!=="split"){switchtoView("infostore/split")}return true;case"infostore-view-list":if(currentpath[1]!=="list"){switchtoView("infostore/list")}return true}});toolbar.addTo(ox.widgets.toolBar.viewControl);ox.ToolBarController.setDefaultTab(toolbar,1)};ox.gui.initToolBarContacts=function($p){var upsell=ox.api.window.core.ox.upsell;
var meta=$.extend(ox.widgets.toolBar.meta,{contacts:{compose:{title:_("New Contact"),icons:["mod_contacts.png"],big:true},composeDistributionList:{title:_("New Distribution List"),icons:["distributionlist.png"],big:true},edit:{title:_("Edit"),icons:["edit.png"],big:true,requires:["one","modify"]},"delete":{title:_("Delete"),icons:["delete.png"],big:true,requires:["some","delete"]},print:{title:_("Print"),icons:["print.png"],big:true,requires:function(ability){return currentpath[1]!=="cards"&&ability.some
}},duplicate:{title:_("Use as template"),icons:["duplicate_contacts.png"],requires:["one"]},move:{title:_("Move"),icons:["contact_move.png"],requires:["some","delete"],visible:upsell.visible("contacts-copy-move")},copy:{title:_("Copy"),icons:["contact_copy.png"],requires:["some"],visible:upsell.visible("contacts-copy-move")},vcard:{title:_("Send as vCard"),icons:["forward.png"],requires:["some"]},"attachment-open":{title:_("Open attachment"),icons:["attachment_open.png"],selection:"attachments",requires:function(ability){return ability.one
}},"attachment-save":{title:_("Save as"),icons:["send_as_attachment.png"],selection:"attachments",requires:function(ability){return ability.one}},"attachment-save-infostore":{title:_("Save in InfoStore"),icons:["save.png"],selection:"attachments",requires:function(ability){return ability.one},mousedown:function(options,e){if(ox.api.config.get("modules.infostore.module")==false){corewindow.triggerEvent("Feature_Not_Available","modules/contacts/save_to_infostore",window)}}}},contactsView:{cards:{title:_("Cards"),icons:["card_view.png"],behavior:"radio",group:"contacts-view",big:true,checked:function(){return currentpath[1]==="cards"
}},phonelist:{title:_("Phone list"),icons:["list_view.png"],behavior:"radio",group:"contacts-view",big:true,checked:function(){return currentpath[1]==="phonelist"}},detail:{title:_("Detail"),icons:["detail_view.png"],requires:["one"],behavior:"radio",group:"contacts-view",big:true,checked:function(){return currentpath[1]==="detail"}}}});var toggleAttachmentSection=function(){if(currentpath[0]==="contacts"){var tab=ox.widgets.toolBar.tabs.contactsEdit;var section=tab.children[2];var visible=section.isVisible();
if(currentpath[2]==="attachment"){if(!visible){section.setVisible(true);tab.validate()}}else{if(visible){section.setVisible(false);tab.validate()}}}};var tabs=ox.widgets.toolBar.tabs;var sections=ox.widgets.toolBar.sections;var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;var add=$p.add;toolbar=ox.widgets.toolBar.views.contacts=new ox.gui.TabMenu($p.getOptions({id:"toolbar-contacts",showSectionNames:false}));tab=tabs.contactsCreate=new ox.gui.PanelMenu("toolbar-contacts-create",_("&New")).addTo(toolbar);
section=sections.contactsCreate=new ox.gui.PanelMenuSection(_("New"),"contactsCreateSection").addTo(tab);add(section,meta.create,"contacts-create",["mail","calendar","contact","distributionlist","task","file"]);tab=tabs.contactsEdit=new ox.gui.PanelMenu("toolbar-contacts-edit",_("&Edit")).addTo(toolbar);section=sections.contactsCompose=new ox.gui.PanelMenuSection(_("Compose"),"contactsComposeSection").addTo(tab);add(section,meta.contacts,"contacts-edit",["compose","composeDistributionList"]);section=sections.contactsEdit=new ox.gui.PanelMenuSection(_("Edit"),"contactsEditSection").addTo(tab);
add(section,meta.contacts,"contacts-edit",["edit","delete","print","duplicate","vcard","move","copy"]);if(upsell.isVisible("infostore")&&upsell.isVisible("contacts-attachments")){section=sections.contactsAttachment=new ox.gui.PanelMenuSection(_("Attachments"),"contactsAttachmentSection").addTo(tab);add(section,meta.contacts,"contacts-edit",["attachment-open","attachment-save","attachment-save-infostore"])}tab=tabs.contactsView=new ox.gui.PanelMenu("toolbar-contacts-view",_("&View")).addTo(toolbar);
section=sections.contactsView=new ox.gui.PanelMenuSection(_("View"),"contactsViewSection").addTo(tab);add(section,meta.contactsView,"contacts-view",["cards","phonelist","detail"]);if(upsell.isVisible("contacts-attachments")){tab=tabs.contactsTagging=new ox.gui.PanelMenu("toolbar-contacts-tag",_("&Flags")).addTo(toolbar);section=sections.contactsFlags=new ox.gui.PanelMenuSection(_("Flags"),"contactsFlagsSections").addTo(tab);add(section,meta.flags,"contacts-flag",["0","1","2","3","4","5","6","7","8","9","10"])
}if(ox.api.config.get(["modules","com.openexchange.subscribe"])===true||ox.api.config.get(["modules","com.openexchange.publish"])===true||ox.api.config.get("ui.upsell.features.social")===true){tab=tabs.contactsSocial=new ox.gui.PanelMenu("toolbar-contacts-socialOX",_("&Social")).addTo(toolbar);section=sections.contactsSocialOX=new ox.gui.PanelMenuSection(_("Social"),"contactsSocialOXSections").addTo(tab);add(section,meta.socialOX,"contacts-socialOX",["refresh","publish","subscribe"])}if(corewindow.embedded){ox.widgets.searchField.contacts=new ox.gui.SearchField("ox-topbar-search-contacts").addListener("widget:search",function(e){triggerEvent("OX_New_Search",ox.api.ui.getActiveModule(),e.data.value)
});tab=tabs.contactsSearch=new ox.gui.PanelMenu("toolbar-contacts-search",_("&Search")).addTo(toolbar);section=sections.contactsSearch=new ox.gui.PanelMenuSection(_("Search"),"contactsSearchSection").addTo(tab);section.add(ox.widgets.searchField.contacts)}var events={"contacts-edit-compose":"OX_Before_Create_Contact","contacts-edit-compose-clone":"OX_Before_Create_Contact","contacts-edit-composeDistributionList":"OX_Before_Create_Distributionlist","contacts-edit-edit":"OX_Contact_Edit","contacts-edit-print":"OX_Print","contacts-edit-duplicate":"OX_Contact_Duplicate","contacts-edit-move":"OX_Contact_Move","contacts-edit-copy":"OX_Contact_Copy","contacts-edit-delete":"OX_Contact_Delete","contacts-edit-vcard":"OX_Contact_SendVCard","contacts-edit-attachment-save":"OX_Attachment_Save","contacts-edit-attachment-save-infostore":"OX_Attachment_SaveInfoStore"};
var views={"contacts-view-cards":"cards","contacts-view-phonelist":"phonelist","contacts-view-detail":"detail"};ox.ToolBarController.addHandler(function(id){if(id in events){triggerEvent(events[id]);return true}if(id in views){menuswitchContactView(views[id]);return true}switch(id){case"contacts-edit-attachment-open":triggerEvent("OX_Attachment_Open");return true}return false});ox.api.event.register("OX_View_Changed",toggleAttachmentSection);toolbar.addTo(ox.widgets.toolBar.viewControl);ox.ToolBarController.processSelection("attachments",false,[],true);
ox.ToolBarController.setDefaultTab(toolbar,1)};ox.gui.initToolBarConfig=function($p){temporary.configuration={};var auto_id=0;temporary.configuration.newToolbar=function(title,sections,id){var ID=(id||auto_id++);var toolbar=new ox.gui.TabMenu($p.getOptions({id:"toolbar-"+ID,showSectionNames:false}));var tab=new ox.gui.PanelMenu("toolbar-"+ID+"-"+ID,title).addTo(toolbar);for(var i=0;i<sections.length;i++){var meta=sections[i];var section=sections[i]=new ox.gui.PanelMenuSection(meta.title);section.addTo(tab);
for(var j=0;j<meta.buttons.length;j++){var button=meta.buttons[j];if(button.event){button.action=(function(event){return function(){triggerEvent(event)}})(button.event);delete button.event}button.id=ID+"-"+(meta.id||i)+"-"+(button.id||j);var item=new ox.gui.MenuItem(button);ox.widgets.toolBar.menuItems[item.id]=item;section.add(item)}}toolbar.addTo(ox.widgets.toolBar.viewControl);toolbar.addListener("widget:togglehover",$p.resize);return toolbar};temporary.configuration.showToolbar=function(toolbar){ox.widgets.toolBar.viewControl.showView(toolbar.id);
toolbar.setPosition(0);jQuery(window).trigger("resize")};temporary.configuration.saveButton={title:_("Save"),buttons:[{title:_("Save"),icons:["img/menu/btn_save.gif"],big:true,event:"OX_SAVE_OBJECT"}]};temporary.configuration.defaultToolbar=temporary.configuration.newToolbar(_("Preferences"),[temporary.configuration.saveButton],"preferences")};ox.gui.initToolBarPermissions=function($p){var meta=$.extend(ox.widgets.toolBar.meta,{permissions:{save:{title:_("Save"),icons:["save.png"],big:true,action:function(){triggerEvent("OX_SAVE_OBJECT");
return true}},add:{title:_("Add user"),icons:["userrights.png"],action:function(){ox.api.folder.get({folder:configparentfolder!=-1?configparentfolder:configfolder,success:function(oFolder){triggerEvent("OX_Configuration_Add_User",oFolder)}});return true}},remove:{title:_("Remove user"),icons:["userrights_remove.png"],action:function(){triggerEvent("OX_Configuration_Remove_User");return true}},adminYes:{title:_("Administrator"),icons:["mod_configuration.png"],action:function(){changeRights("ADMIN",1)
},behavior:"radio",group:"permissions-admin"},adminNo:{title:_("User"),icons:["user.png"],action:function(){changeRights("ADMIN",0)},behavior:"radio",group:"permissions-admin"},folderNone:{title:_("None"),icons:["delete_folder.png"],action:function(){changeRights("FOLDER",0)},behavior:"radio",group:"permissions-folder"},folderVisible:{title:_("Visible folder"),icons:["folder_closed.png"],action:function(){changeRights("FOLDER",1)},behavior:"radio",group:"permissions-folder"},folderCreateObjects:{title:_("Create objects"),icons:["folder_closed.png"],action:function(){changeRights("FOLDER",2)
},behavior:"radio",group:"permissions-folder"},folderCreateFolders:{title:_("Create subfolders"),icons:["folder_opened.png"],action:function(){changeRights("FOLDER",4)},behavior:"radio",group:"permissions-folder"},folderMax:{title:_("Maximum"),icons:["folder_opened.png"],action:function(){changeRights("FOLDER",64)},behavior:"radio",group:"permissions-folder"},readNone:{title:_("None"),icons:["userrights_read.png"],action:function(){changeRights("READ",0)},behavior:"radio",group:"permissions-read"},readOwn:{title:_("Read own"),icons:["userrights_read.png"],action:function(){changeRights("READ",1)
},behavior:"radio",group:"permissions-read"},readAll:{title:_("Read all"),icons:["userrights_read.png"],action:function(){changeRights("READ",2)},behavior:"radio",group:"permissions-read"},readMax:{title:_("Maximum"),icons:["userrights_read.png"],action:function(){changeRights("READ",64)},behavior:"radio",group:"permissions-read"},modifyNone:{title:_("None"),icons:["userrights_write.png"],action:function(){changeRights("WRITE",0)},behavior:"radio",group:"permissions-write"},modifyOwn:{title:_("Modify own"),icons:["userrights_write.png"],action:function(){changeRights("WRITE",1)
},behavior:"radio",group:"permissions-write"},modifyAll:{title:_("Modify all"),icons:["userrights_write.png"],action:function(){changeRights("WRITE",2)},behavior:"radio",group:"permissions-write"},modifyMax:{title:_("Maximum"),icons:["userrights_write.png"],action:function(){changeRights("WRITE",64)},behavior:"radio",group:"permissions-write"},deleteNone:{title:_("None"),icons:["userrights_delete.png"],action:function(){changeRights("DELETE",0)},behavior:"radio",group:"permissions-delete"},deleteOwn:{title:_("Delete own"),icons:["userrights_delete.png"],action:function(){changeRights("DELETE",1)
},behavior:"radio",group:"permissions-delete"},deleteAll:{title:_("Delete all"),icons:["userrights_delete.png"],action:function(){changeRights("DELETE",2)},behavior:"radio",group:"permissions-delete"},deleteMax:{title:_("Maximum"),icons:["userrights_delete.png"],action:function(){changeRights("DELETE",64)},behavior:"radio",group:"permissions-delete"}}});var tabs=ox.widgets.toolBar.tabs;var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;var add=$p.add;toolbar=new ox.gui.TabMenu($p.getOptions({id:"toolbar-permissions",showSectionNames:false}));
configToolbars.folderPermissions=ox.widgets.toolBar.views.permissions=toolbar;tab=tabs.permissionsMain=new ox.gui.PanelMenu("toolbar-permissions-save",_("&Save")).addTo(toolbar);section=new ox.gui.PanelMenuSection(_("Save")).addTo(tab);add(section,meta.permissions,"permissions-save",["save","add","remove"]);tab=tabs.permissionsForFolders=new ox.gui.PanelMenu("toolbar-permissions-folder",_("&Folder permissions")).addTo(toolbar);section=new ox.gui.PanelMenuSection(_("Folder admin")).addTo(tab);add(section,meta.permissions,"permissions-folder",["adminYes","adminNo"]);
section=new ox.gui.PanelMenuSection(_("Folder permissions")).addTo(tab);add(section,meta.permissions,"permissions-folder",["folderNone","folderVisible","folderCreateObjects","folderCreateFolders","folderMax"]);tab=tabs.permissionsForObjects=new ox.gui.PanelMenu("toolbar-permissions-object",_("&Object permissions")).addTo(toolbar);section=new ox.gui.PanelMenuSection(pgettext("to","Read")).addTo(tab);add(section,meta.permissions,"permissions-object",["readNone","readOwn","readAll","readMax"]);section=new ox.gui.PanelMenuSection(_("Modify")).addTo(tab);
add(section,meta.permissions,"permissions-object",["modifyNone","modifyOwn","modifyAll","modifyMax"]);section=new ox.gui.PanelMenuSection(_("Delete")).addTo(tab);add(section,meta.permissions,"permissions-object",["deleteNone","deleteOwn","deleteAll","deleteMax"]);toolbar.addTo(ox.widgets.toolBar.viewControl)};ox.gui.initToolBarMessaging=function($p){var meta=$.extend(ox.widgets.toolBar.meta,{messaging:{"new":{title:_("New"),icons:["img/mail/btn_sendmail.gif"],big:true}}});var tabs=ox.widgets.toolBar.tabs;
var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;var add=$p.add;toolbar=ox.widgets.toolBar.views.messaging=new ox.gui.TabMenu($p.getOptions({id:"toolbar-messaging",showSectionNames:false}));tab=tabs.messaging=new ox.gui.PanelMenu("toolbar-messaging-new",_("&Messaging")).addTo(toolbar);section=new ox.gui.PanelMenuSection(_("Message")).addTo(tab);add(section,meta.messaging,"messaging",["new"]);ox.ToolBarController.addHandler(function(id){if(id=="messaging-new"){triggerEvent("NewMessage");
return true}return false});toolbar.addTo(ox.widgets.toolBar.viewControl)};ox.gui.initToolBarNewWindow=function(){ox.widgets={};var $m=ox.gui.initToolBar();var root=$("#window_toolbar_container")[0];var control=ox.widgets.toolBar.viewControl=new ox.gui.ViewControl("toolbar-view-control").removeCSSClass("oxStretch").setParentDOMNode(root).addTo(ox.desktop);corewindow.register("LanguageChanged",function(){ox.desktop.triggerGlobalEvent("LanguageChanged")});return $m};ox.gui.initToolBarNewWindowMail=function(){var $p=ox.gui.initToolBarNewWindow(),upsell=ox.api.window.core.ox.upsell;
var meta=$.extend(ox.widgets.toolBar.meta,{window_mail:{send:{title:_("Send"),icons:["mail_send.png"],big:true,selection:"default"},"save-draft":{title:_("Save draft"),icons:["mail_write.png"],big:true,requires:function(){return true}},view:{title:_("View"),big:true,icons:["options.png"]},from:{title:pgettext("who","From"),icons:["dummy.gif"],behavior:"checkbox",checked:ox.api.config.get("gui.mail.newmail_options.from")},"reply-to":{title:_("Reply-to"),icons:["dummy.gif"],behavior:"checkbox",visible:function(){return ox.api.config.get("ui.mail.replyTo.configurable",false)===true
},checked:function(){return ox.api.config.get("ui.mail.replyTo.configurable",false)===true&&ox.api.config.get("gui.mail.newmail_options.replyto",false)}},cc:{title:_("CC"),icons:["dummy.gif"],behavior:"checkbox",checked:ox.api.config.get("gui.mail.newmail_options.cc")},bcc:{title:_("BCC"),icons:["dummy.gif"],behavior:"checkbox",checked:ox.api.config.get("gui.mail.newmail_options.bcc")},options:{title:_("Options"),icons:["dummy.gif"],behavior:"checkbox",checked:ox.api.config.get("gui.mail.newmail_options.options")},editorToolbar:{title:_("Editor toolbar"),icons:["dummy.gif"],behavior:"checkbox",visible:function(){return ox.api.config.get("gui.mail.formatmessage")!=="TEXT/PLAIN"
},checked:function(){return ox.api.config.get("gui.mail.newmail_options.toolbar",true)}},"attachment-add":{title:_("Add attachment"),icons:["attachment_add.png"],big:true},"attachment-add-file":{title:_("Attach local file"),icons:["attachment_add.png"]},"attachment-add-infoitem":{title:_("Attach InfoItem"),icons:["attachment_add.png"],requires:function(ability){return ox.api.config.get("modules.infostore.module")},mousedown:function(options,e){if(ox.api.config.get("modules.infostore.module")==false){corewindow.triggerEvent("Feature_Not_Available","modules/mail/new/add_infostore_attachment",window)
}},visible:upsell.visible("infostore")},"attachment-remove":{title:_("Remove attachment"),icons:["attachment_remove.png"],selection:"attachments",requires:["some"],big:true},cancel:{title:_("Cancel"),big:true,icons:["cancel.png"]}}});var tabs=ox.widgets.toolBar.tabs;var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;var add=$p.add;toolbar=ox.widgets.toolBar.views.detailMail=new ox.gui.TabMenu($p.getOptions({id:"new-mail-menu",showSectionNames:false}));tab=tabs.newMailWindow=new ox.gui.PanelMenu("window-mail-main",_("&E-Mail")).addTo(toolbar);
section=new ox.gui.PanelMenuSection(_("Mail")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_mail,"mail_new",["send","save-draft"]);section=new ox.gui.PanelMenuSection(_("Mail")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_mail,"mail_new",["attachment-add","attachment-remove"]);add(items["mail_new-attachment-add"],ox.widgets.toolBar.meta.window_mail,"mail_new",["attachment-add-file","attachment-add-infoitem"]);section=new ox.gui.PanelMenuSection(_("View")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_mail,"mail_new",["view"]);
add(items["mail_new-view"],ox.widgets.toolBar.meta.window_mail,"mail_new",["from","reply-to","cc","bcc","options","editorToolbar"]);section=new ox.gui.PanelMenuSection(_("Cancel")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_mail,"mail_new",["cancel"]);toolbar.addTo(ox.widgets.toolBar.viewControl);$p.postInit();register("SubSelected",function(array){ox.ToolBarController.processSelection("attachments",false,array,true)});var events={"mail_new-send":"OX_SAVE_OBJECT","mail_new-save-draft":"OX_Save_Template_Object","mail_new-attachment-add-file":"OX_Object_Add_Attachment","mail_new-attachment-add-infoitem":"OX_Object_Add_Attachment_Infostore","mail_new-attachment-remove":"OX_Object_Attachment_Delete","mail_new-cancel":"OX_Cancel_Object"};
ox.ToolBarController.addHandler(function(id){var m;if(events[id]!==undefined){triggerEvent(events[id]);return true}switch(id){case"mail_new-from":triggerEvent("OX_New_Mail_Toggle_Additional_Header","from");return true;case"mail_new-reply-to":triggerEvent("OX_New_Mail_Toggle_Additional_Header","replyto");return true;case"mail_new-cc":triggerEvent("OX_New_Mail_Toggle_Additional_Header","cc");return true;case"mail_new-bcc":triggerEvent("OX_New_Mail_Toggle_Additional_Header","bcc");return true;case"mail_new-options":triggerEvent("OX_New_Mail_Toggle_Additional_Header","options");
return true;case"mail_new-editorToolbar":triggerEvent("OX_New_Mail_Toggle_Toolbar");return true}});ox.desktop.validate();ox.api.window.core.triggerEvent("OX_Window_Toolbar_Ready",{handle:window.url.guid,type:"mail"});ox.ToolBarController.processSelection("default",false,[],true);ox.ToolBarController.processSelection("attachments",false,[],true)};ox.gui.initToolBarNewWindowMailDetail=function(){var $p=ox.gui.initToolBarNewWindow();function isNestedMessage(){if("value" in isNestedMessage){return isNestedMessage.value
}var msg=ox.api.window.getData(url.guid).oNestedMessage;return isNestedMessage.value=Boolean(msg&&msg.length)}var meta=$.extend(ox.widgets.toolBar.meta,{mail:{edit:{title:_("Edit draft"),icons:["draft.png"],big:true,requires:function(ability){return isStdFolder("drafts")},visible:function(){return isStdFolder("drafts")}},reply:{title:_("Reply"),icons:["reply.png"],big:true,requires:function(){return !isNestedMessage()}},"reply-all":{title:_("Reply all"),icons:["reply_all.png"],big:true,requires:function(){return !isNestedMessage()
}},forward:{title:_("Forward"),icons:["forward.png"],big:true,requires:function(){return !isNestedMessage()}},"delete":{title:_("Delete"),icons:["delete.png"],big:true,requires:function(ability){return ability["delete"]&&!isNestedMessage()}},save:{title:_("Save"),icons:["send_as_link.png"]},"view-source":{title:_("Show source"),icons:["mail_source.png"]},print:{title:_("Print"),icons:["print.png"]},"mark-as":{title:_("Mark as"),icons:["mark_as.png"],requires:function(){return !isNestedMessage()}},"mark-as-read":{title:_("Read")},"mark-as-unread":{title:_("Unread")},"mark-as-answered":{title:_("Answered"),requires:["write"]},"mark-as-unanswered":{title:_("Unanswered"),requires:["write"]},"mark-as-deleted":{title:_("Deleted"),requires:["delete"]},"mark-as-undeleted":{title:_("Undeleted"),requires:["delete"]},copy:{title:_("Copy"),icons:["mail_copy.png"],requires:["some"]},cancel:{title:_("Close"),big:true,icons:["cancel.png"]}}});
(function(){var spamButton=ox.api.config.get("mail.spambutton",false);var spamFolder=ox.api.config.get("mail.folder.spam");var folder=url.folder;var accountId=ox.api.folder.derive("accountId",folder);if(spamButton===true&&accountId===0&&folder!==spamFolder){meta.mail.spam={title:_("Spam"),icons:["spam.png"]}}else{if(spamButton===true&&folder===spamFolder){meta.mail.ham={title:_("Not Spam"),icons:["ham.png"]}}}}());var tabs=ox.widgets.toolBar.tabs;var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;
var add=$p.add;toolbar=ox.widgets.toolBar.views.mail=new ox.gui.TabMenu($p.getOptions({id:"toolbar-mail",showSectionNames:false}));tab=tabs.mailEdit=new ox.gui.PanelMenu("toolbar-mail_detail-edit",_("&Edit")).addTo(toolbar);section=new ox.gui.PanelMenuSection(_("Edit")).addTo(tab);add(section,meta.mail,"mail_detail-edit",["edit","reply","reply-all","forward","delete","print","mark-as","save"]);if(meta.mail.spam){add(section,meta.mail,"mail_detail-edit",["spam"])}else{if(meta.mail.ham){add(section,meta.mail,"mail_detail-edit",["ham"])
}}add(section,meta.mail,"mail_detail-edit",["view-source"]);section=new ox.gui.PanelMenuSection(_("Cancel")).addTo(tab);add(section,ox.widgets.toolBar.meta.mail,"mail_detail",["cancel"]);add(items["mail_detail-edit-mark-as"],meta.mail,"mail_detail-edit",["mark-as-read","mark-as-unread","mark-as-answered","mark-as-unanswered","mark-as-deleted","mark-as-undeleted"]);tab=tabs.mailTagging=new ox.gui.PanelMenu("toolbar-mail_detail-tag",_("&Flags")).addTo(toolbar);section=new ox.gui.PanelMenuSection(_("Flags"),"mailFlagsSection").addTo(tab);
add(section,meta.flags,"mail_detail-flag",["0","1","2","3","4","5","6","7","8","9","10"]);var events={"mail_detail-compose-compose":"OX_NEW_MAIL","mail_detail-edit-reply":"OX_Mail_Reply","mail_detail-edit-reply-all":"OX_Mail_ReplyAll","mail_detail-edit-forward":"OX_Mail_Forward","mail_detail-edit-delete":"OX_Mail_Delete","mail_detail-edit-edit":"OX_Mail_Edit_Draft","mail_detail-edit-copy":"OX_Mail_Copy","mail_detail-edit-move":"OX_Mail_Move","mail_detail-edit-save":"OX_Mail_SaveMail","mail_detail-edit-view-source":"OX_Mail_Show_Source","mail_detail-edit-print":"OX_Print","mail_detail-cancel":"OX_Cancel_Object","mail_detail-edit-spam":"OX_Mail_Spam","mail_detail-edit-ham":"OX_Mail_Ham"};
var mailFlags={read:"seen",unread:"unseen",answered:"answer",unanswered:"answered",deleted:"delete",undeleted:"undelete"};ox.ToolBarController.addHandler(function(id){var m;if(events[id]!==undefined){triggerEvent(events[id]);return true}m=id.match(/^mail_detail-edit-mark-as-(\w+)$/);if(m&&m.length){triggerEvent("OX_Mail_Flag",mailFlags[m[1]]);return true}m=id.match(/^\w+-flag-(\d+)$/);if(m&&m.length){triggerEvent("OX_Add_Flag",m[1]);return true}});toolbar.addTo(ox.widgets.toolBar.viewControl);ox.desktop.validate();
ox.api.window.core.triggerEvent("OX_Window_Toolbar_Ready",{handle:window.url.guid,type:"maildetail"});ox.ToolBarController.processSelection("default",false,[],true)};ox.gui.initToolBarNewWindowCalendar=function(){var $p=ox.gui.initToolBarNewWindow(),upsell=ox.api.window.core.ox.upsell;var meta=$.extend(ox.widgets.toolBar.meta,{window_calendar:{save:{title:_("Save"),icons:["save.png"],big:true},"add-participant":{title:_("Add participant"),icons:["member_add.png"],big:true,requires:function(){return ox.api.config.get("participants.showDialog")
},mousedown:function(options,e){if(ox.api.config.get("participants.showDialog")==false){corewindow.triggerEvent("Feature_Not_Available","modules/calendar/new/add_participants",window)}},visible:upsell.visible("participants")},"add-external-participant":{title:_("Add external participant"),icons:["distributionlist_extcontact.png"],big:true,requires:function(){return ox.api.config.get("participants.showDialog")},mousedown:function(options,e){if(ox.api.config.get("participants.showDialog")==false){corewindow.triggerEvent("Feature_Not_Available","modules/calendar/new/add_participants",window)
}},visible:upsell.visible("participants")},"remove-participant":{title:_("Remove participant"),icons:["member_remove.png"],big:true,selection:"participants",requires:function(ability){return currentpath[1]==="participant"&&ox.api.config.get("participants.showDialog")&&ability.some},mousedown:function(options,e){if(ox.api.config.get("participants.showDialog")==false){corewindow.triggerEvent("Feature_Not_Available","modules/calendar/new/remove_participants",window)}},visible:upsell.visible("participants")},"attachment-add":{title:_("Add attachment"),icons:["attachment_add.png"],selection:"attachments",requires:function(){return ox.api.config.get("modules.infostore.module")
},mousedown:function(options,e){if(ox.api.config.get("modules.infostore.module")==false){corewindow.triggerEvent("Feature_Not_Available","modules/calendar/new/add_attachment",window)}},visible:upsell.visible("infostore")},"attachment-remove":{title:_("Remove attachment"),icons:["attachment_remove.png"],selection:"attachments",requires:function(ability,selection){return currentpath[1]==="attachment"&&ox.api.config.get("modules.infostore.module")&&ability.some},mousedown:function(options,e){if(ox.api.config.get("modules.infostore.module")==false){corewindow.triggerEvent("Feature_Not_Available","modules/calendar/new/delete_attachment",window)
}},visible:upsell.visible("infostore")},cancel:{title:_("Cancel"),icons:["cancel.png"],big:true}}});var tabs=ox.widgets.toolBar.tabs;var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;var add=$p.add;toolbar=ox.widgets.toolBar.views.calendar=new ox.gui.TabMenu($p.getOptions({id:"new-calendar-menu",showSectionNames:false}));tab=tabs.newCalendarWindow=new ox.gui.PanelMenu("window-calendar-main",_("Appointment")).addTo(toolbar);section=new ox.gui.PanelMenuSection(_("New")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_calendar,"calendar_new",["save"]);
if(upsell.isVisible("participants")){section=new ox.gui.PanelMenuSection(_("Participants")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_calendar,"calendar_new",["add-participant","add-external-participant","remove-participant"])}if(upsell.isVisible("infostore")){section=new ox.gui.PanelMenuSection(_("Attachments")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_calendar,"calendar_new",["attachment-add","attachment-remove"])}section=new ox.gui.PanelMenuSection(_("Cancel")).addTo(tab);
add(section,ox.widgets.toolBar.meta.window_calendar,"calendar_new",["cancel"]);register("OX_View_Changed",function(){ox.ToolBarController.processSelection("default",false,[],true);ox.ToolBarController.processSelection("participants",false,newAppointment.participants.participantsGridBig.selection.getSelected(),true);ox.ToolBarController.processSelection("attachments",false,newAppointment.attachmentGrid?newAppointment.attachmentGrid.liveGrid.selection.getSelected():[],true)});var events={"calendar_new-save":"OX_SAVE_OBJECT","calendar_new-add-participant":"OX_Object_Add_Participant","calendar_new-add-external-participant":"OX_Object_Open_External","calendar_new-remove-participant":"OX_Object_Participant_Delete","calendar_new-cancel":"OX_Cancel_Object","calendar_new-attachment-add":"OX_Object_Add_Attachment","calendar_new-attachment-remove":"OX_Object_Attachment_Delete"};
ox.ToolBarController.addHandler(function(id){if(events[id]!==undefined){if(id==="calendar_new-add-participant"||id==="calendar_new-add-external-participant"){changeView("calendar_new/participant")}else{if(id==="calendar_new-attachment-add"){changeView("calendar_new/attachment")}}triggerEvent(events[id]);return true}});toolbar.addTo(ox.widgets.toolBar.viewControl);$p.postInit();ox.desktop.validate();triggerEvent("OX_View_Changed");ox.api.window.core.triggerEvent("OX_Window_Toolbar_Ready",{handle:window.url.guid,type:"calendar"});
ox.ToolBarController.processSelection("participants",false,[],true);ox.ToolBarController.processSelection("attachments",false,[],true)};ox.gui.initToolBarNewWindowContact=function(){var $p=ox.gui.initToolBarNewWindow(),upsell=corewindow.ox.upsell;var meta=$.extend(ox.widgets.toolBar.meta,{window_contact:{save:{title:_("Save"),icons:["save.png"],big:true},"add-picture":{title:_("Add picture"),icons:["picture_add.png"],big:true},"remove-picture":{title:_("Remove picture"),icons:["picture_remove.png"],big:true},"attachment-add":{title:_("Add attachment"),icons:["attachment_add.png"],big:false,requires:function(){return ox.api.config.get("modules.infostore.module")
},mousedown:function(options,e){if(ox.api.config.get("modules.infostore.module")==false){corewindow.triggerEvent("Feature_Not_Available","modules/contacts/new/add_attachment",window)}},visible:upsell.visible("infostore")},"attachment-remove":{title:_("Remove attachment"),icons:["attachment_remove.png"],selection:"attachments",requires:function(ability){return currentpath[1]==="attachment"&&ox.api.config.get("modules.infostore.module")&&ability.some},mousedown:function(options,e){if(ox.api.config.get("modules.infostore.module")==false){corewindow.triggerEvent("Feature_Not_Available","modules/contacts/new/delete_attachment",window)
}},big:false,visible:upsell.visible("infostore")},cancel:{title:_("Cancel"),big:true,icons:["cancel.png"]}}});var tabs=ox.widgets.toolBar.tabs;var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;var add=$p.add;toolbar=ox.widgets.toolBar.views.contact=new ox.gui.TabMenu($p.getOptions({id:"new-contact-menu",showSectionNames:false}));tab=tabs.newMailWindow=new ox.gui.PanelMenu("window-contact-main",_("Contact")).addTo(toolbar);section=new ox.gui.PanelMenuSection(_("Contact")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_contact,"contact_new",["save"]);
section=new ox.gui.PanelMenuSection(_("Picture")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_contact,"contact_new",["add-picture","remove-picture"]);if(upsell.isVisible("infostore")&&upsell.isVisible("contacts-attachments")){section=new ox.gui.PanelMenuSection(_("Attachment")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_contact,"contact_new",["attachment-add","attachment-remove"])}section=new ox.gui.PanelMenuSection(_("Cancel")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_contact,"contact_new",["cancel"]);
toolbar.addTo(ox.widgets.toolBar.viewControl);$p.postInit();register("OX_View_Changed",function(){ox.ToolBarController.processSelection("default",false,[],true);ox.ToolBarController.processSelection("attachments",false,tmp_attachment?tmp_attachment.liveGrid.selection.getSelected():[],true)});var events={"contact_new-save":"OX_SAVE_OBJECT","contact_new-attachment-add":"OX_Object_Add_Attachment","contact_new-attachment-remove":"OX_Object_Attachment_Delete","contact_new-add-picture":"OX_Picture_Add","contact_new-remove-picture":"OX_Picture_Remove","contact_new-cancel":"OX_Cancel_Object"};
ox.ToolBarController.addHandler(function(id){if(events[id]!==undefined){if(id==="contact_new-add-picture"||id==="contact_new-remove-picture"){changeView("contact_new/personal")}else{if(id==="contact_new-attachment-add"){changeView("contact_new/attachment")}}triggerEvent(events[id]);return true}});ox.desktop.validate();triggerEvent("OX_View_Changed");ox.api.window.core.triggerEvent("OX_Window_Toolbar_Ready",{handle:window.url.guid,type:"contact"});ox.ToolBarController.processSelection("attachments",false,[],true)
};ox.gui.initToolBarNewWindowTask=function(){var $p=ox.gui.initToolBarNewWindow();var meta=$.extend(ox.widgets.toolBar.meta,{window_task:{save:{title:_("Save"),icons:["save.png"],big:true},"add-participant":{title:_("Add participant"),icons:["member_add.png"],requires:function(){return ox.api.config.get("participants.showDialog")},big:true,mousedown:function(options,e){if(ox.api.config.get("participants.showDialog")==false){corewindow.triggerEvent("Feature_Not_Available","modules/tasks/new/add_participants",window)
}}},"add-external-participant":{title:_("Add external participant"),icons:["distributionlist_extcontact.png"],requires:function(){return ox.api.config.get("participants.showDialog")},big:true,mousedown:function(options,e){if(ox.api.config.get("participants.showDialog")==false){corewindow.triggerEvent("Feature_Not_Available","modules/tasks/new/add_participants",window)}}},"remove-participant":{title:_("Remove participant"),icons:["member_remove.png"],selection:"participants",requires:function(ability){return currentpath[1]==="participant"&&ox.api.config.get("participants.showDialog")&&ability.some
},big:true,mousedown:function(options,e){if(ox.api.config.get("participants.showDialog")==false){corewindow.triggerEvent("Feature_Not_Available","modules/tasks/new/remove_participants",window)}}},"attachment-add":{title:_("Add attachment"),icons:["attachment_add.png"],requires:function(){return ox.api.config.get("modules.infostore.module")},mousedown:function(options,e){if(ox.api.config.get("modules.infostore.module")==false){corewindow.triggerEvent("Feature_Not_Available","modules/tasks/new/add_attachment",window)
}},visible:corewindow.ox.upsell.visible("infostore")},"attachment-remove":{title:_("Remove attachment"),icons:["attachment_remove.png"],selection:"attachments",requires:function(ability){return currentpath[1]==="attachment"&&ox.api.config.get("modules.infostore.module")&&ability.some},mousedown:function(options,e){if(ox.api.config.get("modules.infostore.module")==false){corewindow.triggerEvent("Feature_Not_Available","modules/tasks/new/delete_attachment",window)}},visible:corewindow.ox.upsell.visible("infostore")},cancel:{title:_("Cancel"),big:true,icons:["cancel.png"]}}});
var tabs=ox.widgets.toolBar.tabs;var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;var add=$p.add;toolbar=ox.widgets.toolBar.views.task=new ox.gui.TabMenu($p.getOptions({id:"new-task-menu",showSectionNames:false}));tab=tabs.newMailWindow=new ox.gui.PanelMenu("window-task-main",_("&New Task")).addTo(toolbar);section=new ox.gui.PanelMenuSection(_("Task")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_task,"task_new",["save"]);if(corewindow.ox.upsell.isVisible("participants")){section=new ox.gui.PanelMenuSection(_("Participants")).addTo(tab);
add(section,ox.widgets.toolBar.meta.window_task,"task_new",["add-participant","add-external-participant","remove-participant"])}if(corewindow.ox.upsell.isVisible("infostore")){section=new ox.gui.PanelMenuSection(_("Attachment"),"task_newAttachmentSection").addTo(tab);add(section,ox.widgets.toolBar.meta.window_task,"task_new",["attachment-add","attachment-remove"])}section=new ox.gui.PanelMenuSection(_("Cancel")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_task,"task_new",["cancel"]);toolbar.addTo(ox.widgets.toolBar.viewControl);
$p.postInit();register("OX_View_Changed",function(){ox.ToolBarController.processSelection("default",false,[],true);ox.ToolBarController.processSelection("participants",false,tmp_participant.participantsGridBig.selection.getSelected(),true);ox.ToolBarController.processSelection("attachments",false,tmp_attachment?tmp_attachment.liveGrid.selection.getSelected():[],true)});var events={"task_new-save":"OX_SAVE_OBJECT","task_new-add-participant":"OX_Object_Add_Participant","task_new-add-external-participant":"OX_Object_Open_External","task_new-remove-participant":"OX_Object_Participant_Delete","task_new-attachment-add":"OX_Object_Add_Attachment","task_new-attachment-remove":"OX_Object_Attachment_Delete","task_new-cancel":"OX_Cancel_Object"};
ox.ToolBarController.addHandler(function(id){if(events[id]!==undefined){if(id==="task_new-add-participant"||id==="task_new-add-external-participant"){changeView("task_new/participant")}else{if(id==="task_new-attachment-add"){changeView("task_new/attachment")}}triggerEvent(events[id]);return true}});ox.desktop.validate();triggerEvent("OX_View_Changed");ox.api.window.core.triggerEvent("OX_Window_Toolbar_Ready",{handle:window.url.guid,type:"task"});ox.ToolBarController.processSelection("participants",false,[],true);
ox.ToolBarController.processSelection("attachments",false,[],true)};ox.gui.initToolBarNewWindowDistributionlist=function(){var $p=ox.gui.initToolBarNewWindow();var meta=$.extend(ox.widgets.toolBar.meta,{window_distributionlist:{save:{title:_("Save"),icons:["save.png"],big:true},add:{title:_("Add from adressbook"),icons:["member_add.png"],big:true},custom:{title:_("Custom form"),icons:["distributionlist_extcontact.png"],big:true},"delete":{title:_("Delete"),icons:["member_remove.png"],selection:"contact",requires:["some"],big:true},cancel:{title:_("Cancel"),big:true,icons:["cancel.png"]}}});
var tabs=ox.widgets.toolBar.tabs;var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;var add=$p.add;toolbar=ox.widgets.toolBar.views.distributionlist=new ox.gui.TabMenu($p.getOptions({id:"new-distribution-menu",showSectionNames:false}));tab=tabs.newMailWindow=new ox.gui.PanelMenu("window-distributionlist-main",_("&Distributionlist")).addTo(toolbar);section=new ox.gui.PanelMenuSection(_("Distribution list")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_distributionlist,"contact_new",["save"]);
section=new ox.gui.PanelMenuSection(_("Contact")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_distributionlist,"contact_new",["add","custom","delete"]);section=new ox.gui.PanelMenuSection(_("Cancel")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_distributionlist,"contact_new",["cancel"]);toolbar.addTo(ox.widgets.toolBar.viewControl);$p.postInit();register("SubSelected",function(){ox.ToolBarController.processSelection("contact",false,distruBigGrid.selection.getSelected(),true)});
var events={"contact_new-save":"OX_SAVE_OBJECT","contact_new-add":"OX_Object_Distributionlist_Internal_Contact","contact_new-custom":"OX_Object_Distributionlist_External_Mail","contact_new-delete":"OX_Object_Distributionlist_Delete","contact_new-cancel":"OX_Cancel_Object"};ox.ToolBarController.addHandler(function(id){var m;if(events[id]!==undefined){triggerEvent(events[id]);return true}});ox.desktop.validate();ox.ToolBarController.processSelection("contact",false,[],true);ox.ToolBarController.processSelection("default",false,[],true);
setTimeout(function(){triggerEvent("SubSelected")},10)};ox.gui.initToolBarNewWindowInfoStore=function(){var $p=ox.gui.initToolBarNewWindow();var meta=$.extend(ox.widgets.toolBar.meta,{window_infostore:{save:{title:_("Save"),icons:["save.png"],big:true},cancel:{title:_("Cancel"),big:true,icons:["cancel.png"]}}});var tabs=ox.widgets.toolBar.tabs;var items=ox.widgets.toolBar.menuItems;var toolbar,tab,section;var add=$p.add;toolbar=ox.widgets.toolBar.views.infostore=new ox.gui.TabMenu($p.getOptions({id:"new-infostore-menu",showSectionNames:false}));
tab=tabs.newMailWindow=new ox.gui.PanelMenu("window-infostore-main",_("File")).addTo(toolbar);section=new ox.gui.PanelMenuSection(_("Save")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_infostore,"infostore_new",["save"]);section=new ox.gui.PanelMenuSection(_("Cancel")).addTo(tab);add(section,ox.widgets.toolBar.meta.window_infostore,"infostore_new",["cancel"]);toolbar.addTo(ox.widgets.toolBar.viewControl);$p.postInit();register("OX_View_Changed",function(){ox.ToolBarController.processSelection("default",false,[],true)
});var events={"infostore_new-save":"OX_SAVE_OBJECT","infostore_new-cancel":"OX_Cancel_Object"};ox.ToolBarController.addHandler(function(id){var m;if(events[id]!==undefined){triggerEvent(events[id]);return true}});ox.desktop.validate();triggerEvent("OX_View_Changed");ox.ToolBarController.processSelection("participants",false,[],true);ox.ToolBarController.processSelection("attachments",false,[],true)}}());
