if (!expresso_offline) {
var _showBar = showBar;
var _hideBar = hideBar;
}
function __showBar(){
_showBar();
resizeWindow();
}
function __hideBar(){
_hideBar();
resizeWindow();
}
showBar = __showBar;
hideBar = __hideBar;
XEvents.add( window, 'onresize', resizeWindow );
// BEGIN: FUNCTION RESIZE WINDOW
function resizeWindow(){
var divScrollMain = Element("divScrollMain_"+numBox);
var table_message = Element("table_message");
var content_folders = Element("content_folders");
var clientHeight = ((window.innerHeight ? window.innerHeight : document.body.offsetHeight) - 8);
var clientWidth = ((window.innerWidth ? window.innerWidth : document.body.offsetWidth) - 17);
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))) + "px";
div_scroll.style.width = (clientWidth - (findPosX(div_scroll)+10)) + "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";
}
}
// END: FUNCTION RESIZE WINDOW
var _beforeunload_ = window.onbeforeunload;
window.onbeforeunload = function()
{
return unloadMess();
};
function unloadMess(){
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 {
var mess = get_lang("Your message has not been sent and will be discarted.");
for (var i = 0; i < BordersArray.length; i++) {
var body = Element('body_' + BordersArray[i].sequence);
if (body && body.contentWindow && body.contentWindow.document.designMode.toLowerCase() == 'on') {
return mess;
}
}
}
}
// Change the class of message.
// In refresh, the flags UnRead and UnSeen don't exist anymore.
function set_msg_as_read(msg_number, selected){
tr_message = Element(msg_number);
if (exist_className(tr_message, 'tr_msg_unread'))
decrement_folder_unseen(1);
remove_className(tr_message, 'tr_msg_unread');
remove_className(tr_message, 'selected_msg');
Element("td_message_unseen_"+msg_number).innerHTML = "";
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){
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(1);
remove_className(tr_message, 'selected_msg');
add_className(tr_message, 'tr_msg_unread');
Element("td_message_unseen_"+msg_number).innerHTML = "
";
}
function set_msg_as_flagged(msg_number){
var msg = Element(msg_number);
remove_className(msg, 'selected_msg');
add_className(msg, 'flagged_msg');
Element("td_message_important_"+msg_number).innerHTML = "
";
}
function set_msg_as_unflagged(msg_number){
var msg = Element(msg_number);
remove_className(msg, 'selected_msg');
remove_className(msg, 'flagged_msg');
Element("td_message_important_"+msg_number).innerHTML = " ";
}
function get_current_folder(){
return current_folder;
}
// Kill current box (folder or page).
function kill_current_box(){
var box = document.getElementById("table_box");
if (box != null)
box.parentNode.removeChild(box);
else
return false;
}
// Kill current paging.
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 download_local_attachment(url) {
if (div_attachment == null){
var div_attachment = document.createElement("DIV");
div_attachment.id="id_div_attachment";
document.body.appendChild(div_attachment);
}
div_attachment.innerHTML="";
}
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 (div_attachment == null){
var div_attachment = document.createElement("DIV");
div_attachment.id="id_div_attachment";
document.body.appendChild(div_attachment);
}
if(new_file_name)
params = "&newfilename="+escape(new_file_name);
if(encoding)
params += "&encoding="+encoding;
div_attachment.innerHTML="";
}
function download_all_attachments(msg_folder, msg_number){
var handler_source = function(data){
download_attachments(null, null, data, null,null,'anexos.zip');
};
cExecute("expressoMail1_2.exporteml.download_all_attachments",handler_source,"folder="+msg_folder+"&num_msg="+msg_number);
}
//ADD forwarded files
function addForwardedFile(id_border,file_name,link){
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');
if (!expresso_offline) {
if (!is_ie) {
var inputFile = document.createElement("INPUT");
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 {
var 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 {
var inputFile = document.createElement("input");
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(expresso.connector.serialize(a_tmp));
var checkbox = document.createElement("INPUT");
checkbox.type = "checkbox";
checkbox.id = "checkbox_"+id_border+"_"+countDivFiles;
checkbox.name = "local_attachments[]";
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);
checkbox.checked = true; //Incrível, mas no Internet Explorer o checked só funciona efetivamente se o elemente já estiver renderizado... por isso só aqui eu seleciono ele...
return inputFile;
}
// Add Input File Dynamically.
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');
divFile.innerHTML = "";
var linkFile = document.createElement("A");
linkFile.id = "linkFile_"+id_border+"_"+countDivFiles;
linkFile.href='javascript:void(0)';
linkFile.onclick=function () {removeFile(this.id.replace("link","div")); return false;};
linkFile.innerHTML=get_lang("Remove");
//divFile.innerHTML += " ";
divFile.appendChild(linkFile);
divFile.id = "divFile_"+id_border+"_"+countDivFiles;
divFiles.appendChild(divFile);
return document.getElementById("inputFile_"+id_border+"_"+countDivFiles);
}
var setTimeout_write_msg = 0;
var old_msg = false;
// Funcao usada para escrever mensagem
// notimeout = True : mensagem nao apaga
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 = '
'+msg+' |
---|
"; block_quoted_body += body; block_quoted_body += ""; return block_quoted_body; } function make_forward_body(body, from, date, subject, to, cc){ from = from.replace(//g,">"); to = to.replace(//g,">"); var forward_body = '