var BordersArray = new Array(); var countBorders = 0; var partMsgs = new Array(); var msgAttachments = new Array(); var uidsSave = new Array(); var zebraDiscardEventDialog = false; var saveBorderError = new Array(); var countID = 2; var tab_content = ""; var tab_role = ""; var lastIndexSelected = 0; var ptabs = $("#ptabs").tabs({ tabTemplate: "
  • #{label} Fechar Aba
  • ", panelTemplate: "
    ", add: function( event, ui ) { countID++; $(ptabs).tabs('select', '#' + $(ptabs).find("div:last").attr("id")); $(ptabs).find("span.tab-close:last").hover(function(){$(this).toggleClass("ui-icon-circle-close ui-icon-close");}, function(){$(this).toggleClass("ui-icon-circle-close ui-icon-close");}) $(ptabs).find("div:last").addClass("conteudo").attr("role", tab_role).append(tab_content); if(tab_role == "new") uidsSave[indexTab("#"+ui.panel.id)] = []; }, show: function(event, ui){ switch($( ui.panel ).attr("role")){ case "new": case "search": $("#footer_menu").hide(); break; case "message": case "draft": case "folder": $("#footer_menu").show(); break; } resizeWindow(); }, cookie: { expires: 1 }, select: function(event, ui) { lastIndexSelected = ui.index; } }); /* method : createTab descrition : create a new tab params : { label : Label of the tab * role : Tab type * content : Content of the tab * href : Tab id * callback : a function } comments : { #1 : if the user just set the label, a tab with blank content and a dynamic id is created #2 : if a tab with a set href already exists, don't duplicate, this function only select the tab #3 : if the role is * = Optional */ function createTab(label, role, content,href, callback){ if( !$("#ptabs_"+href).length){ tab_content = content ? content : ""; tab_role = role ? role : "new"; $(ptabs).tabs("add", "#ptabs_"+(href ? href : countID), (label.length > 21 ? label.substring(0, 18)+"..." : label)); if(typeof(callback) == 'function') callback($("#ptabs_"+(href ? href : countID))); else return $("#ptabs_"+(href ? href : countID)); }else{ $(ptabs).tabs( "select", indexTab("#ptabs_"+href) ); } } /* method : removeTab descrition : remove a tab params : { * href : Tab id * callback : a function } comments : { #1 : if the user doesn't set no parameter, this function just remove the open tab * = Optional */ function removeTab(href, callback){ ptabs.tabs("remove", ( href ? indexTab(href) : lastIndexSelected ) ); if(typeof(callback) == 'function') callback(); } /* method : indexTab descrition : return a tab index params : { * href : Tab id } comments : { #1 : if the user doesn't set no parameter, this function just return the index of the open tab * = Optional */ function indexTab(href){ return href ? $( "li", ptabs ).index( $('[href="'+href+'"]').parent() ) : lastIndexSelected; } /* method : idTab descrition : remove a tab id params : { * index : Tab index } comments : { #1 : if the user doesn't set no parameter, this function just return the id of the open tab * = Optional */ function idTab(index){ return $( ".ui-tabs-panel", ptabs ).eq((index ? index : indexTab())).attr("id"); } function getTabData(index){ return { id : parseInt(idTab(index).substring(6).split("_r_")[0]), folder : Base64.decode(idTab(index).substring(6).split("_r_")[1]), role : getTabRole(index), header : getTabHeader(index), content : getTabContent(index) }; } function getTabHeader(index){ return $( ptabs ).find('[href="#'+$( ".ui-tabs-panel", ptabs ).eq((index ? index : indexTab())).attr("id")+'"]').parent(); } function getTabRole(index){ return getTabContent(index).attr("role"); } function getTabContent(index){ return $( ".ui-tabs-panel", ptabs ).eq((index ? index : indexTab())); }