Index: trunk/prototype/modules/mail/js/foldertree.js
===================================================================
--- trunk/prototype/modules/mail/js/foldertree.js	(revision 7612)
+++ trunk/prototype/modules/mail/js/foldertree.js	(revision 7635)
@@ -87,6 +87,32 @@
 }
 
-function draw_new_tree_folder(callback){
-    var folders = DataLayer.get("folder", true);    
+function normalizeFolder( folders ){
+
+    if(folders  == "")
+        return folders;
+
+    if( !$.isArray( folders  )){
+        var array = [];
+
+        for(var i in folders){
+
+            if(i.indexOf('(javascript)') < 0)
+                array[array.length] = folders[i];
+        }
+
+        folders = array;
+
+    }
+
+    return folders;
+
+}
+
+function draw_new_tree_folder(callback, force){
+
+    if(force)
+        DataLayer.remove('folder', false);
+
+    var folders =  normalizeFolder( DataLayer.get('folder') );
 
 if(preferences.use_local_messages == 1){
@@ -283,10 +309,10 @@
             if(folder_to_move == "tbody_box"){
                 move_msgs2(get_current_folder(), 'selected', 0, folder_to, to_folder_title,true);
-                return refresh();
+                return;
             }
             //SE FOR DE UMA PESQUISA RAPIDA
             else if(ui.draggable.parents('[id^="content_id_"]')[0]){
                 move_search_msgs("content_id_"+border_id, folder_to, to_folder_title);
-                return refresh();
+                return;
             }
             // eventnsagens : SE O DROP VIER DE UMA ABA ABERTA
@@ -296,5 +322,5 @@
                 alternate_border(border_id);
                 move_msgs2(folder, id_msg, border_id, folder_to, to_folder_title,true);
-                return refresh();
+                return;
             }
             // SE O DROP VIER DA LISTA DE PASTAS
@@ -496,5 +522,5 @@
                                         }
                                         write_msg(get_lang("The folder %1 was successfully removed", folder_name));
-                                        cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu);
+                                        cExecute("$this.imap_functions.get_folders_list&onload=true", force_update_menu);
                                     }
                                 });
@@ -511,6 +537,6 @@
                     } */
                 })
-                //FUNÃÃO DO eventNU FLUTUANTE EXCLUIR < END
-                //FUNÃÃO DO eventNU FLUTUANTE NOVA PASTA < BEGIN
+                //FUNÇÃO DO eventNU FLUTUANTE EXCLUIR < END
+                //FUNÇÃO DO eventNU FLUTUANTE NOVA PASTA < BEGIN
                 .end().find(".float-menu-new").click(function(){
                     $(this).parents(".float-menu").hide();
@@ -661,5 +687,5 @@
                     write_msg(get_lang('You must wait while the messages will be exported...'),true);        
                 });
-                //FUNÃÃO DO eventNU FLUTUANTE NOVA PASTA < END
+                //FUNÇÃO DO eventNU FLUTUANTE NOVA PASTA < END
             }
             if(!$(".new_folder").length){
Index: trunk/prototype/modules/mail/js/label.js
===================================================================
--- trunk/prototype/modules/mail/js/label.js	(revision 7612)
+++ trunk/prototype/modules/mail/js/label.js	(revision 7635)
@@ -328,4 +328,32 @@
 }
 
