Index: /trunk/expressoMail1_2/js/abas.js
===================================================================
--- /trunk/expressoMail1_2/js/abas.js	(revision 5172)
+++ /trunk/expressoMail1_2/js/abas.js	(revision 5200)
@@ -47,5 +47,22 @@
 	if (footer_menu != null) {
 		footer_menu.style.display = (openTab.type[ID] != 4 ? '' : 'none');
-		if((aba.id.indexOf("_r") < 0) && (aba.id.indexOf("_0") < 0) && (aba.id.indexOf("id_search_") < 0)){
+		var alternate_menu = document.getElementById('localOption');
+		if(alternate_menu != null && alternate_menu != 'undefined'){ //Quando Carregado o expresso mail
+			if(openTab.imapBox[ID]!= null && openTab.imapBox[ID]!= 'undefined' ){ //Quando abrir uma Nova Mensagem
+				if((openTab.imapBox[ID].indexOf("local_") >= 0)){						
+						alternate_menu.title = get_lang("Unarchive");
+						alternate_menu.removeAttribute("onclick");
+						alternate_menu.setAttribute("onclick",  'expresso_local_messages.unarchive_msgs(\''+openTab.imapBox[ID]+'\', null)');
+						alternate_menu.innerHTML = get_lang("Unarchive");
+						
+					}else{
+						alternate_menu.title = get_lang("Archive");
+						alternate_menu.removeAttribute("onclick");
+						alternate_menu.setAttribute("onclick", 'archive_msgs(\''+openTab.imapBox[ID]+'\', null)');				
+						alternate_menu.innerHTML = get_lang("Archive");
+					}
+			}
+		}
+		if((aba.id.indexOf("_r") < 0) && (aba.id.indexOf("_0") < 0) && (aba.id.indexOf("id_search_") < 0) && (aba.id.indexOf("_s") < 0)){
 			spanD.style.display = 'none';
 			footer_menu.style.display = 'none';			
@@ -167,5 +184,21 @@
 		
 		var ID = id_value;
-		openTab.imapBox[ID] = current_folder;
+		if((currentTab != 0) && (currentTab.indexOf("search") >= 0) && (ID.indexOf("msg") < 0)) {
+			var id_border = currentTab.replace(/[a-zA-Z_]+/, "");
+			ID_TR = ID.toString().substr(0,ID.toString().indexOf("_r"));
+			var tr = Element(ID_TR);
+			openTab.imapBox[ID] = (tr.getAttribute('name') == null?get_current_folder():tr.getAttribute('name'));
+		}else if(ID.indexOf("search_local") >= 0){
+			if(current_folder.indexOf("local") >= 0)
+				openTab.imapBox[ID] = current_folder;
+			else
+				openTab.imapBox[ID] = 'local_search';
+		}else if(ID.indexOf("search_") >= 0){
+			if(current_folder.indexOf("local") < 0)
+				openTab.imapBox[ID] = current_folder;
+			else
+				openTab.imapBox[ID] = 'search';
+		}else
+			openTab.imapBox[ID] = current_folder;
 	}
 	td = document.createElement("TD");
Index: /trunk/expressoMail1_2/js/main.js
===================================================================
--- /trunk/expressoMail1_2/js/main.js	(revision 5194)
+++ /trunk/expressoMail1_2/js/main.js	(revision 5200)
@@ -1031,7 +1031,9 @@
 	}
 
-	if(currentTab.toString().indexOf("_r") != -1){
-            id_msgs = currentTab.toString().substr(0,currentTab.toString().indexOf("_r"));
-        }
+	if(currentTab.toString().indexOf("_r") != -1)
+        id_msgs = currentTab.toString().substr(0,currentTab.toString().indexOf("_r"));
+		
+    if(currentTab.toString().indexOf("_s") != -1)
+		id_msgs = currentTab.toString().substr(0,currentTab.toString().indexOf("_s"));
 
 	if(!id_msgs){
@@ -1040,5 +1042,5 @@
 			return;
 		}else
-		id_msgs = get_selected_messages();
+			id_msgs = get_selected_messages();
 	}	
 
Index: /trunk/expressoMail1_2/js/local_messages.js
===================================================================
--- /trunk/expressoMail1_2/js/local_messages.js	(revision 5184)
+++ /trunk/expressoMail1_2/js/local_messages.js	(revision 5200)
@@ -1634,12 +1634,16 @@
 	// se a aba estiver aberta e selecionada, apenas a msg da aba Ã© movida
 	if(currentTab.toString().indexOf("_r") != -1)
-            msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r"));
-	
-        if( msgs_number =='selected' || !msgs_number ){
+        msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r"));
+		
+	if(currentTab.toString().indexOf("_s") != -1)
+		msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_s"));
+	
+    if( msgs_number =='selected' || !msgs_number ){
 		if (currentTab != 0 && currentTab.indexOf("search_")  >= 0)
 			msgs_number = get_selected_messages_search();
 		else
-	    msgs_number = get_selected_messages();
-		}
+			msgs_number = get_selected_messages();
+	}
+		
 	if( !msgs_number )
 	    return write_msg(get_lang('No selected message.'));
Index: /trunk/expressoMail1_2/js/draw_api.js
===================================================================
--- /trunk/expressoMail1_2/js/draw_api.js	(revision 5158)
+++ /trunk/expressoMail1_2/js/draw_api.js	(revision 5200)
@@ -4119,7 +4119,7 @@
 	if(preferences.use_local_messages==1 && !expresso_offline)
 		if(proxy_mensagens.is_local_folder(current_folder))
-			span_options.innerHTML += '&nbsp; <span title="'+get_lang("Unarchive")+'" class="message_options" onclick="expresso_local_messages.unarchive_msgs(\''+folder+'\',null)">'+get_lang("Unarchive")+'</span>';
+			span_options.innerHTML += '&nbsp; <span id="localOption" title="'+get_lang("Unarchive")+'" class="message_options" onclick="expresso_local_messages.unarchive_msgs(\''+folder+'\',null)">'+get_lang("Unarchive")+'</span>';
 		else
-			span_options.innerHTML += '&nbsp; <span title="'+get_lang("Archive")+'" class="message_options" onclick="archive_msgs(\''+folder+'\',null)">'+get_lang("Archive")+'</span>';
+			span_options.innerHTML += '&nbsp; <span id="localOption" title="'+get_lang("Archive")+'" class="message_options" onclick="archive_msgs(\''+folder+'\',null)">'+get_lang("Archive")+'</span>';
 	if (use_spam_filter) {
 		if ( current_folder == 'INBOX'+cyrus_delimiter+'Spam' )	{
