Index: /branches/2.2/expressoMail1_2/js/search.js
===================================================================
--- /branches/2.2/expressoMail1_2/js/search.js	(revision 3659)
+++ /branches/2.2/expressoMail1_2/js/search.js	(revision 3682)
@@ -225,4 +225,5 @@
 		return data2 - data1;
 	}
+	
 	function date_comp_reverse(a,b)
 	{
@@ -232,16 +233,20 @@
 	function box_comp(a,b)
 	{
-	var compare = [];
-	compare[0] = a.substr(0, a.indexOf('--'));
-	compare[0] = compare[0].toLowerCase();
-	var temp=compare[0];
-	compare[1] = b.substr(0, b.indexOf('--'))
-	compare[1] = compare[1].toLowerCase();
-	compare.sort();
-	if (temp != compare[0])
-		return +1;
-	else
-		return -1;
-	}
+		var compare = [];
+			compare[0] = a.substr(0, a.indexOf('--'));
+			compare[0] = compare[0].toLowerCase();
+		
+		var temp=compare[0];
+			compare[1] = b.substr(0, b.indexOf('--'))
+			compare[1] = compare[1].toLowerCase();
+		
+		compare.sort();
+		
+		if (temp != compare[0])
+			return +1;
+		else
+			return -1;
+	}
+	
 	function box_comp_reverse(a,b)
 	{
@@ -251,16 +256,22 @@
 	function who_comp(a,b)
 	{
-	var compare = [];
-	compare[0] = a.substr(a.indexOf('--')+2);
-	compare[0] = compare[0].toLowerCase();
-	var temp=compare[0];
-	compare[1] = b.substr(b.indexOf('--')+2);
-	compare[1] = compare[1].toLowerCase();
-	compare.sort();
-	if (temp != compare[0])
-		return +1;
-	else
-		return -1;
-	}
+		var compare = [];
+			compare[0] = a.substr(a.indexOf('--')+2);
+			compare[0] = compare[0].substr(compare[0].indexOf('--')+2);
+			compare[0] = compare[0].toLowerCase();
+		
+		var temp = compare[0];
+			compare[1] = b.substr(b.indexOf('--')+2);
+			compare[1] = compare[1].substr(compare[1].indexOf('--')+2);
+			compare[1] = compare[1].toLowerCase();
+		
+		compare.sort();
+		
+		if (temp != compare[0])
+			return +1;
+		else
+			return -1;
+	}
+	
 	function who_comp_reverse(a,b)
 	{
@@ -270,18 +281,23 @@
 	function subject_comp(a,b)
 	{
-	var compare = [];
-	compare[0] = a.substr(a.indexOf('--')+2);
-	compare[0] = compare[0].substr(compare[0].indexOf('--')+2);
-	compare[0] = compare[0].toLowerCase();
-	var temp=compare[0];
-	compare[1] = b.substr(b.indexOf('--')+2);
-	compare[1] = compare[1].substr(compare[1].indexOf('--')+2);
-	compare[1] = compare[1].toLowerCase();
-	compare.sort();
-	if (temp != compare[0])
-		return +1;
-	else
-		return -1;
-	}
+		var compare = [];
+			compare[0] = a.substr(a.indexOf('--')+2);
+			compare[0] = compare[0].substr(compare[0].indexOf('--')+2);
+			compare[0] = compare[0].substr(compare[0].indexOf('--')+2);
+			compare[0] = compare[0].toLowerCase();
+		var temp=compare[0];
+			compare[1] = b.substr(b.indexOf('--')+2);
+			compare[1] = compare[1].substr(compare[1].indexOf('--')+2);
+			compare[1] = compare[1].substr(compare[1].indexOf('--')+2);
+			compare[1] = compare[1].toLowerCase();
+		
+		compare.sort();
+		
+		if (temp != compare[0])
+			return +1;
+		else
+			return -1;
+	}
+	
 	function subject_comp_reverse(a,b)
 	{
@@ -292,7 +308,8 @@
 	{
 		var data1 = a.match(/\d{2}\/\d{2}\/\d{4}--\d+? \w*b--.*--\d*$/g);
-		data1 = data1[0].substr(data1[0].indexOf('--')+2)
-		data1 = data1.substr(0,data1.indexOf('--'))
+			data1 = data1[0].substr(data1[0].indexOf('--')+2)
+			data1 = data1.substr(0,data1.indexOf('--'))
 		var size_a = parseInt(data1.substr(0,data1.indexOf(' ')));
+		
 		if (data1.match("k"))
 			size_a = size_a * 1024;
@@ -300,8 +317,10 @@
 			if (data1.match("m"))
 				size_a = size_a * 1048576;
+		
 		var data2 = b.match(/\d{2}\/\d{2}\/\d{4}--\d+? \w*b--.*--\d*$/g);
-		data2 = data2[0].substr(data2[0].indexOf('--')+2)
-		data2 = data2.substr(0,data2.indexOf('--'))
+			data2 = data2[0].substr(data2[0].indexOf('--')+2)
+			data2 = data2.substr(0,data2.indexOf('--'))
 		var size_b = parseInt(data2.substr(0,data2.indexOf(' ')));
+		
 		if (data2.match("k"))
 			size_b = size_b * 1024;
@@ -311,4 +330,5 @@
 		return size_b - size_a;
 	}
+	
 	function size_comp_reverse(a,b)
 	{
@@ -317,9 +337,12 @@
 
 	// Form resultado
-	searchE.prototype.mount_result = function(data,sort_type){
+	searchE.prototype.mount_result = function( data, sort_type)
+	{
 		var nw_array = new Array;
 		var var_tmp = data.substr(2, data.length - 4);
-		var_tmp  = var_tmp.split("####");
+			var_tmp  = var_tmp.split("####");
+				
 		var cont = parseInt(0);
+		
 		switch (sort_type)
 		{
@@ -334,6 +357,6 @@
 				break;
 			case 'SORTBOX_REVERSE':
-                                var_tmp.sort(box_comp_reverse);
-                                break;
+				var_tmp.sort(box_comp_reverse);
+                break;
 			case 'SORTSUBJECT':
 				var_tmp.sort(subject_comp);
@@ -346,5 +369,5 @@
 				break;
 			case 'SORTWHO_REVERSE':
-                                var_tmp.sort(who_comp_reverse);
+				var_tmp.sort(who_comp_reverse);
 				break;
 			case 'SORTSIZE':
@@ -358,5 +381,6 @@
 		}
 
-		for(var i=0; i < var_tmp.length; i++){
+		for(var i=0; i < var_tmp.length; i++)
+		{
 			if(var_tmp[i] != "")
 			{
@@ -366,21 +390,26 @@
 		}
 
-                if( (preferences.search_result_number != '65536') && (nw_array.length > 0) && (nw_array.length >= preferences.search_result_number) ){
-                    nw_array.length = preferences.search_result_number;
-                    write_msg(get_lang("More than %1 results. Please, try to refine your search.",preferences.search_result_number));
-                }
-                else {
-                        write_msg(nw_array.length + " "+ get_lang('results found'));
-                }
+        if( ( preferences.search_result_number != '65536') && (nw_array.length > 0) && (nw_array.length >= preferences.search_result_number) )
+        {
+            nw_array.length = preferences.search_result_number;
+            write_msg(get_lang("More than %1 results. Please, try to refine your search.",preferences.search_result_number));
+        }
+        else
+        {
+                write_msg(nw_array.length + " "+ get_lang('results found'));
+        }
 
 		numBox++;
+		
 		var border_id = create_border(get_lang("Search Results"), "search_" + numBox);
-                if (!border_id)
-                {
-                    return;
-                }
-		currentTab = border_id;
-                openTab.content_id[currentTab] = Element('content_id_search_' + numBox);
-                openTab.type[currentTab] = 1;
+        
+		if (!border_id)
+        {
+            return;
+        }
+
+        currentTab = border_id;
+        openTab.content_id[currentTab] = Element('content_id_search_' + numBox);
+        openTab.type[currentTab] = 1;
 		var table = document.createElement("TABLE");
 		table.id    = "table_resultsearch_" + numBox;
@@ -391,18 +420,21 @@
 		table.className = "table_box";
 
-		var tbody = document.createElement("TBODY");
-		tbody.id    = "tbody_box_" + numBox;
-
-		for( var i=0; i < nw_array.length; i++){
+		var tbody		= document.createElement("TBODY");
+			tbody.id	= "tbody_box_" + numBox;
+
+		for( var i = 0; i < nw_array.length; i++)
+		{
 			var tr = document.createElement("TR");
-			tr.style.height = preferences.line_height;
+				tr.style.height = preferences.line_height;
 
 			if (false && nw_array[i].match(/.*--.*--\w*--\d{2}\/\d{2}\/\d{4}--\d+? \w*b--.*--\d*$/g) != null) //subject with "--"
 			{
 				var aux1 = nw_array[i].match(/\d{2}\/\d{2}\/\d{4}--\d+? \w*b--.*--\d*$/g);
-				aux1 = aux1[0].split("--");
+					aux1 = aux1[0].split("--");
 				nw_array[i] = nw_array[i].substr(0, nw_array[i].indexOf(aux1[0])-2);
-				var aux = [];
-				aux[0] = nw_array[i].substr(0, nw_array[i].indexOf('--'));
+				
+				var aux 	= [];
+				
+				aux[0]	= nw_array[i].substr(0, nw_array[i].indexOf('--'));
 				nw_array[i] = nw_array[i].substr(nw_array[i].indexOf('--')+2);
 				aux[3] = nw_array[i].substr(0, nw_array[i].indexOf('--'));
@@ -494,21 +526,28 @@
 					td.style.color = "#42795b";
 					td.style.fontWeight = "bold";
-					if(proxy_mensagens.is_local_folder(td1)) {
+					if(proxy_mensagens.is_local_folder(td1))
+					{
 						var td1 = this.aux_local_folder_display(td1);
 						aux[2] = tr.name = aux[0]; // precisa trocar pelo nome real no banco do gears.
-					} else {
-						if(td1 == "INBOX"){
+					}
+					else
+					{
+						if(td1 == "INBOX")
+						{
 							var td1  = get_lang("Inbox");
 						}
 						else if (nm_box[0] == 'user')
+						{
 							if (nm_box.length > 1)
 								var td1 = nm_box[1] + '/' + lang_folder(td1);
 							else
 								var td1 = td1;
+						}
 						else
 							var td1 = lang_folder(td1);
 					}
 
-					if(proxy_mensagens.is_local_folder(td1)) {
+					if( proxy_mensagens.is_local_folder(td1))
+					{
 						var td1 = this.aux_local_folder_display(td1);
 					}
