Index: trunk/prototype/modules/mail/js/followupflag.min.js
===================================================================
--- trunk/prototype/modules/mail/js/followupflag.min.js	(revision 7538)
+++ trunk/prototype/modules/mail/js/followupflag.min.js	(revision 7538)
@@ -0,0 +1,49 @@
+MsgsCallbackFollowupflag={"#FollowupflagMessageIdError":function(){alert("N\u00e3o foi poss\u00edvel sinalizar esta mensagem. \nDetalhes do erro: mensagem n\u00e3o cont\u00e9m o atributo message-id.")},"#FollowupflagLimitError":function(){alert("N\u00e3o foi poss\u00edvel sinalizar esta mensagem. \nDetalhes do erro: limite de flags atingido para esta pasta.")},"#FollowupflagParamsError":function(){alert("N\u00e3o foi poss\u00edvel sinalizar esta mensagem. \nDetalhes do erro: mensagem n\u00e3o cont\u00e9m todos os atributos necess\u00e1rios.")}};
+function updateCacheFollowupflag(msgNumber,msgFolder,op){if(op){if(typeof msgNumber=="object")var extend=DataLayer.get("followupflagged",{filter:["AND",["IN","messageNumber",msgNumber],["IN","folderName",msgFolder]],criteria:{deepness:1}},true);else var extend=DataLayer.get("followupflagged",{filter:["AND",["=","messageNumber",msgNumber],["=","folderName",msgFolder]],criteria:{deepness:1}},true);if(extend!=""||extend!="undefined"||extend!=[])for(var i=0;i<extend.length;i++){if(!onceOpenedHeadersMessages[extend[i].folderName])onceOpenedHeadersMessages[extend[i].folderName]=
+{};if(!onceOpenedHeadersMessages[extend[i].folderName][extend[i].messageNumber])onceOpenedHeadersMessages[extend[i].folderName][extend[i].messageNumber]=[];onceOpenedHeadersMessages[extend[i].folderName][extend[i].messageNumber]["followupflagged"]={};DataLayer.merge(onceOpenedHeadersMessages[extend[i].folderName][extend[i].messageNumber]["followupflagged"],extend[i])}}else onceOpenedHeadersMessages[msgFolder][msgNumber]["followupflagged"]=undefined}
+function init_followup(data){winElement=data.window;selectedMessageIds=data.selectedMessages;folder=current_folder;(function($){$.widget("ui.combobox",{_create:function(){var self=this,select=this.element.hide(),selected=select.children(":selected"),value=selected.val()?selected.text():"";var input=this.input=$("<input>").insertAfter(select).val(value).autocomplete({delay:0,minLength:0,source:function(request,response){var matcher=new RegExp($.ui.autocomplete.escapeRegex(request.term),"i");response(select.children("option").map(function(){var text=
+$(this).text();if(this.value&&(!request.term||matcher.test(text)))return{label:text.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+$.ui.autocomplete.escapeRegex(request.term)+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>"),value:text,option:this}}))},select:function(event,ui){ui.item.option.selected=true;self._trigger("selected",event,{item:ui.item.option})},change:function(event,ui){if(!ui.item){var matcher=new RegExp("^"+$.ui.autocomplete.escapeRegex($(this).val())+"$","i"),valid=false;select.children("option").each(function(){if($(this).text().match(matcher)){this.selected=
+valid=true;return false}});if(!valid)if(select.has('option[value="custom"]').length>0)select.find("option:last").val("custom").html($(this).val()).attr("selected","selected");else{select.append(select.find("option:last").clone().val("custom").html($(this).val()));select.find('option[value="custom"]').attr("selected","selected")}}}}).addClass("ui-widget ui-widget-content ui-corner-left");input.data("autocomplete")._renderItem=function(ul,item){return $("<li></li>").data("item.autocomplete",item).append("<a>"+
+item.label+"</a>").appendTo(ul)};this.button=$("<button type='button'>&nbsp;</button>").attr("tabIndex",-1).attr("title","Show All Items").insertAfter(input).button({icons:{primary:"ui-icon-triangle-1-s"},text:false}).removeClass("ui-corner-all").addClass("ui-corner-right ui-button-icon").click(function(){if(input.autocomplete("widget").is(":visible")){input.autocomplete("close");return}$(this).blur();input.autocomplete("search","");input.focus()})},destroy:function(){this.input.remove();this.button.remove();
+this.element.show();$.Widget.prototype.destroy.call(this)}})})(jQuery);winElement.find('input[name="alarmDate"]').change(function(event){winElement.find('input[name="alarmTime"]').attr("disabled",$(this).val()==""?"disabled":false)});winElement.find('input[name="alarmDate"]').keyup(function(event){winElement.find('input[name="alarmTime"]').attr("disabled",$(this).val()==""?"disabled":false).val("")});winElement.find(".button").button().filter(".menu-configure-followupflag .cancel").click(function(){winElement.dialog("close")}).end().filter(".menu-configure-followupflag .save").click(function(){var saveFollowupflagged=
+function(){var idFollowupflagged=winElement.find('[name="followupflagId"]').val();idFollowupflagged=idFollowupflagged.split(",");for(x=0;x<idFollowupflagged.length;x++)idFollowupflagged[x]=="false"?idFollowupflagged[x]=false:idFollowupflagged;for(i=0;i<selectedMessageIds.length;i++){var isDone=winElement.find('[name="done"]').is(":checked")?1:0;var alarmDate=false;var doneDate=false;var folder_name;var folders=[];var messages=[];var roles=get_selected_messages_search_role().split(",");for(var i=0;i<
+selectedMessageIds.length;i++){if(currentTab==0){folder_name=current_folder;var messageNumber=selectedMessageIds[i]}else{var tr=$('[role="'+roles[i]+'"]');folder_name=$(tr).attr("name");var id=$(tr).attr("id");var messageNumber=id.replace(/_[a-zA-Z0-9]+/,"")}folders.push(folder_name);var followupflagged=DataLayer.merge({uid:User.me.id,followupflagId:followupflagId,folderName:folder_name,messageNumber:messageNumber,isDone:isDone,isSent:0,backgroundColor:backgroundColor},!!idFollowupflagged[i]?{id:idFollowupflagged[i]}:
+{});if(alarmDate=winElement.find('[name="alarmDate"]').datepicker("getDate")){if(alarmTime=winElement.find('[name="alarmTime"]').datepicker("getDate"))alarmDate.set({hour:alarmTime.getHours(),minute:alarmTime.getMinutes()});followupflagged.alarmDeadline=alarmDate.toString("yyyy-MM-dd HH:mm:ss")}if(doneDate=winElement.find('[name="doneDate"]').datepicker("getDate")){if(doneTime=winElement.find('[name="doneTime"]').datepicker("getDate"))doneDate.set({hour:doneTime.getHours(),minute:doneTime.getMinutes()});
+followupflagged.doneDeadline=doneDate.toString("yyyy-MM-dd HH:mm:ss")}if(current_folder==folder_name)var flagged=$("#td_message_followup_"+messageNumber+', tr[role="'+messageNumber+"_"+folder_name+'"] #td_message_followup_search_'+messageNumber).find(".flag-edited");else var flagged=$('tr[role="'+messageNumber+"_"+folder_name+'"] #td_message_followup_search_'+messageNumber).find(".flag-edited");if(isDone)flagged.find("img").attr("src","../prototype/modules/mail/img/flagChecked.png").css("margin-left",
+"-3px");else flagged.find("img").attr("src","../prototype/modules/mail/img/flagEditor.png").css("margin-left","0");var followupflagName=winElement.find('[name="name"] option:selected').text();if(current_folder==folder_name)$("#td_message_followup_"+messageNumber+", "+'tr[role="'+messageNumber+"_"+folder_name+'"] #td_message_followup_search_'+messageNumber).attr("title",followupflagName).find(".flag-edited").css("background",backgroundColor);else $('tr[role="'+messageNumber+"_"+folder_name+'"] #td_message_followup_search_'+
+messageNumber).attr("title",followupflagName).find(".flag-edited").css("background",backgroundColor);DataLayer.put("followupflagged",followupflagged)}DataLayer.commit(false,false,function(data){winElement.find(".menu-configure-followupflag .delete").button("option","disabled",false);updateCacheFollowupflag(selectedMessageIds,folders,true);winElement.dialog("close");alarmFollowupflagged("followupflagAlarms");var fail="success";$.each(data,function(index,value){if(typeof value=="string")fail=value});
+if(fail=="#FollowupflagMessageIdError")alert("Uma ou mais mensagens n\u00e3o puderam ser sinalizadas. \nDetalhes do erro: mensagem n\u00e3o cont\u00e9m o atributo message-id.");else if(fail=="#FollowupflagLimitError")alert("Uma ou mais mensagens n\u00e3o puderam ser sinalizadas. \nDetalhes do erro: limite de flags atingido para esta pasta.");$.each(selectedMessageIds,function(index,value){var flagged=DataLayer.get("followupflagged",{filter:["AND",["=","messageNumber",value],["=","folderName",folder_name]]});
+if(!flagged)$("#td_message_followup_"+value).find(".flag-edited").css("background","#cccccc")})});winElement.find(".menu-configure-followupflag .save").button("option","disabled",true)}selectAllFolderMsgs(false)};winElement.find('[name="name"]').next().data("autocomplete")._trigger("change");var backgroundColor=winElement.find('[name="backgroundColor"]').val();var followupflagId=winElement.find('[name="name"] option:selected').val();if(followupflagId=="custom"){DataLayer.put("followupflag",{name:winElement.find('[name="name"] option:selected').text(),
+uid:User.me.id});DataLayer.commit(false,false,function(data){$.each(data,function(index,value){if(typeof value=="object")followupflagId=value.id});winElement.find('[name="name"] option[value="custom"]').val(followupflagId);saveFollowupflagged()})}else saveFollowupflagged()}).end().filter(".menu-configure-followupflag .delete").click(function(){if(selectedMessageIds.length==0)$(this).button("option","disabled",true);DataLayer.remove("followupflagged",false);DataLayer.get("followupflagged");var roles=
+get_selected_messages_search_role().split(",");for(var i=0;i<selectedMessageIds.length;i++){if(currentTab==0){folder_name=current_folder;var messageNumber=selectedMessageIds[i]}else{var tr=$('[role="'+roles[i]+'"]');folder_name=$(tr).attr("name");var id=$(tr).attr("id");var messageNumber=id.replace(/_[a-zA-Z0-9]+/,"")}if(onceOpenedHeadersMessages[folder_name][messageNumber]["followupflagged"])if(onceOpenedHeadersMessages[folder_name][messageNumber]["followupflagged"].id){var flag_id=onceOpenedHeadersMessages[folder_name][messageNumber]["followupflagged"].id;
+DataLayer.remove("followupflagged",flag_id);if(current_folder==folder_name){$("#td_message_followup_"+messageNumber+", "+'tr[role="'+messageNumber+"_"+folder_name+'"] #td_message_followup_search_'+messageNumber).attr("title","").find(".flag-edited").css("background","#CCC");$("#td_message_followup_"+messageNumber+", "+'tr[role="'+messageNumber+"_"+folder_name+'"] #td_message_followup_search_'+messageNumber).find(".flag-edited").find("img").attr("src","../prototype/modules/mail/img/flagEditor.png").css("margin-left",
+"0")}else{$('tr[role="'+messageNumber+"_"+folder_name+'"] #td_message_followup_search_'+messageNumber).attr("title","").find(".flag-edited").css("background","#CCC");$('tr[role="'+messageNumber+"_"+folder_name+'"] #td_message_followup_search_'+messageNumber).find(".flag-edited").find("img").attr("src","../prototype/modules/mail/img/flagEditor.png").css("margin-left","0")}updateCacheFollowupflag(messageNumber,folder_name,false)}}DataLayer.commit(false,false,function(){winElement.dialog("close");alarmFollowupflagged("followupflagAlarms")});
+selectAllFolderMsgs(false)});winElement.find(":input").change(function(event){if(event.keyCode!="27"&&event.keyCode!="13")winElement.find(".menu-configure-followupflag .save").button("option","disabled",false)}).keydown(function(event){if(event.keyCode!="27"&&event.keyCode!="13")winElement.find(".menu-configure-followupflag .save").button("option","disabled",false)});winElement.find(".date").datepicker();winElement.find(".time").timepicker({});winElement.find('[name="name"]').combobox().next().next().click(function(event,
+ui){$(".ui-autocomplete.ui-menu li").css("position","relative");$(".ui-autocomplete.ui-menu li a:gt(5)").append("<span class='ui-icon ui-icon-only ui-icon-close delete_followupflag'></span>").find("span").click(function(event){var id=$(".followupflag-configure").find("option")[$(this).parents("li").index()].value;var nameFollowupflag=$(".followupflag-configure").find("option")[$(this).parents("li").index()].text;var removeLi=$(this).parents("li");$.Zebra_Dialog(get_lang("All messages flagged with the flag type ")+
+"<strong>"+nameFollowupflag+"</strong>"+get_lang(" will be removed. This action cannot be undone. Want to continue?"),{"type":"question","custom_class":is_ie?"configure-zebra-dialog":"","title":"Aten\u00e7\u00e3o","buttons":["Sim","N\u00e3o"],"overlay_opacity":"0.5","onClose":function(caption){if(caption=="Sim"){var listFollowupflag=DataLayer.get("followupflagged",["=","followupflagId",id]);for(var i=0;i<listFollowupflag.length;i++)DataLayer.remove("followupflagged",listFollowupflag[i].id);DataLayer.remove("followupflag",
+false);DataLayer.get("followupflag");DataLayer.remove("followupflag",""+id);DataLayer.commit(false,false,function(data){$('[title="'+nameFollowupflag+'"]').attr("title","").find("div").css({backgroundColor:"#CCC"});$(removeLi).remove();$('option[value="'+id+'"]').remove();$(".ui-autocomplete.ui-menu li:first");$(".followupflag-configure").find("option:first").attr("selected","selected");$(".ui-autocomplete-input").val($(".followupflag-configure").find("option:selected").text());for(var i=0;i<listFollowupflag.length;i++)if(listFollowupflag[i].id==
+winElement.find('[name="followupflagId"]').val())winElement.find('[name="followupflagId"]').val("")});event.stopImmediatePropagation()}}});if(is_ie)$(".ZebraDialogOverlay").css("z-index","1006")})});winElement.find(".ui-corner-right.ui-button-icon").attr("title",get_lang("Show All Items"));winElement.find('[name="alarmDate"],[name="alarmTime"]').attr("disabled","disabled");winElement.find(".menu-configure-followupflag .delete").button("option","disabled",true);var idFollowupflag=winElement.find('[name="followupflagId"]').val();
+idFollowupflag=idFollowupflag.split(",");$.each(idFollowupflag,function(index,value){if(value!="false")winElement.find(".menu-configure-followupflag .delete").button("option","disabled",false)});winElement.find('[name="alarm"]').click(function(){if($(this).is(":checked"))winElement.find('[name="alarmDate"]').removeAttr("disabled");else winElement.find('[name="alarmDate"],[name="alarmTime"]').attr("disabled","disabled").val("")});if(winElement.find('[name="alarm"]').is(":checked"))winElement.find('[name="alarmDate"],[name="alarmTime"]').removeAttr("disabled");
+winElement.find('[name="done"]').click(function(){if($(this).is(":checked"))winElement.find(".input-done input").attr("disabled","disabled");else winElement.find(".input-done input").removeAttr("disabled")});winElement.find(".followupflag-color-fields").hide();winElement.find(".followupflag-color.sample-list .sample-item").click(function(){winElement.find(".menu-configure-followupflag .save").button("enable");winElement.find(".followupflag-color.sample-list .sample-item").removeClass("selected");
+$(this).addClass("selected");var color=$(this).attr("alt");winElement.find('[name="backgroundColor"]').css("background-color",color).val(color)});winElement.find(".followupflag-color.sample-list .sample-item.selected").trigger("click");winElement.find('[name="setColor"]').change(function(){if(winElement.find('[name="setColor"]').val()=="default"){winElement.find(".followupflag-color.sample-list").show("fast");winElement.find(".followupflag-color-fields").hide();winElement.find(".followupflag-color.sample-list .sample-item.selected").trigger("click")}else if(winElement.find('[name="setColor"]').val()==
+"custom"){winElement.find(".followupflag-color-fields").show("fast");winElement.find(".followupflag-color.sample-list").hide();winElement.find(".colorwell").focus()}});if(winElement.find('[name="setColor"] option:selected').val()=="custom")winElement.find('[name="setColor"]').trigger("change");var colorpickerPreviewChange=function(color){winElement.find(".menu-configure-followupflag .save").button("enable");winElement.find(".colorwell-selected").val(color).css("background-color",color);winElement.find(".flag-color-preview").css("background",
+color)};var f=$.farbtastic(winElement.find(".colorpicker"),colorpickerPreviewChange);var selected;winElement.find(".colorwell").each(function(){f.linkTo(this)}).focus(function(){if(selected)$(selected).removeClass("colorwell-selected");$(selected=this).addClass("colorwell-selected");f.linkTo(this,colorpickerPreviewChange);f.linkTo(colorpickerPreviewChange)});if(winElement.find('[name="setColor"] option:selected').val()=="custom")winElement.find(".colorwell").focus()}
+function alarmFollowupflagged(alert_type,filter_list){var currentDate=(new Date).toString("dd/MM/yyyy");var data={alarmDeadline:false,doneDeadline:false,filtersAlarms:false};switch(alert_type){case "followupflagAlarms":$(".doneDeadline").remove();$(".alarmDeadline").remove();data.alarmDeadline=$.cookie("fadeAlarm")!=currentDate?true:false;data.doneDeadline=$.cookie("fadeCompleted")!=currentDate?true:false;break;case "filtersAlarms":$(".filtersDeadline").remove();data.filtersAlarms=$.cookie("fadeFilterAlarm")!=
+currentDate?true:false;break;default:$(".gray").remove();data.alarmDeadline=$.cookie("fadeAlarm")!=currentDate?true:false;data.doneDeadline=$.cookie("fadeCompleted")!=currentDate?true:false;data.filtersAlarms=$.cookie("fadeFilterAlarm")!=currentDate?true:false;break}var startDate=(new Date).set({hour:0,minute:0,second:0}).toString("yyyy-MM-dd 00:00:00");var endDate=(new Date).set({hour:0,minute:0,second:0}).addHours(24).toString("yyyy-MM-dd 00:00:00");if(data.alarmDeadline){var decodeAlarms={"sent":[],
+"task":[]};alarms=DataLayer.get("followupflagged",{filter:["AND",["<","alarmDeadline",endDate],["=","isSent","0"],["=","isDone","0"]],criteria:{deepness:1}});if(alarms.length>0){var itens=[];for(var i=0;i<alarms.length;i++){var date=Date.parseExact(alarms[i]["alarmDeadline"],"yyyy-MM-dd HH:mm:ss");alarms[i]["alarmDeadline"]=date.toString("dd/MM HH:mm");var nameFollowupflag=alarms[i]["followupflag"]["id"]<7?get_lang(alarms[i]["followupflag"]["name"]):alarms[i]["followupflag"]["name"];var li_alarm=
+alarms[i]["alarmDeadline"]+" - "+nameFollowupflag+" - "+alarms[i]["message"]["headers"]["subject"];if(alarms[i]["doneDeadline"]!=""){var dateDone=Date.parseExact(alarms[i]["doneDeadline"],"yyyy-MM-dd HH:mm:ss");if(dateDone.getTime()<$.now())continue}if(date.getTime()<=$.now())decodeAlarms.sent.push({"msg_number":alarms[i]["messageNumber"],"msg_folder":alarms[i]["folderName"],"a":truncate(li_alarm,34),"id":alarms[i].id});else decodeAlarms.task.push({a:truncate(li_alarm,34),sentTime:date.getTime()/
+1E3,id:alarms[i].id,"msg_folder":alarms[i].folderName,"msg_number":alarms[i].messageNumber})}if(decodeAlarms.task.length)alarmDeadline.load(decodeAlarms.task);if(decodeAlarms.sent.length)data.alarmDeadline={alarms:decodeAlarms.sent,title:get_lang("Follow ups"),caption:itens.length==1?get_lang("You have one undone message today:"):get_lang("You have %1 follow ups due for today:",decodeAlarms.sent.length),type:"alarmDeadline"};else data.alarmDeadline=false}else data.alarmDeadline=false}if(data.doneDeadline){alarms=
+DataLayer.get("followupflagged",{filter:["AND",[">","doneDeadline",startDate],["<","doneDeadline",endDate]],criteria:{deepness:1}});if(alarms.length>0){var itens=[];for(var i=0;i<alarms.length;i++){var date=Date.parseExact(alarms[i]["doneDeadline"],"yyyy-MM-dd HH:mm:ss");alarms[i]["doneDeadline"]=date.toString("dd/MM HH:mm");var nameFollowupflag=alarms[i]["followupflag"]["id"]<7?get_lang(alarms[i]["followupflag"]["name"]):alarms[i]["followupflag"]["name"];var li_alarm=alarms[i]["doneDeadline"]+" - "+
+nameFollowupflag+" - "+truncate(alarms[i]["message"]["headers"]["subject"],15);itens.push({a:truncate(li_alarm,34),id:alarms[i].id,"msg_folder":alarms[i].folderName,"msg_number":alarms[i].messageNumber})}data.doneDeadline={alarms:itens,title:get_lang("Done"),caption:itens.length==1?get_lang("You have one undone message today:"):get_lang("You have %1 follow ups due for today:",itens.length),type:"doneDeadline"}}else data.doneDeadline=false}if(data.filtersAlarms){alarms=filter_list;if(alarms.length>
+0){var itens=[];for(var i=0;i<alarms.length;i++){alarms[i]["udate"]=(new Date(alarms[i]["udate"]*1E3)).toString("dd/MM HH:mm");var li_alarm=alarms[i]["udate"]+" - "+alarms[i]["from"]+" - "+alarms[i]["subject"];itens.push({"msg_number":alarms[i]["msg_number"],"msg_folder":alarms[i]["msg_folder"],a:truncate(html_entities(li_alarm),34),id:alarms[i].id})}data.filtersAlarms={alarms:itens,title:get_lang("Filter by sender"),caption:itens.length==1?get_lang("You have an archived message:"):get_lang("You have %1 messages archived:",
+itens.length),type:"filtersDeadline",captions:{singular:"You have one undone message today:",plural:"You have %1 undone messages today:"}}}else data.filtersAlarms=false}for(var i in data)if(data[i]!=false)showAlarmsModal(data[i]);$(".gray").find(".content-alarm").hide();$(".gray").find('.header-alarm [name="header-icon"]').removeClass("minimize-alarm").addClass("maximize-alarm");if($(".gray").length>0)if($(".gray").hasClass("filtersDeadline")){$(".filtersDeadline").find(".content-alarm").show();$('.filtersDeadline .header-alarm [name="header-icon"]').removeClass("maximize-alarm").addClass("minimize-alarm")}else if($(".gray").hasClass("alarmDeadline")){$(".alarmDeadline").find(".content-alarm").show();
+$('.alarmDeadline .header-alarm [name="header-icon"]').removeClass("maximize-alarm").addClass("minimize-alarm")}else if($(".gray").hasClass("doneDeadline")){$(".doneDeadline").find(".content-alarm").show();$('.doneDeadline .header-alarm [name="header-icon"]').removeClass("maximize-alarm").addClass("minimize-alarm")}}
+function showAlarmsModal(alarm){var ok_function=function(event,type,type_cookie){if($(event.target).parents("."+type).find('[name="stopAlert"]').is(":checked"))$.cookie(type_cookie,(new Date).toString("dd/MM/yyyy"),{expires:1})};var dialogText=DataLayer.render("../prototype/modules/mail/templates/followupflag_alarm_list.ejs",alarm);var titulo='<div class="header-alarm"><span class="img_title"></span><span class="title-alarm"><strong>'+alarm.title+'</strong></span><span name="header-icon" class="maximize-alarm"></span></div>';
+$("#freeow").freeow(titulo,dialogText,{classes:["gray",alarm.type],autoHide:false,startStyle:null,onClick:function(event){var type="";var type_cookie="";if($(this).hasClass("alarmDeadline")){type="alarmDeadline";type_cookie="fadeAlarm"}else if($(this).hasClass("doneDeadline")){type="doneDeadline";type_cookie="fadeCompleted"}else if($(this).hasClass("filtersDeadline")){type="filtersDeadline";type_cookie="fadeFilterAlarm"}if($(event.target).hasClass("stop-alert-alarm"))return;if($(event.target).hasClass("minimize-alarm")){$("."+
+type).find(".content-alarm").hide();$(event.target).removeClass("minimize-alarm").addClass("maximize-alarm");return}if($(event.target).hasClass("maximize-alarm")){$("."+type).find(".content-alarm").show();$(event.target).removeClass("maximize-alarm").addClass("minimize-alarm");return}if($(!!$.browser.safari?event.target.parentElement:event.target).hasClass("confirm-alarm")){ok_function(event,type,type_cookie);$("."+type).remove();return}return false}});$(".gray .background .content p").remove();$(".gray .icon").remove();
+$(".gray .close").remove();$("div.gray.alarmDeadline .button.delete").button({text:false,icons:{primary:"ui-icon-close"}});$(".content-alarm button").button()}
+function cancelAlarm(element,idAlarm,messageNumber,folderName){$(element).parents("li").remove();var view="div.gray.alarmDeadline";var length=$(view).find("ul.message-list li").length;if(length>0){var msg="";if(length==1)msg=get_lang("You have a follow up due for today:");else msg=get_lang("You have %1 follow ups due for today:",length);$(view).find("span.subtitle-alarm strong").html(msg)}else $(view).remove();DataLayer.put("followupflagged",{id:idAlarm,isSent:"1",folderName:folderName,messageNumber:messageNumber,
+uid:User.me.uid});DataLayer.commit()}
+alarmDeadline={load:function(alarm){var currentDate=(new Date).toString("dd/MM/yyyy");if($.cookie("fadeAlarm")!=currentDate)for(var i=0;i<alarm.length;i++)this.addAlarm(alarm[i])},addAlarm:function(alarm){DataLayer.task(parseInt(alarm["sentTime"]),function(timestamp){var view="div.gray.alarmDeadline";if(!$(view+" li.message-item."+alarm.id).length){var currentDate=(new Date).toString("dd/MM/yyyy");if($.cookie("fadeAlarm")!=currentDate)if($("div.gray.alarmDeadline").length){$(view).find("ul.message-list").append(DataLayer.render("../prototype/modules/mail/templates/followupflag_alarmDeadline_add_item_list.ejs",alarm));
+var length=$(view).find("ul.message-list li").length;var msg="";if(length==1)msg=get_lang("You have a follow up due for today:");else msg=get_lang("You have %1 follow ups due for today:",length);$(view).find("span.subtitle-alarm strong").html(msg);$(view+" .button.delete").button({text:false,icons:{primary:"ui-icon-close"}})}else{var item={alarms:[alarm],title:get_lang("Follow ups"),caption:get_lang("You have one undone message today:"),type:"alarmDeadline"};showAlarmsModal(item)}}})}};
+$("#main_table").ready(function(){handlerMessageFilter=function(data){alarmFollowupflagged(null,data)};cExecute("$this.imap_functions.getFlaggedAlertMessages&folders="+fromRules,handlerMessageFilter)});
Index: trunk/expressoMail1_2/index.php
===================================================================
--- trunk/expressoMail1_2/index.php	(revision 7535)
+++ trunk/expressoMail1_2/index.php	(revision 7538)
@@ -21,5 +21,6 @@
 	echo "<script type='text/javascript'>var template = '".$_SESSION['phpgw_info']['expressoMail1_2']['user']['preferences']['common']['template_set']."';</script>";
 	echo '
-		<link rel="stylesheet" type="text/css" href="templates/default/main.css"></link>
+		<link rel="stylesheet" type="text/css" href="../prototype/plugins/freeow/style/freeow/freeow.css" >
+		<link rel="stylesheet" type="text/css" href="templates/default/main.min.css"></link>
 		<link rel="stylesheet" type="text/css" href="../phpgwapi/js/dftree/dftree.css"></link>
 		<link rel="Stylesheet" type="text/css" href="../prototype/plugins/jquery/jquery-ui.css" />
@@ -28,6 +29,8 @@
 		<link rel="stylesheet" href="../prototype/modules/mail/css/followupflag.css" type="text/css" />
 		<link rel="stylesheet" href="../prototype/modules/attach_message/attach_message.css" type="text/css" />
+		<link rel="stylesheet" href="../prototype/plugins/jqgrid/themes/prognusone/jquery-ui-1.8.2.custom.css" type="text/css" />
+		<link rel="stylesheet" type="text/css" href="../prototype/plugins/contextmenu/jquery.contextMenu.css"></link>
 		<!-- <link rel="stylesheet" href="../prototype/modules/mail/css/label.css" type="text/css" /> -->
-
+		
 		<script src="js/modal/modal.js"></script>
 		<script type="text/javascript" src="../prototype/plugins/jquery/jquery.min.js"></script>
@@ -58,5 +61,6 @@
 		<script src="../prototype/modules/mail/js/foldertree.js" type="text/javascript"></script>		
 		<script src="../prototype/modules/mail/js/label.js" type="text/javascript"></script>	
-		<script src="../prototype/modules/mail/js/followupflag.js" type="text/javascript"></script>
+		<script src="../prototype/modules/mail/js/followupflag.min.js" type="text/javascript"></script>
+		<script type="text/javascript" src="../prototype/plugins/freeow/jquery.freeow.min.js"></script>
     ';
 	//---------------------------//
@@ -318,5 +322,5 @@
 	// os demais pois nele contem a função get_lang
 	// que é utilizada em diversas partes
-	echo $obj -> getFilesJs("js/common_functions.js",$update_version);
+	echo $obj -> getFilesJs("js/common_functions.min.js",$update_version);
 	include("inc/load_lang.php");
 
@@ -327,5 +331,5 @@
     
 	$scripts = "js/abas.js," .
-				"js/main.js," .
+				"js/main.min.js," .
 				"js/draw_api.js,";
 	
@@ -366,8 +370,6 @@
 	<link href="../prototype/modules/filters/filters.css" rel="stylesheet" type="text/css">
 	<link rel="stylesheet" href="../prototype/plugins/farbtastic/farbtastic.css" type="text/css" >	
-	<link rel="stylesheet" href="../prototype/plugins/fileupload/jquery.fileupload-ui.css" type="text/css" >
-	<link rel="stylesheet" type="text/css" href="../prototype/plugins/contextmenu/jquery.contextMenu.css"></link>		
-	<link rel="stylesheet" href="../prototype/plugins/jqgrid/css/ui.jqgrid.css" type="text/css" />	
-	<link rel="stylesheet" href="../prototype/plugins/jqgrid/themes/prognusone/jquery-ui-1.8.2.custom.css" type="text/css" />
+	<link rel="stylesheet" href="../prototype/plugins/fileupload/jquery.fileupload-ui.css" type="text/css" >		
+	<link rel="stylesheet" href="../prototype/plugins/jqgrid/css/ui.jqgrid.css" type="text/css" />
 	<link rel="Stylesheet" type="text/css" href="../prototype/plugins/timepicker/jquery-ui-timepicker-addon.css" />
 	<link rel="stylesheet" type="text/css" href="../prototype/modules/calendar/css/layout.css" />
@@ -383,6 +385,5 @@
 	<script type="text/javascript" src="../prototype/plugins/fileupload/jquery.fileupload.js"></script>
 	<script type="text/javascript" src="../prototype/plugins/fileupload/jquery.iframe-transport.js"></script>
-	<script type="text/javascript" src="../prototype/plugins/qtip/jquery.qtip-1.0.0-rc3.min.js"></script>
-	<!-- <script type="text/javascript" src="../prototype/plugins/contextmenu/jquery.ui.position.js"></script> -->	
+	<script type="text/javascript" src="../prototype/plugins/qtip/jquery.qtip-1.0.0-rc3.min.js"></script>	
 	<script type="text/javascript" src="../prototype/modules/calendar/js/timezone.js"></script>
 	<script type="text/javascript" src="../prototype/plugins/dateFormat/dateFormat.js"></script>
@@ -392,7 +393,4 @@
 	<script type="text/javascript" src="../prototype/modules/calendar/js/calendar.alarms.js"></script>
 	<script type="text/javascript" src="../prototype/modules/calendar/js/helpers.js"></script>
-	<link rel="stylesheet" type="text/css" href="../prototype/plugins/freeow/style/freeow/freeow.css" >
-	<script type="text/javascript" src="../prototype/plugins/freeow/jquery.freeow.min.js"></script>
-	<script type="text/javascript" src="../prototype/plugins/freeow/jquery.freeow.js"></script>
 	<script src="../prototype/plugins/jqgrid/js/i18n/grid.locale-pt-br.js" type="text/javascript"></script>
 	<script src="../prototype/plugins/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
@@ -402,7 +400,7 @@
 	<script type="text/javascript" src="../prototype/plugins/timepicker/localization/jquery-ui-timepicker-pt-BR.js"></script>
 	<script type="text/javascript" src="../prototype/plugins/jquery/i18n/jquery.ui.datepicker-pt-BR.js"></script>
