var CONTROL_KEY=1,SHIFT_KEY=2,CONTROL_SHIFT_KEY=3;
function roundcube_browser(){var a=navigator;this.ver=parseFloat(a.appVersion);this.appver=a.appVersion;this.agent=a.userAgent;this.agent_lc=a.userAgent.toLowerCase();this.name=a.appName;this.vendor=a.vendor?a.vendor:"";this.vendver=a.vendorSub?parseFloat(a.vendorSub):0;this.product=a.product?a.product:"";this.platform=String(a.platform).toLowerCase();this.lang=a.language?a.language.substring(0,2):a.browserLanguage?a.browserLanguage.substring(0,2):a.systemLanguage?a.systemLanguage.substring(0,2):
"en";this.win=this.platform.indexOf("win")>=0;this.mac=this.platform.indexOf("mac")>=0;this.linux=this.platform.indexOf("linux")>=0;this.unix=this.platform.indexOf("unix")>=0;this.dom=document.getElementById?true:false;this.dom2=document.addEventListener&&document.removeEventListener;this.ie4=(this.ie=document.all&&!window.opera)&&!this.dom;this.ie5=this.dom&&this.appver.indexOf("MSIE 5")>0;this.ie8=this.dom&&this.appver.indexOf("MSIE 8")>0;this.ie7=this.dom&&this.appver.indexOf("MSIE 7")>0;this.ie6=
this.dom&&!this.ie8&&!this.ie7&&this.appver.indexOf("MSIE 6")>0;this.mz=this.dom&&this.ver>=5;this.ns6=(this.ns=this.ver<5&&this.name=="Netscape"||this.ver>=5&&this.vendor.indexOf("Netscape")>=0)&&parseInt(this.vendver)==6;this.ns7=this.ns&&parseInt(this.vendver)==7;this.chrome=this.agent_lc.indexOf("chrome")>0;this.safari=!this.chrome&&(this.agent_lc.indexOf("safari")>0||this.agent_lc.indexOf("applewebkit")>0);this.konq=this.agent_lc.indexOf("konqueror")>0;this.iphone=this.safari&&this.agent_lc.indexOf("iphone")>
0;this.ipad=this.safari&&this.agent_lc.indexOf("ipad")>0;if((this.opera=window.opera?true:false)&&window.RegExp)this.vendver=/opera(\s|\/)([0-9\.]+)/.test(this.agent_lc)?parseFloat(RegExp.$2):-1;else if(this.chrome&&window.RegExp)this.vendver=/chrome\/([0-9\.]+)/.test(this.agent_lc)?parseFloat(RegExp.$1):0;else if(!this.vendver&&this.safari)this.vendver=/(safari|applewebkit)\/([0-9]+)/.test(this.agent_lc)?parseInt(RegExp.$2):0;else if(!this.vendver&&this.mz||this.agent.indexOf("Camino")>0)this.vendver=
/rv:([0-9\.]+)/.test(this.agent)?parseFloat(RegExp.$1):0;else if(this.ie&&window.RegExp)this.vendver=/msie\s+([0-9\.]+)/.test(this.agent_lc)?parseFloat(RegExp.$1):0;else if(this.konq&&window.RegExp)this.vendver=/khtml\/([0-9\.]+)/.test(this.agent_lc)?parseFloat(RegExp.$1):0;if(this.safari&&/;\s+([a-z]{2})-[a-z]{2}\)/.test(this.agent_lc))this.lang=RegExp.$1;this.dhtml=this.ie4&&this.win||this.ie5||this.ie6||this.ns4||this.mz;this.vml=this.win&&this.ie&&this.dom&&!this.opera;this.pngalpha=this.mz||
this.opera&&this.vendver>=6||this.ie&&this.mac&&this.vendver>=5||this.ie&&this.win&&this.vendver>=5.5||this.safari;this.opacity=this.mz||this.ie&&this.vendver>=5.5&&!this.opera||this.safari&&this.vendver>=100;this.cookies=a.cookieEnabled;this.xmlhttp_test=function(){var b=new Function("try{var o=new ActiveXObject('Microsoft.XMLHTTP');return true;}catch(err){return false;}");return this.xmlhttp=window.XMLHttpRequest||window.ActiveXObject&&b()};this.set_html_class=function(){var b=" js";if(this.ie){b+=
" ie";if(this.ie5)b+=" ie5";else if(this.ie6)b+=" ie6";else if(this.ie7)b+=" ie7";else if(this.ie8)b+=" ie8"}else if(this.opera)b+=" opera";else if(this.konq)b+=" konqueror";else if(this.safari)b+=" safari";if(this.chrome)b+=" chrome";else if(this.iphone)b+=" iphone";else if(this.ipad)b+=" ipad";else if(this.ns6)b+=" netscape6";else if(this.ns7)b+=" netscape7";if(document.documentElement)document.documentElement.className+=b}}
var rcube_event={get_target:function(a){return(a=a||window.event)&&a.target?a.target:a.srcElement},get_keycode:function(a){return(a=a||window.event)&&a.keyCode?a.keyCode:a&&a.which?a.which:0},get_button:function(a){return(a=a||window.event)&&typeof a.button!="undefined"?a.button:a&&a.which?a.which:0},get_modifier:function(a){var b=0;a=a||window.event;if(bw.mac&&a){b+=(a.metaKey&&CONTROL_KEY)+(a.shiftKey&&SHIFT_KEY);return b}if(a){b+=(a.ctrlKey&&CONTROL_KEY)+(a.shiftKey&&SHIFT_KEY);return b}},get_mouse_pos:function(a){if(!a)a=
window.event;var b=a.pageX?a.pageX:a.clientX,c=a.pageY?a.pageY:a.clientY;if(document.body&&document.all){b+=document.body.scrollLeft;c+=document.body.scrollTop}if(a._offset){b+=a._offset.left;c+=a._offset.top}return{x:b,y:c}},add_listener:function(a){if(a.object&&a.method){if(!a.element)a.element=document;if(!a.object._rc_events)a.object._rc_events=[];var b=a.event+"*"+a.method;a.object._rc_events[b]||(a.object._rc_events[b]=function(c){return a.object[a.method](c)});if(a.element.addEventListener)a.element.addEventListener(a.event,
a.object._rc_events[b],false);else if(a.element.attachEvent){a.element.detachEvent("on"+a.event,a.object._rc_events[b]);a.element.attachEvent("on"+a.event,a.object._rc_events[b])}else a.element["on"+a.event]=a.object._rc_events[b]}},remove_listener:function(a){if(!a.element)a.element=document;var b=a.event+"*"+a.method;if(a.object&&a.object._rc_events&&a.object._rc_events[b])if(a.element.removeEventListener)a.element.removeEventListener(a.event,a.object._rc_events[b],false);else if(a.element.detachEvent)a.element.detachEvent("on"+
a.event,a.object._rc_events[b]);else a.element["on"+a.event]=null},cancel:function(a){a=a?a:window.event;a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();a.cancelBubble=true;return a.returnValue=false},touchevent:function(a){return{pageX:a.pageX,pageY:a.pageY,offsetX:a.pageX-a.target.offsetLeft,offsetY:a.pageY-a.target.offsetTop,target:a.target,istouch:true}}};function rcube_event_engine(){this._events={}}
rcube_event_engine.prototype={addEventListener:function(a,b,c){if(!this._events)this._events={};this._events[a]||(this._events[a]=[]);this._events[a][this._events[a].length]={func:b,obj:c?c:window}},removeEventListener:function(a,b,c){if(typeof c=="undefined")c=window;for(var d,e=0;this._events&&this._events[a]&&e<this._events[a].length;e++)if((d=this._events[a][e])&&d.func==b&&d.obj==c)this._events[a][e]=null},triggerEvent:function(a,b){var c,d;if(typeof b=="undefined")b=this;else if(typeof b=="object")b.event=
a;if(this._events&&this._events[a]&&!this._event_exec){this._event_exec=true;for(var e=0;e<this._events[a].length;e++)if(d=this._events[a][e]){if(typeof d.func=="function")c=d.func.call?d.func.call(d.obj,b):d.func(b);else if(typeof d.obj[d.func]=="function")c=d.obj[d.func](b);if(typeof c!="undefined"&&!c)break}}this._event_exec=false;return c}};
function rcube_layer(a,b){this.name=a;this.create=function(c){var d=c.x?c.x:0,e=c.y?c.y:0,f=c.width,g=c.height,i=c.zindex,j=c.vis;c=c.parent;var h=document.createElement("DIV");with(h){a=this.name;with(style){position="absolute";visibility=j?j==2?"inherit":"visible":"hidden";left=d+"px";top=e+"px";if(f)width=f.toString().match(/\%$/)?f:f+"px";if(g)height=g.toString().match(/\%$/)?g:g+"px";if(i)zIndex=i}}c?c.appendChild(h):document.body.appendChild(h);this.elm=h};if(b!=null){this.create(b);this.name=
this.elm.id}else this.elm=document.getElementById(a);if(!this.elm)return false;this.css=this.elm.style;this.event=this.elm;this.width=this.elm.offsetWidth;this.height=this.elm.offsetHeight;this.x=parseInt(this.elm.offsetLeft);this.y=parseInt(this.elm.offsetTop);this.visible=this.css.visibility=="visible"||this.css.visibility=="show"||this.css.visibility=="inherit"?true:false;this.move=function(c,d){this.x=c;this.y=d;this.css.left=Math.round(this.x)+"px";this.css.top=Math.round(this.y)+"px"};this.resize=
function(c,d){this.css.width=c+"px";this.css.height=d+"px";this.width=c;this.height=d};this.show=function(c){if(c==1){this.css.visibility="visible";this.visible=true}else if(c==2){this.css.visibility="inherit";this.visible=true}else{this.css.visibility="hidden";this.visible=false}};this.write=function(c){this.elm.innerHTML=c}}
function rcube_check_email(a,b){if(a&&window.RegExp)return(b?RegExp("(^|<|[,;s\n])([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x22([^\\x0d\\x22\\x5c\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x22)(\\x2e([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x22([^\\x0d\\x22\\x5c\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x22))*\\x40([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x5b([^\\x0d\\x5b-\\x5d\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x5d)(\\x2e([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x5b([^\\x0d\\x5b-\\x5d\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x5d))*($|>|[,;s\n])","i"):
RegExp("^([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x22([^\\x0d\\x22\\x5c\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x22)(\\x2e([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x22([^\\x0d\\x22\\x5c\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x22))*\\x40([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x5b([^\\x0d\\x5b-\\x5d\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x5d)(\\x2e([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x5b([^\\x0d\\x5b-\\x5d\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x5d))*$",
"i")).test(a)?true:false;return false}function rcube_clone_object(a){var b={},c;for(c in a)b[c]=a[c]&&typeof a[c]=="object"?clone_object(a[c]):a[c];return b}function urlencode(a){return window.encodeURIComponent?encodeURIComponent(a):escape(a)}
function rcube_find_object(a,b){var c,d;b||(b=document);if(b.getElementsByName&&(c=b.getElementsByName(a)))d=c[0];if(!d&&b.getElementById)d=b.getElementById(a);if(!d&&b.all)d=b.all[a];if(!d&&b.images.length)d=b.images[a];if(!d&&b.forms.length)for(c=0;c<b.forms.length;c++)if(b.forms[c].name==a)d=b.forms[c];else if(b.forms[c].elements[a])d=b.forms[c].elements[a];if(!d&&b.layers){if(b.layers[a])d=b.layers[a];for(c=0;!d&&c<b.layers.length;c++)d=rcube_find_object(a,b.layers[c].document)}return d}
function rcube_mouse_is_over(a,b){var c=rcube_event.get_mouse_pos(a),d=$(b).offset();return c.x>=d.left&&c.x<d.left+b.offsetWidth&&c.y>=d.top&&c.y<d.top+b.offsetHeight}function setCookie(a,b,c,d,e,f){a=a+"="+escape(b)+(c?"; expires="+c.toGMTString():"")+(d?"; path="+d:"")+(e?"; domain="+e:"")+(f?"; secure":"");document.cookie=a}
function getCookie(a){var b=document.cookie;a=a+"=";var c=b.indexOf("; "+a);if(c==-1){c=b.indexOf(a);if(c!=0)return null}else c+=2;var d=document.cookie.indexOf(";",c);if(d==-1)d=b.length;return unescape(b.substring(c+a.length,d))}roundcube_browser.prototype.set_cookie=setCookie;roundcube_browser.prototype.get_cookie=getCookie;
function rcube_console(){this.log=function(a){var b=rcube_find_object("dbgconsole");if(b){a+=a.charAt(a.length-1)=="\n"?"--------------------------------------\n":"\n--------------------------------------\n";if(bw.konq){b.innerText+=a;b.value=b.innerText}else b.value+=a}};this.reset=function(){var a=rcube_find_object("dbgconsole");if(a)a.innerText=a.value=""}}var bw=new roundcube_browser;bw.set_html_class();window.console||(console=new rcube_console);
RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};if(bw.ie){document._getElementById=document.getElementById;document.getElementById=function(a){var b=0,c=document._getElementById(a);if(c&&c.id!=a)for(;(c=document.all[b])&&c.id!=a;)b++;return c}};
