/**
 * Roundcube functions for default skin interface
 *
 * Copyright (c) 2013, The Roundcube Dev Team
 *
 * The contents are subject to the Creative Commons Attribution-ShareAlike
 * License. It is allowed to copy, distribute, transmit and to adapt the work
 * by keeping credits to the original autors in the README file.
 * See http://creativecommons.org/licenses/by-sa/3.0/ for details.
 *
 * @license magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0-1.0
 */
/*
 magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0-1.0
*/
function rcube_mail_ui(){function e(a){p||(p=rcmail.local_storage_get_item("prefs.larry",{}));if(null==p[a]){var c=rcmail.get_cookie(a);null!=c&&(p[a]=c,rcmail.local_storage_set_item("prefs.larry",p)&&rcmail.set_cookie(a,c,new Date))}return p[a]}function q(a,c){p[a]=c;if(!rcmail.local_storage_set_item("prefs.larry",p)){var d=new Date;d.setYear(d.getFullYear()+1);rcmail.set_cookie(a,c,d)}}function r(a){a=a?10:0;rcmail.resize_timeout&&window.clearTimeout(rcmail.resize_timeout);rcmail.resize_timeout=
window.setTimeout(function(){"mail"==rcmail.env.task&&("show"==rcmail.env.action||"preview"==rcmail.env.action?b():"compose"==rcmail.env.action&&t());$("body.iframe .footerleft").each(function(){var a=$(this),d=$(document.body),b=a.hasClass("floating"),f=d.outerHeight(!0)>$(window).height();f!=b&&(b=f?"addClass":"removeClass",a[b]("floating"),d[b]("floatingbuttons"))})},a)}function k(a){var c=$(a.object).siblings("div");c.length&&$(a.object).insertBefore(c.first());if("error"==a.type&&"login"!=rcmail.env.task){rcmail.hide_message(a.object);
l.message_timer&&window.clearTimeout(l.message_timer);l.messagedialog||(l.messagedialog=$("<div>").addClass("popupdialog").hide());c=a.message;var d=function(){l.messagedialog.is(":visible")&&l.messagedialog.dialog("destroy").hide()};l.messagedialog.is(":visible")&&l.messagedialog.text()!=c&&(c=l.messagedialog.html()+"<p>"+a.message+"</p>");l.messagedialog.html(c).dialog({resizable:!1,closeOnEscape:!0,dialogClass:a.type,title:rcmail.gettext("errortitle"),close:d,hide:{effect:"fadeOut"},width:420,
minHeight:90}).show();l.messagedialog.closest("div[role=dialog]").attr("role","alertdialog");0<a.timeout&&(l.message_timer=window.setTimeout(d,a.timeout))}}function w(a){var c=a?a.new_layout:rcmail.env.layout,d=$("#mailview-top"),b=$("#mailview-bottom");a&&$("#mainscreencontent").removeClass().addClass(c);$("#mailviewsplitter")["desktop"==c?"show":"hide"]();$("#mailviewsplitter2")["widescreen"==c?"show":"hide"]();$("#mailpreviewframe")["list"!=c?"show":"hide"]();rcmail.env.contentframe="list"==c?
null:"messagecontframe";"widescreen"==c?($("#countcontrols").detach().appendTo($("#messagelistheader")),d.css({height:"auto",width:394}),b.css({top:0,left:406,height:"auto"}).show(),x?x.resize():(x=new rcube_splitter({id:"mailviewsplitter2",p1:"#mailview-top",p2:"#mailview-bottom",orientation:"v",relative:!0,start:416,min:400,size:12}),x.init())):"desktop"==c?(d.css({height:270,width:"auto"}),b.css({left:0,top:284,height:"auto"}).show(),y?y.resize():(y=new rcube_splitter({id:"mailviewsplitter",p1:"#mailview-top",
p2:"#mailview-bottom",orientation:"h",relative:!0,start:276,min:150,size:12,offset:4}),y.init())):(d.css({height:"auto",width:"auto"}),b.hide());a&&"widescreen"==a.old_layout&&$("#countcontrols").detach().appendTo($("#messagelistfooter"))}function b(){$("#messagecontent").css("top",$("#messageheader").outerHeight()+1+"px");$("#message-objects div a").addClass("button");$("#attachment-list li").length||($("div.rightcol").hide().attr("aria-hidden","true"),$("div.leftcol").css("margin-right","0"));var a=
$("#messagebody.mailvelope, #messagebody > .mailvelope");if(a.length){var c=$("#messagecontent").length?$("#messagecontent").height()-16:$(window).height()-a.offset().top-2;a.height(c)}}function n(a){}function I(a){}function J(a){if("TEXTAREA"==a.nodeName){var c=$(a),d=a.scrollHeight;c.css("height",14*(80<a.value.length&&21<d?2:1)+"px");t()}}function t(){var a=$("#composebody"),c=$("#compose-content"),d=$("#composeview-bottom");var b=c.height()-d.position().top;var f=300-b;d.height(Math.max(300,b));
c.css("overflow",0<f?"auto":"hidden");c=a.parent().width()-5;d=a.parent().height()-8;a.width(c).height(d);$("#composebodycontainer > div").width(c+8);$("#composebody_ifr").height(d+4-$("div.mce-toolbar").height());$("#googie_edit_layer").width(c).height(d);a=$("#directorylist");a.length&&$("#compose-contacts .scroller").css("top",a.position().top+a.outerHeight())}function D(a){var c=$("#quotadisplay"),d=$("#quotamenu"),b=a.total?24*Math.ceil(a.percent/100*20):0;a.total&&480==b&&100>a.percent&&(b-=
24);c.css("background-position","0 -"+b+"px");c.attr("class","countdisplay p"+10*Math.round(a.percent/10));a.table&&(d.length||(d=$('<div id="quotamenu" class="popupmenu">').appendTo($("body"))),d.html(a.table),c.css("cursor","pointer").off("click").on("click",function(a){return rcmail.command("menu-open","quotamenu",a.target,a)}))}function K(a){$(".boxtitle a.search",a).click(function(c){var d=$(".boxtitle",a),b=$(".listsearchbox",a),f=b.is(":visible")?-1:1,m=34+($("select",b).length?22:0);b.slideToggle({duration:160,
progress:function(c,b){0>f&&(b=1-b);$(".scroller",a).css("top",d.outerHeight()+m*b+"px")},complete:function(){b.toggleClass("expanded");b.is(":visible")?(b.find("input[type=text]").focus(),m=34+($("select",b).length?$("select",b).outerHeight()+4:0),$(".scroller",a).css("top",d.outerHeight()+m+"px")):$("a.reset",b).click()}});return!1})}function P(a){"reply-list"==a.command&&1==rcmail.env.reply_all_mode?(a=rcmail.gettext(a.status?"replylist":"replyall"),"preview"==rcmail.env.action?$("a.button.replyall").attr("title",
a):$("a.button.reply-all").text(a).attr("title",a)):"compose-encrypted"==a.command&&$("a.button.encrypt").show()}function E(a,c){var b=z[a]=$("#"+a);b.appendTo(document.body);b.length&&(u[a]=$.extend(u[a]||{},c||{}))}function L(){$("#preview-shortheaders").toggle();var a=$("#preview-allheaders").toggle(),c=$("a#previewheaderstoggle");a.is(":visible")?c.attr("href","#hide").removeClass("add").addClass("remove").attr("aria-expanded","true"):c.attr("href","#details").removeClass("remove").addClass("add").attr("aria-expanded",
"false");q("previewheaders",a.is(":visible")?"1":"0")}function A(a,c){if(c||!$("#mail"+a+"mode").hasClass("disabled"))$("#maillistmode, #mailthreadmode").removeClass("selected").attr("tabindex","0").attr("aria-disabled","false"),$("#mail"+a+"mode").addClass("selected").attr("tabindex","-1").attr("aria-disabled","true")}function B(a){if(a&&"messagelistmenu"==a.name)Q(a);else if(a){var c=u[a.name]||{},b=$(c.link||"#"+a.name+"link"),g=a.obj&&a.obj.is(":visible");if(a.obj&&g&&b.length){var f=b.parent();
$(window);f.hasClass("dropbutton")&&(b=f);if(c.above||b.hasClass("dropbutton"))f=b.offset(),a.obj.css({left:f.left+"px",top:f.top+(c.above?-a.obj.height():b.outerHeight())+"px"})}a.obj&&c.iconized&&a.obj.children("ul").addClass("iconized");a.obj&&c.editable&&a.obj.attr("data-editable","true");"function"==typeof c.callback&&c.callback(g,a)}}function R(a,c){var b=a.parentNode.id.replace(/^attach/,"");$.each(["open","download","rename"],function(){var a=this;$("#attachmenu"+a).off("click").attr("onclick",
"").click(function(c){return rcmail.command(a+"-attachment",b,this)})});u.attachmentmenu.link=a;rcmail.command("menu-open",{menu:"attachmentmenu",id:b},a,c)}function F(a){a=$(a);a.children(".drop").length||a.append($('<a class="drop skip-content" tabindex="0" aria-haspopup="true">Show options</a>').on("click keypress",function(a){if("keypress"!=a.type||13==rcube_event.get_keycode(a))return R(this,a),!1}))}function Q(a){var b=$("#listoptions");b.is(":visible")?b.dialog("close",a.originalEvent):($('input[name="sort_col"][value="'+
rcmail.env.sort_col+'"]').prop("checked",!0),$('input[name="sort_ord"][value="DESC"]').prop("checked","DESC"==rcmail.env.sort_order),$('input[name="sort_ord"][value="ASC"]').prop("checked","DESC"!=rcmail.env.sort_order),$.each(["widescreen","desktop","list"],function(){$('input[name="layout"][value="'+this+'"]').prop("checked",rcmail.env.layout==this)}),$("#listoptions-columns",b)["widescreen"==rcmail.env.layout?"hide":"show"](),$('input[name="list_col[]"]').each(function(){$(this).prop("checked",
-1!=$.inArray(this.value,rcmail.env.listcols))}),b.dialog({modal:!0,resizable:!1,closeOnEscape:!0,title:null,open:function(a){setTimeout(function(){b.find("a, input:not(:disabled)").not("[aria-disabled=true]").first().focus()},100)},close:function(a){b.dialog("destroy").hide();a.originalEvent&&rcube_event.is_keyboard(a.originalEvent)&&$("#listmenulink").focus()},minWidth:500,width:b.width()+25}).show())}function S(a){$("#listoptions").dialog("close");rcube_event.is_keyboard(a.originalEvent)&&$("#listmenulink").focus();
a=$('input[name="sort_col"]:checked').val();var b=$('input[name="sort_ord"]:checked').val(),d=$('input[name="layout"]:checked').val(),g=$('input[name="list_col[]"]:checked').map(function(){return this.value}).get();rcmail.set_list_options(g,a,b,rcmail.env.threading,d)}function T(a){a=$("#contacts-table");var b=a.parent().css("overflow","hidden");a.clone().css({position:"absolute",top:"0",left:"0",width:a.width()+"px","z-index":10}).appendTo(b).animate({left:-(a.width()+5)+"px"},300,"swing",function(){$(this).remove();
b.css("overflow","auto")})}function U(a){a=$("#contacts-table");var b=a.parent().css("overflow","hidden"),d=a.clone().appendTo(b);a.css({position:"absolute",top:"0",left:-(a.width()+5)+"px",width:a.width()+"px",height:a.height()+"px","z-index":10}).animate({left:"0"},300,"linear",function(){d.remove();$(this).css({position:"relative",left:"0",width:"100%",height:"auto","z-index":1});b.css("overflow","auto")})}function C(a){var b=$("#upload-dialog");b.is(":visible")?b.dialog("close"):rcmail.mailvelope_editor||
("compose"!=rcmail.env.action||b.data("extended")||($("<a>").addClass("iconlink add").attr("href","#add").html("Add").appendTo($('input[type="file"]',b).parent()).click(M),b.data("extended",!0)),b.dialog({modal:!0,resizable:!1,closeOnEscape:!0,title:b.attr("title"),open:function(a){document.all||$("input[type=file]",b).first().click()},close:function(){try{$("#upload-dialog form").get(0).reset()}catch(d){}b.dialog("destroy").hide();$("div.addline",b).remove()},width:480}).show())}function M(a){a=
$(this).parent();a=a.clone().addClass("addline").insertAfter(a);a.children(".iconlink").click(M);a.children("input").val("");document.all||$("input[type=file]",a).click()}function G(a,b){var c=$("#compose-"+a);if(!c.is(":visible"))return H[a]&&!b&&$("#_"+a).val(H[a]),c.show(),$("#"+a+"-link").hide(),t(),$("input,textarea",c).focus(),!1}function N(a,b){a=$(a);var c=a.get(0).id,g=a.children("fieldset");if(g.length){c||(c="rcmtabcontainer",a.attr("id",c));var f=$("<ul>").addClass("tabsbar").prependTo(a);
g.each(function(a){var b=$(this),d=b.children("legend"),m=c+"-t"+a;var g=$("<a>").text(d.text()).attr("href","#"+m);a=$("<li>").addClass("tablink");d.remove();b.attr("id",m);a.append(g).appendTo(f)});a.tabs({active:b||0,heightStyle:"content",activate:function(a,b){r()}})}}var v={},z={},u={forwardmenu:{editable:1},searchmenu:{editable:1,callback:function(a){if(a&&rcmail.env.search_mods){var b;a=$('input:checkbox[name="s_mods[]"]',z.searchmenu);var d=rcmail.env.mailbox,g=rcmail.env.search_mods,f=rcmail.env.search_scope||
"base";if("mail"==rcmail.env.task){"all"==f&&(d="*");g=g[d]?g[d]:g["*"];var m="text";$('input:radio[name="s_scope"]').prop("checked",!1).filter("#s_scope_"+f).prop("checked",!0)}else m="*";if(g[m])a.map(function(){this.checked=!0;this.disabled=this.value!=m});else for(b in a.prop("disabled",!1).prop("checked",!1),g)$("#s_mod_"+b).prop("checked",!0)}}},attachmentmenu:{},listoptions:{editable:1},groupmenu:{above:1},mailboxmenu:{above:1},spellmenu:{callback:function(a,b){var c,g=rcmail.spellcheck_lang(),
f=$("ul",b.obj);if(!f.length){f=$('<ul class="toolbarmenu selectable" role="menu">');for(c in rcmail.env.spell_langs){var m=$('<li role="menuitem">');a=$('<a href="#'+c+'" tabindex="0"></a>').text(rcmail.env.spell_langs[c]).addClass("active").data("lang",c).on("click keypress",function(a){if("keypress"!=a.type||13==rcube_event.get_keycode(a))return rcmail.spellcheck_lang_set($(this).data("lang")),rcmail.hide_menu("spellmenu",a),!1});a.appendTo(m);m.appendTo(f)}f.appendTo(b.obj)}$("li",f).each(function(){var a=
$("a",this);a.data("lang")==g?a.addClass("selected").attr("aria-selected","true"):a.hasClass("selected")&&a.removeClass("selected").removeAttr("aria-selected")})}},"folder-selector":{iconized:1}},l=this,y,x,H={},p;this.set=function(a,b){v[a]=b};this.init=function(){rcmail.addEventListener("message",k);$("#taskbar a").each(function(a,b){$(b).append('<span class="tooltip">'+$(".button-inner",this).html()+"</span>")});$("#taskbar .minmodetoggle").click(function(a){a=$(document.body).toggleClass("minimal").hasClass("minimal");
q("minimalmode",a?1:0);$(window).resize()});if("mail"==rcmail.env.task){rcmail.addEventListener("menu-open",B).addEventListener("menu-close",B).addEventListener("menu-save",S).addEventListener("enable-command",P).addEventListener("responseafterlist",function(a){A(rcmail.env.threading?"thread":"list",!0)}).addEventListener("responseaftersearch",function(a){A(rcmail.env.threading?"thread":"list",!0)});var a=$("#dragmessagemenu");a.length&&(rcmail.gui_object("dragmenu","dragmessagemenu"),z.dragmenu=
a);if("show"==rcmail.env.action||"preview"==rcmail.env.action)rcmail.addEventListener("aftershow-headers",function(){b()}).addEventListener("afterhide-headers",function(){b()}),$("#previewheaderstoggle").click(function(a){L();this.blur&&!rcube_event.is_keyboard(a)&&this.blur();return!1}),$("#attachment-list > li").each(function(){F(this)}),"1"==e("previewheaders")&&L(),"show"==rcmail.env.action&&$("#messagecontent").focus();else if("compose"==rcmail.env.action){rcmail.addEventListener("aftersend-attachment",
C).addEventListener("fileappended",function(a){a.attachment.complete&&F(a.item)}).addEventListener("aftertoggle-editor",function(a){window.setTimeout(function(){t()},200);a&&a.mode&&$("select[name='editorSelector']").val(a.mode)}).addEventListener("compose-encrypted",function(a){$("select[name='editorSelector']").prop("disabled",a.active);$("a.button.attach, a.button.responses")[a.active?"addClass":"removeClass"]("disabled");$("#responseslist a.insertresponse")[a.active?"removeClass":"addClass"]("active")});
var c=["cc","bcc","replyto","followupto"];for(a=0;a<c.length;a++){var d=c[a];var g=$("#_"+d);g.length&&(g.on("change",{v:d},function(a){this.value&&G(a.data.v,!0)}),""!=g.val()&&G(d,!0))}$("#composeoptionstoggle").click(function(a){var b=$("#composeoptions").toggle().is(":visible");$("#composeoptionstoggle").toggleClass("remove").attr("aria-expanded",b?"true":"false");t();q("composeoptions",b?"1":"0");rcube_event.is_keyboard(a)||this.blur();return!1}).css("cursor","pointer");"0"!==e("composeoptions")&&
$("#composeoptionstoggle").click();$("textarea[name='_to'], textarea[name='_cc'], textarea[name='_bcc']").change(function(a){J(this)}).change();rcmail.addEventListener("autocomplete_insert",function(a){J(a.field)});(a=rcmail.opener())&&"compose"==a.env.action&&$("#composeoptionstoggle",opener.document).hasClass("remove")&&$("#composeoptionstoggle").click();(new rcube_splitter({id:"composesplitterv",p1:"#composeview-left",p2:"#composeview-right",orientation:"v",relative:!0,start:206,min:170,size:12,
render:t})).init();$("#attachment-list > li").each(function(){F(this)})}else"list"!=rcmail.env.action&&rcmail.env.action?"get"==rcmail.env.action&&(new rcube_splitter({id:"mailpartsplitterv",p1:"#messagepartheader",p2:"#messagepartcontainer",orientation:"v",relative:!0,start:226,min:150,size:12})).init():(w(),$("#maillistmode").addClass(rcmail.env.threading?"":"selected").click(function(a){A("list");return!1}),$("#mailthreadmode").addClass(rcmail.env.threading?"selected":"").click(function(a){A("thread");
return!1}),rcmail.init_pagejumper("#pagejumper"),rcmail.addEventListener("setquota",D).addEventListener("layout-change",w).addEventListener("afterimport-messages",C));$("#mailview-left").length&&(new rcube_splitter({id:"mailviewsplitterv",p1:"#mailview-left",p2:"#mailview-right",orientation:"v",relative:!0,start:206,min:150,size:12,callback:n,render:I})).init()}else if("settings"==rcmail.env.task)if(rcmail.addEventListener("init",function(){var a="#settingstabpreferences";rcmail.env.action&&(a="#settingstab"+
(0<rcmail.env.action.indexOf("identity")?"identities":rcmail.env.action.replace(/\./g,"")));$(a).addClass("selected").children().first().removeAttr("onclick").click(function(){return!1})}),"folders"==rcmail.env.action)(new rcube_splitter({id:"folderviewsplitter",p1:"#folderslist",p2:"#folder-details",orientation:"v",relative:!0,start:266,min:180,size:12})).init(),rcmail.addEventListener("setquota",D),K($("#folderslist"));else if("identities"==rcmail.env.action)(new rcube_splitter({id:"identviewsplitter",
p1:"#identitieslist",p2:"#identity-details",orientation:"v",relative:!0,start:266,min:180,size:12})).init();else if("responses"==rcmail.env.action)(new rcube_splitter({id:"responseviewsplitter",p1:"#identitieslist",p2:"#identity-details",orientation:"v",relative:!0,start:266,min:180,size:12})).init();else if("preferences"==rcmail.env.action||!rcmail.env.action)(new rcube_splitter({id:"prefviewsplitter",p1:"#sectionslist",p2:"#preferences-box",orientation:"v",relative:!0,start:266,min:180,size:12})).init();
else{if("edit-prefs"==rcmail.env.action){a=$("#preferences-details fieldset.advanced legend");var f=$('<a href="#toggle"></a>').text(rcmail.gettext("toggleadvancedoptions")).attr("title",rcmail.gettext("toggleadvancedoptions")).addClass("advanced-toggle");a.click(function(a){f.html($(this).hasClass("collapsed")?"&#9650;":"&#9660;");$(this).toggleClass("collapsed").closest("fieldset").children(".propform").toggle()}).append(f).addClass("collapsed");bw.mz&&a.parents("form").css("display","inline")}}else"addressbook"==
rcmail.env.task&&(rcmail.addEventListener("afterupload-photo",C).addEventListener("beforepushgroup",T).addEventListener("beforepopgroup",U).addEventListener("menu-open",B).addEventListener("menu-close",B),""==rcmail.env.action&&((new rcube_splitter({id:"addressviewsplitterd",p1:"#addressview-left",p2:"#addressview-right",orientation:"v",relative:!0,start:206,min:150,size:12,render:I})).init(),(new rcube_splitter({id:"addressviewsplitter",p1:"#addresslist",p2:"#contacts-box",orientation:"v",relative:!0,
start:266,min:260,size:12})).init()),a=$("#dragcontactmenu"),a.length&&(rcmail.gui_object("dragmenu","dragcontactmenu"),z.dragmenu=a));$(".tabbed").each(function(a,b){N(b)});$("select.decorated").each(function(){if(bw.opera)$(this).removeClass("decorated");else{var a=$(this),b=a.parent(),c=Math.max(a.height(),26)-2,d=a.width()-22,f=$("option",this).first().text();""!=$("option:selected",this).val()&&(f=$("option:selected",this).text());var g=$('<a class="menuselector" tabindex="-1"><span class="handle">'+
f+"</span></a>").css("position","absolute").offset(a.position()).insertAfter(a);g.children().width(d).height(c).css("line-height",c-1+"px");"absolute"!=b.css("position")&&b.css("position","relative");a.width(g.width()).on(bw.mz?"change keyup":"change",function(){var a=$("option:selected",this).text();$(this).next().children().text(a)});a.on("focus",function(a){g.addClass("focus")}).on("blur",function(a){g.removeClass("focus")})}});a=$("body.minwidth");a.length&&a.css("min-width",$(".toolbar").width()+
$("#quicksearchbar").width()+$("#searchfilter").width()+30);window.onresize=r;r()};this.init_tabs=N;this.show_about=function(a){var b=$("<iframe>").attr({id:"aboutframe",src:rcmail.url("settings/about"),frameborder:"0"});h=Math.floor(.75*$(window).height());buttons={};supportln=$("#supportlink");supportln.length&&(v.supporturl=supportln.attr("href"))&&(buttons[supportln.html()]=function(a){0>v.supporturl.indexOf("mailto:")?window.open(v.supporturl):location.href=v.supporturl});b.dialog({modal:!0,
resizable:!1,closeOnEscape:!0,title:a?a.title||a.innerHTML:null,close:function(){b.dialog("destroy").remove()},buttons:buttons,width:640,height:h}).width(640)};this.show_popup=function(a,b,d){!d&&u[a]||E(a,d);d=u[a]||{};d=$(d.link?d.link:"#"+a+"link");var c=d.offset();d.has(".inner")&&(d=d.children(".inner"));return rcmail.command("menu-open",{menu:a,show:b},d.get(0),$.Event("click",{target:d.get(0),pageX:c.left,pageY:c.top,clientX:c.left,clientY:c.top}))};this.toggle_popup=function(a,b,d){!d&&u[a]||
E(a,d);return rcmail.command("menu-open",a,b.target,b)};this.add_popup=E;this.set_searchmod=function(a){var b=rcmail.env.task;var d=rcmail.env.search_mods,g=rcmail.env.mailbox;"all"==$('input[name="s_scope"]:checked').val()&&(g="*");d||(d={});if("mail"==b){d[g]||(d[g]=rcube_clone_object(d["*"]));var f=d[g];b="text"}else f=d,b="*";a.checked?f[a.value]=1:delete f[a.value];a.value==b&&$('input:checkbox[name="s_mods[]"]').map(function(){this!=a&&(this.checked=!0,a.checked?(this.disabled=!0,delete f[this.value]):
(this.disabled=!1,f[this.value]=1))});rcmail.set_searchmods(f)};this.set_searchscope=function(a){rcmail.set_searchscope(a.value)};this.show_uploadform=C;this.show_header_row=G;this.hide_header_row=function(a){var b=$("#_"+a);H[a]=b.val();b.val("");$("#compose-"+a).hide();$("#"+a+"-link").show();t();return!1};this.update_quota=D;this.get_pref=e;this.save_pref=q;this.folder_search_init=K;if(window.$&&document.body){var O=e("minimalmode");(parseInt(O)||null===O&&850>$(window).height())&&$(document.body).addClass("minimal");
bw.tablet&&$("#viewport").attr("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0");$(document).ready(function(){l.init()})}}
function rcube_scroller(e,q,r){var k=this;this.list=$(e);this.top=$(q);this.bottom=$(r);this.step_size=6;this.step_time=20;this.delay=500;this.top.mouseenter(function(){rcmail.drag_active&&(k.ts=window.setTimeout(function(){k.scroll("down")},k.delay))}).mouseout(function(){k.ts&&window.clearTimeout(k.ts)});this.bottom.mouseenter(function(){rcmail.drag_active&&(k.ts=window.setTimeout(function(){k.scroll("up")},k.delay))}).mouseout(function(){k.ts&&window.clearTimeout(k.ts)});this.scroll=function(e){var b=
this,n=this.step_size;rcmail.drag_active&&("down"==e&&(n*=-1),this.list.get(0).scrollTop+=n,this.ts=window.setTimeout(function(){b.scroll(e)},this.step_time))}}
function rcube_splitter(e){function q(n){if(bw.konq||bw.chrome||bw.safari)document.body.style.webkitUserSelect="none";b.p1pos=b.relative?b.p1.position():b.p1.offset();b.p2pos=b.relative?b.p2.position():b.p2.offset();b.drag_active=!0;$(document).on("mousemove."+this.id,r).on("mouseup."+this.id,k);rcmail.message_list&&(rcmail.message_list.drag_active=!0);$("iframe").each(function(b,n){$("<div>").attr("id","iframe-splitter-fix-"+b).addClass("iframe-splitter-fix").css({background:"#fff",width:n.offsetWidth+
"px",height:n.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css($(this).offset()).appendTo("body")})}function r(n){if(!b.drag_active)return!1;window.clearTimeout(b.ts);b.ts=window.setTimeout(function(){var e=rcube_event.get_mouse_pos(n);if(b.relative){var k=b.parent.offset();e.x-=k.left;e.y-=k.top}b.horizontal?e.y-b.halfsize>b.p1pos.top&&e.y+b.halfsize<b.p2pos.top+b.p2.outerHeight()&&(b.pos=Math.max(b.min,e.y-Math.max(0,b.offset)),b.pos>b.min&&(b.pos=Math.min(b.pos,b.parent.height()-
b.min)),b.resize()):e.x-b.halfsize>b.p1pos.left&&e.x+b.halfsize<b.p2pos.left+b.p2.outerWidth()&&(b.pos=Math.max(b.min,e.x-Math.max(0,b.offset)),b.pos>b.min&&(b.pos=Math.min(b.pos,b.parent.width()-b.min)),b.resize());b.p1pos=b.relative?b.p1.position():b.p1.offset();b.p2pos=b.relative?b.p2.position():b.p2.offset()},1);return!1}function k(e){if(bw.konq||bw.chrome||bw.safari)document.body.style.webkitUserSelect="auto";$(document).off("."+b.id);b.drag_active=!1;rcmail.message_list&&(rcmail.message_list.drag_active=
!1);$("div.iframe-splitter-fix").remove();b.set_cookie();"function"==typeof b.callback&&b.callback(b);return bw.safari?!0:rcube_event.cancel(e)}function w(e){b.horizontal?(e=parseInt(b.parent.outerHeight(),10)-parseInt(b.p2[0].style.top,10),b.p2.css("height",(0<e?e:0)+"px")):(e=parseInt(b.parent.outerWidth(),10)-parseInt(b.p2[0].style.left,10),b.p2.css("width",(0<e?e:0)+"px"))}this.p=e;this.id=e.id;this.horizontal="horizontal"==e.orientation||"h"==e.orientation;this.halfsize=(void 0!==e.size?e.size:
10)/2;this.pos=e.start||0;this.min=e.min||20;this.offset=e.offset||0;this.relative=e.relative?!0:!1;this.drag_active=!1;this.render=e.render;this.callback=e.callback;var b=this;rcube_splitter._instances[this.id]=b;this.init=function(){this.p1=$(this.p.p1);this.p2=$(this.p.p2);this.parent=this.p1.parent();if(this.p1.length&&this.p2.length){this.p1pos=this.relative?this.p1.position():this.p1.offset();this.p2pos=this.relative?this.p2.position():this.p2.offset();this.handle=$("<div>").attr("id",this.id).attr("unselectable",
"on").attr("role","presentation").addClass("splitter "+(this.horizontal?"splitter-h":"splitter-v")).appendTo(this.parent).mousedown(q);if(this.horizontal){var b=this.p1pos.top+this.p1.outerHeight();this.handle.css({left:"0px",top:b+"px"})}else b=this.p1pos.left+this.p1.outerWidth(),this.handle.css({left:b+"px",top:"0px"});bw.ie&&$(window).resize(w);(b=this.get_cookie())&&!isNaN(b)?(this.pos=parseFloat(b),this.resize()):this.pos&&(this.resize(),this.set_cookie())}};this.resize=function(){if(this.horizontal){if(this.p1.css("height",
Math.floor(this.pos-this.p1pos.top-Math.floor(this.halfsize))+"px"),this.p2.css("top",Math.ceil(this.pos+Math.ceil(this.halfsize)+2)+"px"),this.handle.css("top",Math.round(this.pos-this.halfsize+this.offset)+"px"),bw.ie){var b=parseInt(this.parent.outerHeight(),10)-parseInt(this.p2.css("top"),10);this.p2.css("height",(0<b?b:0)+"px")}}else this.p1.css("width",Math.floor(this.pos-this.p1pos.left-Math.floor(this.halfsize))+"px"),this.p2.css("left",Math.ceil(this.pos+Math.ceil(this.halfsize))+"px"),this.handle.css("left",
Math.round(this.pos-this.halfsize+this.offset+3)+"px"),bw.ie&&(b=parseInt(this.parent.outerWidth(),10)-parseInt(this.p2.css("left"),10),this.p2.css("width",(0<b?b:0)+"px"));this.p2.resize();this.p1.resize();this.drag_active&&$("iframe").each(function(b,e){var k=$(this).offset();$("#iframe-splitter-fix-"+b).css({top:k.top+"px",left:k.left+"px",width:e.offsetWidth+"px",height:e.offsetHeight+"px"})});"function"==typeof this.render&&this.render(this)};this.get_cookie=function(){return window.UI?UI.get_pref(this.id):
null};this.set_cookie=function(){window.UI&&UI.save_pref(this.id,this.pos)}}rcube_splitter._instances={};rcube_splitter.get_instance=function(e){return rcube_splitter._instances[e]};