-        <script type="text/javascript"> 
-            User.moduleName = "expressoMail1_2";
-		</script>	
+    <script type="text/javascript"> 
+        User.moduleName = "expressoMail1_2";
+	</script>	
 ';
 ?>
Index: trunk/expressoMail1_2/templates/default/main.min.css
===================================================================
--- trunk/expressoMail1_2/templates/default/main.min.css	(revision 7538)
+++ trunk/expressoMail1_2/templates/default/main.min.css	(revision 7538)
@@ -0,0 +1,1 @@
+body{overflow:hidden}.expressomail-attachments{background:#EEE;font-size:11px;width:100%;margin:0;padding:0}.expressomail-attachments-label{display:block;float:left}ul.expressomail-attachments-list{list-style:none;display:block;margin-left:40px}.expressomail-attachments-link{font-size:11px}textarea{overflow:hidden;height:auto}a.rich{padding:5px;cursor:pointer;text-align:center}button.adress_button{width:47px;text-align:center}span.ui-icon.expressomail-icon-read-confirmation{background-image:url(images/notification.gif)!important;background-position:0 0;width:24px;height:24px}span.ui-icon.expressomail-icon-save{background-image:url(images/disk.png)!important;background-position:0 2px;width:16px;height:16px;background-size:13px}span.ui-icon.expressomail-icon-signature{background-image:url(images/signature.gif)!important;background-position:8px 2px;width:24px;height:24px;background-size:13px}span.ui-icon.expressomail-icon-encryption{background-image:url(images/lock.png)!important;background-position:7px 1px;width:24px;height:24px;background-size:13px}span.ui-icon.expressomail-icon-send{background-image:url(images/send.png)!important;background-position:-2px 2px;width:25px;height:16px;background-size:19px}span.ui-icon.expressomail-icon-save_and_send{background-image:url(images/save_and_send.png)!important;width:25px;height:16px;background-size:17px}span.ui-icon.expressomail-icon-important{background-image:url(images/important.png)!important;background-position:7px 1px;width:24px;height:24px;background-size:13px}.expressomail-thumbs{font-size:11px;width:100%;max-width:100%;margin:20px 0 0 0;border-top:1px solid #AAA;float:left}.expressomail-thumbs span.message_tips{display:block;padding-left:18px;line-height:18px;height:18px;background-image:url(images/menu/ktip.png);background-repeat:no-repeat}ul.expressomail-thumbs-list{list-style:none;margin:0;padding:0}ul.expressomail-thumbs-list li{height:80px;max-width:120px;max-height:80px;display:block;float:left;margin:5px;padding:0}ul.expressomail-thumbs-list li img{width:auto;height:100%;border:2px solid #fde7bc}.expressomail-thumbs-link{font-size:11px}.jcarousel-container{width:auto}table.expressomail-message-body{width:100%;height:100%}table.table_message,div.table_message{background:#96b3d3;background:-moz-linear-gradient(top,#96b3d3 0,#b4c9e4 30%,#d9e6ef 65%,#e2e9f1 70%,#e9f0f8 78%,#e8f1fa 83%,#dbe5ef 96%,#d9e3ed 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#96b3d3),color-stop(30%,#b4c9e4),color-stop(65%,#d9e6ef),color-stop(70%,#e2e9f1),color-stop(78%,#e9f0f8),color-stop(83%,#e8f1fa),color-stop(96%,#dbe5ef),color-stop(100%,#d9e3ed));background:-webkit-linear-gradient(top,#96b3d3 0,#b4c9e4 30%,#d9e6ef 65%,#e2e9f1 70%,#e9f0f8 78%,#e8f1fa 83%,#dbe5ef 96%,#d9e3ed 100%);background:-o-linear-gradient(top,#96b3d3 0,#b4c9e4 30%,#d9e6ef 65%,#e2e9f1 70%,#e9f0f8 78%,#e8f1fa 83%,#dbe5ef 96%,#d9e3ed 100%);background:-ms-linear-gradient(top,#96b3d3 0,#b4c9e4 30%,#d9e6ef 65%,#e2e9f1 70%,#e9f0f8 78%,#e8f1fa 83%,#dbe5ef 96%,#d9e3ed 100%);background:linear-gradient(top,#96b3d3 0,#b4c9e4 30%,#d9e6ef 65%,#e2e9f1 70%,#e9f0f8 78%,#e8f1fa 83%,#dbe5ef 96%,#d9e3ed 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#96b3d3',endColorstr='#d9e3ed',GradientType=0)}table.expressomail-message-body tr{vertical-align:top}.table_message_options{background-color:#000;-moz-border-collapse:separate;border-color:gray;border-spacing:0;border-style:outset;border-width:.01;cursor:default;padding:1px;-moz-border-radius:3px;-webkit-border-radius:3px}.table_message_options_ie{border-collapse:collapse;background-color:#000;border-color:gray;border-spacing:0;border-style:outset;border-width:1;cursor:default;padding:1px;-moz-border-radius:3px;-webkit-border-radius:3px}.table_message{background-color:#000;-moz-border-collapse:separate;border-color:gray;border-radius:3px 3px 3px 3px;border-spacing:0;border-style:outset;border-width:1px;cursor:default;padding:1px;-moz-border-radius:3px;-webkit-border-radius:3px}.div_message_scroll{background:none repeat scroll 0 0 WHITE;overflow:auto;padding-right:5px}a.message-attach-link{margin-left:20px}.messagescol td label{padding-right:20px}.messagescol td.message-general-options .checkbox{margin:5px 5px 0 0}.ui-dialog-dragging{opacity:.4;filter:alpha(opacity=40)}.context-menu-item.icon-important{background-image:url(images/important.png);background-position:6px 5px!important}.context-menu-item.icon-export{background-image:url(images/export.png)}.context-menu-item.icon-move{background-image:url(images/move.png)}.context-menu-item.icon-seen{background-image:url(images/seen.gif)}.context-menu-item.icon-unseen{background-image:url(images/unseen.gif)}.context-menu-item.icon-normal{background-image:url(images/door.png)}.context-menu-item.icon-followupflag{background-image:url(images/door.png)}.context-menu-item.icon-quick-add{background-image:url(images/vcard_add.png)}.context-menu-item.icon-delete-box{background-image:url(images/user_delete.png)}.context-menu-item.icon-quick-search-contact{background-image:url(images/zoom.png)}.context-menu-item.icon-archive{background-image:url(images/archive.png)}.context-menu-item.icon-search-mail{background-image:url(images/menu/search.png)}.context-menu-item.icon-filter{background-image:url(images/menu/filters.png)}.context-menu-item.icon-edit-folder{background-image:url(images/menu/editfolders.png)}.context-menu-item.icon-share-mailbox{background-image:url(images/menu/usersfolders.png)}.context-menu-item.icon-label{background-image:url(images/menu/usersfolders.png)}.context-menu-item.icon-tag{background-image:url(images/menu/tag.png);background-size:12px;background-position:6px 2px!important}.context-menu-item.icon-empty-trash{background-image:url(images/menu/trash.png)}.context-menu-item.icon-queue{background-image:url(images/menu/queue.png)}.context-menu-item.icon-config{background-image:url(images/menu/config.png)}form.fileupload{margin:14px 0 0 -13px;float:left;margin-bottom:-20px}form.fileupload .files-list{margin-left:5px;margin-top:-14px;padding:.2em .7em}form.fileupload .files-list .delete-upload{top:7px}div.attachments-list{max-height:130px;overflow-y:auto;padding-top:5px}.button-files-upload{float:left}form.fileupload .ui-button .ui-button-text{line-height:2}form.fileupload .ui-button{margin-left:5px}form.fileupload .message-add-original-att{margin-left:0}.button.add.button-add-attachment{margin:-9px 0 0 8px}.button.upload{margin-bottom:4px}div.fileupload-buttonbar{padding:.2em .5em}.archive-error{color:#F00}.progress.in-progress{width:100px;height:12px}.row.fileupload-buttonbar{margin-top:-14px;padding:.2em .7em}.archive-attach.name{width:310px}.archive-attach.name label{display:block;position:absolute;left:136px;top:194px}.size{min-width:65px}.message-attach.name{width:200px}.message-attach.size{margin:0 4px 0 4px}.message-attach-error{color:red}.expressomail-qs-container{font-size:11px}.expressomail-qs-container legend{font-size:1.1em;font-weight:bold}.expressomail-qs-container #accordion{margin:5px}.expressomail-qs-container fieldset,.expressomail-qs-container div{margin:0}.expressomail-qs-container .ui-autocomplete-input{height:22px;width:200px;margin-right:-1px}.expressomail-qs-container #wrap-progressbar{height:22px;width:122px;float:left}.expressomail-qs-container #wrap-progressbar #inner-progressbar{text-align:center;width:100px}.expressomail-qs-container #wrap-progressbar #inner-progressbar span{font-size:10px;line-height:12px}.expressomail-qs-container #wrap-progressbar #inner-progressbar #progressbar{width:100px;height:10px}.expressomail-qs-container .clear{clear:both}.expressomail-qs-container fieldset{border:1px solid #AAA;border-radius:5px;margin:5px}.expressomail-qs-container #ul{list-style:none;margin:0;padding:0}.expressomail-qs-container #fieldset1{color:#444}.expressomail-qs-container #fieldset1 label{font-weight:bold;display:block}.expressomail-qs-container #list-acc-users li,.expressomail-qs-container #search-result-users li{margin-right:5px;border-radius:3px}.expressomail-qs-container #list-acc-mails li{margin-right:5px;padding-bottom:4px;border-radius:3px}.expressomail-qs-container #list-acc-users li:hover,.expressomail-qs-container #list-acc-mails li:hover,.expressomail-qs-container #search-result-users li:hover{background-color:#DDD}.expressomail-qs-container #list-acc-users li span.ui-icon,.expressomail-qs-container #list-acc-mails li span.ui-icon,.expressomail-qs-container #search-result-users li span.ui-icon{display:none;margin:2px}.expressomail-qs-container #list-acc-users li input,.expressomail-qs-container #list-acc-mails li input,.expressomail-qs-container #search-result-users li input{margin-top:5px}.expressomail-qs-container #list-acc-users li label,.expressomail-qs-container #list-acc-mails li label,.expressomail-qs-container #search-result-users li label{margin-top:-5px}.expressomail-qs-container #list-acc-users li:hover span,.expressomail-qs-container #list-acc-mails li:hover span,.expressomail-qs-container #search-result-users li:hover span{display:inline}.expressomail-qs-container #search-result-users li span.ui-icon{display:none}.expressomail-qs-container .ui-icon{float:right}.expressomail-qs-container #icon-bar1 .ui-icon{float:left;margin:0 3px}.expressomail-qs-container #icon-bar1 span{float:left;margin:2px 3px 0 0}.expressomail-qs-container .ui-icon-trash,.expressomail-qs-container .ui-icon-edit,.expressomail-qs-container .ui-icon-close,.expressomail-qs-container .ui-icon-plus,.expressomail-qs-container .ui-icon-pencil{background-color:#EEE}.expressomail-qs-container .ui-icon-trash:hover,.expressomail-qs-container .ui-icon-edit:hover,.expressomail-qs-container .ui-icon-close:hover,.expressomail-qs-container .ui-icon-plus:hover,.expressomail-qs-container .ui-icon-pencil:hover{background-color:#BBB}.expressomail-qs-container .ui-autocomplete-input{width:170px}.expressomail-qs-container .ui-accordion .ui-accordion-content{padding:5px}.expressomail-qs-container .foot-note{width:905px;padding:5px;margin-top:20px;border-top:1px solid #ddd}.expressomail-qs-container .acc-list{font-family:"Trebuchet MS",Tahoma,Verdana,Arial,sans-serif;font-size:11px;color:#555}.expressomail-qs-container .acc-list h3{font-family:"Trebuchet MS",Tahoma,Verdana,Arial,sans-serif;font-size:11px;color:#555;margin:0;padding:5px 3px;background-color:#fff}.expressomail-qs-container .acc-list ul{margin:5px 0}.expressomail-qs-container .acc-list ul li{border-radius:3px;padding:5px}.expressomail-qs-container .acc-list ul li:hover{background-color:#DDD}.expressomail-qs-container .acc-list ul li.active{background-color:#eb8f00}.expressomail-qs-container .acc-list ul li strong{display:block}.expressomail-qs-container .acc-list ul li em{display:block}.expressomail-qs-container #feedback{font-size:1.4em}.expressomail-qs-container #selectable .ui-selecting{background:#ddecf7}.expressomail-qs-container #selectable .ui-selected{background:#72a9d3;color:white}.expressomail-qs-container #selectable{list-style-type:none;margin:0;padding:0;width:100%}.expressomail-qs-container ul#selectable{overflow:hidden;width:444px;height:250px}.expressomail-qs-container ul#selectable li{width:435px;overflow:hidden}.expressomail-qs-container ul#selectable li.ui-selected{width:100%}.expressomail-qs-container ul#selectable li div{width:6000px}.expressomail-qs-container .ui-button-icon-only{width:1.2em}.expressomail-qs-container .ui-icon{margin-left:-8px}.expressomail-qs-container .ui-widget button{border:0 solid}.expressomail-qs-container .menu-control{float:right;margin-left:400px;position:absolute;z-index:100;padding-top:5px}.expressomail-qs-container .acc-list{width:444px;height:250px;float:left;border:1px solid #DDD;background-color:#EEE;border-radius:3px;margin-left:1px;margin:10px 5px 5px 1px}.expressomail-qs-container .details-container{width:300px;height:246px;float:right;margin:5px 0}.expressomail-qs-container .acc-list .demo{width:100%;margin-top:20px}.dialog-modal.expressomail-qs-container{height:416px;padding:5px}.ui-dialog .ui-dialog-buttonpane{padding:0;border:0;margin:0}.expressomail-qs-container .menu-control .ui-button-text-only .ui-button-text{padding:.1em .6em}fieldset.search-field,fieldset.search-catalog-options{border:1px solid #cfcfcf;padding:5px}fieldset.search-field input,fieldset.search-catalog-options select{display:inline-block;border:0;background-color:#FFF}fieldset.search-field span{display:inline-block;margin:0 0 -3px 5px}fieldset.search-field{max-width:190px;width:190px;margin:0;text-align:left;display:inline}fieldset.search-field input{max-width:165px;width:165px}fieldset.search-catalog-options{max-width:124px;width:120px;margin:0;text-align:left;display:inline}fieldset.search-catalog-options select{max-width:120px;width:120px}.ui-dialog .ui-dialog-titlebar-minimize{height:18px;margin:-10px 0 0;padding:1px;position:absolute;right:1.8em;top:50%;width:19px}.ui-dialog-buttonpane .ui-button{margin-top:0;padding-top:0}.button-mod{margin-top:-2.5em}.print-all-messages h1{font-size:1.35em}.print-all-messages h2{font-size:1.05em}.print-all-messages tbody{font-size:.95em}.print-all-messages thead td{font-weight:bold;padding:3px;border-bottom:solid 2px #999}.print-all-messages tbody td{border-bottom:solid 1px #ccc}.print-all-messages img{display:none}.print-all-messages input{display:none}pre{white-space:pre-wrap!important;white-space:-moz-pre-wrap!important;white-space:-pre-wrap!important;white-space:-o-pre-wrap!important;word-wrap:break-word!important;font-family:monospace!important;font-size:11px!important}.checkbox{border:none!important}textarea{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px}.whiteSpace{width:2px}.table_box{width:100%;color:black;background:#fff;border-bottom:1px solid #f4f8fb;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px;cursor:pointer;table-layout:fixed}.em_div_write_msg{height:24px;background:transparent}.td_msg{border-width:0}.span-sender:hover{text-decoration:underline}.th_resizable{padding-left:3px!important;border-left:solid 1px #999;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.td_resizable{padding-left:1px;border:0;border-left:solid 1px #dde1dd;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;border-right-width:0!important}.tr_msg_unread{font-weight:bold!important}.table_box tr{border:0;height:20px}.table-info-quota{table-layout:fixed}.td-info-quota{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tr_msg_read{color:#3f3f3f;background-color:#fff;-moz-user-select:none}.tr_msg_read2{color:#3f3f3f;background-color:#dee8f0;-moz-user-select:none}.selected_msg{background-color:#ffffcb}.flagged_msg{color:red}.show_img_link{width:100%;color:black;font-weight:bold;background-color:#ffc;border-bottom:1px solid #cfcfcf;cursor:pointer;-moz-user-select:none}.show_img_link:hover{color:#000!important}.action_info_table{border-spacing:0}.action_info_th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px;border-width:0;padding:1px 10px 0 10px;border-style:inset inset inset inset;border-color:gray gray gray gray;background-color:#fad163;-moz-border-radius:6px 6px 6px 6px}.message_header{background-color:#abc6e1}.message_header td{padding:0}.table_message_ruler{width:10px;border:0;border-left:1px dotted #88a;display:none;position:absolute;z-index:10;height:300px}.table_message_header_box{width:100%;color:black;border-style:solid;border-width:0;border-collapse:collapse;border-color:#bbb;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px;cursor:pointer;table-layout:fixed}.font-menu{color:#000}.font-menu-sel{color:#00f}.font-menu,.font-menu-sel{float:left;clear:left;overflow:hidden;white-space:nowrap;padding-left:5px;margin-right:5px;text-decoration:none;text-align:center}.menu-sel{text-decoration:none;text-align:center;color:#00f;height:20px;width:220px;background-color:#f7f7f7;margin-bottom:0;border:1px solid #4a79b1;border-bottom:0;padding:0 5px 0 0;-moz-border-radius:9px 9px 0 0;-moz-user-select:none;-webkit-border-radius:9px 9px 0 0;border-radius:9px 9px 0 0;cursor:pointer}.menu{text-decoration:none;text-align:center;height:20px;width:220px;background-color:#c8d7ea;margin-bottom:0;border:1px solid #f4f7fc;border-bottom:1px solid #4a79b1;padding:0 5px 0 0;-moz-border-radius:9px 9px 0 0;-moz-user-select:none;-webkit-border-radius:9px 9px 0 0;border-radius:9px 9px 0 0;cursor:pointer}.last_menu{border-bottom:1px solid #4a79b1;-moz-border-radius:0}.table_top{background-color:#fff;padding:1px 1px 1px 1px;height:16px;cursor:default;margin:0;border-width:0 1px 1px 1px;border-style:outset outset outset outset;border-color:black black black black}.tr_message_header{background-color:#eee;font-family:Verdana,Arial,Helvetica,sans-serif;cursor:default;border-style:none none none none;-moz-border-radius:0}.tr_message_body{background-color:#fff;cursor:default;-moz-border-radius:9px 9px 9px 9px}.message_body{background-color:#fff;cursor:default;-moz-border-radius:9px 9px 9px 9px}.header_message_field{font-weight:bold}.suggestion_list{background:white;border:1px solid;padding:4px}.suggestion_list ul{padding:0;margin:0;list-style-type:none}.suggestion_list a{text-decoration:none;color:navy}.suggestion_list .selected{background:navy;color:white}.suggestion_list .selected a{color:white}#autosuggest{display:none}div#tipDiv{position:absolute;visibility:hidden;left:0;top:0;z-index:10000;background-color:#efefef;border:1px solid #337;width:220px;padding:0;color:#000;font-size:11px;line-height:1.2;cursor:pointer}.richtext_toolbar{background-color:#c0c0c0}.imagebutton{border:solid 2px #c0c0c0;background-color:#c0c0c0;float:left}.select_richtext{float:left}.sel_color{border-width:1px;border-color:#fff;border-style:solid;cursor:pointer}.unsel_color{border-width:1px;border-color:#bbb;border-style:solid}.dtree{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:8px;color:#000;background-color:#fff}.dtree img{border:0;vertical-align:middle}.dtree a{font-family:Verdana,Arial,Helvetica,sans-serif;color:#000;white-space:nowrap}.dtree table{margin-top:0;padding:0}.dtree td{padding:0}.folderscol{width:100%}.messagescol{width:100%;padding:0}.menu-folders{text-align:center;text-decoration:none;font:bold 12px Arial,Helvetica,sans-serif;color:#063;width:100%;height:20px;border-right:1px solid #000;border-left:1px solid #000;border-top:1px solid #000;cursor:default;-moz-border-radius:9px 9px 0 0}.content-menu{padding:0;background-image:url(../../../phpgwapi/templates/default/images/bgBlockContent.jpg)}.content-menu-td{margin-left:5px}.content-menu-td:hover{background-color:#fff;border:1px solid #ccc}.content-folders{width:162px;padding:0;position:relative;overflow:auto}.filter{font-family:Arial,Helvetica,sans-serif;font-size:8px;background-color:#fff}.filter img{border:0;vertical-align:middle}.filter a{font-family:Arial,Helvetica,sans-serif;color:#000;white-space:nowrap}.message_options_trash{background-image:url(images/page_white_delete.png);background-repeat:no-repeat;background-position:left center;padding:0 6pt 1pt 14pt}.message_options_move{background-image:url(images/move.png);background-repeat:no-repeat;background-position:left center;padding:0 6pt 1pt 14pt}.message_options_print{background-image:url(images/print.png);background-repeat:no-repeat;background-position:left center;padding:0 6pt 1pt 14pt}.message_options_export{background-image:url(images/export.png);background-repeat:no-repeat;background-position:left center;padding:0 6pt 1pt 14pt}.message_options_import{background-image:url(images/import.png);background-repeat:no-repeat;background-position:left center;padding:0 6pt 1pt 14pt}.message_options_inactive{white-space:nowrap;color:#999;padding-right:0!important}.message_options_active{white-space:nowrap;color:#900;font-weight:bold!important;cursor:pointer;padding-right:0!important}.message_options{cursor:pointer;color:#114fa4;white-space:nowrap;font-weight:bold;padding-right:0!important}.message_options_over{cursor:pointer;white-space:nowrap;color:#fc6103;font-weight:bold!important;padding-right:0!important}.reply_options{cursor:pointer;color:white;white-space:nowrap;font-weight:bold}.reply_options_active{cursor:pointer;white-space:nowrap;color:yellow;text-decoration:underline;font-weight:bold!important}.class_search_div{position:relative;left:12px}.em_sidebox_menu{position:relative;left:2px;padding:0 13px 0 0;font-weight:bold;font-size:10px;color:#666;text-decoration:none;white-space:nowrap;font-family:sans-serif}.em_div_sidebox_menu{position:relative;cursor:pointer;left:17px}.catalog{font-family:Arial,Helvetica,sans-serif;font-size:14px;font-weight:bold}div.quicksearchcontacts{border-width:1px;border-style:solid;broder-color:grey;overflow:auto;position:relative;left:10px;height:302px;width:577px}table.quicksearchcontacts{border-width:0;border-spacing:0;background-color:white;cursor:default}tr.quicksearchcontacts_unselected{background-color:white}tr.quicksearchcontacts_selected{background-color:#5598d7;color:white}td.quicksearchcontacts_cc{border-style:none}input.em_button_like_span{border:0 none!important;margin:0!important;padding:0!important;color:#114fa4!important;background:transparent none repeat scroll 0!important;font-family:Arial,Helvetica,sans-serif!important;font-size:11px!important;height:15px!important;font-weight:bold}.l{background-image:url(../../../phpgwapi/templates/default/images/foldertree_folder.png)}.sl{background-image:url(../../../phpgwapi/templates/default/images/foldertree_folderopen.png)}.dsused{background-image:url(../../../expressoMail1_2/templates/default/images/dsused.gif)}.divAppboxHeader{font-style:italic;font-weight:normal;font-variant:small-caps;color:#006!important;font-size:16px!important;text-align:center;padding:0}@media screen and (-webkit-min-device-pixel-ratio:0){input[type="file"]{background-color:#FFF;border:1px solid #e4e4e4;height:20px;width:350px;vertical-align:middle}}.local-messages-search-warning{cursor:pointer;cursor:hand;background:none repeat scroll 0 0 #feb;color:red;line-height:2em;font-size:1.2em;text-align:center}.new-event-win.active:focus,.new-task-win.active:focus{outline:0}.new-event-win.active body,.new-task-win.active body{line-height:1;color:black;background:white}.new-event-win.active ol,.new-event-win.active ul,.new-task-win.active ol,.new-task-win.active ul{list-style:none;list-style-image:none;padding-left:5px}.new-event-win.active table,.new-task-win.active table{border-collapse:separate;border-spacing:0}.new-event-win.active caption,.new-event-win.active th,.new-event-win.active td,.new-task-win.active caption,.new-task-win.active th,.new-task-win.active td{font-weight:normal}.new-event-win.active blockquote:before,.new-event-win.active blockquote:after,.new-event-win.active q:before,.new-event-win.active q:after,.new-task-win.active blockquote:before,.new-task-win.active blockquote:after,.new-task-win.active q:before,.new-task-win.active q:after{content:""}.new-event-win.active blockquote,.new-event-win.active q,.new-task-win.active blockquote,.new-task-win.active q{quotes:"" ""}.new-event-win.active .mail.name-special,.new-event-win.active .name.name-special,.new-task-win.active .mail.name-special,.new-task-win.active .name.name-special{padding:0 0 0 35px}.new-event-win.active .add-attendee-search.search-field,.new-task-win.active .add-attendee-search.search-field{width:249px}.new-event-win.active #calendar_addevent_details4,.new-task-win.active #calendar_addtask _details4{margin:10px 0 0 0}.new-event-win.active input,.new-task-win.active input{color:#000}.new-event-win.active #calendar_addevent_details5,.new-task-win.active #calendar_addtask_details5{margin:10px 0 11px 0}.new-event-win fieldset.tab-level2,.new-task-win fieldset.tab-level2{padding:0 5px;min-height:110px;max-height:310px;overflow:hidden}.new-event-win.active select,.new-task-win.active select{border:1px solid #cfcfcf;border-color:#cfcfcf;color:#555;background-color:#FFF}.new-event-win.active a:link,.new-event-win.active a:visited .new-task-win.active a:link,.new-task-win.active a:visited{color:#2e6e9e}.new-event-win.active dd,.new-event-win.active dl,.new-event-win.active dt,.new-task-win.active dd,.new-task-win.active dl,.new-task-win.active dt{margin:0}.new-event-win.active #divAppbox .new-task-win.active #divAppbox{overflow-x:auto;overflow-y:scroll}.new-event-win.active select .new-task-win.active select{border-color:#cfcfcf;color:#555;padding-left:0}.qtip-wrapper fieldset{padding:0;border:0}.new-event-win.active .fc-event-skin{border-color:#36C!important;background-color:#36C!important;color:white!important}.fc-event-vert .fc-event-bg{display:block!important}#new_event_map .map-event .fc-event-inner.fc-event-skin{border-style:dashed!important;border-width:2px!important;border-color:#36C!important;background-color:transparent!important}#new_event_map .map-event .fc-event-inner.fc-event-skin .fc-event-head,#new_event_map .map-event .fc-event-inner.fc-event-skin .fc-event-content{background-color:transparent!important;color:transparent!important}#new_event_map .map-event .ui-resizable-handle{display:block!important;color:black!important}div.new-event-win.active div.button-files-upload{margin:15px 0 0 0}fieldset.alarm{border:none!important;padding:0!important;margin:0!important}.new-task-win dl.block-add-attendee{width:350px}.new-task-win.active .add-attendee-search.search-field{width:322px}.new-task-win .menu-container.footer-container{width:774px}#content_folders .foldertree-skin-prognus span.selected{font-weight:bold!important}#content_folders .foldertree-skin-prognus span.trash{;background-image:url(../../../prototype/modules/mail/img/bin.png)}#content_folders .foldertree-skin-prognus span.drafts{background-image:url(../../../prototype/modules/mail/img/folder_page_white.png)}#content_folders .foldertree-skin-prognus span.spam{background-image:url(../../../prototype/modules/mail/img/folder_delete.png)}#content_folders .foldertree-skin-prognus span.sent{background-image:url(../../../prototype/modules/mail/img/folder_go.png)}#content_folders .foldertree-skin-prognus span.folder{display:block;padding-bottom:1px;padding-left:18px;padding-right:0;padding-top:1px;font-family:Lucida Grande,Lucida Sans,Arial,sans-serif}#content_folders .treeview .closed{display:block}.folders-loading{background:url(../../../prototype/modules/mail/img/loader.gif)!important;background-position:0 0!important;background-repeat:no-repeat!important}.draggin-box{cursor:pointer;background-color:#cdc5bf;float:left;width:auto;height:16px;border:1px solid #333;text-align:right;z-index:2000}.ui-draggin-default-image{float:left;text-align:right}.draggin-mail{float:left;background-image:url(../../../prototype/modules/mail/img/move.png);background-position:0 0;background-repeat:no-repeat;color:red;text-align:right;font-weight:bold;padding-right:5px;padding-left:25px;font-family:Lucida Grande,Lucida Sans,Arial,sans-serif;font-size:11px}.draggin-folder{float:left;background-image:url(../../../prototype/modules/mail/img/folder.png);background-position:0 0;background-repeat:no-repeat;padding-left:20px;color:red;text-align:right;font-weight:bold;padding-right:5px}.collapse_folders_td{cursor:pointer;width:12px;height:100%;border-radius:5px;border-left:1px solid #ccc}.collapse_folders_td.collapse_folders_td_over{border-left:1px solid #1b75bb}.folder-over{border:1px solid black}.floating-default{float:left;text-align:left}.collapse_folders_td .ui-icon.ui-icon-triangle-1-e{background-position:-37px -20px;width:8px;height:8px}.collapse_folders_td .ui-icon.ui-icon-triangle-1-w{width:8px;height:8px;background-position:-100px -20px}.float-menu{position:absolute;text-align:left}button.expressomail-button-icon-ative{color:#e17009!important;border:1px solid #e17009!important;background:none repeat scroll 0 0 #ffe1cc!important}.outoffice{width:295px;height:50px;overflow:hidden}.title-outoffice{margin-left:10px;font-family:verdana;font-size:1.2em}.outoffice span{margin:5px}#detalhes_contato img{margin-bottom:-4px}button.expressomail-button-icon-ative{color:#e17009!important;border:1px solid #e17009!important;background:none repeat scroll 0 0 #ffe1cc!important}.box{background-color:#dfeffc;border-radius:5px;-moz-border-radius:5px;border:1px solid #add9ed;display:inline-block;cursor:pointer;margin-top:1px;margin-right:1px;outline:0;padding:1px}.box span{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px;color:#201b41;outline:0}.out-office-box{background-color:#dac407;border:1px solid #837c3f!important}.out-office-box span{color:#837c3f}.email-area{border-radius:5px;width:98.5%;padding:5px;border:1px solid #bbb;heigth:auto;max-height:115px;overflow-y:auto;cursor:text}.email-text{outline:0;width:15px;border:0;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px}.box-input{outline:0;border:0;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px;display:none;width:40px}.hidden{display:none}.loading{background:url(../../../prototype/modules/mail/img/loader.gif)!important;background-position:0 0!important;background-repeat:no-repeat!important}.line-separator{background:url("images/linha.png") repeat-x scroll 0 8px transparent;clear:both}.box-draggable-hover{border:1px solid #474747}.box-loading{background:url("../../../prototype/modules/mail/img/loading.gif") no-repeat!important;background-size:17px auto!important}.box-info{background:url("images/information.png") no-repeat!important}input.required-fail{border-color:red}div.conteudo div.new-msg-head-data div.att-box{background-color:#dfeffc;border-radius:5px;-moz-border-radius:5px;border:1px solid #add9ed;display:inline-block;cursor:pointer;margin-top:3px;margin-right:3px;outline:0;padding:1px}div.conteudo div.new-msg-head-data div.att-box span.att-box-value{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px;color:#201b41;outline:0}div.conteudo div.new-msg-head-data div.att-box span.att-box-loading{background:url("../../../prototype/modules/mail/img/loading.gif") no-repeat!important;display:inline-block;background-size:15px auto!important}div.conteudo div.new-msg-head-data div.att-box.invalid-email-box{background-color:#ea9aa0;border:1px solid #540303!important}div.new-msg-head-data div.email-area .invalid-email-box{color:#540303;background-color:#ea9aa0;border:1px solid #540303!important}div.new-msg-head-data div.email-area .box-selected{background-color:#bbb}.fileupload_msg_tooltip{width:99.7%;text-align:center;background:#dfeffc;font-weight:bold;border-radius:5px;height:115px;line-height:115px;font-size:larger}.fileupload_msg_tooltip.hover{background:#add9ed}.select-all-messages{min-height:20px;font-size:13px;font-family:Arial;white-space:nowrap;text-align:center}.select-all-messages .select-link{text-decoration:underline!important}.none-selected{color:#9f9f9f}.selected_shortcut_msg{color:white;background-color:#95a7fc}.current_selected_shortcut_msg{color:white;background-color:#5194d2}div.gray li{float:left;width:253px}div.gray li a.button.delete{float:right}.div-addtask #calendar_addtask_details1 .h1{width:100%}.div-addtask #calendar_addtask_details2 textarea{width:675px}.div-addtask .button-files-upload{width:100%}.div-addtask fieldset.block-add-attendee .search-result-list,fieldset.block-add-activity .search-result-list{width:330px}.new-event-win div.div-addevent,.new-task-win div.div-addtask{width:775px}.calendar-addevent-details-txt-timezone,.calendar-addtask-details-txt-timezone{width:212px}.div-addtask #calendar_addtask_details1 .time-previsao{width:40px}.div-addtask #calendar_addtask_details1 .date-previsao{width:80px}.div-addtask #calendar_addtask_details6{width:756px}.div-addtask #calendar_addtask_details1 .start-time{width:40px}.div-addtask #calendar_addtask_details1 .start-date{width:80px}.div-addtask #calendar_addtask_details1 .end-time{width:40px}.div-addtask #calendar_addtask_details1 .end-date{width:80px}.div-addtask #calendar_addtask_details1 .previsao-termino{margin:0 0 0 20px}.div-addtask #calendar_addtask_details1 .subitem{margin:5px;display:block}.div-addtask #calendar_addtask_details1 .subitem .span_done{margin:0 30px}.div-addtask #calendar_addtask_details1 .subitem .span_done img{position:relative;top:4px;width:16px;height:16px}.div-addtask #calendar_addtask_details1 .calendar_addevent_details_lnk_timezone{margin:0 0 0 20px}.div-addtask #calendar_addtask_details1 .subitem .done{width:45px}.div-addtask #calendar_addtask_details1 .ui-spinner-buttons{top:-2px!important}@-moz-document url-prefix(){.div-addtask #calendar_addtask_details1 .ui-spinner-buttons{top:-14px!important}}.div-addtask #calendar_addtask_details1 .ui-spinner-buttons .ui-spinner-up{height:7px!important}.div-addtask #calendar_addtask_details1 .ui-spinner-buttons .ui-spinner-down{height:8px!important}.div-addtask #calendar_addtask_details1 .subitem .span_done.noAction{background-image:url("../../../prototype/modules/calendar/img/gray.png");background-repeat:no-repeat}.div-addtask #calendar_addtask_details1 .subitem .span_done.inProcess{background-image:url("../../../prototype/modules/calendar/img/yellow.png");background-repeat:no-repeat}.div-addtask #calendar_addtask_details1 .subitem .span_done.finished{background-image:url("../../../prototype/modules/calendar/img/green.png");background-repeat:no-repeat}.div-addtask #calendar_addtask_details1 .subitem .span_done.canceled{background-image:url("../../../prototype/modules/calendar/img/red.png");background-repeat:no-repeat}#calendar_addtask_details4{margin:0}#calendar_addtask_details5{margin:-2px 0 0 0}#calendar_addtask_details7{margin:3px 0 0 0}.div-addtask #calendar_addtask_details1 .subitem .span_done label{position:relative;left:28px}.div-addtask fieldset#calendar_addtask_details5.tab-level2{margin:0}.div-addtask #calendar_addtask_details8 .parent{width:746px;min-height:208px;float:left}.div-addtask #calendar_addtask_details8 .parent .child-top{width:745px;height:25px;background:#e8f4fd;border-left:1px solid #CCC;border-right:1px solid #CCC;border-bottom:1px solid #CCC;border-top:1px solid #CCC}.div-addtask #calendar_addtask_details8 .parent .child-bottom{width:745px;height:208px;overflow:auto;float:left;border-left:1px solid #CCC;border-right:1px solid #CCC;border-bottom:1px solid #CCC}.div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each{height:20px}.div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each:hover{background:#fff2f2;cursor:pointer}.div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .date-hour{overflow:hidden;width:140px;float:left;height:20px}.div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .date-hour span{margin:8px;float:left}.div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .user{overflow:hidden;width:150px;float:left;height:20px;border-left:1px solid #CCC}.div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .user span{margin:8px;float:left}.div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .attribute{overflow:hidden;width:130px;float:left;height:20px;border-left:1px solid #CCC}.div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .attribute span{margin:8px;float:left}.div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .beforeValue{overflow:hidden;width:150px;float:left;height:20px;border-left:1px solid #CCC}.div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .beforeValue span{margin:8px;float:left}.div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .afterValue{overflow:hidden;width:150px;float:left;height:20px;border-left:1px solid #CCC}.div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .afterValue span{margin:8px;float:left}.div-addtask #calendar_addtask_details8 .parent .child-top .date-hour{width:140px;float:left;background:#e8f4fd;height:20px;text-align:center}.div-addtask #calendar_addtask_details8 .parent .child-top .date-hour span{display:block;padding:6px;font-weight:bold;color:#2e6e9e}.div-addtask #calendar_addtask_details8 .parent .child-top .user{width:150px;float:left;background:#e8f4fd;height:20px;font-weight:bold;color:#2e6e9e;text-align:center}.div-addtask #calendar_addtask_details8 .parent .child-top .user span{display:block;padding:6px}.div-addtask #calendar_addtask_details8 .parent .child-top .attribute{width:130px;float:left;background:#e8f4fd;height:20px;font-weight:bold;color:#2e6e9e;text-align:center}.div-addtask #calendar_addtask_details8 .parent .child-top .attribute span{display:block;padding:6px}.div-addtask #calendar_addtask_details8 .parent .child-top .beforeValue{width:150px;float:left;background:#e8f4fd;height:20px;font-weight:bold;color:#2e6e9e;text-align:center}.div-addtask #calendar_addtask_details8 .parent .child-top .beforeValue span{display:block;padding:6px}.div-addtask #calendar_addtask_details8 .parent .child-top .afterValue{width:150px;float:left;background:#e8f4fd;height:20px;font-weight:bold;color:#2e6e9e;text-align:center}.div-addtask #calendar_addtask_details8 .parent .child-top .afterValue span{display:block;padding:6px}.new-message-input.email-text{resize:none;height:16px;overflow:hidden;vertical-align:middle;cursor:text}.local-connect{width:16px;height:16px;background:url("images/connect_delete.gif") no-repeat;display:inline-block;cursor:pointer}
Index: trunk/expressoMail1_2/js/common_functions.min.js
===================================================================
--- trunk/expressoMail1_2/js/common_functions.min.js	(revision 7538)
+++ trunk/expressoMail1_2/js/common_functions.min.js	(revision 7538)
@@ -0,0 +1,78 @@
+if(!expresso_offline){var _showBar=showBar;var _hideBar=hideBar}function __showBar(){_showBar();resizeWindow()}function __hideBar(){_hideBar();resizeWindow()}showBar=__showBar;hideBar=__hideBar;window.onresize=resizeWindow;var message="N\u00e3o Informado";
+try{var ArchiveServices=new web_service_mailarchiver_serpro__ArchiveServices;ArchiveServices.url=mail_archive_protocol+"://"+mail_archive_host+":"+mail_archive_port+"/arcserv/ArchiveServices";ArchiveServices.synchronous=true}catch(e){var ArchiveServices=null}
+function config_events(pObj,pEvent,pHandler){if(typeof pObj=="object"){if(pEvent.substring(0,2)=="on")pEvent=pEvent.substring(2,pEvent.length);if(pObj.addEventListener)pObj.addEventListener(pEvent,pHandler,false);else if(pObj.attachEvent)pObj.attachEvent("on"+pEvent,pHandler)}}
+function resizeWindow(){var divScrollMain=Element("divScrollMain_"+numBox);var table_message=Element("table_message");var content_folders=Element("content_folders");var clientWidth=0,clientHeight=0;if(typeof window.innerWidth=="number"){clientWidth=window.innerWidth;clientHeight=window.innerHeight}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){clientWidth=document.documentElement.clientWidth;clientHeight=document.documentElement.clientHeight}else if(document.body&&
+(document.body.clientWidth||document.body.clientHeight)){clientWidth=document.body.clientWidth;clientHeight=document.body.clientHeight}clientHeight=clientHeight-8;if(divScrollMain)divScrollMain.style.height=clientHeight-(findPosY(divScrollMain)+(table_message.clientHeight?table_message.clientHeight:table_message.offsetHeight))+"px";if(typeof BordersArray!="undefined")for(var i=1;BordersArray.length>1&&i<BordersArray.length;i++){var div_scroll=Element("div_message_scroll_"+BordersArray[i].sequence);
+var div=Element("content_id_"+BordersArray[i].sequence);if(div){div.style.height=clientHeight-(findPosY(div)+(table_message.clientHeight?table_message.clientHeight:table_message.offsetHeight)+2)+"px";div.style.width=clientWidth-(findPosX(div)+10)+"px"}if(div_scroll){div_scroll.style.height=clientHeight-(findPosY(div_scroll)+(table_message.clientHeight?table_message.clientHeight:table_message.offsetHeight)+5)+"px";div_scroll.style.width=clientWidth-(findPosX(div_scroll)+15)+"px"}}if(content_folders){var search_div=
+Element("search_div");var contentFoldersY=findPosY(content_folders);content_folders.style.height=clientHeight-(contentFoldersY+(contentFoldersY>findPosY(search_div)?0:(search_div.clientHeight?search_div.clientHeight:search_div.offsetHeight)+5))+"px"}redim_borders(count_borders());resizeMailList()}var _beforeunload_=window.onbeforeunload;window.onbeforeunload=unloadMess;
+function unloadMess(){if(typeof BordersArray=="undefined")return;if(typeof expresso_mail_sync!="undefined"&&expresso_mail_sync.working){var mess=get_lang("You're about archiving your e-mails from server. Do you really want to stop this action?");return mess}else for(var i=0;i<BordersArray.length;i++)if(BordersArray[i].sequence>0&&!isNaN(BordersArray[i].sequence)&&parseInt(BordersArray[i].sequence)==BordersArray[i].sequence)return get_lang("There are still editing posts, really want to leave the page")+
+"?"}function get_lang(_key){if(typeof _key=="undefined")return false;var key=_key.toLowerCase();if(array_lang[key])var _value=array_lang[key];else var _value=_key+"*";if(arguments.length>1)for(j=1;typeof arguments[j]!="undefined";j++)_value=_value.replace("%"+j,arguments[j]);return _value}function round(value,decimal){var return_value=Math.round(value*Math.pow(10,decimal))/Math.pow(10,decimal);return return_value}
+function set_msg_as_read(msg_number,selected){tr_message=Element(msg_number);if(exist_className(tr_message,"tr_msg_unread"))decrement_folder_unseen();remove_className(tr_message,"tr_msg_unread");remove_className(tr_message,"selected_msg");if(document.getElementById("td_message_unseen_"+msg_number)!=null)Element("td_message_unseen_"+msg_number).innerHTML="<img src ='templates/"+template+"/images/seen.gif' title='"+get_lang("Seen")+"'>";connector.purgeCache();return true}
+function msg_is_read(msg_number,selected){tr_message=Element(msg_number);return!(tr_message&&LTrim(tr_message.className).match("tr_msg_unread"))}
+function set_msg_as_unread(msg_number,isSearch){tr_message=Element(msg_number);if((exist_className(tr_message,"tr_msg_read")||exist_className(tr_message,"tr_msg_read2"))&&!exist_className(tr_message,"tr_msg_unread"))increment_folder_unseen();remove_className(tr_message,"selected_msg");add_className(tr_message,"tr_msg_unread");if(!isSearch)Element("td_message_unseen_"+msg_number).innerHTML="<img src ='templates/"+template+"/images/unseen.gif' title='"+get_lang("Unseen")+"'>"}
+function set_msg_as_flagged(msg_number,isSearch){var msg=Element(msg_number);remove_className(msg,"selected_msg");add_className(msg,"flagged_msg");if(isSearch)Element("td_message_important_"+msg_number.substr(0,msg_number.indexOf("_"))).innerHTML="<img src ='templates/"+template+"/images/important.png' title='"+get_lang("Important")+"'>";else Element("td_message_important_"+msg_number).innerHTML="<img src ='templates/"+template+"/images/important.png' title='"+get_lang("Important")+"'>"}
+function set_msg_as_unflagged(msg_number,isSearch){var msg=Element(msg_number);remove_className(msg,"selected_msg");remove_className(msg,"flagged_msg");if(isSearch)Element("td_message_important_"+msg_number.substr(0,msg_number.indexOf("_"))).innerHTML="&nbsp;&nbsp;&nbsp;";else Element("td_message_important_"+msg_number).innerHTML="&nbsp;&nbsp;&nbsp;"}function removeAll(id){do{if(typeof Element(id)=="undefined")break;$("#"+id).remove()}while(Element(id))}
+function get_current_folder(){return current_folder}function kill_current_box(){var box=document.getElementById("table_box");if(box!=null)box.parentNode.removeChild(box);else return false}function remove_rows(el){while(el.rows.length>0)el.deleteRow(0);Element("tot_m").innerHTML=0;Element("new_m").innerHTML=0}function kill_current_paging(){var paging=Element("span_paging");if(paging!=null)paging.parentNode.removeChild(paging)}
+function show_hide_span_paging(ID){if(ID!="0"&&Element("span_paging"))Element("span_paging").style.display="none";else if(Element("span_paging"))Element("span_paging").style.display=""}function get_messages_number_in_page(){main=document.getElementById("tbody_box");main_list=main.childNodes;return main_list.length}
+function download_local_attachment(url){url=encodeURI(url);url=url.replace("%25","%");if(div_attachment==null){var div_attachment=document.createElement("DIV");div_attachment.id="id_div_attachment";document.body.appendChild(div_attachment)}div_attachment.innerHTML="<iframe style='display:none;width:0;height:0' name='attachment' src='"+url+"'></iframe>";window.onbeforeunload=function(){return unloadMess()}}
+function download_attachments(msg_folder,msg_number,idx_file,msg_part,encoding,new_file_name,show_iframe){div_attachment=document.getElementById("id_div_attachment");var params="";if(msg_folder)msg_folder=utf8_decoder(Base64.decode(msg_folder));if(div_attachment==null){var div_attachment=document.createElement("DIV");div_attachment.id="id_div_attachment";document.body.appendChild(div_attachment)}if(new_file_name){var extension=/\.[^.]*$/.exec(new_file_name);if(extension==".eml")params="&newFilename="+
+new_file_name;else params="&newFilename="+escape(new_file_name)}if(encoding)params+="&encoding="+encoding;div_attachment.innerHTML="<iframe style='display:none;width:0;height:0' name='attachment' src='inc/get_archive.php?msgFolder="+msg_folder+"&msgNumber="+msg_number+"&idx_file="+idx_file+"&indexPart="+msg_part+params+"'></iframe>"}
+function download_all_attachments(msg_folder,msg_number){var handler_source=function(data){download_attachments(null,null,data,null,null,"anexos.zip")};cExecute("$this.exporteml.download_all_attachments",handler_source,"folder="+utf8_decoder(msg_folder)+"&num_msg="+msg_number)}
+function addForwardedFile(id_border,file_name,link,divFiles){if(!divFiles)var divFiles=document.getElementById("divFiles_"+id_border);if(!divFiles)return false;if(divFiles.lastChild)var countDivFiles=parseInt(divFiles.lastChild.id.split("_")[2])+1;if(!countDivFiles)var countDivFiles=1;var divFile=document.createElement("DIV");var inputFile=document.createElement("INPUT");if(!expresso_offline)if(!is_ie){var tmp_id_border=document.createAttribute("id_border");tmp_id_border.value=id_border;inputFile.setAttributeNode(tmp_id_border);
+inputFile.id="inputFile_"+id_border+"_"+countDivFiles;inputFile.type="file";inputFile.size=50;inputFile.maxLength=255;inputFile.name="file_"+countDivFiles;inputFile.style.display="none"}else{inputFile=document.createElement("link");var tmp_id_border=document.createAttribute("id_border");tmp_id_border.value=id_border;inputFile.setAttributeNode(tmp_id_border);inputFile.id="inputFile_"+id_border+"_"+countDivFiles;inputFile.name="file_"+countDivFiles}else{inputFile.type="hidden";inputFile.name="offline_forward_"+
+countDivFiles}divFile.appendChild(inputFile);var a_tmp=new Array;a_tmp[0]="local_";a_tmp[1]="file_"+countDivFiles;a_tmp[2]=file_name;s_tmp=escape(connector.serialize(a_tmp));var checkbox=document.createElement("INPUT");checkbox.type="checkbox";checkbox.id="checkbox_"+id_border+"_"+countDivFiles;checkbox.name="local_attachments[]";checkbox.setAttribute("checked","checked");checkbox.value=s_tmp;divFile.appendChild(checkbox);var link_attachment=document.createElement("A");link_attachment.setAttribute("href",
+link);link_attachment.innerHTML=file_name;divFile.appendChild(link_attachment);countDivFiles++;divFile.id="divFile_"+id_border+"_"+countDivFiles;divFiles.appendChild(divFile);return inputFile}
+function addFile(id_border){divFiles=document.getElementById("divFiles_"+id_border);if(!divFiles)return false;if(divFiles.lastChild)var countDivFiles=parseInt(divFiles.lastChild.id.split("_")[2])+1;if(!countDivFiles)var countDivFiles=1;divFile=document.createElement("div");var inputFile=document.createElement("input");inputFile.id="inputFile_"+id_border+"_"+countDivFiles;inputFile.name="file_"+countDivFiles;inputFile.type="file";inputFile.size=50;inputFile.maxlength=255;inputFile.onchange=function(){validateFileExtension(this.value,
+this.id.replace("input","div"),this.getAttribute("id_border"))};divFile.appendChild(inputFile);var linkFile=document.createElement("a");linkFile.id="linkFile_"+id_border+"_"+countDivFiles;linkFile.href="javascript:void(0)";linkFile.onclick=function(){removeFile("divFile_"+id_border+"_"+countDivFiles);return false};linkFile.innerHTML=get_lang("Remove");divFile.appendChild(linkFile);divFile.id="divFile_"+id_border+"_"+countDivFiles;divFiles.appendChild(divFile);return inputFile}
+function removeFile(id){var el=Element(id);el.parentNode.removeChild(el)}
+function validateFileExtension(fileName,id,id_border){var error_flag=false;if(fileName.indexOf("/")!=-1)if(fileName[0]!="/"){var file=fileName.substr(fileName.lastIndexOf("\\")+1,fileName.length);if(fileName.indexOf(":\\")!=1&&fileName.indexOf("\\\\")!=0)error_flag=true}else var file=fileName.substr(fileName.lastIndexOf("/")+1,fileName.length);else var file=fileName;var fileExtension=file.split(".");fileExtension=fileExtension[fileExtension.length-1];for(var i=0;i<denyFileExtensions.length;i++)if(denyFileExtensions[i]==
+fileExtension){error_flag=true;break}if(error_flag==true){alert(get_lang("File extension forbidden or invalid file")+".");removeFile(id);addFile(id_border);return false}return true}var setTimeout_write_msg=0;var old_msg=false;
+function write_msg(msg,notimeout){if(setTimeout_write_msg)clearTimeout(setTimeout_write_msg);var msg_div=Element("em_div_write_msg");var old_divStatusBar=Element("divStatusBar");if(!msg_div){msg_div=document.createElement("DIV");msg_div.id="em_div_write_msg";msg_div.className="em_div_write_msg";old_divStatusBar.parentNode.insertBefore(msg_div,old_divStatusBar)}if(document.getElementById("JabberMessenger"))loadscript.adIcon();msg_div.innerHTML='<table width="100%" cellspacing="0" cellpadding="0" border="0"><tbody><tr><th width="40%"></th><th noWrap class="action_info_th">'+
+msg+'</th><th width="40%"></th></tr></tbody></table>';old_divStatusBar.style.display="none";msg_div.style.display="";handle_write_msg=function(){try{if(!old_msg)clean_msg();else write_msg(old_msg,true)}catch(e){}};if(notimeout)old_msg=msg;else setTimeout_write_msg=setTimeout("handle_write_msg();",5E3)}function clean_msg(){old_msg=false;var msg_div=Element("em_div_write_msg");var old_divStatusBar=Element("divStatusBar");if(msg_div)msg_div.style.display="none";old_divStatusBar.style.display=""}
+function make_body_reply(body,to,date_day,date_hour){to=to.replace("<","&lt;");to=to.replace(">","&gt;");block_quoted_body="<div>";block_quoted_body+=get_lang("At %1, %2 hours, %3 wrote:",date_day,date_hour,to)+'<br type="_moz"></div>';block_quoted_body+='<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">';block_quoted_body+=body;block_quoted_body+="</blockquote>";return block_quoted_body}
+function make_forward_body(body,from,date,subject,to,cc){from=from.replace(/</g,"&lt;");from=from.replace(/>/g,"&gt;");to=to.replace(/</g,"&lt;");to=to.replace(/>/g,"&gt;");var forward_body="<div>---------- "+get_lang("Forwarded message")+' ----------<br type="_moz"></div><div>';forward_body+=get_lang("From")+": "+from+'<br type="_moz"></div><div>';forward_body+=get_lang("Date")+": "+date+'<br type="_moz"></div><div>';forward_body+=get_lang("Subject")+": "+subject+'<br type="_moz"></div><div>';forward_body+=
+get_lang("To")+": "+to+'<br type="_moz"></div><div>';if(cc!=undefined){cc=cc.replace(/</g,"&lt;");cc=cc.replace(/>/g,"&gt;");forward_body+=get_lang("CC")+": "+cc+'<div><br type="_moz"></div><div><br type="_moz"></div><div><br type="_moz"></div>'}forward_body+=body;return forward_body}function emMessageSearch(e,value){var e=is_ie?window.event:e;if(e.keyCode==13)search_emails(value)}
+function validateEmail(email){if(typeof email!="string")return false;var validName=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/i;return validName.test(email)}function validateDomain(domain){var domainReg=/^(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/i;return domainReg.test(domain)}function validateUrl(url){var urlReg=/([A-Za-z]{2,7}:\/\/)(.*)/i;urlParts=url.split(urlReg);return urlParts[1].length>4&&validateDomain(urlParts[2])}
+function performQuickSearch(keyword){if(preferences.quick_search_default=="1")emQuickSearch(keyword,"null","null","expressoMail");else search_emails(keyword)}
+function emQuickSearch(emailList,field,ID,Type,force){var quickSearchKeyBegin;var quickSearchKeyEnd;var content=$("#content_id_"+ID);if(expresso_offline){alert(get_lang("Not allowed in offline mode"));return}if(field!="null"&&ID!="null"){connector.loadScript("QuickCatalogSearch");if(typeof QuickCatalogSearch=="undefined"){setTimeout('emQuickSearch("'+emailList+'", "'+field+'", "'+ID+'", "'+Type+'", "'+force+'")',500);return false}}else{connector.loadScript("QuickSearchUser");if(typeof QuickSearchUser==
+"undefined"){setTimeout('emQuickSearch("'+emailList+'", "'+field+'", "'+ID+'", "'+Type+'", "'+force+'")',500);return false}}var handler_emQuickSearch=function(data){if(!data.status&&data.error=="many results"){alert(get_lang("More than %1 results. Please, try to refine your search.",data.maxResult));return false}if(data.length>0)if(field!="null"&&ID!="null")QuickCatalogSearch.showList(data,quickSearchKeyBegin,quickSearchKeyEnd,ID,field);else QuickSearchUser.showList(data);else alert(get_lang("None result was found."));
+return true};if(field!="null"&&ID!="null"){content.find(field).focus();var i=getPosition(content.find(field)[0]);var j=--i;while(j>=0&&emailList.charAt(j)!=",")j--;quickSearchKeyBegin=++j;while(i<=emailList.length&&emailList.charAt(i)!=",")i++;quickSearchKeyEnd=i;var search_for=trim(emailList.substring(quickSearchKeyBegin,quickSearchKeyEnd))}else var search_for=emailList;if(preferences.search_characters_number=="x")preferences.search_characters_number=0;if(search_for.length<preferences.search_characters_number){alert(get_lang("Your search argument must be longer than %1 characters.",
+preferences.search_characters_number));return false}if(Type==undefined)cExecute("$this.ldap_functions.quicksearchcontact&search_for="+search_for+"&field="+field+"&ID="+ID,handler_emQuickSearch);else cExecute("$this.ldap_functions.quicksearchcontact&search_for="+search_for+"&field="+field+"&ID="+ID+"&Type="+Type,handler_emQuickSearch)}
+function filterbox(){connector.loadScript("filter");connector.loadScript("filters");if(typeof filters=="undefined"){setTimeout("filterbox()",500);return false}filters.Forms()}function filterbox2(){init_filters();jQuery(".expresso-window-container").dialog("open")}
+function sharebox(){var handler_imap_getacl=function(data){connector.loadScript("finder","../services/");connector.loadScript("sharemailbox");if(typeof sharemailbox=="undefined"){setTimeout("sharebox()",500);return false}sharemailbox.makeWindow(data)};cExecute("$this.imap_functions.getacl",handler_imap_getacl)}
+function configureLabels(data){if(get_current_folder().split("_")[0]=="local"){alert("Pastas locais n\u00e3o fornece suporte para marcadores");return true}dialogElement=$(".label-configure-win").html(DataLayer.render("../prototype/modules/mail/templates/label_configure.ejs",{}));dialogElement.dialog({width:815,height:410,title:" Configura\u00e7\u00e3o do Marcador",resizable:false,modal:true,closeOnEscape:true,close:function(event,ui){event.stopPropagation();if(typeof shortcut!="undefined")shortcut.disabled=
+false},open:function(event,ui){if(typeof shortcut!="undefined")shortcut.disabled=true},autoOpen:false,dialogClass:"dialog-configure-label"});init_label({window:dialogElement,selectedItem:data.selectedItem,applyToSelectedMessages:data.applyToSelectedMessages});dialogElement.dialog("open")}
+function configureFollowupflag(){if(get_current_folder().split("_")[0]=="local"){alert("Pastas locais n\u00e3o fornece suporte para acompanhamento.");return true}var messages=new Array;var selectedMessageIds=new Array;var folder_name;if(currentTab==0)selectedMessageIds=get_selected_messages().split(",");else{selectedMessageIds=get_selected_messages_search().split(",");var id_border=currentTab.replace(/[a-zA-Z_]+/,"")}var roles=get_selected_messages_search_role().split(",");for(var i=0;i<selectedMessageIds.length;i++){if(currentTab==
+0){folder_name=current_folder;var number=selectedMessageIds[i]}else{var tr=$('[role="'+roles[i]+'"]');folder_name=$(tr).attr("name");var id=$(tr).attr("id");var number=id.replace(/_[a-zA-Z0-9]+/,"")}messages.push(onceOpenedHeadersMessages[folder_name][number])}if(!User.followupflags)DataLayer.remove("followupflag",false);User.followupflags=DataLayer.get("followupflag",true);var data={followupflags:User.followupflags,messages:messages};dialogElement=$(".followupflag-configure-win").html(DataLayer.render("../prototype/modules/mail/templates/followupflag_configure.ejs",
+data));dialogElement.dialog({width:532,height:420,title:get_lang("Follow up"),resizable:false,modal:true,closeOnEscape:true,close:function(event,ui){event.stopPropagation();if(typeof shortcut!="undefined")shortcut.disabled=false},open:function(event,ui){if(typeof shortcut!="undefined")shortcut.disabled=true},autoOpen:false});init_followup({window:dialogElement,selectedMessages:selectedMessageIds});dialogElement.dialog("open")}
+function open_rss(param){connector.loadScript("news_edit");if(typeof news_edit=="undefined"){setTimeout("open_rss('"+param+"')",500);return false}news_edit.read_rss(param);return true}function editrss(){connector.loadScript("news_edit");if(typeof news_edit=="undefined"){setTimeout("editrss()",500);return false}news_edit.makeWindow()}function preferences_mail(){location.href="../preferences/preferences.php?appname=expressoMail1_2"}
+function search_emails(value,data){var resize=false;resize=resize_borders();if(!resize){var str_continue="";var bolContinue=true;str_continue="\n"+get_lang("You must manually close one of your tabs before opening a new one");if(preferences.auto_close_first_tab==1){var children=Element("border_tr").childNodes;var bolDelete=true;for(var i=0;i<children.length;i++)if(children[i].nodeName==="TD"&&children[i].id!=="border_id_0"&&children[i].id!=="border_blank"){bolDelete=true;var num_child=children[i].id.toString().substr(10);
+alternate_border(num_child);if(editTest(num_child))bolDelete=false;if(bolDelete||bolContinue){str_fechar="\n"+get_lang("Reached maximum tab limit. Want to close this tab");var confirmacao=confirm(str_fechar);if(confirmacao){bolContinue=false;delete_border(num_child,"false");break}else return}}}else{alert(get_lang("Reached maximum tab limit")+str_continue);return}}connector.loadScript("TreeS");connector.loadScript("search");if(typeof EsearchE=="undefined"||typeof ttree=="undefined"){setTimeout("search_emails('"+
+value+"', '"+data+"')",500);return false}EsearchE.showForms(value,data);$("#em_message_search").val("")}function source_msg(id_msg,folder){var num_msg=id_msg.substr(0,id_msg.length-2);var handler_source=function(data){download_attachments(null,null,data[0],null,null,data[1]+".eml")};cExecute("$this.exporteml.export_msg",handler_source,"folder="+url_decode(folder)+"&msgs_to_export="+num_msg)}
+function url_encode(str){if(str===null)return false;var hex_chars="0123456789ABCDEF";var noEncode=/^([a-zA-Z0-9\_\-\.])$/;var n,strCode,hex1,hex2,strEncode="";for(n=0;n<str.length;n++)if(noEncode.test(str.charAt(n)))strEncode+=str.charAt(n);else{strCode=str.charCodeAt(n);hex1=hex_chars.charAt(Math.floor(strCode/16));hex2=hex_chars.charAt(strCode%16);strEncode+="%"+(hex1+hex2)}return strEncode}
+function url_decode(str){var n,strCode,strDecode="";for(n=0;n<str.length;n++)strDecode+=str.charAt(n);return strDecode}function url_decode_s(str){var result="";for(var i=0;i<str.length;i++)if(str.charAt(i)=="+")result+=" ";else result+=str.charAt(i);return unescape(result)}function Element(el){return document.getElementById(el)}
+function getPosition(obj){if(typeof obj.selectionStart!="undefined")return obj.selectionStart;else if(document.selection&&document.selection.createRange){var M=document.selection.createRange();try{var Lp=M.duplicate();Lp.moveToElementText(obj)}catch(e){var Lp=obj.createTextRange()}Lp.setEndPoint("EndToStart",M);var rb=Lp.text.length;if(rb>obj.value.length)return-1;return rb}}
+function trim(inputString){if(typeof inputString!="string")return inputString;var retValue=inputString;var ch=retValue.substring(0,1);while(ch==" "){retValue=retValue.substring(1,retValue.length);ch=retValue.substring(0,1)}ch=retValue.substring(retValue.length-1,retValue.length);while(ch==" "){retValue=retValue.substring(0,retValue.length-1);ch=retValue.substring(retValue.length-1,retValue.length)}while(retValue.indexOf("  ")!=-1)retValue=retValue.substring(0,retValue.indexOf("  "))+retValue.substring(retValue.indexOf("  ")+
+1,retValue.length);return retValue}
+function increment_folder_unseen(){var folder_id=get_current_folder();var folder_unseen=Element("dftree_"+folder_id+"_unseen");var abas_unseen=Element("new_m").innerHTML;abas_unseen=abas_unseen.match(/(<font.*?>){0,1} *([0-9]+) *(<\/font>){0,1}/)[2];if(folder_unseen)folder_unseen.innerHTML=parseInt(folder_unseen.innerHTML)+1;else{tree_folders.getNodeById(folder_id).alter({caption:tree_folders.getNodeById(current_folder).caption+'<font style=color:red>&nbsp(</font><span id="dftree_'+current_folder+
+'_unseen" style=color:red>1</span><font style=color:red>)</font>'});tree_folders.getNodeById(folder_id)._refresh()}if(abas_unseen==NaN||abas_unseen==undefined)abas_unseen=1;else abas_unseen=parseInt(abas_unseen)+1;Element("new_m").innerHTML='<font style="color:red">'+abas_unseen+"</font>";if(current_folder.indexOf("INBOX")!==0&&current_folder.indexOf("local_")!==0){var display_unseen_in_shared_folders=Element("dftree_user_unseen");if(display_unseen_in_shared_folders)tree_folders.getNodeById("user").alter({caption:'<font style=color:red>[</font><span id="dftree_user_unseen" style="color:red">'+
+(parseInt(display_unseen_in_shared_folders.innerHTML)+1)+"</span><font style=color:red>]</font>"+get_lang("Shared folders")});else tree_folders.getNodeById("user").alter({caption:'<font style=color:red>[</font><span id="dftree_user_unseen" style="color:red">1</span><font style=color:red>]</font>'+get_lang("Shared folders")});tree_folders.getNodeById("user")._refresh()}var display_unseen_in_mailbox=Element("dftree_root_unseen");if(!expresso_offline)var node_to_refresh="root";else var node_to_refresh=
+"local_root";tree_folders.getNodeById(node_to_refresh)._refresh()}
+function decrement_folder_unseen(){var folder_id=get_current_folder();var folder_unseen=Element("dftree_"+folder_id+"_unseen");var abas_unseen=Element("new_m").innerHTML;abas_unseen=abas_unseen.match(/(<font.*?>){0,1} *([0-9]+) *(<\/font>){0,1}/)[2];if(!folder_unseen||!abas_unseen)return;if(folder_unseen&&parseInt(folder_unseen.innerHTML)>1)folder_unseen.innerHTML=parseInt(folder_unseen.innerHTML)-1;else if(parseInt(folder_unseen.innerHTML)<=1){var tmp_folder_name=tree_folders.getNodeById(folder_id).caption.split("<");
+var folder_name=tmp_folder_name[0];tree_folders.getNodeById(folder_id).alter({caption:folder_name});tree_folders.getNodeById(folder_id)._refresh()}if(parseInt(abas_unseen)>1)Element("new_m").innerHTML='<font style="color:red">'+(parseInt(abas_unseen)-1)+"</font>";else{Element("new_m").innerHTML="0";$(folder_unseen).parent().empty()}if(current_folder.indexOf("INBOX")!==0){var display_unseen_in_shared_folders=Element("dftree_user_unseen");if(display_unseen_in_shared_folders){var unseen_in_shared_folders=
+parseInt(display_unseen_in_shared_folders.innerHTML);unseen_in_shared_folders--;if(unseen_in_shared_folders>0)tree_folders.getNodeById("user").alter({caption:'<font style=color:red>[</font><span id="dftree_root_unseen" style="color:red">'+unseen_in_shared_folders+"</span><font style=color:red>]</font>"+get_lang("My Folders")});else tree_folders.getNodeById("user").alter({caption:get_lang("Shared folders")});tree_folders.getNodeById("user")._refresh()}}var display_unseen_in_mailbox=Element("dftree_root_unseen");
+if(display_unseen_in_mailbox){var unseen_in_mailbox=parseInt(display_unseen_in_mailbox.innerHTML);unseen_in_mailbox--;if(!expresso_offline)var node_to_refresh="root";else var node_to_refresh="local_root";tree_folders.getNodeById(node_to_refresh).alter({caption:get_lang("My Folders")});tree_folders.getNodeById(node_to_refresh)._refresh()}}
+function LTrim(value){var w_space=String.fromCharCode(32);var strTemp="";var iTemp=0;var v_length=value?value.length:0;if(v_length<1)return"";while(iTemp<v_length){if(value&&value.charAt(iTemp)!=w_space){strTemp=value.substring(iTemp,v_length);break}iTemp++}return strTemp}function set_menu_bg(menu){return true;menu.style.backgroundColor="white";menu.style.border="1px solid black";menu.style.padding="0px 0px"}
+function unset_menu_bg(menu){return true;menu.style.backgroundColor="";menu.style.border="0px";menu.style.padding="1px 0px"}function array_search(needle,haystack){var n=haystack.length;for(var i=0;i<n;i++)if(haystack[i]==needle)return true;return false}function lang_folder(fn){if(fn.toUpperCase()=="INBOX")return get_lang("Inbox");if(special_folders[fn]&&typeof special_folders[fn]=="string")return get_lang(special_folders[fn]);return fn}
+function add_className(obj,className){if(obj&&!exist_className(obj,className))obj.className=obj.className+" "+className}function remove_className(obj,className){var re=new RegExp("\\s*"+className);if(obj)obj.className=obj.className.replace(re," ")}function exist_className(obj,className){return obj&&obj.className.indexOf(className)!=-1}
+function remove_chk_box_select_all_messages(){var main=Element("tbody_box");var main_list=main.childNodes;var len_main_list=main_list.length;for(i=0;i<len_main_list;i++)if(Element("check_box_message_"+main_list[i].id).checked)return;document.getElementById("chk_box_select_all_messages").checked=false}
+function select_all_messages(select){var main=Element("tbody_box");var main_list=main.childNodes;var len_main_list=main_list.length;var folder=$("#content_folders .folder.selected").attr("title");folder=folder?folder:get_lang("INBOX");folder=folder.length>70?'"'+folder.substr(0,70)+"..."+'"':'"'+folder+'"';var filterFlag=search_box_type!="ALL"?'"'+get_lang(search_box_type)+"s"+'"':"";var div=$(".select-all-messages");if(select){for(i=0;i<len_main_list;i++){Element("check_box_message_"+main_list[i].id).checked=
+true;remove_className(Element(main_list[i].id),"selected_msg");if(!$("#"+main_list[i].id).hasClass("selected_shortcut_msg"))add_className(Element(main_list[i].id),"selected_msg");else $("#"+main_list[i].id).addClass("selected_msg");selectedPagingMsgs[main_list[i].id]=true}if(totalSelected()==totalFolderMsgs&&totalSelected()>0){allMsgsSelected=true;if(total_pages>1){var link="<a class='select-link' href='#'>Limpar sele\u00e7\u00e3o?</a>";var info="Todas as <b>"+totalFolderMsgs+"</b> mensagens "+filterFlag+
+" em "+folder+" foram selecionadas. "+link;div.html("<span>"+info+"<span>");$(".select-link").bind("click",function(){selectAllFolderMsgs()})}}else if(!allMsgsSelected&&total_pages>1){var link="<a class='select-link' href='#'>Selecionar todas as <b>"+totalFolderMsgs+"</b> mensagens "+filterFlag+" em "+folder+"?</a>";var info="Todas as <b>"+$("#table_box tr").length+"</b> mensagens desta p\u00e1gina foram selecionadas. "+link;div.html("<span>"+info+"<span>");$(".select-link").bind("click",function(){selectAllFolderMsgs(true)})}}else{for(i=
+0;i<len_main_list;i++){Element("check_box_message_"+main_list[i].id).checked=false;remove_className(Element(main_list[i].id),"selected_msg selected_shortcut_msg");$("#"+main_list[i].id).removeClass("selected_msg");$("#"+main_list[i].id).removeClass("current_selected");selectedPagingMsgs[main_list[i].id]=false}if(allMsgsSelected){allMsgsSelected=false;updateSelectedMsgs()}else if(totalSelected()>0&&total_pages>1){var link="<a class='select-link' href='#'>Limpar sele\u00e7\u00e3o?</a>";var info="Foram selecionadas <b>"+
+totalSelected()+"</b> mensagens "+filterFlag+" em "+folder+". "+link;div.html("<span>"+info+"<span>");div.show();$(".select-link").bind("click",function(){selectAllFolderMsgs(false)})}else div.html('<span class="none-selected">Nenhuma mensagem foi selecionada.</span>')}resizeWindow()}
+function borkb(size){kbyte=1024;mbyte=kbyte*1024;gbyte=mbyte*1024;if(!size)size=0;if(size<kbyte)return size+" B";else if(size<mbyte)return parseInt(size/kbyte)+" KB";else if(size<gbyte)if(size/mbyte>100)return(size/mbyte).toFixed(0)+" MB";else return(size/mbyte).toFixed(1)+" MB";else return(size/gbyte).toFixed(1)+" GB"}
+function validate_date_order(dateStart,dateEnd){if(parseInt(dateEnd.split("/")[2].toString()+dateEnd.split("/")[1].toString()+dateEnd.split("/")[0].toString())>=parseInt(dateStart.split("/")[2].toString()+dateStart.split("/")[1].toString()+dateStart.split("/")[0].toString()))return true;else return false}
+function validate_date(date){if(date.match(/^[0-3][0-9]\/[0-1][0-9]\/\d{4,4}$/)){tmp=date.split("/");day=new Number(tmp[0]);month=new Number(tmp[1]);year=new Number(tmp[2]);if(month>=1&&month<=12&&day>=1&&day<=31){if(month==2&&day<=29)return true;return true}else return false}else return false}
+function dateMask(inputData,e){if(document.all)var tecla=event.keyCode;else var tecla=e.which;if(tecla>=47&&tecla<58){var data=inputData.value;if(data.length==2||data.length==5){data+="/";inputData.value=data}}else if(tecla==8||tecla==0)return true;else return false}
+function translateFolder(folderName){for(var i=0;i<folders.length;i++)if(folders[i].folder_parent=="user"&&folderName==folders[i].folder_id.split(cyrus_delimiter).pop())if(folders[i].folder_id.split(cyrus_delimiter).pop()!=folders[i].folder_name)return folders[i].folder_name;return folderName}function useDesktopNotification(){return!!parseInt(preferences.notifications)};
Index: trunk/expressoMail1_2/js/main.min.js
===================================================================
--- trunk/expressoMail1_2/js/main.min.js	(revision 7538)
+++ trunk/expressoMail1_2/js/main.min.js	(revision 7538)
@@ -0,0 +1,1 @@
+var time_refresh=300000;var check_services_interval=2000;var check_services_tryouts=1;var check_services_tryouts_limit=5;var autosave_time=40000;var results_search_messages="";var cabecalho="<h4>ExpressoLivre - ExpressoMail</h4>";var auxNotificationCriteriaVetor=[];var auxNotification;var countNewMessage=0;var notifyNewMessageFilter=[];var dynamicPersonalContacts=new Array();var dynamicPersonalGroups=new Array();var dynamicContacts=new Array();var topContact=0;DataLayer.get("folder",true);if(!String.prototype.trim){String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}}function mount_url_folder(folders){return folders.join(cyrus_delimiter)}function updateDynamicContact(userContacts){if(!userContacts){userContacts=REST.get("/usercontacts",false)}if(userContacts.collection&&!userContacts.collection.error){dynamicData=normalizeContacts(userContacts.collection.itens)}else{dynamicData=[]}if(dynamicData){var dynamicContactsList=[];$.each(dynamicData,function(index,dynamic){var dataType=userContacts.collection.itens[index].dataType;dynamic.value=(dynamic.name?dynamic.name+" - ":"")+dynamic.mail;dynamic.type=dataType;dynamic.typel=(dataType.substring(0,7)=="/shared"?"/"+dataType.substring(7,dataType.length)+"s":dataType);topContact=dynamic.number_of_messages>topContact?dynamic.number_of_messages:topContact;dynamicContactsList.push(dynamic)})}dynamicData=dynamicContactsList}function updateDynamicPersonalContacts(){dynamicPersonalContacts=new Array();var personalContacts=REST.get("/personalContact");if(personalContacts.collection&&!personalContacts.collection.error){var contactsData=normalizeContacts(personalContacts.collection.itens);if(contactsData){$.each(contactsData,function(index,value){var contact={id:parseInt(value.id),name:value.name,email:value.email,value:value.name+" - "+value.email,type:"P"};dynamicPersonalContacts.push(contact)})}}}function updateDynamicPersonalGroups(){dynamicPersonalGroups=new Array();var groups=REST.get("/groups");if(groups.collection&&!groups.collection.error){var contactsData=normalizeContacts(groups.collection.itens);if(contactsData.collecion&&!contactsData.collecion.error){$.each(contactsData,function(index,value){var contact={id:parseInt(value.id),owner:value.owner,name:value.name,email:value.email,type:"G"};dynamicPersonalGroups.push(contact)})}}}function init(){if(!is_ie){Element("tableDivAppbox").width="100%"}var save_gmtoffset=function(data){gmtoffset=data};var save_preferences=function(data){preferences=data;if(preferences.show_name_print_messages=="1"){var getUserName=document.getElementById("user_info");var userName=getUserName.innerHTML;var position=userName.indexOf("-");var userName=userName.substring(3,position);cabecalho="<h4>"+userName}current_folder="INBOX";if(ArchiveServices){expresso_mail_archive.Startup()}else{if(preferences.use_local_messages=="1"){write_msg(get_lang("Sorry, but Mail Archiver does not seems to be running or installed at this workstation. By now, we are turning off local messages!"))}}cExecute("$this.imap_functions.get_range_msgs2&folder=INBOX&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type=SORTARRIVAL&search_box_type=ALL&sort_box_reverse=1",handler_draw_box);$.ajax({async:false,url:"controller.php?"+$.param({action:"$this.imap_functions.getMessagesIds",folder:get_current_folder(),msg_range_begin:"0",msg_range_end:"0",sort_box_type:"SORTARRIVAL",search_box_type:search_box_type,sort_box_reverse:"1"}),success:function(data){data=connector.unserialize(data);if(data){var _data={};$.each(data,function(index,value){if(data[index]){_data[data[index]]=data[index]}});populateSelectedMsgs(_data)}},beforeSend:function(jqXHR,settings){connector.showProgressBar()},complete:function(jqXHR,settings){connector.hideProgressBar()}});if(preferences.hide_folders=="1"){Element("divAppboxHeader").innerHTML=title_app_menu}if(preferences.delete_trash_messages_after_n_days!=0){cExecute("$this.imap_functions.automatic_trash_cleanness&before_date="+preferences.delete_trash_messages_after_n_days+"&cyrus_delimiter="+cyrus_delimiter,handler_automatic_trash_cleanness)}if(preferences.use_signature_digital_cripto=="1"){loadApplet()}DataLayer.get("folder",true);cExecute("$this.imap_functions.get_folders_list&onload=true",update_menu);if($.cookie("collapse_folders")=="true"){if(!is_ie){$("#folderscol").addClass("hidden")}else{$("#folderscol").hide()}$(".collapse_folders").addClass("ui-icon ui-icon-triangle-1-e").children().attr("title","Expandir");refresh();resizeWindow()}else{$(".collapse_folders").addClass("ui-icon ui-icon-triangle-1-w").children().attr("title","Ocultar");refresh();resizeWindow()}$(".collapse_folders_td").attr("title","Ocultar/Expandir").click(function(){if($("#folderscol").css("display")!="none"){if(!is_ie){$("#folderscol").addClass("hidden")}else{$("#folderscol").hide()}$(".collapse_folders").removeClass("ui-icon-triangle-1-w");$(".collapse_folders").addClass("ui-icon-triangle-1-e");$(".collapse_folders").parent().attr("title","Expandir");$.cookie("collapse_folders","true");refresh();resizeWindow()}else{if(!is_ie){$("#folderscol").removeClass("hidden")}else{$("#folderscol").show()}$(".collapse_folders").removeClass("ui-icon-triangle-1-e");$(".collapse_folders").addClass("ui-icon-triangle-1-w");$(".collapse_folders").parent().attr("title","Ocultar");$.cookie("collapse_folders","false");refresh();resizeWindow()}resizeWindow()}).hover(function(){$(this).addClass("collapse_folders_td_over")},function(){$(this).removeClass("collapse_folders_td_over")});if(parseInt(preferences.use_dynamic_contacts)){var load_dynamics=function(){updateDynamicContact();updateDynamicPersonalContacts();updateDynamicPersonalGroups()};load_dynamics()}};var handler_automatic_trash_cleanness=function(data){if(data!=false){write_msg(data.length+" "+Element("txt_clear_trash").value)}};Element("divAppboxHeader").innerHTML=title_app;cyrus_delimiter=Element("cyrus_delimiter").value;cExecute("$this.functions.get_preferences",save_preferences);cExecute("phpgwapi.browser.isMobile",function(data){mobile_device=((data.constructor==Boolean)?data:(data==="true"))});DataLayer.get("folder",true);cExecute("$this.imap_functions.get_folders_list&onload=true",update_menu);setTimeout("auto_refresh()",time_refresh);$("#divAppbox").css("padding-left","0px")}function init_offline(){current_folder="local_Inbox";if(account_id!=null){if(!is_ie){Element("tableDivAppbox").width="100%"}else{connector.createXMLHTTP()}Element("divStatusBar").innerHTML='<table height="16px" border=0 width=100% cellspacing=0 cellpadding=2><tr><td style="padding-left:17px" width=33% id="content_quota" align=left></td><td width=33% height=16px align=center nowrap><font face=Verdana, Arial, Helvetica, sans-serif color=#000066 size=2><b>ExpressoMail Offline</b><font size=1><b> - Versão 1.0</b></font></td><td width=33% id="div_menu_c3" align=right></td></tr></table>';draw_tree_folders();proxy_mensagens.messages_list("local_Inbox",1,preferences.max_email_per_page,"SORTARRIVAL",null,1,1,1,function handler(data){draw_box(data,"local_Inbox")});cyrus_delimiter=Element("cyrus_delimiter").value}}function loadApplet(){var search_div=Element("search_div");var applet=null;if(navigator.userAgent.match("MSIE")){applet=document.createElement('<object style="display:yes;width:0;height:0;vertical-align:bottom;" id="cert_applet" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"></object>');var parameters={type:"application/x-java-applet;version=1.5",code:"ExpressoSmimeApplet",codebase:"/security/",mayscript:"true",token:token_param,locale:locale,archive:"ExpressoCertMail.jar,ExpressoCert.jar,bcmail-jdk15-142.jar,mail.jar,activation.jar,bcprov-jdk15-142.jar,commons-codec-1.3.jar,commons-httpclient-3.1.jar,commons-logging-1.1.1.jar"};if(parameters!="undefined"&&parameters!=null){for(var parameter in parameters){var param=document.createElement("PARAM");param.setAttribute("name",parameter);param.setAttribute("value",parameters[parameter]);applet.appendChild(param)}}}else{applet=document.createElement("embed");applet.innerHTML='<embed style="display:yes;width:0;height:0;vertical-align:bottom;" id="cert_applet" code="ExpressoSmimeApplet.class" codebase="/security/" locale="'+locale+'"archive="ExpressoCertMail.jar,ExpressoCert.jar,bcmail-jdk15-142.jar,mail.jar,activation.jar,bcprov-jdk15-142.jar,commons-codec-1.3.jar,commons-httpclient-3.1.jar,commons-logging-1.1.1.jar" token="'+token_param+'" type="application/x-java-applet;version=1.5" mayscript > <noembed> No Java Support. </noembed> </embed> '}if(applet!=null){applet.style.top="-100px";applet.style.left="-100px";window.document.body.insertBefore(applet,document.body.lastChild)}}function disable_field(field,condition){var comando="if ("+condition+") { document.getElementById('"+field.id+"').disabled=true;} else { document.getElementById('"+field.id+"').disabled=false; }";eval(comando)}function remove_all_attachments(folder,msg_num){var call_back=function(data){if(!data.status){alert(data.msg)}else{msg_to_delete=Element(msg_num);change_tr_properties(msg_to_delete,data.msg_no);msg_to_delete.childNodes[1].innerHTML="";write_msg(get_lang("Attachments removed"));folderName=Base64.encode(folder);folderName=folderName.replace(/=/gi,"");delete_border(msg_num+"_r_"+folderName,"false")}};if(confirm(get_lang("delete all attachments confirmation"))){cExecute("$this.imap_functions.remove_attachments&folder="+folder+"&msg_num="+msg_num,call_back)}}function watch_changes_in_msg(border_id){if(document.getElementById("border_id_"+border_id)){function keypress_handler(){away=false;var save_link=content.find(".save");save_link.onclick=function onclick(event){openTab.toPreserve[border_id]=true;save_msg(border_id)};save_link.button({disabled:false});$(".header-button").button()}var content=$("#content_id_"+border_id);var subject_obj=content.find(".subject");if(subject_obj.addEventListener){subject_obj.addEventListener("keypress",keypress_handler,false)}else{if(subject_obj.attachEvent){subject_obj.attachEvent("onkeypress",keypress_handler)}}var to_obj=content.find('[name="input_to"]');if(to_obj.addEventListener){to_obj.addEventListener("keypress",keypress_handler,false)}else{if(to_obj.attachEvent){to_obj.attachEvent("onkeypress",keypress_handler)}}var cc_obj=content.find('[name="input_cc"]');if(cc_obj.addEventListener){cc_obj.addEventListener("keypress",keypress_handler,false)}else{if(cc_obj.attachEvent){cc_obj.attachEvent("onkeypress",keypress_handler)}}if(content.find('[name="input_cco"]').length){var cco_obj=content.find('[name="input_cco"]');if(cco_obj.addEventListener){cco_obj.addEventListener("keypress",keypress_handler,false)}else{if(cco_obj.attachEvent){cco_obj.attachEvent("onkeypress",keypress_handler)}}}var txtarea_obj=Element("body_"+border_id);if(txtarea_obj){if((preferences.plain_text_editor==1)||(Element("body_")+border_id).checked){if(txtarea_obj.addEventListener){txtarea_obj.addEventListener("keypress",keypress_handler,false)}else{if(txtarea_obj.attachEvent){txtarea_obj.attachEvent("onkeypress",keypress_handler)}}}}}}function show_msg_img(msg_number,folder){var call_back=function(data){data.showImg=true;if(!Element(data.msg_number)){trElement=document.createElement("DIV");trElement.id=data.msg_number;Element("tbody_box").appendChild(trElement)}show_msg(data)};proxy_mensagens.msg_img(msg_number,folder,call_back)}function show_msg(msg_info){if(!verify_session(msg_info)){return}if(typeof(msg_info)!="object"){alert(get_lang("Error in show_msg param is not object"))}if(msg_info.status_get_msg_info=="false"){write_msg(get_lang("Problems reading your message")+".");return}var handler_sendNotification=function(data){if(data){write_msg(get_lang("A read confirmation was sent."))}else{write_msg(get_lang("Error in SMTP sending read confirmation."))}};if(msg_info.source){if(!Element("cert_applet")){write_msg(get_lang('The preference "%1" isn\'t enabled.',get_lang("Enable digitally sign/cipher the message?")))}else{Element("cert_applet").doButtonClickAction("decript",msg_info.msg_number,msg_info.source,msg_info.msg_folder)}return}if(msg_info.status_get_msg_info=="false"){write_msg(get_lang("Problems reading your message")+".");return}if(msg_info.status=="false"){eval(msg_info.command_to_exec)}else{var ID=msg_info.original_ID?msg_info.original_ID:msg_info.msg_number;var folderName=msg_info.msg_folder;folderName=Base64.encode(folderName);folderName=folderName.replace(/=/gi,"");var id_msg_read=ID+"_r_"+folderName;if(Element("border_id_"+id_msg_read)&&currentTab>0){id_msg_read+="n"}if(preferences.use_shortcuts=="1"){select_msg(ID,"null")}var isPartMsg=false;for(var ii=0;ii<partMsgs.length;ii++){if(partMsgs[ii]==ID){isPartMsg=true}}if(msg_info.alarm==false){if((openTab.type[currentTab]==2||openTab.type[currentTab]==3)&&isPartMsg===false){delete_border(currentTab,"false")}}if(Element("border_id_"+id_msg_read)){alternate_border(id_msg_read);resizeWindow()}else{var border_id=create_border(msg_info.subject,id_msg_read);if(border_id){openTab.type[border_id]=2;openTab.imapBox[border_id]=msg_info.msg_folder;draw_message(msg_info,border_id);var unseen_sort=document.getElementById("span_flag_UNSEEN").getAttribute("onclick");unseen_sort=unseen_sort.toString();if(!(unseen_sort.indexOf("'UNSEEN' == 'UNSEEN'")<0)){var sort_type=sort_box_type;sort_box_type=null;sort_box("UNSEEN",sort_type,false);delete selectedPagingMsgs[msg_info.msg_number];totalFolderMsgs--}}else{return}}var domains="";if((msg_info.DispositionNotificationTo)&&(!msg_is_read(ID)||(msg_info.Recent=="N"))){if(preferences.notification_domains!=undefined&&preferences.notification_domains!=""){domains=preferences.notification_domains.split(",")}else{var confNotification=true}for(var i=0;i<domains.length;i++){if(Base64.decode(msg_info.DispositionNotificationTo).match("@"+domains[i])){var confNotification=true;break}}if(confNotification==undefined){var confNotification=confirm(get_lang("The sender:\n%1\nwaits your notification of reading. Do you want to confirm this?",Base64.decode(msg_info.DispositionNotificationTo)),"")}if(confNotification){if(preferences.confirm_read_message){$.Zebra_Dialog(get_lang("Would you like to send the read receipt?"),{type:"question",title:get_lang("Read receipt"),buttons:[get_lang("Yes"),get_lang("No")],overlay_opacity:0.5,onClose:function(caption){if(caption==get_lang("Yes")){cExecute("$this.imap_functions.send_notification&notificationto="+msg_info.DispositionNotificationTo+"&date="+msg_info.udate+"&subject="+url_encode(msg_info.subject),handler_sendNotification)}else{write_msg(get_lang("Confirmation message is not sent"))}}})}else{cExecute("$this.imap_functions.send_notification&notificationto="+msg_info.DispositionNotificationTo+"&date="+msg_info.udate+"&subject="+url_encode(msg_info.subject),handler_sendNotification)}}}if(!msg_is_read(ID)){if(proxy_mensagens.is_local_folder(get_current_folder())){expresso_mail_archive.drawdata=null;var tl=expresso_mail_archive.pattern.tagConfig("unseen",ID,1);expresso_mail_archive.taglist=tl;expresso_mail_archive.progressbar=window.setTimeout("expresso_mail_archive.tagMessage()",1)}set_msg_as_read(ID,true);if(msg_info.cacheHit||(!proxy_mensagens.is_local_folder(get_current_folder())&&msg_info.original_ID)){set_message_flag(ID,"seen")}}}setTimeout("resizeWindow()",300)}function auto_refresh(){refresh(preferences.alert_new_msg,preferences.notifications);setTimeout("auto_refresh()",time_refresh)}function auto_archiving(){expresso_mail_sync.start_sync();setTimeout("auto_archiving()",600000)}function notificationFilter(data,notifyCriteria){if(parseInt(notifyCriteria)&&data.length>0&&!activePage){var howManyCriteria=$("div.gray.filtersDeadline .message-list li").length;var differenceOfNewCriteria=data.length-howManyCriteria;if(differenceOfNewCriteria>0){for(var i=data.length-differenceOfNewCriteria;i<data.length;i++){desktopNotification.sentNotification("",get_lang("Filter criteria"),truncate(new Date(data[i].udate).toString("dd/MM HH:mm")+" - "+data[i].from+" - "+data[i].subject,75));desktopNotification.showNotification(false,function(){window.focus();this.cancel()})}}}}function refresh(alert_new_msg,notifyPermission){getFromAlertRules();var handler_refresh=function(data){handlerMessageFilter=function(data){notificationFilter(data,notifyPermission);alarmFollowupflagged("filtersAlarms",data)};cExecute("$this.imap_functions.getFlaggedAlertMessages&folders="+fromRules,handlerMessageFilter);if(data.msg_range_end){if(data.msg_range_end>0){current_page=data.msg_range_end/preferences.max_email_per_page}}if(!verify_session(data)){return}var total_messages_element=Element("tot_m");var box=Element("tbody_box");if(box.childNodes.length==0){showEmptyBoxMsg(box)}if(data.length>0||countNewMessage>0){for(var i=0;i<data.length;i++){if(!onceOpenedHeadersMessages[current_folder]){onceOpenedHeadersMessages[current_folder]={}}onceOpenedHeadersMessages[current_folder][data[i].msg_number]=data[i]}Element("table_message_header_box_0").emptyBody=false;table_element=Element("table_box");var msg_info=document.getElementById("msg_info");if(msg_info!=null){var msg_tr=msg_info.parentNode.parentNode;msg_tr.removeChild(msg_info.parentNode);if(!Element("colgroup_main_"+numBox)){var colgr_element=buildColGroup();colgr_element.setAttribute("id","colgroup_main_"+numBox);table_element.appendChild(colgr_element)}}var box=Element("tbody_box");if(!$("#colgroup_main_0").size()){$(table_element).append(Element("colgroup_main_"+numBox))}if(data.msgs_to_delete.length>0){for(var i=0;i<data.msgs_to_delete.length;i++){if((data.msgs_to_delete[i]!=undefined)&&(data.msgs_to_delete[i]!="")){removeAll(data.msgs_to_delete[i])}}}if(data[0].msg_folder!=current_folder){return false}totalFolderMsgs+=data.new_msgs;for(var i=0;i<data.length;i++){var existent=document.getElementById(data[i].msg_number);if(!existent){selectedPagingMsgs[data[i].msg_number]=false;totalFolderMsgs++;updateSelectedMsgs(false,data[i].msg_number);var new_msg=this.make_tr_message(data[i],current_folder,data.offsetToGMT);$(new_msg).draggable({start:function(){if($(".shared-folders").length){$(".shared-folders").parent().find('.folder:not(".shared-folders")').droppable({over:function(a,b){over=$(this);$(this).addClass("folder-over");if(($(this)[0]!=$(this).parent().find(".head_folder")[0])){if($(this).prev()[0]){if($(this).parent().find(".expandable-hitarea")[0]==$(this).prev()[0]){setTimeout(function(){if(over.hasClass("folder-over")){over.prev().trigger("click")}},500)}}}},out:function(){$(this).removeClass("folder-over")},drop:function(event,ui){$(this).css("border","");if($(this).parent().attr("id")==undefined){var folder_to="INBOX";var to_folder_title=get_lang("Inbox")}else{var folder_to=$(this).parent().attr("id");var to_folder_title=$(this).attr("title")}var folder_to_move=ui.draggable.parent().attr("id");var border_id=ui.draggable.find("input[type=hidden]").attr("name");if(folder_to_move=="tbody_box"){move_msgs2(get_current_folder(),"selected",0,folder_to,to_folder_title,true);return refresh()}}})}},stop:function(){$(".shared-folders").parent().find(".folder").droppable("destroy")},helper:function(event){$(this).addClass("selected_msg").find("input:checkbox").attr("checked",true);updateSelectedMsgs($(this).find("input:checkbox").is(":checked"),$(this).attr("id"));if($("#tbody_box .selected_shortcut_msg").length>1){$("#tbody_box .selected_shortcut_msg").addClass("selected_msg").find(".checkbox").attr("checked",true);$.each($(".selected_shortcut_msg"),function(index,value){updateSelectedMsgs($(value).find(":checkbox").is(":checked"),$(value).attr("id"))})}if(totalSelected()>1){return $("<tr><td>"+DataLayer.render("../prototype/modules/mail/templates/draggin_box.ejs",{texto:(totalSelected()+" mensagens selecionadas"),type:"messages"})+"</td></tr>")}if($(this).find(".td_msg_subject").text().length>18){return $("<tr><td>"+DataLayer.render("../prototype/modules/mail/templates/draggin_box.ejs",{texto:$(this).find(".td_msg_subject").text().substring(0,18)+"...",type:"messages"})+"</td></tr>")}else{return $("<tr><td>"+DataLayer.render("../prototype/modules/mail/templates/draggin_box.ejs",{texto:$(this).find(".td_msg_subject").text(),type:"messages"})+"</td></tr>")}},iframeFix:true,delay:150,cursorAt:{top:5,left:56},refreshPositions:true,containment:"#divAppbox"}).bind("contextmenu",function(){if(!(($(event.target).find("img").length>0)&&($(event.target).hasClass("td-label")))){if($(this).find("input:checkbox").attr("checked")!="checked"){$(this).find("input:checkbox").trigger("click");$(this).addClass("selected_msg")}updateSelectedMsgs($(this).find("input:checkbox").is(":checked"),$(this).attr("id"))}});if(data[i].next_msg_number!=undefined&&data[i].next_msg_number!=null){try{box.insertBefore(new_msg,box.childNodes[data[i].msg_key_position])}catch(e){box.insertBefore(new_msg,box.firstChild)}}else{if(data[i].Recent=="N"){box.insertBefore(new_msg,box.firstChild)}else{box.appendChild(new_msg)}}}}if(parseInt(preferences.use_shortcuts)){select_msg("null","reload_msg","null")}if(parseInt(alert_new_msg)&&data.new_msgs>0&&activePage){alert(data.new_msgs>1?get_lang("You have %1 new messages",data.new_msgs)+"!":get_lang("You have 1 new message")+"!")}if(parseInt(notifyPermission)&&(data.new_msgs>0||!!countNewMessage)&&!activePage){countNewMessage+=data.length;desktopNotificationAux=desktopNotification.sentNotification("",get_lang("Notification"),countNewMessage>1?get_lang("You have %1 new messages",countNewMessage)+"!":get_lang("You have 1 new message")+"!");if(auxNotification!=="undefined"){desktopNotification.cancelByReference(auxNotification)}desktopNotification.showNotification(function(){countNewMessage=0},function(){window.focus();this.cancel();countNewMessage=0});auxNotification=desktopNotificationAux}build_quota(data.quota)}if(data.new_msgs){total_messages_element.innerHTML=parseInt(total_messages_element.innerHTML)+data.new_msgs}else{if(data.tot_msgs){total_messages_element.innerHTML=data.tot_msgs>=0?data.tot_msgs:0}}var box=Element("tbody_box");if(box.childNodes.length>1){updateBoxBgColor(box.childNodes)}connector.purgeCache();cExecute("$this.imap_functions.get_folders_list&onload=true",update_menu);resizeMailList()};msg_range_end=(current_page*preferences.max_email_per_page);msg_range_begin=(msg_range_end-(preferences.max_email_per_page)+1);main=Element("tbody_box");if(!main){return}main_list=main.childNodes;var tmp="";var string_msgs_in_main="";var len=main_list.length;for(var j=0;j<len;j++){tmp+=main_list[j].id+","}string_msgs_in_main=tmp.substring(0,(tmp.length-1));if(!expresso_offline){$.ajax({url:"controller.php?"+$.param({action:"$this.imap_functions.refresh",folder:current_folder,msgs_existent:string_msgs_in_main,msg_range_begin:msg_range_begin,msg_range_end:msg_range_end,sort_box_type:sort_box_type,search_box_type:search_box_type,sort_box_reverse:sort_box_reverse}),success:function(data){data=connector.unserialize(data);if(data){handler_refresh(data)}},beforeSend:function(jqXHR,settings){connector.showProgressBar()},complete:function(jqXHR,settings){connector.hideProgressBar()}})}var msgs=$("#tbody_box tr");if(!msgs.hasClass("current_selected_shortcut_msg selected_shortcut_msg")){msgs.first().focus().addClass("current_selected_shortcut_msg selected_shortcut_msg")}}function delete_msgs(folder,msgs_number,border_ID,show_success_msg,archive){if(preferences.use_local_messages==1&&expresso_local_messages.isArchiving(msgs_number,folder)){alert("Impossivel deletar mensagens que estão ainda estão sendo arquivadas.");return}var userTrashFolder="";if(arguments.length<4){show_success_msg=true}if(folder=="null"){folder=current_folder}if(folder.substr(0,4)=="user"){var arrayFolder=folder.split(cyrus_delimiter);userTrashFolder="user"+cyrus_delimiter+arrayFolder[1]+cyrus_delimiter+special_folders.Trash;DataLayer.remove("folder",false);DataLayer.get("folder");var has_folder=DataLayer.get("folder",userTrashFolder);if(!has_folder){create_new_folder(special_folders.Trash,"user"+cyrus_delimiter+arrayFolder[1])}}else{userTrashFolder=mount_url_folder(["INBOX",special_folders.Trash])}if(openTab.type[currentTab]==1){return move_search_msgs("content_id_"+currentTab,userTrashFolder,special_folders.Trash)}if(currentTab.toString().indexOf("_r")!=-1){msgs_number=currentTab.toString().substr(0,currentTab.toString().indexOf("_r"))}if(!archive&&(parseInt(preferences.save_deleted_msg))&&(folder!=userTrashFolder)){move_msgs2(folder,""+msgs_number,border_ID,userTrashFolder,special_folders.Trash,show_success_msg);return}var handler_delete_msgs=function(data){Element("chk_box_select_all_messages").checked=false;if(currentTab){mail_msg=Element("tbody_box_"+currentTab)}else{mail_msg=Element("tbody_box")}if(preferences.use_shortcuts=="1"){if(mail_msg&&exist_className(mail_msg.childNodes[mail_msg.childNodes.length-1],"selected_shortcut_msg")){select_msg("null","up",true)}else{if(!select_msg("null","down",true)){select_msg("null","up",true)}}}if(data.status==false){write_msg(get_lang("You don't have permission for this operation in this shared folder!"));return false}if(preferences.use_local_messages==1){if(!expresso_mail_archive.isArchiveOperation){if(show_success_msg){if(data.msgs_number.length==1){write_msg(get_lang("The message was deleted."))}else{write_msg(get_lang("The messages were deleted."))}}}}else{if(show_success_msg){if(data.msgs_number.length==1){write_msg(get_lang("The message was deleted."))}else{write_msg(get_lang("The messages were deleted."))}}}if(openTab.type[currentTab]>1){var msg_to_delete=Element(msgs_number);if(parseInt(preferences.delete_and_show_previous_message)&&msg_to_delete){if(msg_to_delete.previousSibling){var previous_msg=msg_to_delete.previousSibling.id;$.ajax({url:"controller.php?"+$.param({action:"$this.imap_functions.get_info_msg",msg_number:previous_msg,msg_folder:current_folder,decoded:true}),success:function(data){data=connector.unserialize(data);if(data){show_msg(data)}},beforeSend:function(jqXHR,settings){connector.showProgressBar()},complete:function(jqXHR,settings){connector.hideProgressBar()}})}else{delete_border(currentTab,"false")}}else{delete_border(currentTab,"false")}}for(var i=0;i<data.msgs_number.length;i++){var msg_to_delete=Element(data.msgs_number[i]);if(msg_to_delete){removeAll(msg_to_delete.id);delete selectedPagingMsgs[data.msgs_number[i]]}totalFolderMsgs=totalFolderMsgs-data.msgs_number.length}$.each(data.msgs_number,function(index,value){msgFolder=Base64.encode(get_current_folder());tabToRemove=value+"_r_"+msgFolder.replace(/=/g,"");if($("#"+tabToRemove)){delete_border(tabToRemove,"false")}});Element("tot_m").innerHTML=parseInt(Element("tot_m").innerHTML)-data.msgs_number.length;refresh()};if(msgs_number.length>0||parseInt(msgs_number)>0){cExecute("$this.imap_functions.delete_msgs&folder="+folder+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse,handler_delete_msgs)}else{write_msg(get_lang("No selected message."))}}function move_search_msgs(border_id,new_folder,new_folder_name,action){var msg_to_delete="";var msg_to_move="";var selected_messages="";var temp_msg;var remove_currente_folder="";var id_border=currentTab.replace(/[a-zA-Z_]+/,"");if(currentTab.indexOf("search_local")!=-1||proxy_mensagens.is_local_folder(new_folder)){alert(get_lang("You cant manipulate local messages on search"));return}var delete_msg=false;if(new_folder_name==special_folders.Trash){delete_msg=true}selected_messages=get_selected_messages_search();if(preferences.use_local_messages==1&&expresso_local_messages.isArchiving(selected_messages,folder)){alert("Impossivel mover mensagens que ainda estão sendo arquivadas.");return}var handler_move_search_msgs=function(data){if(!data||!data.msgs_number){return}else{if(data.deleted){if(data.no_move&&data.move){alert(get_lang("Unable to remove the message (s) of shared folders which you do not have permission."))}else{if(data.msgs_number.length==1){write_msg(get_lang("The message was deleted."))}else{write_msg(get_lang("The messages were deleted."))}}}else{if(data.status==false&&data.move){alert(get_lang("Unable to remove the message (s) of shared folders which you do not have permission."))}else{if(data.status==false){alert(get_lang("You don't have permission for this operation in this shared folder!"));return false}else{if(data.msgs_number.length==1){write_msg(get_lang("The message was moved to folder ")+lang_folder(data.new_folder_name))}else{write_msg(get_lang("The messages were moved to folder ")+lang_folder(data.new_folder_name))}}}}}if(data.no_move){var no_remove=data.no_move.split(",");var continua=true;selected_messages=selected_messages.split(",");for(i=0;i<selected_messages.length;i++){for(j=0;j<no_remove.length;j++){if(selected_messages[i]==no_remove[j]){continua=false}}if(continua){removeAll(selected_messages[i]+"_s"+id_border)}continua=true}}else{selected_messages=selected_messages.split(",");for(i=0;i<selected_messages.length;i++){removeAll(selected_messages[i]+"_s"+id_border)}}var box=Element("tbody_box_"+getNumBoxFromTabId(currentTab)).childNodes;if(box.length>1){updateBoxBgColor(box)}connector.purgeCache();if(remove_currente_folder!=""){var mail_msg=Element("tbody_box").childNodes;remove_currente_folder=remove_currente_folder.substring(0,(remove_currente_folder.length-1));remove_currente_folder=remove_currente_folder.split(",");for(i=0;i<remove_currente_folder.length;i++){removeAll(remove_currente_folder[i])}var box=Element("tbody_box");if(box.childNodes.length>0){updateBoxBgColor(box.childNodes)}if(folder==get_current_folder()){Element("tot_m").innerHTML=parseInt(Element("tot_m").innerHTML)-remove_currente_folder.length}}draw_new_tree_folder();EsearchE.refresh()};if(selected_messages){var selected_param="";if(selected_messages.indexOf(",")!=-1){selected_msg_array=selected_messages.split(",");for(i=0;i<selected_msg_array.length;i++){var tr=Element(selected_msg_array[i]+"_s"+id_border);if(tr.getAttribute("name")==current_folder){remove_currente_folder+=tr.id.replace(/_[a-zA-Z0-9]+/,"")+","}if((action=="delete"&&tr.getAttribute("name")==mount_url_folder(["INBOX",special_folders.Trash]))||!(parseInt(preferences.save_deleted_msg))){msg_to_delete+=","+special_folders.Trash+";"+tr.id.replace(/_[a-zA-Z0-9]+/,"")}else{if(!(tr.getAttribute("name")==new_folder&&action!="delete")){msg_to_move=(tr.getAttribute("name")==null?get_current_folder():tr.getAttribute("name"));selected_param+=","+msg_to_move+";"+tr.id.replace(/_[a-zA-Z0-9]+/,"")}else{write_msg(get_lang("At least one message have the same origin"));return false}}}}else{var tr=Element(selected_messages+"_s"+id_border);if(tr.getAttribute("name")==current_folder){remove_currente_folder+=tr.id.replace(/_[a-zA-Z0-9]+/,"")+","}if((action=="delete"&&tr.getAttribute("name")==mount_url_folder(["INBOX",special_folders.Trash]))||!(parseInt(preferences.save_deleted_msg))){msg_to_delete=special_folders.Trash+";"+tr.id.replace(/_[a-zA-Z0-9]+/,"")}else{if(!(tr.getAttribute("name")==new_folder&&action!="delete")){trfolder=(tr.getAttribute("name")==null?get_current_folder():tr.getAttribute("name"));selected_param=trfolder+";"+tr.id.replace(/_[a-zA-Z0-9]+/,"")}else{write_msg(get_lang("The origin folder and the destination folder are the same."));return false}}}var params="";if(msg_to_delete!=""&&msg_to_move!=""){params+="&selected_messages_move="+url_encode(selected_param);params+="&new_folder_move="+url_encode(new_folder);params+="&new_folder_name_move="+url_encode(new_folder_name);new_folder=mount_url_folder(["INBOX",special_folders.Trash]);new_folder_name=special_folders.Trash;params+="&selected_messages_delete="+url_encode(msg_to_delete);params+="&new_folder_delete="+url_encode(new_folder);cExecute("$this.imap_functions.move_delete_search_messages",handler_move_search_msgs,params)}else{if(msg_to_delete!=""){new_folder=mount_url_folder(["INBOX",special_folders.Trash]);new_folder_name=special_folders.Trash;params+="&delete=true";params+="&selected_messages="+url_encode(msg_to_delete);params+="&new_folder="+url_encode(new_folder);cExecute("$this.imap_functions.move_search_messages",handler_move_search_msgs,params)}else{params="&selected_messages="+url_encode(selected_param);params+="&delete=false";params+="&new_folder="+url_encode(new_folder);params+="&new_folder_name="+url_encode(new_folder_name);cExecute("$this.imap_functions.move_search_messages",handler_move_search_msgs,params)}}}else{write_msg(get_lang("No selected message."))}}function move_msgs2(folder,msgs_number,border_ID,new_folder,new_folder_name,show_success_msg,not_opem_previus){not_opem_previus=typeof(not_opem_previus)!="undefined"?not_opem_previus:false;var folder_error=new_folder_name;if(preferences.use_local_messages==1&&expresso_local_messages.isArchiving(msgs_number,folder)){alert("Impossivel mover mensagens que estão ainda estão sendo arquivadas.");return}if(!folder||folder=="null"){folder=Element("input_folder_"+msgs_number+"_r")?Element("input_folder_"+msgs_number+"_r").value:(openTab.imapBox[currentTab]?openTab.imapBox[currentTab]:get_current_folder())}if(openTab.type[currentTab]==1){return move_search_msgs("content_id_"+currentTab,new_folder,new_folder_name)}var handler_move_msgs=function(data){if(typeof(data)=="string"){if(data.match(/^(.*)TRYCREATE(.*)$/)){connector.loadScript("TreeS");var move_to_folder=data.match(/^(.*)Spam(.*)$/)?"Spam":special_folders.Trash;alert(get_lang("There is not %1 folder, Expresso is creating it for you... Please, repeat your request later.",folder_error));ttree.FOLDER="root";create_new_folder(move_to_folder,"INBOX");return false}else{write_msg(get_lang("Error moving message.")+" "+get_lang('Permission denied to folder "%1".',new_folder_name));if(new_folder_name=="Trash"&&folder.split("/")[1]==new_folder.split("/")[1]){alert(get_lang("You can not remove the message with the preference 'Send to Trash' enabled. There is no permission to move messages to the trash folder."))}return false}}if(data.status==false){write_msg(get_lang("You don't have permission for this operation in this shared folder!"));return false}mail_msg=(Element("divScrollMain_"+numBox))?Element("divScrollMain_"+numBox).firstChild.firstChild:Element("divScrollMain_0").firstChild.firstChild;if(data.msgs_number.length==1){write_msg(get_lang("The message was moved to folder ")+lang_folder(data.new_folder_name))}else{write_msg(get_lang("The messages were moved to folder ")+lang_folder(data.new_folder_name))}if(openTab.type[currentTab]>1){msg_to_delete=Element(msgs_number);if(parseInt(preferences.delete_and_show_previous_message)&&msg_to_delete){if(msg_to_delete.previousSibling){var previous_msg=msg_to_delete.previousSibling.id;if(!not_opem_previus){$.ajax({url:"controller.php?"+$.param({action:"$this.imap_functions.get_info_msg",msg_number:previous_msg,msg_folder:folder,decoded:true}),success:function(data){data=connector.unserialize(data);if(data){show_msg(data)}},beforeSend:function(jqXHR,settings){connector.showProgressBar()},complete:function(jqXHR,settings){connector.hideProgressBar()}})}}else{if(current_page>1){$("#msg_opt_previous_"+msg_to_delete.getAttribute("id")+"_r").trigger("click")}else{var border_id=$("#border_id_"+currentTab).prev().attr("id").split("_").slice(2,3).join("");var folderName=current_folder;if(border_id){$.ajax({url:"controller.php?"+$.param({action:"$this.imap_functions.get_info_msg",msg_number:border_id,msg_folder:folderName,decoded:true}),success:function(data){data=connector.unserialize(data);delete_border(currentTab,"false");if(data){show_msg(data)}},beforeSend:function(jqXHR,settings){connector.showProgressBar()},complete:function(jqXHR,settings){connector.hideProgressBar()}})}else{delete_border(currentTab,"false")}}}}else{if(msg_to_delete.id===String(currentTab).split("_")[0]){delete_border(currentTab,"false")}}if(msg_to_delete){mail_msg.removeChild(msg_to_delete)}var box=Element("tbody_box");if(box.childNodes.length>0){updateBoxBgColor(box.childNodes)}if(folder==get_current_folder()){Element("tot_m").innerHTML=parseInt(Element("tot_m").innerHTML)-1}return}Element("chk_box_select_all_messages").checked=false;if(!mail_msg){mail_msg=Element("tbody_box")}data.msgs_number=data.msgs_number.split(",");var msg_to_delete;if(typeof(msgs_number)=="string"){all_search_msg=msgs_number.split(",")}else{if(typeof(msgs_number)=="number"){all_search_msg=msgs_number}}for(var i=0;i<=all_search_msg.length;i++){msg_to_delete=Element(folder+";"+all_search_msg[i]);if(msg_to_delete){msg_to_delete.parentNode.removeChild(msg_to_delete)}}if(preferences.use_shortcuts=="1"){var all_messages=Element("tbody_box").childNodes;var msg_list_shortcut=get_selected_messages_shortcut().split(",");if(data.msgs_number.length>0&&msg_list_shortcut.length>0&&data.msgs_number.toString()==msg_list_shortcut.toString()){if(exist_className(all_messages[all_messages.length-1],"selected_shortcut_msg")){select_msg("null","up",true)}else{if(!select_msg("null","down",true)){select_msg("null","up",true)}}}}for(var i=0;i<data.msgs_number.length;i++){msg_to_delete=Element(data.msgs_number[i]);if(msg_to_delete){mail_msg.removeChild(msg_to_delete)}}if(data.msgs_number.length==1){write_msg(get_lang("The message was moved to folder ")+lang_folder(data.new_folder_name))}else{write_msg(get_lang("The messages were moved to folder ")+lang_folder(data.new_folder_name))}if(data.border_ID.indexOf("r")!=-1){if(parseInt(preferences.delete_and_show_previous_message)&&folder==get_current_folder()){delete_border(data.border_ID,"false");show_msg(data.previous_msg)}else{delete_border(data.border_ID,"false")}}if(folder==get_current_folder()){var n_total_msg=parseInt(Element("tot_m").innerHTML)-data.msgs_number.length;n_total_msg=n_total_msg>=0?n_total_msg:0;draw_paging(n_total_msg);Element("tot_m").innerHTML=n_total_msg;totalFolderMsgs-=data.msgs_number.length}refresh()};if(folder==new_folder){write_msg(get_lang("The origin folder and the destination folder are the same."));return}try{if(proxy_mensagens.is_local_folder(Element("input_folder_"+currentTab).getAttribute("value"))&&!border_ID){alert(get_lang("You cant manipulate local messages on search"));return}}catch(e){}if(currentTab==0&&msgs_number=="selected"){msgs_number=get_selected_messages()}else{if(currentTab!=0&&msgs_number=="selected"){msgs_number=currentTab.substr(0,currentTab.indexOf("_r"))}}if(openTab.type[currentTab]==1){return move_search_msgs("content_id_"+currentTab,new_folder,new_folder_name)}if(currentTab.toString().indexOf("_r")!=-1&&currentTab==border_ID){if(currentTab.toString().indexOf("_s")!=-1){msgs_number=currentTab.toString().substr(0,currentTab.toString().indexOf("_s"))}else{msgs_number=currentTab.toString().substr(0,currentTab.toString().indexOf("_r"))}}if(msgs_number){refresh()}else{$("#"+get_current_folder()).find("span:first").addClass("selected")}if(proxy_mensagens.is_local_folder(folder)){expresso_mail_archive.update_counters=true;if(msgs_number=="selected"){msgs_number=get_selected_messages()}if(new_folder=="local_root"){alert(get_lang("Select a folder!"))}if(parseInt(msgs_number)>0||msgs_number.length>0){if(proxy_mensagens.is_local_folder(new_folder)){expresso_mail_archive.moveMessages(new_folder.replace("local_messages_",""),msgs_number);delete_border(border_ID)}else{if(!new_folder){new_folder="INBOX"}if(currentTab.toString().indexOf("_r")!=-1){msgs_number=currentTab.toString().substr(0,currentTab.toString().indexOf("_r"))}expresso_mail_archive.unarchieve(folder,new_folder,msgs_number);if(currentTab!=0){delete_border(border_ID)}}}else{write_msg(get_lang("No selected message."))}}else{if(proxy_mensagens.is_local_folder(new_folder)){if(msgs_number=="selected"){archive_msgs(folder,new_folder)}else{archive_msgs(folder,new_folder,msgs_number)}}else{if(parseInt(msgs_number)>0||msgs_number.length>0){var handler_removeFlag=function(){$.ajax({url:"controller.php?"+$.param({action:"$this.imap_functions.move_messages",folder:folder,msgs_number:""+msgs_number,border_ID:border_ID,sort_box_type:sort_box_type,search_box_type:search_box_type,sort_box_reverse:sort_box_reverse,reuse_border:border_ID,new_folder:new_folder,new_folder_name:new_folder_name,get_previous_msg:(!not_opem_previus?preferences.delete_and_show_previous_message:false),decoded:true}),success:function(data){data=connector.unserialize(data);$.each(msgs_number.split(","),function(index,value){delete selectedPagingMsgs[value];msgFolder=Base64.encode(get_current_folder());tabToRemove=value+"_r_"+msgFolder.replace(/=/g,"");if($("#"+tabToRemove)){}});totalFolderMsgs-=msgs_number.split(",").length;selectAllFolderMsgs();$(".select-link").unbind("click");if(data){handler_move_msgs(data)}},beforeSend:function(jqXHR,settings){connector.showProgressBar()},complete:function(jqXHR,settings){connector.hideProgressBar()}})};var hasFolder=false;$.each(fromRules,function(index,value){if(value==folder){hasFolder=true;cExecute("$this.imap_functions.removeFlagMessagesFilter&folder="+folder+"&msg_number="+msgs_number,handler_removeFlag);return false}});if(!hasFolder){handler_removeFlag()}}else{write_msg(get_lang("No selected message."))}}}$.each(msgs_number.split(","),function(index,value){delete selectedPagingMsgs[value]});totalFolderMsgs=totalFolderMsgs-msgs_number.split(",").length;selectAllFolderMsgs(false);updateSelectedMsgs()}function move_msgs(folder,msgs_number,border_ID,new_folder,new_folder_name,not_opem_previus){move_msgs2(folder,msgs_number,border_ID,new_folder,new_folder_name,true,not_opem_previus)}function normalizeMsgNumber(msgNumber){if(msgNumber||msgNumber=="selected"){msgNumber=get_selected_messages()}if(currentTab.toString().indexOf("_r")!=-1){if(currentTab.toString().indexOf("_s")!=-1){msgNumber=currentTab.toString().substr(0,currentTab.toString().indexOf("_s"))}else{msgNumber=currentTab.toString().substr(0,currentTab.toString().indexOf("_r"))}}if(parseInt(msgNumber)<=0||msgNumber.length<=0){write_msg(get_lang("No selected message."));return(false)}return(msgNumber)}function archive_search_msgs(folder_dest){var id_msgs="";id_msgs=get_selected_messages_search();var msg_to_arquive="";var messages="";var id_border=currentTab.replace(/[a-zA-Z_]+/,"");if(parseInt(id_msgs)<=0||id_msgs.length<=0){return write_msg(get_lang("No selected message."))}if(folder_dest=="local_root"||folder_dest==null){folder_dest="local_Inbox"}id_msgs=expresso_local_messages.checkArchived(id_msgs,folder_dest);if(!id_msgs){write_msg("Todas as mensagens já foram arquivadas anteriormente.");return}document.getElementById("overlay").style.visibility="visible";var handler_arquivar_mensagens=function(data){var msgs_info=[];for(var i=0;i<data.length;i++){msgs_info[i]=connector.unserialize(data[i])}var h=expresso_local_messages.has_local_mails();expresso_local_messages.insert_mails(msgs_info,folder_dest,function(s,f){complete_archiving(s,f,h)});document.getElementById("overlay").style.visibility="hidden"};id_msgs=id_msgs.split(",");for(i=0;i<id_msgs.length;i++){var tr=Element(id_msgs[i]+"_s"+id_border);msg_to_arquive=(tr.getAttribute("name")==null?get_current_folder():tr.getAttribute("name"));messages+=","+msg_to_arquive+";"+tr.id.replace(/_[a-zA-Z0-9]+/,"")}$.ajax({url:"controller.php?"+$.param({action:"$this.imap_functions.get_info_msg",msg_number:messages,msg_folder:folder_dest,decoded:true}),success:function(data){data=connector.unserialize(data);if(data){handler_arquivar_mensagens(data)}},beforeSend:function(jqXHR,settings){connector.showProgressBar()},complete:function(jqXHR,settings){connector.hideProgressBar()}})}function archive_msgs(folder,folder_dest,id_msgs){if(typeof(currentTab)=="string"&&currentTab.indexOf("local")!=-1){alert("Impossível manipular mensagens locais a partir de uma busca. Isso é permitido apenas para mensagens não locais.");return true}write_msg(get_lang("Starting to archive messages"));if(currentTab.toString().indexOf("_r")!=-1){id_msgs=currentTab.toString().substr(0,currentTab.toString().indexOf("_r"))}if(!id_msgs){id_msgs=get_selected_messages()}if(folder_dest=="local_root"||folder_dest==null){folder_dest="local_inbox"}if(parseInt(id_msgs)>0||id_msgs.length>0){window.setTimeout("expresso_mail_archive.Archive('"+folder+"','"+folder_dest+"','"+id_msgs+"')",1);selectAllFolderMsgs(false)}else{write_msg(get_lang("No selected message."))}}function complete_archiving(success,fails,has_local_messages_before){var msgs_to_remove={};var target=mount_url_folder(["INBOX",special_folders.Trash,"tmpMoveToLocal"]);success=expresso_local_messages.select_mail(["original_id","original_folder"],success);for(var i=0;i<success.length;i++){var msg_info=success[i];Element("chk_box_select_all_messages").checked=false;if(Element("check_box_message_"+msg_info.original_id)){Element("check_box_message_"+msg_info.original_id).checked=false}if(Element(msg_info.original_id)){remove_className(Element(msg_info.original_id),"selected_msg")}msgs_to_remove[msg_info.original_folder]=msgs_to_remove[msg_info.original_folder]||[];msgs_to_remove[msg_info.original_folder].push(msg_info.original_id)}if(preferences.keep_archived_messages==0){for(var folder in msgs_to_remove){if(folder!="undefined"){delete_msgs(folder,msgs_to_remove[folder],"null",false,true)}}}if(!has_local_messages_before&&expresso_local_messages.has_local_mails()){ttreeBox.update_folder()}else{update_menu()}}function action_msg_selected_from_search(aba,evento){if(evento=="delete"){move_search_msgs(aba,"INBOX/Trash","Trash","delete")}}function get_all_messages_search(){var aba=document.getElementById("content_id_"+currentTab);var messages="";jQuery(function(){jQuery("#"+aba.id+" tr").each(function(i,main_list){messages+=main_list.id.replace(/_[a-zA-Z0-9]+/,"")+","})});if(messages.indexOf(",")==0){messages=messages.substring(1,(messages.length))}return messages.substring(0,(messages.length-1))}function get_selected_messages_search(){var aba=document.getElementById("content_id_"+currentTab);var selected_messages="";jQuery("#"+aba.id+" tr").each(function(i,main_list){var check_box=main_list.firstChild.firstChild;if(check_box&&check_box.checked){selected_messages+=main_list.id.replace(/_[a-zA-Z0-9]+/,"")+","}});if(selected_messages!=""){if(selected_messages.indexOf(",")==0){selected_messages=selected_messages.substring(1,(selected_messages.length))}selected_messages=selected_messages.substring(0,(selected_messages.length-1));return selected_messages}else{return false}}function get_selected_messages_search_role(){var aba=document.getElementById("content_id_"+currentTab);var selected_messages="";jQuery("#"+aba.id+" tr").each(function(i,main_list){var check_box=main_list.firstChild.firstChild;if(check_box&&check_box.checked&&check_box.id!="chk_box_select_all_messages_search"){selected_messages+=main_list.role+","}});if(selected_messages!=""){if(selected_messages.indexOf(",")==0){selected_messages=selected_messages.substring(1,(selected_messages.length))}selected_messages=selected_messages.substring(0,(selected_messages.length-1));return selected_messages}else{return false}}function get_selected_messages_shortcut(){var main;try{main=document.getElementById("divScrollMain_"+numBox).firstChild.firstChild}catch(e){}if(!main){main=Element("tbody_box_"+numBox)}if(!main){main=Element("tbody_box")}var main_list=main.childNodes;var selected_messages_by_shortcuts="";var j=0;for(j;j<(main_list.length);j++){if(exist_className(Element(main_list[j].id),"selected_shortcut_msg")){selected_messages_by_shortcuts+=main_list[j].id+","}}selected_messages_by_shortcuts=selected_messages_by_shortcuts.substring(0,(selected_messages_by_shortcuts.length-1));return selected_messages_by_shortcuts}function get_selected_messages(){var selected=new Array();$.each(selectedPagingMsgs,function(index,value){if(value){selected.push(index)}});return""+selected}function replaceAll(string,token,newtoken){while(string.indexOf(token)!=-1){string=string.replace(token,newtoken)}return string}function new_message_to(email){var new_border_ID=new_message("new","null");document.getElementById("to_"+new_border_ID).value=email}function new_message(type,border_ID,flagged){if(RichTextEditor.editorReady===false){return false}RichTextEditor.editorReady=false;if(Element("show_img_link_"+border_ID)){show_msg_img(border_ID.match(/^\d*/)[0],Element("input_folder_"+border_ID).value)}var new_border_ID=draw_new_message(parseInt(border_ID.replace("_r","")));if(typeof(openTab.type[new_border_ID])!="undefined"){if(tabTypes[type]==openTab.type[new_border_ID]){if(type!="edit"){delete_border(currentTab);new_border_ID=draw_new_message(parseInt(border_ID))}}else{var a_types={6:get_lang("Forward"),7:get_lang("Reply"),8:get_lang("Reply to all with history"),9:get_lang("Reply without history"),10:get_lang("Reply to all without history")};if(new_border_ID!=0){if(!confirm(get_lang("Your message to %1 has not been saved or sent. To %2 will be necessary open it again. Discard your message?",a_types[openTab.type[new_border_ID]].toUpperCase(),a_types[tabTypes[type]].toUpperCase()))){return new_border_ID}else{delete_border(currentTab);new_border_ID=draw_new_message(parseInt(border_ID))}}}}if(new_border_ID=="maximo"){RichTextEditor.editorReady=true;return false}if(new_border_ID==false){RichTextEditor.editorReady=true;setTimeout("new_message('"+type+"','"+border_ID+"','"+flagged+"');",500);return false}openTab.type[new_border_ID]=tabTypes[type];var folder_message=Element("input_folder_"+border_ID);if(folder_message){var input_current_folder=document.createElement("input");input_current_folder.id="new_input_folder_"+border_ID;input_current_folder.name="input_folder";input_current_folder.type="hidden";input_current_folder.value=folder_message.value;Element("content_id_"+new_border_ID).appendChild(input_current_folder)}var title="";data=[];if(Element("from_"+border_ID)){if(document.getElementById("reply_to_"+border_ID)){data.to=document.getElementById("reply_to_values_"+border_ID).value;data.to=data.to.replace(/&lt;/gi,"<");data.to=data.to.replace(/&gt;/gi,">")}else{if(document.getElementById("sender_values_"+border_ID)){data.to=document.getElementById("sender_values_"+border_ID).value;data.to=data.to.replace(/&lt;/gi,"<");data.to=data.to.replace(/&gt;/gi,">")}else{if(document.getElementById("from_values_"+border_ID)){data.to=document.getElementById("from_values_"+border_ID).value;data.to=data.to.replace(/&lt;/gi,"<");data.to=data.to.replace(/&gt;/gi,">")}}}if(document.getElementById("to_values_"+border_ID)){data.to_all=document.getElementById("to_values_"+border_ID).value;data.to_all_alternative=document.getElementById("user_email_alternative").value;data.to_all=data.to_all.replace(/\n/gi," ");data.to_all=data.to_all.replace(/&lt;/gi,"<");data.to_all=data.to_all.replace(/&gt;/gi,">");var _array_to_all=data.to_all.split(",");var _array_to_alternative=data.to_all_alternative.split(",")}}if(document.getElementById("cc_"+border_ID)){data.cc=document.getElementById("cc_values_"+border_ID).value;data.cc=data.cc.replace(/&lt;/gi,"<");data.cc=data.cc.replace(/&gt;/gi,">");var _array_cc=data.cc.split(",")}if(document.getElementById("cco_"+border_ID)){data.cco=document.getElementById("cco_values_"+border_ID).value;data.cco=data.cco.replace(/&lt;/gi,"<");data.cco=data.cco.replace(/&gt;/gi,">")}if($("#subject_"+border_ID)){data.subject=$("#subject_"+border_ID).text()}if(data.subject==get_lang("(no subject)   ")){data.subject=""}if(document.getElementById("body_"+border_ID)){data.body=document.getElementById("body_"+border_ID).innerHTML}if(document.getElementById("from_values_"+border_ID)){data.from=document.getElementById("from_values_"+border_ID).value}if(Element("date_"+border_ID)){data.date=Element("date_"+border_ID).innerHTML}if(Element("date_day_"+border_ID)){data.date_day=Element("date_day_"+border_ID).value}if(Element("date_hour_"+border_ID)){data.date_hour=Element("date_hour_"+border_ID).value}var signature=RichTextEditor.getSignatureDefault();if(type!="new"&&type!="edit"&&document.getElementById("is_local_"+border_ID)!=null){data.is_local_message=(document.getElementById("is_local_"+border_ID).value=="1")?true:false}if(typeof($.fn.elastic)=="undefined"){$.lazy({src:"../prototype/plugins/jquery-elastic/jquery.elastic.source.js",name:"elastic"})}var content=$("#content_id_"+new_border_ID);var btnSaveVerify=function(){$("#content_id_"+currentTab+" .save").button("disable");dataBtn=new Array(".to",".cc",".cco","input[name=input_subject]",".reply-to");for(var i in dataBtn){$("#content_id_"+currentTab+" "+dataBtn[i]).keydown(function(){$("#content_id_"+currentTab+" .save").button("enable")})}RichTextEditor.keydown(new_border_ID)};switch(type){case"reply_without_history":btnSaveVerify();RichTextEditor.replyController=true;content.find('[name="input_to"]').val(data.to);draw_reply_boxes_by_field("to",data.to,content);title="Re: "+html_entities(data.subject);content.find(".subject").val("Re: "+data.subject);useOriginalAttachments(new_border_ID,border_ID);content.find('[name="msg_reply_from"]').val($("#msg_number_"+border_ID).val());if(preferences.use_signature=="1"){RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>'+signature,true)}break;case"reply_with_history":btnSaveVerify();RichTextEditor.replyController=true;title="Re: "+html_entities(data.subject);content.find(".subject").val("Re: "+data.subject);content.find('[name="input_to"]').val(data.to);draw_reply_boxes_by_field("to",data.to,content);content.find('[name="msg_reply_from"]').val($("#msg_number_"+border_ID).val());block_quoted_body=make_body_reply(data.body,data.from,data.date_day,data.date_hour);useOriginalAttachments(new_border_ID,border_ID);if(preferences.use_signature=="1"){RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>'+signature+'<div><br type="_moz"></div>'+block_quoted_body,true)}else{RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>'+block_quoted_body,true)}break;case"reply_to_all_without_history":btnSaveVerify();RichTextEditor.replyController=true;data.to_all=new Array();data.to_all=removeUserEmail(_array_to_all);data.to_all=removeAlternative(data.to_all,_array_to_alternative);content.find('[name="msg_reply_from"]').val($("#msg_number_"+border_ID).val());data.to_all=data.to_all.join(",");title="Re: "+html_entities(data.subject);content.find(".subject").val("Re: "+data.subject);if(data.to.indexOf(Element("user_email").value)>0){draw_reply_boxes_by_field("to",data.to_all,content);content.find('[name="input_to"]').val(data.to_all)}else{draw_reply_boxes_by_field("to",data.to+","+data.to_all,content);content.find('[name="input_to"]').val(data.to+","+data.to_all)}if(data.cc){data.cc=new Array();data.cc=removeUserEmail(_array_cc);data.cc=removeAlternative(data.cc,_array_to_alternative);if(data.cc!=get_lang("undisclosed-recipient")){data.cc=data.cc.join(",")}else{data.cc=""}if(data.cc!=""){content.find('[name="input_cc"]').val(data.cc);input_binds(content.find('[name="input_cc"]').parent(),new_border_ID);content.find(".cc-tr").show();content.find(".cc-button").toggleClass("expressomail-button-icon-ative");content.find(".cc-button").find("span").html("Remover CC");draw_reply_boxes_by_field("cc",data.cc,content)}}useOriginalAttachments(new_border_ID,border_ID);if(preferences.use_signature=="1"){RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>'+signature,true)}break;case"reply_to_all_with_history":btnSaveVerify();RichTextEditor.replyController=true;data.to_all=new Array();data.to_all=removeUserEmail(_array_to_all);data.to_all=removeAlternative(data.to_all,_array_to_alternative);content.find('[name="msg_reply_from"]').val($("#msg_number_"+border_ID).val());if(data.to_all!=get_lang("undisclosed-recipient")){data.to_all=data.to_all.join(",")}else{data.to_all=""}title="Re: "+html_entities(data.subject);if(data.to.indexOf(Element("user_email").value)>0){draw_reply_boxes_by_field("to",data.to_all,content);content.find('[name="input_to"]').val(data.to_all)}else{draw_reply_boxes_by_field("to",data.to+","+data.to_all,content);content.find('[name="input_to"]').val(data.to+","+data.to_all)}if(data.cc){data.cc=new Array();data.cc=removeUserEmail(_array_cc);data.cc=removeAlternative(data.cc,_array_to_alternative);if(data.cc!=get_lang("undisclosed-recipient")){data.cc=data.cc.join(",")}else{data.cc=""}if(data.cc!=""){content.find('[name="input_cc"]').val(data.cc);input_binds(content.find('[name="input_aux_cc"]').parent(),new_border_ID);content.find(".cc-tr").show();content.find(".cc-button").toggleClass("expressomail-button-icon-ative");content.find(".cc-button").find("span").html("Remover CC");draw_reply_boxes_by_field("cc",data.cc,content)}}content.find(".subject").val("Re: "+data.subject);block_quoted_body=make_body_reply(data.body,data.from,data.date_day,data.date_hour);useOriginalAttachments(new_border_ID,border_ID);if(preferences.use_signature=="1"){RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div><div><br type="_moz"></div>'+signature+'<div><br type="_moz"></div>'+block_quoted_body,true)}else{RichTextEditor.setInitData(new_border_ID,block_quoted_body,true)}break;case"forward":btnSaveVerify();title="Fw: "+html_entities(data.subject);content.find(".subject").val("Fw: "+data.subject);var divFiles=Element("divFiles_"+new_border_ID);var campo_arquivo;content.find('[name="msg_forward_from"]').val($("#msg_number_"+border_ID).val());if(Element("attachments_"+border_ID)){addOriginalAttachments(new_border_ID,border_ID)}if(preferences.use_signature=="1"){$("#body_"+new_border_ID).val('<div><br type="_moz"></div><div><br type="_moz"></div>'+signature+'<div><br type="_moz"></div>'+make_forward_body(data.body,data.to,data.date,data.subject,data.to_all,data.cc));RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>'+signature+'<div><br type="_moz"></div>'+make_forward_body(data.body,data.to,data.date,data.subject,data.to_all,data.cc));content.find(".to").focus()}else{RichTextEditor.setInitData(new_border_ID,make_forward_body(data.body,data.to,data.date,data.subject,data.to_all,data.cc));$("#body_"+new_border_ID).val('<div><br type="_moz"></div><div><br type="_moz"></div>'+make_forward_body(data.body,data.to,data.date,data.subject,data.to_all,data.cc));content.find(".to").focus()}break;case"new":btnSaveVerify();title=get_lang("New Message");if(Element("msg_number").value){var _to=Element("msg_number").value;var reEmail=/^[A-Za-z\d_-]+(\.[A-Za-z\d_-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;if(!reEmail.test(_to)){var array_contacts=contacts.split(",");for(i=0;i<array_contacts.length;i++){if(array_contacts[i].lastIndexOf(_to)!="-1"){var _group=array_contacts[i].split(";");_to='"'+_group[0]+'" <'+_group[1]+">";break}}}content.find('[name="input_to"]').val(_to+",");draw_email_box(_to,content.find(".to").filter("input"));Element("msg_number").value=""}if(preferences.use_signature=="1"){$("#body_"+new_border_ID).val('<div><br type="_moz"></div><div><br type="_moz"></div>'+signature);RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>'+signature);content.find(".to").focus()}else{content.find('[name="input_to"]').focus()}break;case"edit":btnSaveVerify();if(flagged=="F"){$(".important").addClass("expressomail-button-icon-ative")}openTab.imapBox[new_border_ID]=folder_message.value;document.getElementById("font_border_id_"+new_border_ID).innerHTML=data.subject;title="Edição: "+html_entities(data.subject);data.to=Element("to_values_"+border_ID).value;if(data.to!=get_lang("without destination")){data.to=data.to.replace(/&lt;/gi,"<");data.to=data.to.replace(/&gt;/gi,">")}else{data.to=""}draw_reply_boxes_by_field("to",data.to,content);content.find('[name="input_to"]').val(data.to);if(data.cc){data.cc=data.cc.replace(/&lt;/gi,"<");data.cc=data.cc.replace(/&gt;/gi,">");content.find('[name="input_cc"]').val(data.cc);input_binds(content.find('[name="input_cc"]').parent(),new_border_ID);content.find(".cc-tr").show();content.find(".cc-button").toggleClass("expressomail-button-icon-ative");content.find(".cc-button").find("span").html(get_lang("Remove CC"));draw_reply_boxes_by_field("cc",data.cc,content)}if(data.cco){if(content.find('[name="input_cco"]').length){content.find('[name="input_cco"]').val(data.cco);content.find(".cco-tr").show();content.find(".cco-button").toggleClass("expressomail-button-icon-ative");content.find(".cco-button").find("span").html(get_lang("Remove CCo"));input_binds(content.find('[name="input_cco"]').parent(),new_border_ID);draw_reply_boxes_by_field("cco",data.cco,content)}}content.find(".subject").val(data.subject);if($("#disposition_notification_"+border_ID).length){content.find('[name="input_return_receipt"]').attr("checked",true);content.find(".return-recept").toggleClass("expressomail-button-icon-ative")}var element_important_message=Element("important_message_"+new_border_ID);if(element_important_message){if($("#disposition_important_"+border_ID).length){content.find('[name="input_important_message"]').attr("checked",true);content.find(".important").toggleClass("expressomail-button-icon-ative")}}if(Element("attachments_"+border_ID)){addOriginalAttachments(new_border_ID,border_ID)}RichTextEditor.setInitData(new_border_ID,data.body,"edit");uidsSave[new_border_ID].push(new_border_ID);close_delete(border_ID);break;default:}content.find('[name="input_to"]').trigger("update");var txtarea=$("#body_"+new_border_ID);var height=document.body.scrollHeight-330;txtarea.css("overflowY","auto");txtarea.css("height",height);$("#border_id_"+new_border_ID).attr("title",title);set_border_caption("border_id_"+new_border_ID,title);resizeWindow();return new_border_ID}function draw_reply_boxes_by_field(field,value,context){array=break_comma(value);$.each(array,function(index,value){draw_email_box(value,context.find("."+field).filter("textarea:first"))})}function removeUserEmail(emailList){var userEmail=Element("user_email").value;var array_emails=Array();var j=0;for(var i=0;i<emailList.length;i++){if(emailList[i].indexOf(userEmail)<0){array_emails[j++]=emailList[i]}}return array_emails}function removeAlternative(value_to_all,_array_to_alternative){for(i=0;i<_array_to_alternative.length;i++){for(k=0;k<value_to_all.length;k++){if(value_to_all[k].match(/<([^<]*)>[\s]*$/)){if(value_to_all[k].match(/<([^<]*)>[\s]*$/)[1].toLowerCase()==_array_to_alternative[i].toLowerCase()){value_to_all.splice(k,1);k--}}else{if(value_to_all[k].replace(/^\s+|\s+$/g,"").toLowerCase()==_array_to_alternative[i].toLowerCase()){value_to_all.splice(k,1);k--}}}}return value_to_all}function useOriginalAttachments(new_border_ID,old_id_border){if(Element("attachments_"+old_id_border)){var fileUploadMSG=$("#fileupload_msg"+new_border_ID);var attachments=$("#attachments_"+old_id_border).find("a");if(openTab.imapBox[new_border_ID].split("local").length>1&&attachments.length>0){alert("Não é possivel utilizar os anexos das mensagens locais, favor desarquivar para ter acesso aos anexos");return false}var imagens=block_quoted_body.match(/<img[^>]*>/g);var arrayAttachments=[];var arrayAttachmentsA=[];for(var i=0;i<attachments.length;i++){if((attachments[i].tagName=="SPAN")||(attachments[i].tagName=="IMG")||((attachments[i].href.indexOf("javascript:download_local_attachment")==-1)&&(attachments[i].href.indexOf("javascript:download_attachments")==-1))){continue}if(attachments[i].href.split("local")>1){var arrayAtt=attachments[i].href.replace("javascript:download_local_attachment(","").replace(")","").split(",")}else{var arrayAtt=attachments[i].href.replace("javascript:download_attachments(","").replace(")","").split(",")}var att=new Object();var regex=new RegExp("'","g");att.folder=utf8_decoder(Base64.decode(arrayAtt[0].replace(regex,"")));att.uid=arrayAtt[1].replace(regex,"");att.part=arrayAtt[3].replace(regex,"");att.type="imapPart";var idATT=JSON.stringify(att);if(block_quoted_body.indexOf('src="./inc/get_archive.php?msgFolder='+att.folder+"&amp;msgNumber="+att.uid+"&amp;indexPart="+att.part+'"')!==-1){addAttachment(new_border_ID,idATT);var attach={};attach.fileName=attachments[i].text.substring(0,attachments[i].text.lastIndexOf("("));attach.fullFileName=attach.fileName;if(attach.fileName.length>20){attach.fileName=attach.fileName.substr(0,17)+" ... "+attach.fileName.substr(attach.fileName.length-9,attach.fileName.length)}attach.fileSize=attachments[i].text.substring((attachments[i].text.lastIndexOf("(")+1),attachments[i].text.lastIndexOf(")"));attach.error=false;fileUploadMSG.find(" .attachments-list").show();var upload=$(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs",{file:attach}));upload.append('<input type="hidden" name="fileId[]" value=\''+idATT+"'/>");upload.find(".att-box-loading").remove();upload.find(".att-box-delete").click(function(){var idAttach=$(this).parent().find('input[name="fileId[]"]').val();var content_body=RichTextEditor.getData("body_"+new_border_ID);var imagens=content_body.match(/<img[^>]*>/g);var att=JSON.parse(idAttach);if(imagens!=null){for(var x=0;x<imagens.length;x++){if(imagens[x].indexOf('src="./inc/get_archive.php?msgFolder='+att.folder+"&amp;msgNumber="+att.uid+"&amp;indexPart="+att.part)!==-1){content_body=content_body.replace(imagens[x],"")}}RichTextEditor.setData("body_"+new_border_ID,content_body)}fileUploadMSG.find(".attachments-list").find('input[value="'+idAttach+'"]');delAttachment(new_border_ID,idAttach);$(this).parent().qtip("destroy");$(this).parent().remove();if(!fileUploadMSG.find(" .attachments-list").find(".att-box").length){fileUploadMSG.find(" .attachments-list").hide()}});fileUploadMSG.find(".attachments-list").append(upload);fileUploadMSG.find(".attachments-list .att-box:last").qtip({content:DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs",{attach:attach}),position:{corner:{tooltip:"bottomMiddle",target:"topMiddle"},adjust:{resize:true,scroll:true,screen:true}},show:{when:"mouseover",ready:false},hide:"mouseout",style:{border:{width:1,radius:5},width:{min:75,max:1000},padding:3,textAlign:"left",tip:true,name:"blue"}})}else{arrayAttachments.push(idATT);arrayAttachmentsA.push(attachments[i])}}if(arrayAttachments.length>0){var orignialAtt=fileUploadMSG.find(".button-files-upload").append(' <button tabindex="-1" class="message-add-original-att button small">Anexar arquivos originais</button>').find(".message-add-original-att").button();orignialAtt.click(function(event){for(var i=0;i<arrayAttachments.length;i++){var att=JSON.parse(arrayAttachments[i]);addAttachment(new_border_ID,arrayAttachments[i]);var attach={};attach.fileName=arrayAttachmentsA[i].text.substring(0,arrayAttachmentsA[i].text.lastIndexOf("("));attach.fullFileName=attach.fileName;if(attach.fileName.length>20){attach.fileName=attach.fileName.substr(0,17)+" ... "+attach.fileName.substr(attach.fileName.length-9,attach.fileName.length)}attach.fileSize=arrayAttachmentsA[i].text.substring((arrayAttachmentsA[i].text.lastIndexOf("(")+1),arrayAttachmentsA[i].text.lastIndexOf(")"));attach.error=false;fileUploadMSG.find(" .attachments-list").show();var upload=$(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs",{file:attach}));upload.find(".att-box-loading").remove();upload.append('<input type="hidden" name="fileId[]" value=\''+arrayAttachments[i]+"'/>");upload.find(".att-box-delete").click(function(){var idAttach=$(this).parent().find('input[name="fileId[]"]').val();var content_body=RichTextEditor.getData("body_"+new_border_ID);var imagens=content_body.match(/<img[^>]*>/g);var att=JSON.parse(idAttach);if(imagens!=null){for(var x=0;x<imagens.length;x++){if(imagens[x].indexOf('src="./inc/get_archive.php?msgFolder='+att.folder+"&amp;msgNumber="+att.uid+"&amp;indexPart="+att.part)!==-1){content_body=content_body.replace(imagens[x],"")}}RichTextEditor.setData("body_"+new_border_ID,content_body)}fileUploadMSG.find(".attachments-list").find('input[value="'+idAttach+'"]');delAttachment(new_border_ID,idAttach);$(this).parent().qtip("destroy");$(this).parent().remove();if(!fileUploadMSG.find(" .attachments-list").find(".att-box").length){fileUploadMSG.find(" .attachments-list").hide()}});fileUploadMSG.find(".attachments-list").append(upload);fileUploadMSG.find(".attachments-list .att-box:last").qtip({content:DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs",{attach:attach}),position:{corner:{tooltip:"bottomMiddle",target:"topMiddle"},adjust:{resize:true,scroll:true,screen:true}},show:{when:"mouseover",ready:false},hide:"mouseout",style:{border:{width:1,radius:5},width:{min:75,max:1000},padding:3,textAlign:"left",tip:true,name:"blue"}})}$(this).remove()})}}}function addOriginalAttachments(new_border_ID,old_id_border){var fileUploadMSG=$("#fileupload_msg"+new_border_ID);var attachments=$("#attachments_"+old_id_border).find("a");if(openTab.imapBox[new_border_ID].split("local").length>1&&attachments.length>0){alert("Não é possivel utilizar os anexos das mensagens locais, favor desarquivar para ter acesso aos anexos");return false}for(var i=0;i<attachments.length;i++){if((attachments[i].tagName=="SPAN")||(attachments[i].tagName=="IMG")||((attachments[i].href.indexOf("javascript:download_local_attachment")==-1)&&(attachments[i].href.indexOf("javascript:download_attachments")==-1))){continue}fileUploadMSG.find(" .attachments-list").show();if(attachments[i].href.split("local").length>1){var arrayAtt=attachments[i].href.replace("javascript:download_local_attachment(","").replace(")","").split(",")}else{var arrayAtt=attachments[i].href.replace("javascript:download_attachments(","").replace(")","").split(",")}var att=new Object();var regex=new RegExp("'","g");att.folder=utf8_decoder(Base64.decode(arrayAtt[0].replace(regex,"")));att.uid=arrayAtt[1].replace(regex,"");att.part=arrayAtt[3].replace(regex,"");att.type="imapPart";var idATT=JSON.stringify(att);addAttachment(new_border_ID,idATT);var attach={};var attachText=(is_ie?attachments[i].innerText:attachments[i].text);attach.fileName=attachText.substring(0,attachText.lastIndexOf("("));attach.fullFileName=attach.fileName;if(attach.fileName.length>20){attach.fileName=attach.fileName.substr(0,17)+" ... "+attach.fileName.substr(attach.fileName.length-9,attach.fileName.length)}attach.fileSize=attachText.substring((attachText.lastIndexOf("(")+1),attachText.lastIndexOf(")"));attach.error=false;var upload=$(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs",{file:attach}));upload.find(".att-box-loading").remove();upload.find(".att-box-delete").click(function(){var idAttach=$(this).parent().find('input[name="fileId[]"]').val();var content_body=RichTextEditor.getData("body_"+new_border_ID);var imagens=content_body.match(/<img[^>]*>/g);var att=JSON.parse(idAttach);if(imagens!=null){for(var x=0;x<imagens.length;x++){if(imagens[x].indexOf('src="./inc/get_archive.php?msgFolder='+att.folder+"&amp;msgNumber="+att.uid+"&amp;indexPart="+att.part)!==-1){content_body=content_body.replace(imagens[x],"")}}RichTextEditor.setData("body_"+new_border_ID,content_body)}fileUploadMSG.find(" .attachments-list").find('input[value="'+idAttach+'"]');delAttachment(new_border_ID,idAttach);$(this).parent().qtip("destroy");$(this).parent().remove();if(!fileUploadMSG.find(" .attachments-list").find(".att-box").length){fileUploadMSG.find(" .attachments-list").hide()}});upload.append('<input type="hidden" name="fileId[]" value=\''+idATT+"'/>");fileUploadMSG.find(".attachments-list").append(upload);fileUploadMSG.find(".attachments-list .att-box:last").qtip({content:DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs",{attach:attach}),position:{corner:{tooltip:"bottomMiddle",target:"topMiddle"},adjust:{resize:true,scroll:true,screen:true}},show:{when:"mouseover",ready:false},hide:"mouseout",style:{border:{width:1,radius:5},width:{min:75,max:1000},padding:3,textAlign:"left",tip:true,name:"blue"}})}}function send_message_return(data,ID){if(typeof(data)=="object"&&data.load){cExecute("$this.imap_functions.get_folders_list&onload=true",update_menu)}watch_changes_in_msg(ID);var content=$("#content_id_"+ID);var sign=false;var crypt=false;var reComplexEmail=/<([^<]*)>[\s]*$/;if((preferences.use_assinar_criptografar!="0")&&(preferences.use_signature_digital_cripto!="0")){var checkSign=document.getElementById("return_digital_"+ID);if(checkSign.checked){sign=true}var checkCript=document.getElementById("return_cripto_"+ID);if(checkCript.checked){crypt=true}}if(typeof(data)=="object"&&!data.success){connector=new cConnector();if(sign||crypt){var operation="";if(sign){operation="sign"}else{operation="nop"}}if(data.body){Element("cert_applet").doButtonClickAction(operation,ID,data.body)}else{alert(data.error)}return}if(data&&data.success==true){var msg_number_replied=content.find('[name="msg_reply_from"]');var msg_number_forwarded=content.find('[name="msg_forward_from"]');if(msg_number_replied.val()){proxy_mensagens.proxy_set_message_flag(msg_number_replied.val(),"answered")}else{if(msg_number_forwarded.val()){proxy_mensagens.proxy_set_message_flag(msg_number_forwarded.val(),"forwarded")}}if(expresso_offline){write_msg(get_lang("Your message was sent to queue"));delete_border(ID,"true");return}else{if(wfolders.alert){write_msg(get_lang("Your message was sent and save."));wfolders.alert=false}else{write_msg(get_lang("Your message was sent."))}}delete_border(ID,"true");var arrayTo=content.find(".to-tr").find(".box").clone();save_dynamic_contacts(arrayTo);var arrayCC=content.find(".cc-tr").find(".box").clone();save_dynamic_contacts(arrayCC);var arrayCCo=content.find(".cco-tr").find(".box").clone();save_dynamic_contacts(arrayCCo);if(parseInt(preferences.use_dynamic_contacts)){updateDynamicContact()}cache=new Array()}else{if(data=="Post-Content-Length"){write_msg(get_lang("The size of this message has exceeded  the limit (%1B).",Element("upload_max_filesize").value))}else{if(data){var error_mail=$.trim(data.split(":")[data.split(":").length-1]);var array=content.find(".to-tr").find(".box");$.each(array,function(index,value){if(error_mail==$(value).find("input").val().match(reComplexEmail)[1]){$(value).addClass("invalid-email-box")}});if(content.find('[name="input_cco"]').length){if(content.find(".cco-tr").css("display")!="none"){var array=content.find(".cco-tr").find(".box");$.each(array,function(index,value){if(error_mail==$(value).find("input").val().match(reComplexEmail)[1]){$(value).addClass("invalid-email-box")}})}}if(content.find(".cc-tr").css("display")!="none"){var array=content.find(".cc-tr").find(".box");$.each(array,function(index,value){if(error_mail==$(value).find("input").val().match(reComplexEmail)[1]){$(value).addClass("invalid-email-box")}})}write_msg(data)}else{write_msg(get_lang("Connection failed with %1 Server. Try later.","Web"))}}var save_link=$("#content_id_"+ID).find(".save")[0];save_link.onclick=function onclick(event){openTab.toPreserve[ID]=true;save_msg(ID)};$("#save_message_options_"+ID).button({disabled:false})}if(!expresso_offline){connector.hideProgressBar()}}function save_dynamic_contacts(array){if(parseInt(preferences.use_dynamic_contacts)){$.each(array,function(i,value){var stop=false;$.each(dynamicPersonalContacts,function(x,valuex){if(valuex.email==$(value).find("input").val().match(reComplexEmail)[1]){stop=true;return false}});$.each(dynamicPersonalGroups,function(x,valuex){if(valuex.email==$(value).find("input").val().match(reComplexEmail)[1]){stop=true;return false}});if(!stop){var exist=0;$.each(dynamicData,function(x,valuex){if(valuex.mail==$(value).find("input").val().match(reComplexEmail)[1]){exist=valuex.id;return false}});if(exist){REST.put("/dynamiccontact/"+exist,{name:$(value).find("input").val().split('"')[1],mail:$(value).find("input").val().match(reComplexEmail)[1]})}else{REST.post("/dynamiccontacts",{name:$(value).find("input").val().split('"')[1],mail:$(value).find("input").val().match(reComplexEmail)[1]})}}})}}function appletReturn(smime,ID,operation,folder){if(!smime){connector=new cConnector();connector.hideProgressBar();return}if(operation=="decript"){var handler=function(data){if(data.msg_day==""){header=expresso_local_messages.get_msg_date(data.original_ID,proxy_mensagens.is_local_folder(get_current_folder()));data.fulldate=header.fulldate;data.smalldate=header.smalldate;data.msg_day=header.msg_day;data.msg_hour=header.msg_hour}this.show_msg(data)};para="&source="+smime+"&ID="+ID+"&folder="+folder;cExecute("$this.imap_functions.show_decript&",handler,para)}else{ID_tmp=ID;var handler_send_smime=function(data){send_message_return(data,this.ID_tmp)};var textArea=document.createElement("TEXTAREA");textArea.style.display="none";textArea.id="smime";textArea.name="smime";textArea.value+=smime;if(is_ie){var i=0;while(document.forms(i).name!="form_message_"+ID){i++}form=document.forms(i)}else{form=document.forms["form_message_"+ID]}form.appendChild(textArea);cExecuteForm("$this.imap_functions.send_mail",form,handler_send_smime,ID)}}function verifyBodyWords(body,words){for(i=0;i<words.length;i++){if(body.search(words[i])!=-1){return words[i]}}return false}function send_message(ID,folder,folder_name){var content_body=RichTextEditor.getData("body_"+ID);if(language=="pt-br"){var words=["anexo","anexos","anexada","anexado","anexei","anexando","anexaste","anexastes","anexamos","anexaram"]}else{if(language=="es-es"){var words=["anexo","adjunto","adjuntos","adjuntado","adjuntamos"]}else{var words=["attach","attachment","attached","annex","appending"]}}if($("#fileupload_msg"+ID).find(".att-box").length==0&&preferences.alert_message_attachment=="1"){var bodyWord=verifyBodyWords(content_body,words);if(bodyWord){$.Zebra_Dialog(get_lang('You wrote "%1" in your message, but there are no files attached. Send it anyway?',bodyWord),{type:"question",overlay_opacity:"0.5",buttons:["OK","Cancelar"],width:500,onClose:function(clicked){if(clicked=="OK"){send_valided_message(ID,folder,folder_name);return}else{return}}})}else{send_valided_message(ID,folder,folder_name)}}else{if(!zebraDiscardEventDialog&&$("#fileupload_msg"+ID).find(".att-box-loading").length){zebraDiscardEventDialog=true;window.setTimeout(function(){$.Zebra_Dialog("Existem anexos sendo enviados para o servidor. Caso envie sua mensagem agora estes arquivos serão perdidos.",{type:"question",overlay_opacity:"0.5",buttons:["Descartar anexos e enviar","Continuar editando e esperar anexos"],width:500,onClose:function(clicked){if(clicked=="Descartar anexos e enviar"){$.each($("#fileupload_msg"+ID).find(".att-box"),function(index,value){if($(value).find(".att-box-loading").length){$(value).find(".att-box-delete").trigger("click")}});send_valided_message(ID,folder,folder_name)}window.setTimeout(function(){zebraDiscardEventDialog=false},500)}})},300)}else{send_valided_message(ID,folder,folder_name)}}}function send_valided_message(ID,folder,folder_name){if(preferences.auto_save_draft==1){autoSaveControl.status[ID]=true}var content=$("#content_id_"+ID);var save_link=$("#content_id_"+ID).find(".save");var onClick=save_link.onclick;save_link.onclick="";save_link.button({disabled:true});var _subject=trim(content.find(".subject").val());if((_subject.length==0)&&!confirm(get_lang("Send this message without a subject?"))){save_link.click(onClick);content.find(".subject").focus();return}var stringReply="";draw_email_box(content.find(".reply-to-tr").find("textarea:first").val(),content.find(".reply-to-tr").find("textarea:first"));content.find(".reply-to-tr").find("textarea:first").val("");var array=content.find(".reply-to-tr").find(".box");$.each(array,function(index,value){stringReply+=$(value).find("input").val()+","});var stringToEmail="";draw_email_box(content.find(".to-tr").find("textarea:first").val()||content.find(".to-tr").find("input:visible").val(),content.find(".to-tr").find("textarea:first"));content.find(".to-tr").find("textarea:first").val("");content.find(".to-tr").find("input:visible").val("");var array=content.find(".to-tr").find(".box");$.each(array,function(index,value){stringToEmail+=$(value).find("input").val()+","});var stringEmail="";stringEmail=stringToEmail;var stringCCoEmail="";if(content.find('[name="input_cco"]').length){if(content.find(".cco-tr").css("display")!="none"){draw_email_box(content.find(".cco-tr").find("textarea:first").val()||content.find(".cco-tr").find("input:visible").val(),content.find(".cco-tr").find("textarea:first"));content.find(".cco-tr").find("textarea:first").val("");content.find(".cco-tr").find("input:visible").val("");var array=content.find(".cco-tr").find(".box");$.each(array,function(index,value){stringCCoEmail+=$(value).find("input").val()+","})}}stringEmail+=stringCCoEmail;var stringCCEmail="";if(content.find(".cc-tr").css("display")!="none"){draw_email_box(content.find(".cc-tr").find("textarea:first").val()||content.find(".cc-tr").find("input:visible").val(),content.find(".cc-tr").find("textarea:first"));content.find(".cc-tr").find("textarea:first").val("");content.find(".cc-tr").find("input:visible").val("");var array=content.find(".cc-tr").find(".box");$.each(array,function(index,value){stringCCEmail+=$(value).find("input").val()+","})}stringEmail+=stringCCEmail;var mailData=new Object();mailData.body=Base64.encode(RichTextEditor.getData("body_"+ID));mailData.folder=folder;mailData.type=RichTextEditor.plain[ID]?"plain":"html";mailData.uids_save=uidsSave[ID].toString();mailData.save_folder=(openTab.imapBox[ID]&&openTab.type[ID]<6)?openTab.imapBox[ID]:"INBOX"+cyrus_delimiter+draftsfolder;mailData.attachments=listAttachment(ID);mailData.messageNum=currentTab;mailData.input_subject=trim(content.find(".subject").val());mailData.input_reply_to=stringReply;mailData.input_to=stringToEmail;mailData.input_cco=stringCCoEmail;mailData.input_cc=stringCCEmail;mailData.input_cc=stringCCEmail;mailData.abaID=$(content).find('[name="abaID"]').val();mailData.input_important_message=$(content).find('input:checkbox:checked[name="input_important_message"]').val();mailData.input_return_receipt=$(content).find('input:checkbox:checked[name="input_return_receipt"]').val();mailData.msg_forward_from=$(content).find('[name="msg_forward_from"]').val();mailData.msg_reply_from=$(content).find('[name="msg_reply_from"]').val();if($(content).find('select[name="input_from"]').val()){mailData.input_from=$(content).find('select[name="input_from"]').val()}if(stringEmail!=""){$.ajax({url:"controller.php?action=$this.imap_functions.send_mail",data:mailData,type:"POST",success:function(data){send_message_return(connector.unserialize(data),ID)},error:function(){write_msg("Erro ao tentar enviar a mensagem. Nova tentativa em alguns segundos...");var interval=setInterval(function(){send_valided_message(ID,folder,folder_name);clearInterval(interval)},15000);return}})}else{write_msg(get_lang("message without receiver"));return}}function is_valid_email(campo){var invalidEmail=searchEmail(campo);var semicolon=campo.split(";");if((campo.replace(/^\s+|\s+$/g,""))!=""){if(invalidEmail[0]==true){write_msg("Erro de SMTP: Os endereços de destinatário a seguir falharam: "+invalidEmail[1]);return false}else{if(semicolon.length>1){var stringError="Erro de SMTP: Os endereços devem ser separados apenas por vígula: ";for(var i=0;i<semicolon.length;i++){stringError=stringError+semicolon[i];if(i+1<semicolon.length){stringError=stringError+" ; "}}write_msg(stringError);return false}else{return true}}}else{write_msg(get_lang("Message without receiver"));return false}}function change_tr_properties(tr_element,newUid,newSubject){message_id=tr_element.id;var td_from=document.getElementById("td_from_"+message_id);if(typeof(newSubject)!="undefined"){td_from.nextSibling.innerHTML=newSubject}tr_element.id=newUid;var openNewMessage=function(){$.ajax({url:"controller.php?"+$.param({action:"$this.imap_functions.get_info_msg",msg_number:newUid,msg_folder:current_folder,decoded:true}),success:function(data){data=connector.unserialize(data);if(data){show_msg(data)}},beforeSend:function(jqXHR,settings){connector.showProgressBar()},complete:function(jqXHR,settings){connector.hideProgressBar()}})};for(var i=2;i<10;i++){if(typeof(tr_element.childNodes[i].id)!="undefined"){tr_element.childNodes[i].id=tr_element.childNodes[i].id.replace(message_id,newUid)}tr_element.childNodes[i].onclick=openNewMessage}}function autoSave(ID){var content=$("#content_id_"+border_id);content.find(".save").button("option","disabled",true);saveButtonDisabled=$("#content_id_"+ID).find(".save").button("option","disabled");if(autoSaveControl.status[ID]===false&&!saveButtonDisabled){save_msg(ID)}refresh()}function save_msg(border_id){if(preferences.auto_save_draft==1){autoSaveControl.status[border_id]=true}var content=$("#content_id_"+border_id);content.find(".save").button("option","disabled",true);var array=content.find(".reply-to-tr").find(".box");var stringReplyToEmail="";$.each(array,function(index,value){stringReplyToEmail+=$(value).find("input").val()+","});content.find('[name="input_reply_to"]').val(stringReplyToEmail);var stringEmail="";var array=content.find(".to-tr").find(".box");$.each(array,function(index,value){stringEmail+=$(value).find("input").val()+","});content.find('[name="input_to"]').val(stringEmail);stringEmail="";if(content.find('[name="input_cco"]').length){if(content.find(".cco-tr").css("display")!="none"){var array=content.find(".cco-tr").find(".box");$.each(array,function(index,value){stringEmail+=$(value).find("input").val()+","});content.find('[name="input_cco"]').val(stringEmail)}}stringEmail="";if(content.find(".cc-tr").css("display")!="none"){var array=content.find(".cc-tr").find(".box");$.each(array,function(index,value){stringEmail+=$(value).find("input").val()+","});content.find('[name="input_cc"]').val(stringEmail)}var idJavascript=saveBorderError[border_id];if(saveBorderError[border_id]!==false){DataLayer.put("message",DataLayer.merge(DataLayer.form("#form_message_"+border_id),{id:idJavascript}))}else{idJavascript=DataLayer.put("message",DataLayer.form("#form_message_"+border_id))}uidsSave[border_id]=[];DataLayer.commit(false,false,function(data){if(data!=null&&data["message://"+idJavascript]!==undefined&&data["message://"+idJavascript].id!==undefined){uidsSave[border_id].push(data["message://"+idJavascript].id);saveBorderError[border_id]=false;write_msg("Mensagem salva com sucesso!")}else{saveBorderError[border_id]=idJavascript;write_msg("Erro ao salvar sua mensagem! Nova tentativa em alguns segundos.")}})}function set_messages_flag_search_local(flag){}function set_messages_flag_search(flag){var id_border=currentTab.replace(/[a-zA-Z_]+/,"");var msgs_flag=this.get_selected_messages_search();if(!msgs_flag){write_msg(get_lang("No selected message."));return}var selected_param="";msgs_to_flag=msgs_flag.split(",");search=true;for(i=0;i<msgs_to_flag.length;i++){var tr=Element(msgs_to_flag[i]+"_s"+id_border);var msg_to_flag=(tr.getAttribute("name")==null?get_current_folder():tr.getAttribute("name"));selected_param+=","+msg_to_flag+";"+tr.id.replace(/_[a-zA-Z0-9]+/,"")}var handler_set_messages_flag=function(data){var errors=false;var notErrors=false;for(var i=0;i<data.length;i++){var notArray=true;if(data[i].msgs_to_set!=""){var msgs=[];if(data[i].msgs_to_set.indexOf(",")>0){msgs=data[i].msgs_to_set.split(",");notArray=false}else{msgs[0]=data[i].msgs_to_set}for(var j=0;j<msgs.length;j++){switch(data[i].flag){case"unseen":set_msg_as_unread(msgs[j]+"_s"+id_border,true);Element("search_"+id_border+"_check_box_message_"+msgs[j]).checked=false;break;case"seen":set_msg_as_read(msgs[j]+"_s"+id_border,true);Element("search_"+id_border+"_check_box_message_"+msgs[j]).checked=false;break;case"flagged":set_msg_as_flagged(msgs[j]+"_s"+id_border,true);document.getElementById("search_"+id_border+"_check_box_message_"+msgs[j]).checked=false;break;case"unflagged":set_msg_as_unflagged(msgs[j]+"_s"+id_border,true);Element("search_"+id_border+"_check_box_message_"+msgs[j]).checked=false;break}notErrors=true}}else{errors=true}}draw_tree_folders();Element("chk_box_select_all_messages_search").checked=false;refresh();if(errors&&notErrors){write_msg(get_lang("Some messages were not marked with success!"))}else{if(notErrors){write_msg(get_lang("The messages were marked with success!"))}else{write_msg(get_lang("Error marking messages."))}}};cExecute("$this.imap_functions.set_messages_flag_from_search&msg_to_flag="+selected_param+"&flag="+flag,handler_set_messages_flag)}function set_messages_flag(flag,msgs_to_set){if(currentTab!=0&&currentTab.indexOf("search_local")>=0){return set_messages_flag_search_local(flag)}if(currentTab!=0&&currentTab.indexOf("search_")>=0){return set_messages_flag_search(flag)}var handler_set_messages_flag=function(data){if(!verify_session(data)){return}var msgs_to_set=data.msgs_to_set.split(",");if(data.disposition_notification_to){$.Zebra_Dialog(data.disposition_notification_to.length==1?get_lang("One of his messages can not be marked as read, because it contains a read confirmation."):data.disposition_notification_to.length+get_lang(" of its messages could not be marked as read, because it contains a read confirmation."),{type:"warning",overlay_opacity:"0.5",buttons:["Fechar"]})}if(!data.status){write_msg(data.msg);Element("chk_box_select_all_messages").checked=false;for(var i=0;i<msgs_to_set.length;i++){Element("check_box_message_"+msgs_to_set[i]).checked=false;remove_className(Element(msgs_to_set[i]),"selected_msg")}if(!data.msgs_unflageds){return}else{if(data.msgs_not_to_set!=""){write_msg(get_lang("Error processing some messages."))}}msgs_to_set=data.msgs_unflageds.split(",")}for(var i=0;i<msgs_to_set.length;i++){if(preferences.use_cache=="True"){if(current_folder==""){current_folder="INBOX"}var setFlag=function(msgObj){switch(data.flag){case"unseen":msgObj.Unseen="U";break;case"seen":msgObj.Unseen="";break;case"flagged":msgObj.Flagged="F";break;case"unflagged":msgObj.Flagged="";break}}}if(Element("check_box_message_"+msgs_to_set[i])){switch(data.flag){case"unseen":set_msg_as_unread(msgs_to_set[i]);if(results_search_messages!=""){set_msg_as_unread(results_search_messages,true)}Element("check_box_message_"+msgs_to_set[i]).checked=false;break;case"seen":set_msg_as_read(msgs_to_set[i],false);if(results_search_messages!=""){set_msg_as_read(results_search_messages,false,true)}Element("check_box_message_"+msgs_to_set[i]).checked=false;$.each(fromRules,function(index,value){if(value==folder){cExecute("$this.imap_functions.removeFlagMessagesFilter&folder="+folder+"&msg_number="+msgs_to_set,function(){});return false}});break;case"flagged":set_msg_as_flagged(msgs_to_set[i]);if(results_search_messages!=""){set_msg_as_flagged(results_search_messages,true)}document.getElementById("check_box_message_"+msgs_to_set[i]).checked=false;break;case"unflagged":set_msg_as_unflagged(msgs_to_set[i]);if(results_search_messages!=""){set_msg_as_unflagged(results_search_messages,true)}Element("check_box_message_"+msgs_to_set[i]).checked=false;break}}}Element("chk_box_select_all_messages").checked=false};var folder=get_current_folder();if(msgs_to_set=="get_selected_messages"){var msgs_to_set=this.get_selected_messages()}else{folder=Element("input_folder_"+msgs_to_set+"_r").value}if(msgs_to_set){$.ajax({url:"controller.php?"+$.param({action:"$this.imap_functions.set_messages_flag",folder:folder,msgs_to_set:msgs_to_set,flag:flag,decoded:true}),success:function(data){data=connector.unserialize(data);selectAllFolderMsgs();$(".select-link").unbind("click");if(data){handler_set_messages_flag(data)}},beforeSend:function(jqXHR,settings){connector.showProgressBar()},complete:function(jqXHR,settings){connector.hideProgressBar()}})}else{write_msg(get_lang("No selected message."))}}function set_message_flag(msg_number,flag,func_after_flag_change){var msg_number_folder=Element("new_input_folder_"+msg_number+"_r");if(!msg_number_folder){var msg_number_folder=Element("input_folder_"+msg_number+"_r")}var handler_set_messages_flag=function(data){if(!verify_session(data)){return}if(!data.status){write_msg(get_lang("this message cant be marked as normal"));return}else{if(func_after_flag_change){func_after_flag_change(true)}}if(data.status&&Element("td_message_answered_"+msg_number)){switch(flag){case"unseen":set_msg_as_unread(msg_number);break;case"seen":set_msg_as_read(msg_number);break;case"flagged":set_msg_as_flagged(msg_number);break;case"unflagged":set_msg_as_unflagged(msg_number);break;case"answered":Element("td_message_answered_"+msg_number).innerHTML="<img src=templates/"+template+"/images/answered.png title=Respondida>";break;case"forwarded":Element("td_message_answered_"+msg_number).innerHTML="<img src=templates/"+template+"/images/forwarded.png title=Encaminhada>";break}}else{refresh()}};$.ajax({url:"controller.php?"+$.param({action:"$this.imap_functions.set_messages_flag",folder:(msg_number_folder?msg_number_folder.value:get_current_folder()),msgs_to_set:msg_number,flag:flag,decoded:true}),success:function(data){data=connector.unserialize(data);if(data){handler_set_messages_flag(data)}},beforeSend:function(jqXHR,settings){connector.showProgressBar()},complete:function(jqXHR,settings){connector.hideProgressBar()}})}function print_search_msg(){var folder='<h2>&nbsp;Resultado da Pesquisa&nbsp;<font color="#505050" face="Verdana" size="1"></h2>';msgs_number=get_selected_messages_search();var tbody=Element("divScrollMain_"+numBox).firstChild.firstChild.innerHTML;var id_border=currentTab.replace(/[a-zA-Z_]+/,"");if(msgs_number){msgs_number=msgs_number.split(",");var tbody="";for(var i=0;i<msgs_number.length;i++){tbody+='<tr id="'+msgs_number[i]+"_s"+id_border+'" class="tr_msg_unread tr_msg_read2">'+Element(msgs_number[i]+"_s"+id_border).innerHTML+"</tr>"}}else{msgs_number=get_all_messages_search();msgs_number=msgs_number.split(",");var tbody="";for(var i=0;i<msgs_number.length;i++){tbody+='<tr id="'+msgs_number[i]+"_s"+id_border+'" class="tr_msg_unread tr_msg_read2">'+Element(msgs_number[i]+"_s"+id_border).innerHTML+"</tr>"}}var print_width=screen.width-200;var x=((screen.width-print_width)/2);var y=((screen.height-400)/2)-35;var window_print=window.open("","ExpressoMail","width="+print_width+",height=400,resizable=yes,scrollbars=yes,left="+x+",top="+y);seekDot=(is_ie?/width=24/gi:/width="24"/gi);var thead='<tr class="message_header">    <td width="3%"></td><td width="2%"></td><td width="1%"></td><td width="1%"></td><td width="1%"></td><td width="1%"></td><td width="2%"></td><td id="message_header_FOLDER_0" class="th_resizable" align="left" width="20%">Pasta</td><td id="message_header_SORTFROM_0" class="th_resizable" align="left" width="20%">De</td><td id="message_header_SORTSUBJECT_0" class="th_resizable" align="left" width="*">Assunto</td><td id="message_header_SORTARRIVAL_0" class="th_resizable" align="center" width="11%"><b>Data</b><img src="templates/default/images/arrow_descendant.gif"></td><td id="message_header_SORTSIZE_0" class="th_resizable" align="left" width="11%">Tamanho</td></tr>';tbody=tbody.replace(seekDot,"style='display:none'");seekDot=(is_ie?/width=16/gi:/width="16"/gi);tbody=tbody.replace(seekDot,"style='display:none'");seekDot=(is_ie?/width=12/gi:/width="12"/gi);tbody=tbody.replace(seekDot,"style='display:none'");while(1){try{window_print.document.open();var html='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><link rel="stylesheet" type="text/css" href="templates/'+template+'/print.css"></head>'+cabecalho+"</h4><hr><h2>"+folder+'</h2><hr/><blockquote><font size="2"><table width="100%" cellpadding="0" cellspacing="0"><thead>'+thead+"</thead><tbody>"+tbody+"</tbody></table></font></blockquote></body></html>";window_print.document.write(html);window_print.document.close();break}catch(e){}}window_print.document.close();window_print.print()}function print_messages_bodies(){var messages={};messages[get_current_folder()]=get_selected_messages().split(",");var print_bodies=function(data){var print_width=screen.width-200;var x=((screen.width-print_width)/2);var y=((screen.height-400)/2)-35;var window_print=window.open("","ExpressoMail","width="+print_width+",height=400,resizable=yes,scrollbars=yes,left="+x+",top="+y);if(window_print==null){alert(get_lang("The Anti Pop-Up is enabled. Allow this site (%1) for print.",document.location.hostname));return}var header='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><link rel="stylesheet" type="text/css" href="templates/'+template+'/print.css"></head>';window_print.document.write(header);var printData='<body style="overflow:auto">'+cabecalho+"</h4><hr>";window_print.document.write(printData);var newRow=function(label,data){return"<tr><td width=7%><font size='2'><b>"+label+" </b></font></td><td><font size='2'>"+data+"</font></td></tr>"};$.each(data,function(index,message){var html="<table><tbody>";if(message.sender){for(var i=0;i<message.sender.length;i++){html+=newRow(get_lang("Sent by")+":",message.sender[i])}}if(message.from){for(var i=0;i<message.from.length;i++){html+=newRow(get_lang("From")+":",message.from[i])}}if(message.toaddress2){html+=newRow(get_lang("To")+":",message.toaddress2)}if(message.cc){html+=newRow(get_lang("Cc")+":",message.cc)}if(message.bcc){html+=newRow(get_lang("Cco")+":",message.bcc)}if(message.smalldate){html+=newRow(get_lang("Date")+":",message.smalldate)}else{if(message.udate){var norm=function(arg){return(arg<10?"0"+arg:arg)};var weekDays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var today=new Date();today.setHours(23);today.setMinutes(59);today.setSeconds(59);today.setMilliseconds(999);udate_local=message.udate*1000+today.getTimezoneOffset()*60*1000;date_msg=new Date(udate_local);if(preferences.show_date_numerical==0||typeof(preferences.show_date_numerical)=="undefined"){if(today.getTime()-date_msg.getTime()<86400000){html+=newRow(get_lang("Date")+":",norm(date_msg.getHours())+":"+norm(date_msg.getMinutes()))}else{if(today.getTime()-date_msg.getTime()<172800000){newRow(get_lang("Date")+":",get_lang("Yesterday"))}else{if(today.getTime()-date_msg.getTime()<259200000){html+=newRow(get_lang("Date")+":",get_lang(weekDays[date_msg.getDay()]))}else{html+=newRow(get_lang("Date")+":",norm(date_msg.getDate())+"/"+norm(date_msg.getMonth()+1)+"/"+date_msg.getFullYear())}}}}else{html+=newRow(get_lang("Date")+":",norm(date_msg.getDate())+"/"+norm(date_msg.getMonth()+1)+"/"+date_msg.getFullYear())}}}html+=newRow(get_lang("Subject")+":",message.subject);if(message.attachments&&message.attachments.length){var img='<img style="margin-bottom : -5px; cursor : pointer;" src="templates/'+template+'/images/new.png">';var atts="";$.each(message.attachments,function(index,attach){atts+=" | "+attach.name+"("+formatBytes(attach.fsize)+") "+img+" | "});html+=newRow(get_lang("Attachments: "),atts)}else{if(message.attachment&&message.attachment.number_attachments>0){var img='<img style="margin-bottom : -5px; cursor : pointer;" src="templates/'+template+'/images/new.png">';var atts="";$.each(message.attachment.names.split(","),function(index,attach){atts+=" | "+attach+img+" |"});html+=newRow(get_lang("Attachments: "),atts)}}html+="</tbody></table>";if(message.body){html+="<hr>"+message.body}else{if(message._return){html+="<hr>"+message._return}}html+="<hr>";window_print.document.write(html)});window_print.document.close();window_print.print()};if(proxy_mensagens.is_local_folder(get_current_folder())){var msgs=Array();var _msg={};$.each(get_selected_messages().split(","),function(index,value){_msg.header=expresso_mail_archive.getMessageHeaders(value);_msg.body=expresso_mail_archive.getMessageBodies([value]);msgs.push($.extend({},_msg.header,_msg.body[0]))});print_bodies(msgs)}else{$.ajax({url:"controller.php?"+$.param({action:"$this.imap_functions.getMessages",details:"all",messages:messages,}),success:function(data){data=connector.unserialize(data);if(data){print_bodies(data[get_current_folder()])}},beforeSend:function(jqXHR,settings){connector.showProgressBar()},complete:function(jqXHR,settings){connector.hideProgressBar()}})}}function newTbody(messages){var tbody=$("<tbody>");$.each(messages,function(index,msg){var newTr=make_tr_message(msg,get_current_folder());if(msg.attachments&&msg.attachments.length){$(newTr).find("td").eq(1).html("<img src ='templates/"+template+"/images/clip.gif'>")}tbody.append(newTr)});return tbody.html()}function print_messages_list(){var print_list=function(tbody,folder){var print_width=screen.width-200;var x=((screen.width-print_width)/2);var y=((screen.height-400)/2)-35;var window_print=window.open("","ExpressoMail","width="+print_width+",height=400,resizable=yes,scrollbars=yes,left="+x+",top="+y);seekDot=(is_ie?/width=24/gi:/width="24"/gi);var thead='<tr class="message_header"> <td width="3%"></td><td width="2%"></td><td width="1%"></td><td width="1%"></td><td width="1%"></td><td width="1%"></td><td width="2%"></td><td width="2%"></td><td width="2%"></td><td id="message_header_SORTFROM_0" class="th_resizable" align="left" width="20%">De</td><td id="message_header_SORTSUBJECT_0" class="th_resizable" align="left" width="*">Assunto</td><td id="message_header_SORTARRIVAL_0" class="th_resizable" align="center" width="11%"><b>Data</b><img src="templates/default/images/arrow_descendant.gif"></td><td id="message_header_SORTSIZE_0" class="th_resizable" align="left" width="11%">Tamanho</td></tr>';tbody=tbody.replace(seekDot,"style='display:none'");seekDot=(is_ie?/width=16/gi:/width="16"/gi);tbody=tbody.replace(seekDot,"style='display:none'");seekDot=(is_ie?/width=12/gi:/width="12"/gi);tbody=tbody.replace(seekDot,"style='display:none'");while(1){try{window_print.document.open();var html='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><link rel="stylesheet" type="text/css" href="templates/'+template+'/print.css"></head>'+cabecalho+"</h4><hr><h2>"+$("#border_id_0").html()+'</h2><hr/><blockquote><font size="2"><table width="100%" cellpadding="0" cellspacing="0"><thead>'+thead+"</thead><tbody>"+tbody+"</tbody></table></font></blockquote></body></html>";window_print.document.write(html);window_print.document.close();break}catch(e){}}window_print.document.close();window_print.print()};msgs_number=get_selected_messages();if(msgs_number==false){var tbody=Element("divScrollMain_0").firstChild.firstChild.innerHTML;print_list(tbody)}else{var messages={};messages[get_current_folder()]=msgs_number.split(",");if(proxy_mensagens.is_local_folder(get_current_folder())){var msgs=Array();$.each(msgs_number.split(","),function(index,value){msgs.push(expresso_mail_archive.getMessageHeaders(value))});print_list(newTbody(msgs))}else{$.ajax({url:"controller.php?"+$.param({action:"$this.imap_functions.getMessages",details:"all",messages:messages,}),success:function(data){data=connector.unserialize(data);if(data){data=data[get_current_folder()];print_list(newTbody(data))}},beforeSend:function(jqXHR,settings){connector.showProgressBar()},complete:function(jqXHR,settings){connector.hideProgressBar()}})}}}function print_all(){if(typeof(currentTab)=="string"&&currentTab.indexOf("local")!=-1){alert("Impossível manipular mensagens locais a partir de uma busca. Isso é permitido apenas para mensagens não locais.");return true}if(openTab.type[currentTab]==2){return print_msg(current_folder,currentTab.substr(0,currentTab.indexOf("_r")),currentTab)}if(currentTab!=0&&currentTab.indexOf("search_")>=0){return print_search_msg()}if(get_selected_messages()==false){return print_messages_list()}var msg="Algumas mensagens foram selecionadas para impressão. Deseja imprimir o conteúdo de cada uma delas? Caso contrário, apenas uma lista das mensagens selecionadas será impressa.";$.Zebra_Dialog(msg,{type:"question",buttons:["Sim","Não"],overlay_opacity:"0.5",onClose:function(caption){if(caption=="Sim"){return print_messages_bodies()}else{return print_messages_list()}}})}function print_msg(msg_folder,msg_number,border_ID){var div_toaddress_full=Element("div_toaddress_full_"+border_ID);var div_ccaddress_full=Element("div_ccaddress_full_"+border_ID);var div_ccoaddress_full=Element("div_ccoaddress_full_"+border_ID);var printListTO=(div_toaddress_full&&div_toaddress_full.style.display!="none")||toaddress_array[border_ID].length==1?true:false;var printListCC=(div_ccaddress_full&&div_ccaddress_full.style.display!="none")||!div_ccaddress_full?true:false;var printListCCO=(div_ccoaddress_full&&div_ccoaddress_full.style.display!="none")||!div_ccoaddress_full?true:false;var sender=Element("sender_values_"+border_ID)?Element("sender_values_"+border_ID).value:null;var from=Element("from_values_"+border_ID)?Element("from_values_"+border_ID).value:null;var to=Element("to_values_"+border_ID)?Element("to_values_"+border_ID).value:null;var cco=Element("cco_values_"+border_ID)?Element("cco_values_"+border_ID).value:null;var cc=Element("cc_values_"+border_ID)?Element("cc_values_"+border_ID).value:null;var date=Element("date_"+border_ID);var subject=Element("subject_"+border_ID);var attachments=Element("attachments_"+border_ID);var body=Element("body_"+border_ID);var att="";var countAtt=0;if(attachments!==null){countAtt=attachments.getElementsByTagName("a").length;if(countAtt===1){att=attachments.getElementsByTagName("a")[0].innerHTML}else{if(countAtt>1){for(var i=1;i<attachments.getElementsByTagName("a").length;i++){att+=" | "+attachments.getElementsByTagName("a")[i].innerHTML}}}}var body=Element("body_"+border_ID);var print_width=screen.width-200;var x=((screen.width-print_width)/2);var y=((screen.height-400)/2)-35;var window_print=window.open("","ExpressoMail","width="+print_width+",height=400,resizable=yes,scrollbars=yes,left="+x+",top="+y);if(window_print==null){alert(get_lang("The Anti Pop-Up is enabled. Allow this site (%1) for print.",document.location.hostname));return}if(attachments!=null){var a=attachments.childNodes;var attachs="";var show_attachs="";var ii=a.length>2?2:1;for(i=ii;i<a.length;i++){if(a[i].tagName&&a[i].tagName=="A"){attachs+=a[i].innerHTML}}show_attachs="<tr><td width=7%><font size='2'>"+get_lang("Attachments: ")+" </font></td><td><font size='2'>"+attachs+"</font></td></tr>"}else{show_attachs=""}var current_path=window.location.href.substr(0,window.location.href.lastIndexOf("/"));var head='<head><title></title><link href="'+current_path+'/templates/default/main.css" type="text/css" rel="stylesheet"></head>';window_print.document.write(head);while(1){try{var html='<body style="overflow:auto">';html+=cabecalho+"</h4><hr>";html+="<table><tbody>";if(sender){html+="<tr><td width=7% noWrap><font size='2'>"+get_lang("Sent by")+": </font></td><td><font size='2'>"+sender+"</font></td></tr>"}if(from){html+="<tr><td width=7%><font size='2'>"+get_lang("From")+": </font></td><td><font size='2'>"+from+"</font></td></tr>"}if(to){if(!printListTO){to="Os destinatários não estão sendo exibidos para esta impressão"}html+="<tr><td width=7%><font size='2'>"+get_lang("To")+": </font></td><td><font size='2'>"+to+"</font></td></tr>"}if(cc){if(!printListCC){cc="Os destinatários não estão sendo exibidos para esta impressão"}html+="<tr><td width=7%><font size='2'>"+get_lang("Cc")+": </font></td><td><font size='2'>"+cc+"</font></td></tr>"}if(cco){if(!printListCCO){cco="Os destinatários não estão sendo exibidos para esta impressão"}html+="<tr><td width=7%><font size='2'>"+get_lang("Cco")+": </font></td><td><font size='2'>"+cco+"</font></td></tr>"}if(date){html+="<tr><td width=7%><font size='2'>"+get_lang("Date")+": </font></td><td><font size='2'>"+date.innerHTML+"</font></td></tr>"}html+="<tr><td width=7%><font size='2'>"+get_lang("Subject")+": </font></td><td><font size='2'>"+subject.innerHTML+"</font></td></tr>";if(countAtt>0){html+="<tr><td width=7%><font size='2'>"+get_lang("Attachments: ")+"</font></td><td><font size='2'>"+att+"</font></td></tr>"}html+="</tbody></table><hr>";window_print.document.write(html+body.innerHTML);var tab_tags=window_print.document.getElementsByTagName("IMG");var link=location.href.replace(/\/expressoMail1_2\/(.*)/,"");for(var i=0;i<tab_tags.length;i++){var _img=tab_tags[i].cloneNode(true);if(tab_tags[i].src.toUpperCase().indexOf("INC/GET_ARCHIVE.PHP?MSGFOLDER=")>-1){_img.src=link+"/expressoMail1_2/"+tab_tags[i].src.substr(tab_tags[i].src.toUpperCase().indexOf("INC/GET_ARCHIVE.PHP?MSGFOLDER="))}tab_tags[i].parentNode.replaceChild(_img,tab_tags[i])}break}catch(e){}}window_print.document.close();window_print.print()}function empty_trash_imap(shared,button,type){if(shared){var folder_part=$(button).parents("li:first").attr("id").split(cyrus_delimiter);var folder=folder_part[0]+cyrus_delimiter+folder_part[1]}var handler_empty_trash=function(data){Element("chk_box_select_all_messages").checked=false;if(!verify_session(data)){return}update_quota(get_current_folder());draw_new_tree_folder();draw_tree_labels();if(data){if(typeof(data)=="object"){if(data[1]=="Permission denied"){cExecute("$this.imap_functions.get_folders_list&onload=true",update_menu);return write_msg(get_lang("Permission denied"))}}write_msg(get_lang("Your Trash folder was empty."));if(get_current_folder()==mount_url_folder(["INBOX",special_folders.Trash])){draw_paging(0);remove_rows(document.getElementById("table_box"));Element("tot_m").innerHTML=0;Element("new_m").innerHTML=0}}else{write_msg(get_lang("ERROR emptying your Trash folder."))}};$.Zebra_Dialog(get_lang("Do you really want to empty your trash folder?"),{type:"question",title:get_lang("Empty Trash"),buttons:[get_lang("Yes"),get_lang("No")],overlay_opacity:0.5,onClose:function(caption){if(caption==get_lang("Yes")){if(type.id=="local_messages_trash"){expresso_mail_archive.deleteAllMessages(type.id);cExecute("$this.imap_functions.get_folders_list&onload=true",update_menu)}else{cExecute("$this.imap_functions.empty_folder&clean_folder=imapDefaultTrashFolder"+(shared?"&shared="+folder:""),handler_empty_trash)}}}})}function empty_spam_imap(shared,button,type){if(shared){var folder_part=$(button).parents("li:first").attr("id").split(cyrus_delimiter);var folder=folder_part[0]+cyrus_delimiter+folder_part[1]}var handler_empty_spam=function(data){Element("chk_box_select_all_messages").checked=false;if(!verify_session(data)){return}if(get_current_folder()==mount_url_folder(["INBOX",special_folders.Spam])){draw_paging(0);remove_rows(document.getElementById("table_box"))}draw_new_tree_folder();draw_tree_labels();update_quota(get_current_folder());if(data){if(typeof(data)=="object"){if(data[1]=="Permission denied"){cExecute("$this.imap_functions.get_folders_list&onload=true",update_menu);return write_msg(get_lang("Permission denied"))}else{write_msg(get_lang("Your Spam folder was empty."))}}else{write_msg(get_lang("Your Spam folder was empty."))}}else{write_msg(get_lang("ERROR emptying your Spam folder."))}};$.Zebra_Dialog(get_lang("Do you really want to empty your spam folder?"),{type:"question",title:get_lang("Empty Spam"),buttons:[get_lang("Yes"),get_lang("No")],overlay_opacity:0.5,onClose:function(caption){if(caption==get_lang("Yes")){if(type.id=="local_messages_spam"){expresso_mail_archive.deleteAllMessages(type.id);cExecute("$this.imap_functions.get_folders_list&onload=true",update_menu)}else{cExecute("$this.imap_functions.empty_folder&clean_folder=imapDefaultSpamFolder"+(shared?"&shared="+folder:""),handler_empty_spam)}}}})}function buildExportArchiver(msgsArchive,name_box){var hand_export=function(data){if(!data){write_msg(get_lang("Error compressing messages (ZIP). Contact the administrator."))}else{if(data.empty_folder||data=="empty_folder"){write_msg(get_lang("The selected folder is empty."))}else{download_attachments(null,null,data,null,null,get_current_folder().split("_")[2]+".zip")}}};var array=new Array();for(var i=0;i<msgsArchive.length;i++){eachMsg={ContentType:msgsArchive[i].ContentType,from:{email:msgsArchive[i].from.email,full:msgsArchive[i].from.full,name:msgsArchive[i].from.name},msg_sample:msgsArchive[i].msg_sample,subject:msgsArchive[i].subject,to:{email:msgsArchive[i].to.email,full:msgsArchive[i].to.full,name:msgsArchive[i].to.name},toaddress2:msgsArchive[i].toaddress2,msg_number:msgsArchive[i].msg_number,date:new Date(msgsArchive[i].timestamp).toString()};array.push(eachMsg)}$.ajax({type:"POST",url:"controller.php?action=$this.exporteml.export_all_byLocalFolder",data:{folder:name_box,type:"msg_local",messages:array}}).done(function(msg){hand_export(msg.split('"')[1])})}function export_all_selected_msgs(){if(get_current_folder().split("_")[0]=="local"){if(get_selected_messages().indexOf(",")!=-1){expresso_mail_archive.getSomeMsgs(get_selected_messages().split(","))}else{expresso_mail_archive.getSomeMsgs([get_selected_messages()])}buildExportArchiver(expresso_mail_archive.getSomeMsg,get_current_folder().split("_")[2])}else{if(openTab.type[currentTab]>1){source_msg(currentTab,openTab.imapBox[currentTab]);return}var search=false;if(currentTab!=0&&currentTab.indexOf("search_")>=0){var id_border=currentTab.replace(/[a-zA-Z_]+/,"");var msgs_to_export=this.get_selected_messages_search();if(!msgs_to_export){write_msg(get_lang("No selected message."));return}var selected_param="";msgs_to_export=msgs_to_export.split(",");search=true;for(i=0;i<msgs_to_export.length;i++){var tr=Element(msgs_to_export[i]+"_s"+id_border);msg_to_move=(tr.getAttribute("name")==null?get_current_folder():tr.getAttribute("name"));selected_param+=","+msg_to_move+";"+tr.id.replace(/_[a-zA-Z0-9]+/,"")}}else{var msgs_to_export=this.get_selected_messages()}var handler_export_all_selected_msgs=function(data){if(!data){write_msg(get_lang("Error compressing messages (ZIP). Contact the administrator."))}else{var filename="mensagens.zip";if(data[0].match(/\.eml$/gi)){filename=data[1]+".eml"}download_attachments(null,null,data[0],null,null,filename)}};if(search){cExecute("$this.exporteml.makeAll",handler_export_all_selected_msgs,"folder=false&msgs_to_export="+selected_param)}else{if(msgs_to_export){cExecute("$this.exporteml.makeAll",handler_export_all_selected_msgs,"folder="+get_current_folder()+"&msgs_to_export="+msgs_to_export);write_msg(get_lang("You must wait while the messages will be exported..."))}else{write_msg(get_lang("No selected message."))}}}}function select_all_search_messages(select,aba){if(select){jQuery("#"+aba+" tr").each(function(i,o){o.firstChild.firstChild.checked=true;add_className(o,"selected_msg")})}else{jQuery("#"+aba+" tr").each(function(i,o){o.firstChild.firstChild.checked=false;remove_className(o,"selected_msg")})}}function verify_session(data){if(data&&data.imap_error){if(data.imap_error=="nosession"){write_msg(get_lang("your session could not be verified."))}else{write_msg(data.imap_error)}return false}else{return true}}function save_image(e,thumb,file_type){file_type=file_type.replace("/",".");thumb.oncontextmenu=function(e){return false};var _button=is_ie?window.event.button:e.which;var _target=is_ie?event.srcElement:e.target;if(_button==2||_button==3){var _params=_target.id.split(";;");download_attachments(Base64.encode(_params[0]),_params[1],_params[2],_params[3],_params[4],file_type);if($(_target).parent().attr("href").split("http").length>1){var part_find=thumb.toString().split("#");var part2_find=part_find[1].split("/temp");var part_id_dwl=part2_find[0]+"/temp/download"+part2_find[1];download_local_attachment(part_id_dwl);return}else{var _params=_target.id.split(";;");download_attachments(_params[0],_params[1],_params[2],_params[3],_params[4],file_type)}}}function save_image2(info){var obj=jQuery.parseJSON(unescape(info));download_attachments(obj.folder,obj.message,obj.thumbIndex,obj.pid,obj.encoding,obj.type.replace("/","."))}function nospam(msgs_number,border_ID,folder){if(folder=="null"){folder=get_current_folder()}var new_folder="";if(folder.substr(0,4)=="user"){arrayFolder=folder.split(cyrus_delimiter);new_folder="user"+cyrus_delimiter+arrayFolder[1]}else{new_folder="INBOX"}var new_folder_name=get_lang("INBOX");var handler_move_msgs=function(data){if(msgs_number=="selected"){set_messages_flag("unseen","get_selected_messages")}else{proxy_mensagens.proxy_set_message_flag(msgs_number,"unseen")}proxy_mensagens.proxy_move_messages(folder,msgs_number,border_ID,new_folder,new_folder_name);if(openTab.type[currentTab]>1){delete_border(currentTab,"false")}};if(currentTab.toString().indexOf("_r")!=-1){msgs_number=currentTab.toString().substr(0,currentTab.toString().indexOf("_r"))}else{if(msgs_number=="selected"){msgs_number=get_selected_messages()}}if(currentTab==0){msgs_number=get_selected_messages()}if(typeof currentTab=="string"&&currentTab.indexOf("search_")!="-1"){msgs_number="";var checked=$("#divScrollMain_"+currentTab.substr(currentTab.indexOf("_")+1,255)).find("tr input:checked");$.each(checked,function(index,value){if(value){if(index==0){msgs_number=$(value).parents("tr").attr("id")}else{msgs_number+=","+$(value).parents("tr").attr("id")}}})}if(parseInt(msgs_number)>0||msgs_number.length>0){cExecute("$this.imap_functions.spam&folder="+folder+"&spam=false&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+0+"&cyrus_delimiter="+cyrus_delimiter,handler_move_msgs)}else{write_msg(get_lang("No selected message."))}}function spam(folder,msgs_number,border_ID){if(folder=="null"){folder=get_current_folder()}var new_folder="";if(folder.substr(0,4)=="user"){arrayFolder=folder.split(cyrus_delimiter);new_folder="user"+cyrus_delimiter+arrayFolder[1]+cyrus_delimiter+special_folders.Spam}else{new_folder=mount_url_folder(["INBOX",special_folders.Spam])}var new_folder_name="Spam";var not_opem_previus=true;var handler_move_msgs=function(data){proxy_mensagens.proxy_move_messages(folder,msgs_number,border_ID,new_folder,new_folder_name,not_opem_previus);if(openTab.type[currentTab]>1){if(preferences.delete_and_show_previous_message==1){delete_border(currentTab,"false")}}};if(currentTab.toString().indexOf("_r")!=-1){msgs_number=currentTab.toString().substr(0,currentTab.toString().indexOf("_r"))}else{if(currentTab!=0&&currentTab.indexOf("search_")>=0){var content_search=document.getElementById("content_id_"+currentTab);mount_url_folder(["INBOX",special_folders.Trash]),"Trash",move_search_msgs("content_id_"+currentTab,mount_url_folder(["INBOX",special_folders.Spam]),special_folders.Spam);refresh();return}else{if(msgs_number=="selected"){msgs_number=get_selected_messages()}}}if(currentTab==0){msgs_number=get_selected_messages()}if(parseInt(msgs_number)>0||msgs_number.length>0){cExecute("$this.imap_functions.spam&folder="+folder+"&spam=true&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+0+"&cyrus_delimiter="+cyrus_delimiter,handler_move_msgs)}else{write_msg(get_lang("No selected message."))}}function import_window(){if(typeof(currentTab)=="string"&&currentTab.indexOf("local")!=-1){alert("Impossível manipular mensagens locais a partir de uma busca. Isso é permitido apenas para mensagens não locais.");return true}var folder={};var importEmails=$("#importEmails");importEmails.html(DataLayer.render(BASE_PATH+"modules/mail/templates/importEmails.ejs",{}));importEmails.dialog({height:280,width:500,resizable:false,title:get_lang("zip mails to import"),modal:true,buttons:[{text:get_lang("Close"),click:function(){importEmails.dialog("close").dialog("destroy")}},{text:get_lang("Import"),click:function(){var input_file=importEmails.find("input[type=file]");var input_hidden=importEmails.find("input[name=folder]");if(input_file.attr("value")==""){$.Zebra_Dialog(get_lang("You must choose a file")+" !",{type:"warning",overlay_opacity:"0.5",onClose:function(){$("#importMessageAccordion").accordion("activate",0)}})}else{if(input_hidden.attr("value")==""){$.Zebra_Dialog(get_lang("You must choose a folder")+" !",{type:"warning",overlay_opacity:"0.5",onClose:function(){$("#importMessageAccordion").accordion("activate",1)}})}else{var handler_return=function(data){write_msg(get_lang("The import was executed successfully."));return_import_msgs(data,folder)};var formSend=document.getElementById("importFileMessages");importEmails.dialog("destroy");write_msg(get_lang("You must wait while the messages will be imported..."));cExecuteForm("$this.imap_functions.import_msgs",formSend,handler_return)}}}}],open:function(event,ui){if(typeof(shortcut)!="undefined"){shortcut.disabled=true}},close:function(event,ui){if(typeof(shortcut)!="undefined"){shortcut.disabled=false}}});importEmails.css("overflow","hidden");importEmails.find("input[type=file]").change(function(){var deniedExtension=true;var fileExtension=["eml","zip"];var fileName=importEmails.find("input[type=file]").attr("value");fileName=fileName.split(".");if(fileName[1]){for(var i in fileExtension){if(fileExtension[i].toUpperCase()===fileName[1].toUpperCase()){deniedExtension=false;break}}}if(deniedExtension){$.Zebra_Dialog(get_lang("File extension forbidden or invalid file"),{type:"warning",overlay_opacity:"0.5"})}$("#lblFileName").html((!deniedExtension)?importEmails.find("input[type=file]").attr("value"):"")});$("#importMessageAccordion").accordion();var foldersTree=jQuery("#foldertree-container-importMessage").removeClass("empty-container").html(DataLayer.render(BASE_PATH+"api/templates/foldertree.ejs",{folders:[cp_tree1,cp_tree2,[]]})).find("#foldertree").treeview().click(function(event){var target=$(event.target);if(target.is(".collapsable-hitarea, .expandable-hitarea, .lastCollapsable, .lastExpandable, .treeview")){return}if(!target.attr("id")){target=target.parent()}if(target.attr("id")=="foldertree"){return}folder.id=target.attr("id");folder.child=target.find(".folder");folder.caption=target.find("span").attr("title");$("#foldertree-container-importMessage .filetree span.folder.selected").removeClass("selected");if(!target.is("#foldertree > .expandable, #foldertree > .collapsable")){$(target).children(".folder").addClass("selected")}selectedFolder={id:folder.id,name:folder.child.attr("title"),"class":folder.child.attr("class")};importEmails.find("input[name=folder]").attr("value",folder.id)});$("#lblFileName").prev().css("margin-left","10px");$("#lblFileName").prev().css("font-weight","bold")}function return_import_msgs(data,folder){if(data&&data.error){write_msg(data.error)}else{if(data=="Post-Content-Length"){write_msg(get_lang("The size of this message has exceeded  the limit (%1B).",preferences.max_attachment_size?preferences.max_attachment_size:Element("upload_max_filesize").value))}else{var er=/^local_/;if(er.test(folder.id)){alert("Mensagens não podem ser importadas em pastas locais")}else{if(openTab.imapBox[0]==folder.id){openTab.imapBox[0]="";change_folder(folder.id,folder.caption)}refresh()}}}}function decodeCreateSchedulable(type,ID){var startEvent=new Date();if(startEvent.toString("mm")<30){startEvent.add({minutes:(30-parseInt(startEvent.toString("mm")))})}else{startEvent.add({hours:1,minutes:"-"+startEvent.toString("mm")})}var endEvent=function(date){if(!!User.preferences.defaultCalendar){return new Date(parseInt(date.getTime())+(!!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration?(Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration*60000):(User.preferences.defaultDuration*60000)))}else{return new Date(parseInt(date.getTime())+(User.preferences.defaultDuration*60000))}};var emails=$("#to_values_"+ID).val().split(",");var schedulable={};schedulable={acl:{inviteGuests:true,organization:true,participationRequired:false,read:true,write:true},alarms:[],allDay:false,attachments:[],isAttendee:true,attendee:"",category:"","class":"1",delegatedFrom:{},endDate:startEvent.toString(User.preferences.dateFormat),startDate:endEvent(startEvent).toString(User.preferences.dateFormat),startHour:startEvent.toString(User.preferences.hourFormat),endHour:endEvent(startEvent).toString(User.preferences.hourFormat),timezone:User.preferences.defaultCalendar?Calendar.signatureOf[User.preferences.defaultCalendar].calendar.timezone:User.preferences.timezone,summary:$("#subject_"+ID).text(),description:$("#body_"+ID).text(),startTime:startEvent.getTime(),endTime:endEvent(startEvent),timezones:Timezone.timezones,me:{name:User.me.name,mail:User.me.mail,acl:"rowi",status:"1",delegatedFrom:"0",id:User.me.id},organizer:{name:User.me.name,mail:User.me.mail,acl:"rowi",status:"1",delegatedFrom:"0",id:User.me.id},statusParticipants:{accepted:0,cancelled:0,tentative:0,unanswered:emails.length},location:"",attendee:$.map(emails,function(mail){var contact=false;var decoded=Encoder.htmlDecode(mail);var newAttendeeName="";var name=decoded.match(/"([^"]*)"/)?decoded.match(/"([^"]*)"/)[1]:"";var mail=decoded.match(/<([^<]*)>[\s]*$/)?decoded.match(/<([^<]*)>[\s]*$/)[1].toLowerCase():decoded;var user=DataLayer.get("user",["=","mail",mail],true);if($.type(user)=="array"){user=user[0]}if(user!=""){if(User.me.mail==user.mail){return(null)}user.isExternal=(!!user&&!(!!user.isExternal))?0:1;return DataLayer.merge({name:user.name,mail:user.mail,acl:"r",delegatedFrom:"0",status:"4",isExternal:user.isExternal},!!user.id?{id:DataLayer.put("participant",{user:user.id,isExternal:user.isExternal})}:{id:DataLayer.put("participant",{user:user})})}else{if(mail.match(/[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])/)){var userId=DataLayer.put("user",{name:name,mail:mail,isExternal:"1"});var newAttendeeId=DataLayer.put("participant",{user:userId,isExternal:"1"});return{id:newAttendeeId,name:name,mail:mail,acl:"r",delegatedFrom:"0",status:"4",isExternal:"1"}}else{return(null)}}})};schedulable=DataLayer.merge(schedulable,type=="event"?{calendar:User.preferences.defaultCalendar?User.preferences.defaultCalendar:Calendar.calendars[0],calendars:Calendar.calendars}:{group:Calendar.groups[0].id,groups:Calendar.groups,percentage:0,isOrganizer:true});return schedulable}function import_implements_calendar(){if(typeof(Encoder)=="undefined"){$.ajax({url:"../prototype/modules/calendar/js/load.js",async:false,beforeSend:function(xhr){xhr.overrideMimeType("text/javascript; charset=ISO-8859-1")}});$.ajax({url:"../prototype/modules/calendar/js/map.disponibility.js",async:false,beforeSend:function(xhr){xhr.overrideMimeType("text/javascript; charset=ISO-8859-1")}});$.ajax({url:"../prototype/modules/calendar/js/helpers.js",async:false,beforeSend:function(xhr){xhr.overrideMimeType("text/javascript; charset=ISO-8859-1")}});$.ajax({url:"../prototype/modules/calendar/js/task.helpers.js",async:false,beforeSend:function(xhr){xhr.overrideMimeType("text/javascript; charset=ISO-8859-1")}});$.ajax({url:"../prototype/plugins/encoder/encoder.js",async:false,beforeSend:function(xhr){xhr.overrideMimeType("text/javascript; charset=ISO-8859-1")}});$.ajax({url:"../prototype/plugins/jquery.spinner/jquery.spinner.min.js",async:false,beforeSend:function(xhr){xhr.overrideMimeType("text/javascript; charset=ISO-8859-1")}});$.ajax({url:"../prototype/plugins/fullcalendar/fullcalendar.js",async:false,beforeSend:function(xhr){xhr.overrideMimeType("text/javascript; charset=ISO-8859-1")}});DataLayer.dispatchPath="../prototype/"}}function select_import_folder(){var imgExtensions=new Array("eml","zip");var inputFile=document.form_import.file_1;if(!inputFile.value){alert(get_lang("File extension forbidden or invalid file")+".");return false}var fileExtension=inputFile.value.split(".");fileExtension=fileExtension[(fileExtension.length-1)];var deniedExtension=true;for(var i=0;i<imgExtensions.length;i++){if(imgExtensions[i].toUpperCase()==fileExtension.toUpperCase()){deniedExtension=false;break}}if(deniedExtension){alert(get_lang("File extension forbidden or invalid file")+".");return false}arrayJSWin.import_window.close();connector.loadScript("wfolders");if(typeof(wfolders)=="undefined"){setTimeout("select_import_folder()",500)}else{wfolders.makeWindow("null","import")}}function decodeOwner(){owner=User.me.id;var imapBox=openTab.imapBox[currentTab].split(cyrus_delimiter);if(imapBox.length>1){var user=DataLayer.get("user",{filter:["=","uid",imapBox[1]]});owner=$.isArray(user)?user[0].id:user.id}return owner}function import_calendar(data){var import_url="$this.db_functions.import_vcard&msg_folder="+data;var logUser;var up;var owner;function handler_import_calendar(data){if(data===true){write_msg(get_lang("The event was imported successfully."))}else{if(data.url){var form=document.createElement("form");form.setAttribute("action",DEFAULT_URL+data.url+"&isPost=true");form.setAttribute("method","POST");document.body.appendChild(form);form.submit()}else{write_msg(get_lang(data))}}}if(defaultCalendar=="expressoCalendar"&&$("#expressoCalendarid")[0]){import_implements_calendar();$("#import-dialog").dialog({autoOpen:false,height:220,modal:true,resizable:false,open:function(event,ui){if(typeof(shortcut)!="undefined"){shortcut.disabled=true}},close:function(event,ui){event.stopPropagation();if(typeof(shortcut)!="undefined"){shortcut.disabled=false}},closeOnEscape:true});$.ajax({url:"controller.php?action="+import_url+"&from_ajax=true&id_user="+User.me.id+"&readable=true&cirus_delimiter="+cyrus_delimiter+"&analize=true&uidAccount="+decodeOwner(),async:false,success:function(data){data=connector.unserialize(data);var createDialog=function(typeImport,propaget){if(typeof(typeImport)=="object"){var calendarIds=!!typeImport.calendar?typeImport.calendar:Calendar[typeImport.type];typeImport=typeImport.action}switch(parseInt(typeImport)){case 1:case 7:case 10:$("#select-agenda").html("");var options="";if(calendarIds){for(var i=0;i<calendarIds.length;i++){options+='<option value="'+calendarIds[i]+'">'+Calendar.signatureOf[calendarIds[i]].calendar.name+"</option>"}}$("#select-agenda").append(options);$("#select-agenda").css("display","block");$("#import-dialog").dialog({buttons:{Cancel:function(){$(this).dialog("close")},Importar:function(){$.ajax({url:"controller.php?action="+import_url+"&from_ajax=true&selected="+$("#select-agenda option:selected").val()+"&status="+$("#select-status option:selected").val()+"&uidAccount="+decodeOwner()+"&cirus_delimiter="+cyrus_delimiter,success:function(msg){var alt=((msg=connector.unserialize(msg))=="ok")?"Importado com sucesso para ":"Ocorreu um erro ao importar o evento/tarefa para a agenda ";alert(alt+$("#select-agenda option:selected").text())}});$(this).dialog("close")}}});if(typeImport==7){$("#import-dialog").find("#select-status option[value=1]").attr("selected","selected").trigger("change");$("#import-dialog").find("#select-status").attr("disabled","disabled")}break;case 3:$.ajax({url:"controller.php?action="+import_url+"&from_ajax=true&selected=true",success:function(msg){alert(((connector.unserialize(msg))=="ok")?"Seu evento/tarefa foi removido ":"Ocorreu um erro ao remover o evento/tarefa")}});return;break;case 5:$.ajax({url:"controller.php?action="+import_url+"&from_ajax=true&selected=true&cirus_delimiter="+cyrus_delimiter,success:function(msg){alert(((connector.unserialize(msg))=="ok")?"Seu evento/tarefa foi Atualizado com sucesso":"Ocorreu um erro ao atualizar evento/tarefa")}});return;break;case 6:var acceptedSuggestion=confirm("Deseja atualizar o evento/tarefa de acordo com a sugestão ?");$.ajax({url:"controller.php?action="+import_url+"&from_ajax=true&id_user="+User.me.id+"&selected=true&cirus_delimiter="+cyrus_delimiter+"&acceptedSuggestion="+acceptedSuggestion+"&from="+document.getElementById("from_values_"+currentTab).value+"&uidAccount="+decodeOwner(),success:function(msg){if(acceptedSuggestion){alert(((connector.unserialize(msg))=="ok")?"Evento/tarefa atualizado com sucesso ":"Ocorreu um erro ao atualizar o evento")}}});return;break;case 9:alert("Seu evento/tarefa não possui alterações!");return;break;case 11:alert("Este evento/tarefa já fora importando por algum dos particpantes e já se encontra disponível em sua agenda compartilhada!");return;break;default:up=true;$("#select-agenda").css("display","none");$("#import-dialog").children("p:first-child").css("display","none");$("#import-dialog").dialog({height:160,title:"Atualizar Evento/Tarefa",buttons:{Cancel:function(){$(this).dialog("close")},Atualizar:function(){$.ajax({url:"controller.php?action="+import_url+"&from_ajax=true&cirus_delimiter="+cyrus_delimiter+"&selected="+(parseInt(typeImport)==2||parseInt(typeImport)==4?"true":$("#select-agenda option:selected").val())+"&status="+$("#select-status option:selected").val()+"&uidAccount="+decodeOwner(),success:function(msg){alert(((msg=connector.unserialize(msg))=="ok")?"Atualizado com sucesso":"Ocorreu um erro ao atualizar o evento")}});$(this).dialog("close")}},close:function(event,ui){if(typeof(shortcut)!="undefined"){shortcut.disabled=false}},open:function(event,ui){if(typeof(shortcut)!="undefined"){shortcut.disabled=true}}});$(".ui-dialog-buttonpane").find(".ui-button:last").children().html("Atualizar")}$("#import-dialog").dialog("open")};createDialog(data,true)},beforeSend:function(jqXHR,settings){connector.showProgressBar()},complete:function(jqXHR,settings){connector.hideProgressBar()}})}else{if(confirm(get_lang("Do you confirm this import to your Calendar?"))){cExecute(import_url+"&from_ajax=true",handler_import_calendar)}}}function open_msg_part(data){var handler_open_msg_part=function(data){if(data.append==1){proxy_mensagens.get_msg(data.msg_number,data.msg_folder,false,show_msg);partMsgs.push(data.msg_number)}else{write_msg(data.append)}};cExecute("$this.imap_functions.ope_msg_part&msg_folder="+data+"&save_folder=INBOX"+cyrus_delimiter+special_folders.Trash,handler_open_msg_part)}function hack_sent_queue(data,rowid_message){if(data.success!=true){queue_send_errors=true;expresso_local_messages.set_problem_on_sent(rowid_message,data)}else{expresso_local_messages.set_as_sent(rowid_message);if(document.getElementById("_action")){el=document.getElementById("_action");father=el.parentNode;father.removeChild(el)}send_mail_from_queue(false)}}function send_mail_from_queue(first_pass){if(first_pass){modal("send_queue")}var num_msgs=expresso_local_messages.get_num_msgs_to_send();if(num_msgs<=0){close_lightbox();return}document.getElementById("text_send_queue").innerHTML=get_lang("Number of messages to send:")+" "+num_msgs;var handler_send_queue_message=function(data,rowid_message){hack_sent_queue(data,this.ID_tmp)};var msg_to_send=expresso_local_messages.get_form_msg_to_send();if(!is_ie){ID_tmp=msg_to_send.rowid.value}else{for(var i=0;i<msg_to_send.length;i++){if(msg_to_send.elements[i].name=="rowid"){ID_tmp=msg_to_send.elements[i].value;break}}}expresso_local_messages.set_as_sent(ID_tmp);cExecuteForm("$this.imap_functions.send_mail",msg_to_send,handler_send_queue_message,"queue_"+ID_tmp);send_mail_from_queue(false)}function check_mail_in_queue(){var num_msgs=expresso_local_messages.get_num_msgs_to_send();if(num_msgs>0){control=confirm(get_lang("You have messages to send. Want you to send them now?"));if(control){send_mail_from_queue(true)}return true}else{return false}}function force_check_queue(){if(!check_mail_in_queue()){write_msg(get_lang("No messages to send"))}}function create_new_local_folder(parentFolderId,name){parentFolderId=parentFolderId.split("_");var parentName=parentFolderId[2];expresso_mail_archive.createFolder(parentName,name)}function create_new_folder(name_folder,base_path){if(preferences.imap_max_folders){if(cp_tree1.length==parseInt(preferences.imap_max_folders)){$(".folders-loading").removeClass("folders-loading");cExecute("$this.imap_functions.get_folders_list&onload=true",update_menu);return write_msg(get_lang("Limit reached folders"))}}$.ajax({url:"controller.php?action=$this.imap_functions.create_mailbox",type:"POST",async:false,data:"newp="+name_folder+"&base_path="+base_path,success:function(data){data=connector.unserialize(data);if(data=="Mailbox already exists"){write_msg(get_lang("Mailbox already exists"))}else{if(data.substring(data.indexOf("Permission"),data.length)=="Permission denied"){$(".folders-loading").removeClass("folders-loading");cExecute("$this.imap_functions.get_folders_list&onload=true",update_menu);return write_msg(get_lang("Permission denied"))}}cExecute("$this.imap_functions.get_folders_list&onload=true",update_menu)},beforeSend:function(jqXHR,settings){connector.showProgressBar()},complete:function(jqXHR,settings){connector.hideProgressBar()}})}function searchEmail(emailString){var arrayInvalidEmails=new Array();arrayInvalidEmails[1]="";var email;var arrayEmailsFull=new Array();arrayEmailsFull=emailString.split(",");var er_Email=new RegExp("<(.*?)>");var er_ValidaEmail=new RegExp("^[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)*(.[a-zA-Z]{2,3})$");for(i=0;i<arrayEmailsFull.length;i++){email=er_Email.exec(arrayEmailsFull[i]);tempEmail=email==null?arrayEmailsFull[i]:email[1];tempEmail=tempEmail.replace(/^\s+|\s+$/g,"");if(tempEmail!=""){singleEmail=er_ValidaEmail.exec(tempEmail);if(singleEmail==null){arrayInvalidEmails[0]=true;arrayInvalidEmails[1]+=(email==null?arrayEmailsFull[i]:email[1])+""}}}return arrayInvalidEmails}function reports_window(currentTab){ID_msg=currentTab.substr(0,currentTab.indexOf("_"));report_wind.make_report_window(ID_msg)}DataLayer.codec("message","detail",{decoder:function(form){var border_id=form.abaID;var user_selected=$("#content_id_"+border_id).find(".from-select option:selected").text();var str_begin_name=user_selected.indexOf("<")+1;var str_end_name=user_selected.indexOf("@");var user_selected_name=user_selected.substring(str_begin_name,str_end_name);if(user_selected.length>0){var user_selected_email=user_selected.match(/<([^<]*)>[\s]*$/)[1]}else{var user_selected_email=User.me.mail}if(user_selected_email==User.me.mail){var prefix="INBOX"}else{var prefix="user"+cyrus_delimiter+user_selected_name;DataLayer.remove("folder",false);DataLayer.get("folder");var has_folder=DataLayer.get("folder",prefix+cyrus_delimiter+draftsfolder);if(!has_folder){create_new_folder(draftsfolder,prefix)}}var folder_id=(openTab.imapBox[border_id]&&openTab.type[border_id]<6)?openTab.imapBox[border_id]:prefix+cyrus_delimiter+draftsfolder;form.folder=folder_id;form.body=RichTextEditor.getData("body_"+border_id);form.type=RichTextEditor.plain[border_id]?"plain":"html";form.attachments=listAttachment(border_id);form.uidsSave=uidsSave[border_id].toString();return(form)},encoder:function(pref){return(pref)}});DataLayer.codec("mailAttachment","detail",{decoder:function(evtObj){if(notArray=$.type(evtObj)!=="array"){evtObj=[evtObj]}var res=$.map(evtObj,function(form){return[$.map(form.files,function(files){return{source:files,disposition:form["attDisposition"+form.abaID]}})]});return notArray?res[0]:res},encoder:function(){}});function formatBytes(bytes){if(bytes>=1000000000){return(bytes/1000000000).toFixed(2)+" GB"}if(bytes>=1000000){return(bytes/1000000).toFixed(2)+" MB"}if(bytes>=1000){return(bytes/1000).toFixed(2)+" KB"}return bytes+" B"}function truncate(text,size){var result=text;if(text.length>size){result=text.substring(0,size)+"..."}return result}function break_comma(originalText){var quotesMarks=false;var completeString="";var brokenEmails=new Array();originalText+=",";for(i=0;i<originalText.length;i++){var character=originalText.substr(i,1);if(character=='"'){quotesMarks=!quotesMarks}if(!quotesMarks){if(character==","){brokenEmails.push(completeString);completeString=""}else{completeString+=character}}else{completeString+=character}}return brokenEmails}DataLayer.links("message");DataLayer.poll("message",30);function services_retry(){try{connector.purgeCache();if((expresso_mail_archive.enabled==null)&&(expresso_mail_archive.timer==null)&&(expresso_mail_archive.counter>0)){connector.hideProgressBar();write_msg(get_lang("Sorry, but you need to reload this web page. Click at reload page at web browsing top navigation."));return}if(arguments.length==0){write_msg(get_lang("Trying to communicate with Mail Archiver..."))}connector.showProgressBar();var head=document.getElementById("send_queue");var script_xdr=document.createElement("script");var script_xdr_tag_id="mail_archiver_retry_xdr";var script_request=document.createElement("script");var script_request_tag_id="mail_archiver_retry_request";var script_cors=document.createElement("script");var script_cors_tag_id="mail_archiver_retry_cors";var script_utils=document.createElement("script");var script_utils_tag_id="mail_archiver_retry_utils";if(document.getElementById(script_xdr_tag_id)){document.getElementById(script_xdr_tag_id).parentNode.removeChild(document.getElementById(script_xdr_tag_id))}if(document.getElementById(script_request_tag_id)){document.getElementById(script_request_tag_id).parentNode.removeChild(document.getElementById(script_request_tag_id))}if(document.getElementById(script_cors_tag_id)){document.getElementById(script_cors_tag_id).parentNode.removeChild(document.getElementById(script_cors_tag_id))}if(document.getElementById(script_utils_tag_id)){document.getElementById(script_utils_tag_id).parentNode.removeChild(document.getElementById(script_utils_tag_id))}script_xdr.type="text/javascript";script_xdr.src=mail_archive_protocol+"://"+mail_archive_host+":"+mail_archive_port+"/arcservutil/cxf-addon-xdr-adapter.js";script_xdr.id=script_xdr_tag_id;head.appendChild(script_xdr);script_request.type="text/javascript";script_request.src=mail_archive_protocol+"://"+mail_archive_host+":"+mail_archive_port+"/arcservutil/cxf-addon-cors-request-object.js";script_request.id=script_request_tag_id;head.appendChild(script_request);script_cors.type="text/javascript";script_cors.src=mail_archive_protocol+"://"+mail_archive_host+":"+mail_archive_port+"/arcservutil/cxf-addon-cors-utils.js";script_cors.id=script_cors_tag_id;head.appendChild(script_cors);script_utils.type="text/javascript";script_utils.src=mail_archive_protocol+"://"+mail_archive_host+":"+mail_archive_port+"/arcserv/ArchiveServices?js&nojsutils";script_utils.id=script_utils_tag_id;head.appendChild(script_utils);ttintval=window.setTimeout("check_services_restart()",1000)}catch(e){write_msg(get_lang("Sorry, but Mail Archiver still seems to be sleeping. Check out your system services!"));connector.hideProgressBar();check_services_tryouts=1}}function check_services_restart(){try{write_msg(get_lang("Wait: attempt %1 from %2...",check_services_tryouts,check_services_tryouts_limit));if(check_services_tryouts<=5){try{ArchiveServices=new web_service_mailarchiver_serpro__ArchiveServices();ArchiveServices.url=mail_archive_protocol+"://"+mail_archive_host+":"+mail_archive_port+"/arcserv/ArchiveServices";window.clearInterval(ttintval);expresso_mail_archive.Restart(expresso_mail_archive)}catch(e){check_services_tryouts++;window.clearInterval(ttintval);ttintval=window.setTimeout("services_retry(true)",1)}}else{write_msg(get_lang("Sorry, but Mail Archiver still seems to be sleeping. Check out your system services!"));connector.hideProgressBar();check_services_tryouts=1}}catch(e){write_msg(get_lang("Sorry, but Mail Archiver still seems to be sleeping. Check out your system services!"));connector.hideProgressBar();check_services_tryouts=1}};
Index: trunk/expressoMail1_2/js/draw_api.js
===================================================================
--- trunk/expressoMail1_2/js/draw_api.js	(revision 7526)
+++ trunk/expressoMail1_2/js/draw_api.js	(revision 7538)
@@ -695,16 +695,11 @@
     				data = connector.unserialize(data);
     				if(data){
-                        
     					var _data = {};
     					$.each(data,function(index,value){
-    						if (data[index] && data[index]){
+    						if (data[index]){
     							_data[data[index]] = data[index];
     						}
     					});
-
     					populateSelectedMsgs(_data);
-                        
-    					_data = {};
-    				    
     				}
     			},
@@ -1385,5 +1380,4 @@
 	 */
 	if (msg_folder != headers_msgs['folder']) {
-
 		if (headers_msgs['folder']) {
 			array_folder = headers_msgs['folder'].split('/');
@@ -1434,12 +1428,7 @@
 		var tbody_element = document.createElement("TBODY");
 		//add events for column resizing
-		if (is_ie) {
-			table_element.attachEvent("onmousemove",changeCursorState);
-			table_element.attachEvent("onmousedown",startColResize);
-		}
-		else {
-			table_element.addEventListener("mousemove",changeCursorState,false);
-			table_element.addEventListener("mousedown",startColResize,false);
-		}
+        $(table_element).mousemove(changeCursorState);
+        $(table_element).mousedown(startColResize);
+
 		table_element.setAttribute("id", "table_message_header_box_"+numBox);
 		table_element.className = "table_message_header_box";
@@ -2346,35 +2335,21 @@
 
 function draw_header_box(){
-	switch(sort_box_type){
-		case 'SORTFROM':
-			type_name = get_lang("From");
-			break;
-		case 'SORTSUBJECT':
-			type_name = get_lang("Subject");
-			break;
-		case 'SORTARRIVAL':
-			type_name = get_lang("Date");
-			break;
-		case 'SORTSIZE':
-			type_name = get_lang("Size");
-			break;
-		default:
-			type_name = get_lang("Date");
-			break;
-	}
+	var types = {'SORTFROM': 'From', 'SORTSUBJECT': 'Subject', 'SORTARRIVAL': 'Date', 'SORTSIZE': 'Size'};
+    type_name = ( types[sort_box_type] ? get_lang(types[sort_box_type]) : get_lang("Date") );
 	folder = special_folders['Sent'];
 	current = get_current_folder();
 	if ((preferences.from_to_sent == "1") && (current.substr(current.length - folder.length, folder.length) == folder)) {
-        document.getElementById("message_header_SORTFROM_"+numBox).innerHTML    = get_lang("To");
+        $("#message_header_SORTFROM_"+numBox).html(get_lang("To"));
         if (sort_box_type == "SORTFROM")
         	type_name = get_lang("To");
     }else{
-	document.getElementById("message_header_SORTFROM_"+numBox).innerHTML 	= get_lang("From");
+	   $("#message_header_SORTFROM_"+numBox).html(get_lang("From"));
     }
-	document.getElementById("message_header_SORTSUBJECT_"+numBox).innerHTML = get_lang("Subject");
-	document.getElementById("message_header_SORTARRIVAL_"+numBox).innerHTML = get_lang("Date");
-	document.getElementById("message_header_SORTSIZE_"+numBox).innerHTML	= get_lang("Size");
+	$("#message_header_SORTSUBJECT_"+numBox).html(get_lang("Subject"));
+	$("#message_header_SORTARRIVAL_"+numBox).html(get_lang("Date"));
+	$("#message_header_SORTSIZE_"+numBox).html(get_lang("Size"));
 	document.getElementById("message_header_"+(sort_box_type.lastIndexOf("SORT") != "-1" ? sort_box_type : "SORTARRIVAL")+"_"+numBox ).innerHTML = "<B>"+type_name+"</B><img src ='templates/"+template+"/images/arrow_"+(sort_box_reverse == 1 ? 'desc' : 'asc')+"endant.gif'>";
 }
+
 function verifyOption(name, id){
 	var str = name + '' + id;
