_icon_dir="templates/"+template+"/images/menu/";
function ConstructMenuTools(){
// Layout padrão de menu = option1
var _divMenu = Element('menu_tools');
if(_divMenu)
return;
var _option1 = preferences.hide_folders == "1" ? false : true;
var itens = new Array (
"preferences_mail()|"+get_lang("Preferences")+"|preferences.png",
"search_emails(\"\")|"+get_lang("Search")+"|search.png",
"filterbox()|"+get_lang("Edit filters")+"|filters.png",
"folderbox()|"+get_lang("Edit folders")+"|editfolders.png",
"sharebox()|"+get_lang("Share mailbox")+"|usersfolders.png",
"empty_trash_imap()|"+get_lang("Empty trash")+"|trash.png"
);
var _link = Element('link_tools');
_divMenu = document.createElement("DIV");
_divMenu.id = "menu_tools";
_divMenu.style.position = "absolute";
_divMenu.style.top = findPosY(_link) + (_option1 ? 19 : 14);
_divMenu.style.left = findPosX(_link) + (_option1 ? 22 : 22);
_divMenu.style.width = "auto";
_divMenu.style.height = "auto";
_divMenu.style.padding = "1px";
_divMenu.style.paddingTop = "0px";
_divMenu.style.zIndex = "10000";
_divMenu.style.backgroundColor = "WHITE";
_divMenu.style.border = "1px solid #999999";
_divMenu.style.borderTop = "0px solid #FFFFFF";
_divMenu.style.visibility = "hidden";
var _timeout = false;
_hideMenuTools = function () {
Element('menu_tools').style.visibility = "hidden";
};
_viewMenuTools = function () {
Element('menu_tools').style.visibility = "visible";
};
var _mouseover = _link.onmouseover;
_link.onmouseover = function () {
var _option1 = preferences.hide_folders == "1" ? false : true;
var _link = Element('link_tools');
Element('menu_tools').style.top = findPosY(_link) + (_option1 ? 19 : 14);
if(_timeout) {
clearTimeout(_timeout);
_timeout=false;
}
if(_mouseover)
_mouseover();
_timeout = setTimeout("_viewMenuTools();",500);
};
_link.onmouseout = function () {
if(_timeout) {
clearTimeout(_timeout);
_timeout=false;
}
if(_option1)
unset_menu_bg(Element("link_tools"));
_timeout = setTimeout("_hideMenuTools();",500);
}
var _t = document.createElement("TABLE");
_t.cellPadding="0";
_t.cellSpacing="0";
_t.onmouseover = function () {
if(_timeout) {
clearTimeout(_timeout);
_timeout=false;
}
if(_mouseover)
_mouseover();
Element('menu_tools').style.visibility = "visible";
};
var _tbody = document.createElement("TBODY");
var buildTr = function(value) {
var item = value.split('|');
var _tr = document.createElement("TR");
var _td = document.createElement("TD");
_td.innerHTML = " "+item[1]+" ";
_td.style.color = "DARKBLUE";
_td.style.cursor = "pointer";
if(_option1)
_td.style.border = '1px solid #f7f7f7';
_td.onclick = function() { Element('menu_tools').style.visibility='hidden';eval(item[0]);};
_td.onmouseover = function () {
if(_timeout) {
clearTimeout(_timeout);
timeout=false;
}
if(_option1)
set_menu_bg(this);
else {
this.style.textDecoration="underline";
this.style.color = 'DARKORANGE';
}
};
_td.onmouseout = function () {
_timeout = setTimeout("_hideMenuTools();",500);
if(_option1){
unset_menu_bg(this);
unset_menu_bg(Element("link_tools"));
}else {
this.style.backgroundColor = 'WHITE';
this.style.textDecoration="none";
this.style.color = 'DARKBLUE';
}
};
_tr.appendChild(_td);
return _tr;
}
for(i = 0; i < itens.length; i++)
_tbody.appendChild(buildTr(itens[i]));
_t.appendChild(_tbody);
_divMenu.appendChild(_t);
document.body.appendChild(_divMenu);
}
function openListUsers(border_id) {
connector.loadScript("QuickCatalogSearch");
QuickCatalogSearch.showCatalogList(border_id);
}
function ConstructRightMenu(_event){
var div = Element("div_rightbutton");
if(!div){
div = document.createElement("DIV");
div.style.position = 'absolute';
div.style.zIndex = '15';
div.style.border = '1px outset BLACK';
div.style.background = "#EEEEE6";
div.id = 'div_rightbutton';
div.style.padding = "1px";
div.style.fontSize = is_ie || is_gecko1_5 || is_win ? "9pt" : "11pt";
div.style.width = "190px";
div.style.height = is_win && !is_ie ? "129px" : "139px";
div.style.display ='none';
document.body.appendChild(div);
var _tab = " ";
var _sep = "
";
var optionsMenu = new Array(
_tab + get_lang("Mark as")+" "+get_lang('seen')+'|'+"set_messages_flag('seen','get_selected_messages')",
_tab + get_lang("Mark as")+" "+get_lang('unseen')+'|'+"set_messages_flag('unseen','get_selected_messages')",
_tab + get_lang("Mark as")+" "+get_lang('important')+'|'+"set_messages_flag('flagged','get_selected_messages')",
_tab + get_lang("Mark as")+" "+get_lang('normal')+'|'+"set_messages_flag('unflagged','get_selected_messages')",
_sep,
_tab + get_lang("Move to")+" ... |wfolders.makeWindow('', 'move_to')",
_tab + get_lang("Delete")+"|"+"delete_msgs('null','selected','null')",
_tab + get_lang("Export")+"|"+"export_all_selected_msgs()"
);
for(i = 0; i < optionsMenu.length; i++){
optionsMenu_l = optionsMenu[i].split('|');
var div_l = document.createElement("DIV");
div_l.style.padding = "1px";
div_l.style.width = "188px";
div_l.style.cursor = 'pointer';
div_l.innerHTML = optionsMenu_l[0];
div_l.style.valign = 'top';
if(optionsMenu_l[0] != _sep) {
var attr = document.createAttribute('javascript');
attr.value = optionsMenu_l[1]+";Element('div_rightbutton').style.display = 'none';";
div_l.setAttributeNode(attr);
div_l.oncontextmenu = function(e) { return false;};
div_l.onclick = function () {this.onmouseout();eval(this.getAttribute('javascript'));};
div_l.onmouseover = function () {this.style.color = 'WHITE';this.style.background = "#4a79cd";};
div_l.onmouseout = function () {this.style.color = 'BLACK';this.style.background = "#EEEEE6";};
}
else
div_l.style.height = "11px";
div_l.id="link_rightbutton_"+i;
div.appendChild(div_l);
}
}
var x = _event.clientX + document.body.scrollLeft + 2;
var y = _event.clientY + document.body.scrollTop + 2;
var w_width = is_ie ? document.body.clientWidth : window.innerWidth;
var w_height = is_ie ? document.body.clientHeight + document.body.scrollTop : window.innerHeight + window.pageYOffset;
if(x + 218 > w_width)
div.style.left = w_width - (is_ie ? 198 : 218);
else
div.style.left = x;
if(y + 131 > w_height)
div.style.top = w_height - (is_ie ? 125 : 131);
else
div.style.top = y;
div.style.display ='';
}
function ConstructBoxMenu(_event,boxName,boxFolder){
var div = Element("div_rightbutton_folder");
if (div)
div.parentNode.removeChild(div);
div = document.createElement("DIV");
div.style.position = 'absolute';
div.style.zIndex = '15';
div.style.border = '1px outset BLACK';
div.style.background = "#EEEEE6";
div.id = 'div_rightbutton_folder';
div.style.padding = "1px";
div.style.fontSize = is_ie || is_gecko1_5 || is_win ? "9pt" : "11pt";
div.style.width = "190px";
div.style.height = is_win && !is_ie ? "35px" : "33px";
div.style.display ='none';
document.body.appendChild(div);
var _tab = " ";
var _sep = "
";
var optionsMenu = new Array(
_tab + get_lang("Open in new tab")+'|'+"open_folder('"+boxFolder+"', '"+boxName+"')",
_tab + get_lang("Edit folders")+'|'+"folderbox()"
);
for(i = 0; i < optionsMenu.length; i++){
optionsMenu_l = optionsMenu[i].split('|');
var div_l = document.createElement("DIV");
div_l.style.padding = "1px";
div_l.style.width = "188px";
div_l.style.cursor = 'pointer';
div_l.innerHTML = optionsMenu_l[0];
div_l.style.valign = 'top';
if(optionsMenu_l[0] != _sep) {
var attr = document.createAttribute('javascript');
attr.value = optionsMenu_l[1]+";Element('div_rightbutton_folder').style.display = 'none';";
div_l.setAttributeNode(attr);
div_l.oncontextmenu = function(e) { return false;};
div_l.onclick = function () {this.onmouseout();eval(this.getAttribute('javascript'));};
div_l.onmouseover = function () {this.style.color = 'WHITE';this.style.background = "#4a79cd";};
div_l.onmouseout = function () {this.style.color = 'BLACK';this.style.background = "#EEEEE6";};
}
else
div_l.style.height = "11px";
div_l.id="link_rightbutton_folder"+i;
div.appendChild(div_l);
}
var x = _event.clientX + document.body.scrollLeft + 2;
var y = _event.clientY + document.body.scrollTop + 2;
var w_width = is_ie ? document.body.clientWidth : window.innerWidth;
var w_height = is_ie ? document.body.clientHeight + document.body.scrollTop : window.innerHeight + window.pageYOffset;
if(x + 218 > w_width)
div.style.left = w_width - (is_ie ? 198 : 218);
else
div.style.left = x;
if(y + 131 > w_height)
div.style.top = w_height - (is_ie ? 125 : 131);
else
div.style.top = y;
div.style.display ='';
}