Index: sandbox/newExpressoMail/expressoMail1_2/js/abas.js
===================================================================
--- sandbox/newExpressoMail/expressoMail1_2/js/abas.js	(revision 7064)
+++ sandbox/newExpressoMail/expressoMail1_2/js/abas.js	(revision 7167)
@@ -8,15 +8,30 @@
 var countID = 2;
 var tab_content = "";
+var tab_role = "";
 var lastIndexSelected = 0;
 
 var ptabs = $("#ptabs").tabs({ 
-	tabTemplate: "<li role='tab' style='cursor: pointer;'><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close' title='Fechar Aba'>Fechar Aba</span></li>", 
+	tabTemplate: "<li role='tab' style='cursor: pointer;'><a href='#{href}'>#{label}</a> <span class='ui-icon tab-close ui-icon-close' title='Fechar Aba'>Fechar Aba</span></li>", 
+	panelTemplate: "<div></div>",
 	add: function( event, ui ) { 
 	        countID++; 
-	        $(ptabs).tabs('select', '#' + ui.panel.id); 
-	        $.cookie('open_tabs', ($.cookie('open_tabs') ? $.cookie('open_tabs')+"," : "") +ui.panel.id.substring(6));
-	        $( ui.panel ).addClass("conteudo").append(tab_content); 
+	        $(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();
 	},
@@ -29,5 +44,4 @@
 });
 
-//$(ptabs).find(".ui-tabs-nav").wrap("<div class='scroll-tabs'></div>");
 /* 
 	method : createTab
@@ -35,4 +49,5 @@
 	params : {
 		label : Label of the tab
+		* role : Tab type
 		* content : Content of the tab
 		* href : Tab id 
@@ -42,16 +57,19 @@
 		#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, content,href, callback){
+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(href) );
+		$(ptabs).tabs( "select", indexTab("#ptabs_"+href) );
 	}
 }
@@ -83,5 +101,5 @@
 /* 
 	method : indexTab
-	descrition : remove a tab
+	descrition : return a tab index
 	params : {
 		* href : Tab id 
@@ -97,2 +115,40 @@
 		$( "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()));
+}
