Index: sandbox/expresso-solr/expressoMail1_2/js/search.js
===================================================================
--- sandbox/expresso-solr/expressoMail1_2/js/search.js	(revision 7561)
+++ sandbox/expresso-solr/expressoMail1_2/js/search.js	(revision 8056)
@@ -68,5 +68,6 @@
 				"Search_the_messages_in_these_folders" : get_lang('Search the messages in these folders'),
 				"In_all_the_folders"		: get_lang('In all the folders'),
-				"From_value" : (data != "undefined" ? data : "")
+				"From_value" : (data != "undefined" ? data : ""),
+				"Folders" : $.merge(cp_tree1,cp_tree2), 
 			}
 				
@@ -76,9 +77,9 @@
 			this.modal = $(div).dialog(
 			{
-				resizable	: false,
+				resizable	: true,
 				title		: get_lang("Search Email"),
 				position	: 'center',
-				width		: 795,
 				height		: 450,
+				width		: 400,
 				modal		: true,
 				buttons		: [
@@ -107,6 +108,6 @@
 				beforeClose	: function()
 				{ 
-					$("#sel_search_nm_box1")[0].parentNode.removeChild($("#sel_search_nm_box1")[0]);
-					$("#divFoldersSearch")[0].parentNode.removeChild($("#divFoldersSearch")[0]);
+					//$("#sel_search_nm_box1")[0].parentNode.removeChild($("#sel_search_nm_box1")[0]);
+					//$("#divFoldersSearch")[0].parentNode.removeChild($("#divFoldersSearch")[0]);
 					//$(this).dialog("destroy");
 					$('fieldset', div).remove();
@@ -130,6 +131,18 @@
 	
 			// Cria as caixas postais;
-			this.foldersTree();
-			
+			//this.foldersTree();
+
+			$(".search-all-folders").change(function(){
+				$(".pickList").toggle("slow");
+			});
+
+			$("#flagged").pickList({
+		        sourceListLabel:    "Itens disponíveis",
+		        targetListLabel:    "Itens selecionados"
+		    });
+
+			//$(".pickList_controlsContainer button").button().addClass("small");
+
+		    $(".pickList").hide();
 			var dates = $("#since_date, #before_date").datepicker({
 				onSelect: function( selectedDate ) {
@@ -1448,5 +1461,5 @@
 
         }
-
+        /*
         if(trim(Element("flagged").options[Element("flagged").selectedIndex].value) != "")
         {
@@ -1494,5 +1507,5 @@
             }
         }
-
+		*/
 		if(fields == "##")
 		{
@@ -1520,56 +1533,11 @@
 		{
 			var nm_box = new Array;
-			var sel_combo = Element("sel_search_nm_box1");
-			
-			if( sel_combo.options.length <= 0)
-			{
+			var folders_select = $("#flagged").find("option:checked");
+			if(folders_select.length == 0){
 				alert(get_lang("Define the boxes to search!"));
 				return false;
-			}
-
-			for(var i=0; i < sel_combo.options.length; i++)
-			{
-				sel_combo.options[i].selected = true;
-			}
-			
-			var get_children = function(folder, arr_folder){
-				for(var y = 0; y < folder.children.length; y++){
-					if(folder.children[y]){
-						arr_folder[arr_folder.length] = folder.children[y].id;
-						if (folder.children[y].children.length > 0)
-							arr_folder = get_children(folder.children[y], arr_folder);
-						
-					}
-				}
-				return arr_folder;
-			}
-			
-			for( var i=0; i < sel_combo.options.length; i++ )
-			{
-				if( sel_combo.options[i].selected == true )
-				{
-					var arr_folders = new Array();
-					if(!proxy_mensagens.is_local_folder(sel_combo.options[i].value)){
-						nm_box[nm_box.length] = sel_combo.options[i].value + fields;
-						
-						for (x in cp_tree1){
-							if(cp_tree1[x].id == sel_combo.options[i].value){
-								arr_folders = get_children(cp_tree1[x], arr_folders);
-								for (index in arr_folders){
-									nm_box[nm_box.length] = arr_folders[index] + fields;
-								}
-							}
-						}
-						for (x in cp_tree2){
-							if(cp_tree2[x].id == sel_combo.options[i].value){
-								arr_folders = get_children(cp_tree2[x], arr_folders);
-								for (index in arr_folders){
-									nm_box[nm_box.length] = arr_folders[index] + fields;
-								}
-							}
-						}
-						
-					}else
-						local_folders.push(sel_combo.options[i].value.substr(6));
+			}else{
+				for(var i=0; i < folders_select.length; i++){
+					nm_box[nm_box.length] = $(folders_select[i]).val() + fields;
 				}
 			}
@@ -1578,4 +1546,5 @@
         var handler = function( data )
         {
+        	data = jQuery.parseJSON(data.substr(0, data.length-2));
         	var allMsg 	= [3];
 			var count  	= ( data['num_msgs'] ) ?  data['num_msgs'] : "0";
@@ -1892,2 +1861,7 @@
 var EsearchE = new searchE();
 var EsearchE = new searchE();
+
+// Configuração da tela da Ajuda
+function info(){
+	alert("Preencha os Campos para realizar o filtro, o campo das pastas caso não seja alterado realizará a pesquisa em todas as pastas.");
+}
