Index: /trunk/expressoMail1_2/js/abas.js
===================================================================
--- /trunk/expressoMail1_2/js/abas.js	(revision 5213)
+++ /trunk/expressoMail1_2/js/abas.js	(revision 5219)
@@ -146,5 +146,5 @@
 }
 
-function create_border(borderTitle, id_value)
+function create_border(borderTitle, id_value, search)
 {
 	
@@ -240,5 +240,14 @@
 	if ( resize )
 		borderTitle = borderTitle.substring(0, resize*0.08);
-	var cc = document.getElementById("em_message_search");
+	
+	var cc = search;
+	if(!cc){
+		var is_local = ID.match('.*_local_.*');
+		if(!is_local)
+			cc = document.getElementById("em_message_search").value;
+		else{
+			cc = document.getElementsByName(currentTab)[0].value;
+		}
+	}
 
 	td.innerHTML = "<div style='width:100%;border:0;padding:0;'>\n\
@@ -249,5 +258,5 @@
                                 <img onmousedown='javascript:return false' style='cursor:pointer' onclick=delete_border('" + ID + "','false') src='templates/"+template+"/images/close_button.gif'/>\n\ " +
                             "</div>\n\ " + 
-							"<input type=\"hidden\" name=\""+ ID+"\" value=\""+cc.value+"\">" + 
+							"<input type=\"hidden\" name=\""+ ID+"\" value=\""+cc+"\">" + 
                         "</div>";
 	
Index: /trunk/expressoMail1_2/js/search.js
===================================================================
--- /trunk/expressoMail1_2/js/search.js	(revision 5215)
+++ /trunk/expressoMail1_2/js/search.js	(revision 5219)
@@ -368,10 +368,9 @@
 		var border_id 	= borderID;
 		var sort_type	= sortType;
-
-		if( this.value )
-		  return this.quickSearchMail( false, false, sortType, border_id );
+		var is_local = border_id.match('.*_local_.*');
+		if(!is_local)
+			if( this.value )
+				return this.quickSearchMail( document.getElementsByName(currentTab)[0].value, false, sortType, border_id );
  
-		var is_local = border_id.match('.*_local_.*');
-
 		var args   = "$this.imap_functions.search_msg";
 		var params = "condition="+EsearchE.condition+"&page="+EsearchE.page+"&sort_type="+sort_type;
@@ -399,11 +398,13 @@
                         }
     		}
-        	
-        	if( data['num_msgs'])
+        	if (!is_local)
             {
-            	allMsg['data'] 				= data['data'];
-            	allMsg['num_msgs']			= data['num_msgs'];
-                
-            }
+				if( data['num_msgs'])
+				{
+					allMsg['data'] 				= data['data'];
+					allMsg['num_msgs']			= data['num_msgs'];
+					
+				}
+			}
 
             if (gears.length > 0)
@@ -412,7 +413,9 @@
             }
         	
+			var currentSearch = document.getElementsByName(currentTab)[0].value;
+			
         	delete_border( border_id, false );
 			
-			EsearchE.mount_result( allMsg , sort_type ); 
+			EsearchE.mount_result( allMsg , sort_type, null, null, null, currentSearch ); 
 		};
 
@@ -648,5 +651,5 @@
 
 	// Form resultado
-	searchE.prototype.mount_result = function( Data, sort_type, keep_border, keep_filled, division )
+	searchE.prototype.mount_result = function( Data, sort_type, keep_border, keep_filled, division, actualSearch )
 	{
 		var data = ( Data['data'] ) ? Data['data'] : Data['data_gears'];
@@ -674,8 +677,13 @@
 			}
 			if( Data['data'] )
-				var border_id = create_border(get_lang("Server Results"), "search_" + numBox);
-
+				if(!actualSearch)
+					var border_id = create_border(get_lang("Server Results"), "search_" + numBox);
+				else
+					var border_id = create_border(get_lang("Server Results"), "search_" + numBox, actualSearch);
 			if( Data['data_gears'])
-				var border_id = create_border(get_lang("Local Results"), "search_local_msg" + numBox);
+				if(!actualSearch)
+					var border_id = create_border(get_lang("Local Results"), "search_local_msg" + numBox);
+				else
+					var border_id = create_border(get_lang("Local Results"), "search_local_msg" + numBox, actualSearch);
 		}
 
@@ -966,10 +974,13 @@
 		if( parseInt( Data['gears_num_msgs'] ) > 0 && !keep_filled)
 		{
-			var _div_gears = document.createElement("div");
-				_div_gears.onclick = function(){ EsearchE.viewLocalMessage(); };
-				_div_gears.className = 'local-messages-search-warning';
-				_div_gears.innerHTML = get_lang("The search has% 1 messages stored locally. Want to see them ? Click here.", Data['gears_num_msgs']);
-
-			content_search.appendChild(_div_gears);		
+			var messagesWarning = document.getElementById("local-messages-search-warning_"+border_id);
+				if(!messagesWarning){
+					var _div_gears = document.createElement("div");
+					_div_gears.id = "local-messages-search-warning_"+border_id;
+					_div_gears.onclick = function(){ EsearchE.viewLocalMessage(); };
+					_div_gears.className = 'local-messages-search-warning';
+					_div_gears.innerHTML = get_lang("The search has% 1 messages stored locally. Want to see them ? Click here.", Data['gears_num_msgs']);
+					content_search.appendChild(_div_gears);		
+				}
 		}		
 
@@ -1355,5 +1366,5 @@
 		this.page		= isNaN(page) ? ( value ? 0 : this.page ) : page;
 		this.value		= value || this.value || false;
-		
+				
 		if( !this.value )
 		    return alert( "Busca sem caracteres." );