+function SortByName(a, b){
+    var aName = a.name.toLowerCase();
+    var bName = b.name.toLowerCase();
+    return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0));
+}
+
+//Reduz a quantidade de requests
+function orderLabel(labels){
+
+    if(labels == "")
+        return labels;
+
+    if(!$.isArray( labels )){
+        var array = [];
+
+        for(var i in labels){
+
+            array[ array.length ] = labels[ i ];
+
+        }
+
+        labels = array;
+
+    }
+
+    return labels.sort(SortByName);
+}
+
 function init_label(data){
 
@@ -333,6 +361,7 @@
 	
 	//TODO Mudar quando API abstrair atualizações no cache
-	DataLayer.remove('label',false);
-	labels = DataLayer.get('label',{criteria:{order: 'name'}});
+	var labels = DataLayer.get('label');
+
+    labels = orderLabel( labels );
 	
 	if(labels){
Index: trunk/prototype/modules/filters/filters.js
===================================================================
--- trunk/prototype/modules/filters/filters.js	(revision 7621)
+++ trunk/prototype/modules/filters/filters.js	(revision 7635)
@@ -21,6 +21,8 @@
  * Verifica se a regra Fora de escritório está ativa
  */
-function outOfficeVerify() { 	
-	DataLayer.remove('filter', false);
+function outOfficeVerify(force) {
+	if(force)
+        DataLayer.remove('filter', false);
+
 	var filters = DataLayer.get("filter");
 	var outoffice_active = false;
Index: trunk/prototype/modules/calendar/js/timezone.js
===================================================================
--- trunk/prototype/modules/calendar/js/timezone.js	(revision 7579)
+++ trunk/prototype/modules/calendar/js/timezone.js	(revision 7635)
@@ -5,5 +5,5 @@
 */
 
-var objTime = DataLayer.dispatch( "timezones", {teste:'123'} );
+var objTime = DataLayer.dispatch( "timezones" );
 
 Timezone = {
Index: trunk/prototype/api/rest.js
===================================================================
--- trunk/prototype/api/rest.js	(revision 6528)
+++ trunk/prototype/api/rest.js	(revision 7635)
@@ -94,13 +94,4 @@
 	    success: function( dt, textStatus, jqXHR ){
 
-		if(REST.isInvalidToken(dt)){
-		    REST.load('', true);
-		    
-		    if(!REST.me)
-			return {error: 'Empty session', title: 'Error in refresh token', description: 'Error in refresh token.'};
-		    
-		    var ref = REST.resquests[this.url];
-		    result =  REST.send(ref.url, ref.type, ref.data, ref.callback, ref.sync, ref.extraOptions)
-		}
 		delete REST.resquests[this.url];
 		
@@ -137,11 +128,4 @@
 	    envelope['dataType'] = type[1];
 
-	if(REST.me)
-	    envelope = $.extend( envelope, {
-		beforeSend: function (xhr){
-		    xhr.setRequestHeader('Authorization', "OAUTH Bearer " + REST.me.token)
-		}
-	    });
-
 	if( extraOptions )
 	    envelope = $.extend( envelope, extraOptions );
@@ -150,8 +134,4 @@
       
 	return( result );
-    },
-    
-    isInvalidToken: function(data){
-	return ((data) && (data.error && data.error == 'invalid_grant') && (data.error_description == 'The access token provided has expired.')) ? true : false
     },
     
@@ -165,7 +145,5 @@
 
     load: function(url, isRefresh){
-	this.me = this.dispatch( (url || '') + "me", (isRefresh ? {
-	    refreshToken: true
-	} : {}), false, true)	
+
     }
     
Index: trunk/expressoMail1_2/templates/default/main.css
===================================================================
--- trunk/expressoMail1_2/templates/default/main.css	(revision 7634)
+++ trunk/expressoMail1_2/templates/default/main.css	(revision 7635)
@@ -350,6 +350,6 @@
 
 .em_div_write_msg{ 
- 	        height: 24px; 
- 	        background: transparent; 
+        height: 0px; 
+        background: transparent; 
  	} 
 
Index: trunk/expressoMail1_2/js/common_functions.js
===================================================================
--- trunk/expressoMail1_2/js/common_functions.js	(revision 7624)
+++ trunk/expressoMail1_2/js/common_functions.js	(revision 7635)
@@ -499,6 +499,6 @@
 
 	msg_div.innerHTML = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tbody><tr><th width="40%"></th><th noWrap class="action_info_th">'+msg+'</th><th width="40%"></th></tr></tbody></table>';
-
-	old_divStatusBar.style.display = 'none';
+	
+	//old_divStatusBar.style.display = 'none';
 	msg_div.style.display = '';
 	// Nao ponha var na frente!! jakjr
Index: trunk/expressoMail1_2/js/main.js
===================================================================
--- trunk/expressoMail1_2/js/main.js	(revision 7628)
+++ trunk/expressoMail1_2/js/main.js	(revision 7635)
@@ -298,11 +298,7 @@
 		
 		if(parseInt(preferences.use_dynamic_contacts)){
-			var load_dynamics = function(){
-				updateDynamicContact();
-				updateDynamicPersonalContacts();
-				updateDynamicPersonalGroups();
-			};
-			load_dynamics();
-		}
+            updateDynamicContact();
+		}
+
 	}
 	var handler_automatic_trash_cleanness = function(data){
@@ -1540,8 +1536,8 @@
                     msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf('_r'));
 	}
-	if (msgs_number) {
-		refresh();
-	}
-	else{
+//	if (msgs_number) {
+//		refresh();
+//	}
+    if (!msgs_number){
 		$("#"+get_current_folder()).find('span:first').addClass('selected');
 	}
@@ -1614,5 +1610,5 @@
 										    get_previous_msg: ( !not_opem_previus ? preferences.delete_and_show_previous_message : false ),
 										    decoded: true } ),
-
+						async: true,
 						success: function( data ){
 						    data = connector.unserialize( data );
@@ -5280,5 +5276,5 @@
 				return write_msg(get_lang("Permission denied"));
 			}
-			cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu);
+			cExecute("$this.imap_functions.get_folders_list&onload=true", force_update_menu);
 		},
 		beforeSend: function( jqXHR, settings ){
Index: trunk/expressoMail1_2/js/search.js
===================================================================
--- trunk/expressoMail1_2/js/search.js	(revision 7561)
+++ trunk/expressoMail1_2/js/search.js	(revision 7635)
@@ -1886,5 +1886,6 @@
 			handler('none');
 		else
-			cExecute( "$this.imap_functions.search_msg", handler_refresh, "condition="+openTab.condition[currentTab]+"&page="+EsearchE.page+"&sort_type="+sort_type);
+            if(openTab.condition[currentTab] != '')
+			    cExecute( "$this.imap_functions.search_msg", handler_refresh, "condition="+openTab.condition[currentTab]+"&page="+EsearchE.page+"&sort_type="+sort_type);
 	}
 
Index: trunk/expressoMail1_2/js/draw_api.js
===================================================================
--- trunk/expressoMail1_2/js/draw_api.js	(revision 7615)
+++ trunk/expressoMail1_2/js/draw_api.js	(revision 7635)
@@ -476,6 +476,9 @@
 
 function draw_tree_labels(){
-	labels = DataLayer.get('label',{criteria:{order: 'name'}});
-	if(!$("#MyMarckersList").length)
+    labels = DataLayer.get('label');
+
+    labels = orderLabel( labels );
+
+    if(!$("#MyMarckersList").length)
 		var myLabels = $('#content_folders').append("<div id='MyMarckersList' class='acc-list list-label' ></div>").find("#MyMarckersList");
 	else
@@ -589,5 +592,10 @@
 }
 
-function update_menu(data){
+function force_update_menu(data){
+    update_menu(data, true)
+}
+
+
+function update_menu(data, forceLoadFolders){
 		/*
 		 * @AUTHOR Rodrigo Souza dos Santos
@@ -637,5 +645,5 @@
 			folders = data;
 		}
-		draw_new_tree_folder();	
+		draw_new_tree_folder(false, forceLoadFolders);
 		draw_tree_labels();
 		if(Element("table_quota"))
@@ -4517,5 +4525,5 @@
 	if(parseInt(preferences.use_dynamic_contacts)){
 
-        REST.get("/usercontacts", false, updateDynamicContact);
+        //REST.get("/usercontacts", false, updateDynamicContact);
 
 		//PREPARAÇÃO DA ARRAY DOS CONTATOS DINÂMICOS
Index: trunk/expressoMail1_2/js/doiMenuData.js
===================================================================
--- trunk/expressoMail1_2/js/doiMenuData.js	(revision 7544)
+++ trunk/expressoMail1_2/js/doiMenuData.js	(revision 7635)
@@ -86,5 +86,8 @@
      */
     function getLabels(){
-    	var labels = DataLayer.get('label',{criteria:{order: 'name'}});
+        var labels = DataLayer.get('label');
+
+        labels = orderLabel( labels );
+
     	var menuLabelItems = {};
     		menuLabelItems["new"] = {
