Index: /trunk/expressoMail1_2/js/mail_archiver.js
===================================================================
--- /trunk/expressoMail1_2/js/mail_archiver.js	(revision 8112)
+++ /trunk/expressoMail1_2/js/mail_archiver.js	(revision 8118)
@@ -428,17 +428,14 @@
                 var fcaption = "";
 
-                // tratado o caso do id da pasta vir com local_messages_ ou messages_
-                var local_folder_id = destination_folder;
-                if(local_folder_id){
-                    if(local_folder_id.substr(0,5) == 'local'){
-                        local_folder_id = local_folder_id.replace("local_messages_","");
-                    } else if(local_folder_id.substr(0,8) == 'messages'){
-                        local_folder_id = local_folder_id.replace("messages_","");
-                    }
-                }      
+                if(destination_folder.substr(0,5) == 'local'){ 
+                    expresso_mail_archive.folder_destination = destination_folder.replace("local_messages_",""); 
+                } 
+                else{ 
+                    expresso_mail_archive.folder_destination = destination_folder; 
+                } 
 
                 
                 if(!expresso_mail_archive.archivefolder){
-                    expresso_mail_archive.getFolderInfo(local_folder_id);
+                    expresso_mail_archive.getFolderInfo(expresso_mail_archive.folder_destination); 
                     if(typeof(expresso_mail_archive.folder) != "undefined"){
                         //window.alert('folder.path -> ' + expresso_mail_archive.folder.path);
@@ -603,16 +600,5 @@
                 expresso_mail_archive.unarchivecounter = 0;
                 expresso_mail_archive.unarchive_error_counter=0;
-
-                // tratado o caso do id da pasta vir com local_messages_ ou messages_
-                var local_folder_id = folder;      
-                if(local_folder_id){
-                    if(local_folder_id.substr(0,5) == 'local'){
-                        local_folder_id = local_folder_id.replace("local_messages_","");
-                    } else if(local_folder_id.substr(0,8) == 'messages'){
-                        local_folder_id = local_folder_id.replace("messages_","");
-                    }
-                } 
-
-                expresso_mail_archive.getFolderInfo(local_folder_id);
+                expresso_mail_archive.getFolderInfo(folder.replace("local_messages_","")); 
                 expresso_mail_archive.unarchievefolder = expresso_mail_archive.folder.name;
                 (new_folder != null)?expresso_mail_archive.unarchievenewfolder = new_folder:expresso_mail_archive.unarchievenewfolder='INBOX';
@@ -807,16 +793,5 @@
                 expresso_mail_archive.unarchivecounter = 0;
                 expresso_mail_archive.unarchive_error_counter=0;
-
-                // tratado o caso do id da pasta vir com local_messages_ ou messages_
-                var local_folder_id = folder;      
-                if(local_folder_id){
-                    if(local_folder_id.substr(0,5) == 'local'){
-                        local_folder_id = local_folder_id.replace("local_messages_","");
-                    } else if(local_folder_id.substr(0,8) == 'messages'){
-                        local_folder_id = local_folder_id.replace("messages_","");
-                    }
-                } 
-
-                expresso_mail_archive.getFolderInfo(local_folder_id);
+                expresso_mail_archive.getFolderInfo(folder.replace("local_messages_","")); 
                 expresso_mail_archive.unarchievefolder = expresso_mail_archive.folder.name;
                 (new_folder != null)?expresso_mail_archive.unarchievenewfolder = new_folder:expresso_mail_archive.unarchievenewfolder='INBOX';
@@ -1073,15 +1048,7 @@
     expresso_mail_archive.message_list = new Array();
 
-    // tratado o caso do id da pasta vir com local_messages_ ou messages_
-    var local_folder_id = folder;      
-    if(local_folder_id){
-        if(local_folder_id.substr(0,5) == 'local'){
-            local_folder_id = local_folder_id.replace("local_messages_","");
-        } else if(local_folder_id.substr(0,8) == 'messages'){
-            local_folder_id = local_folder_id.replace("messages_","");
-        }
-    } 
-
-    expresso_mail_archive.listMessages(local_folder_id);
+    expresso_mail_archive.currentfolder = folder.replace("local_messages_",""); 
+
+    expresso_mail_archive.listMessages(expresso_mail_archive.currentfolder); 
 
     // This is necessary 'couse we can get a delete operation while an unarchive operation
@@ -1191,27 +1158,7 @@
         expresso_mail_archive.message_list = new Array();  
 
-        // tratado o caso do id da pasta vir com local_messages_ ou messages_
-        var local_folder_id = expresso_mail_archive.currentfolder;      
-        if(local_folder_id){
-            if(local_folder_id.substr(0,5) == 'local'){
-                local_folder_id = local_folder_id.replace("local_messages_","");
-            } else if(local_folder_id.substr(0,8) == 'messages'){
-                local_folder_id = local_folder_id.replace("messages_","");
-            }
-        } 
-
-        // tratado o caso do id da pasta vir com local_messages_ ou messages_
-        var local_folder_id_destination = expresso_mail_archive.folder_destination;
-        if(local_folder_id_destination){
-            if(local_folder_id_destination.substr(0,5) == 'local'){
-                local_folder_id_destination = local_folder_id_destination.replace("local_messages_","");
-            } else if(local_folder_id_destination.substr(0,8) == 'messages'){
-                local_folder_id_destination = local_folder_id_destination.replace("messages_","");
-            }
-        }
-
-        expresso_mail_archive.getFolderInfo(local_folder_id);
-        expresso_mail_archive.getFolderInfo(local_folder_id_destination);
-        expresso_mail_archive.listMessages(local_folder_id); 
+        expresso_mail_archive.getFolderInfo(expresso_mail_archive.currentfolder); 
+        expresso_mail_archive.getFolderInfo(expresso_mail_archive.folder_destination); 
+        expresso_mail_archive.listMessages(expresso_mail_archive.currentfolder);  
               
         expresso_mail_archive.resetObject();
@@ -1548,18 +1495,7 @@
 
 MailArchiver.prototype.deleteAllMessages = function(folderId){
-    try{
-
-        // tratado o caso do id da pasta vir com local_messages_ ou messages_
-        var local_folder_id = folderid;
-        if(local_folder_id){
-            if(local_folder_id.substr(0,5) == 'local'){
-                local_folder_id = local_folder_id.replace("local_messages_","");
-            } else if(local_folder_id.substr(0,8) == 'messages'){
-                local_folder_id = local_folder_id.replace("messages_","");
-            }
-        }
-        
+    try{    
         var objfolder = new Object();
-        objfolder.folder = local_folder_id;
+        objfolder.folder = folderId; 
 
         var query_data = expresso_mail_archive.queryconfig.query(objfolder);
@@ -1599,22 +1535,12 @@
             folderid = this.currentfolder;    
         }
-
-        // tratado o caso do id da pasta vir com local_messages_ ou messages_
-        var local_folder_id = folderid;
-        if(local_folder_id){
-            if(local_folder_id.substr(0,5) == 'local'){
-                local_folder_id = local_folder_id.replace("local_messages_","");
-            } else if(local_folder_id.substr(0,8) == 'messages'){
-                local_folder_id = local_folder_id.replace("messages_","");
-            }
-        }
         
         var objfolder = new Object();
-        objfolder.folder = local_folder_id;
+        objfolder.folder = folderid; 
         //var testing_data_xml = '<?xml version="1.0" encoding="UTF-8"?><query lowerIndex="0" upperIndex="50"><folder id="'+folderid+'"/><order asc="date"/><order desc="subject"/></query>';
         //var testing_data_json_mapped = '{"query":{"@lowerIndex":"0", "@upperIndex":"50", "folder":[{"@id":"'+folderid+'"}], "order":[{"@asc":"date", "@desc":"subject"}]}}';
         var query_data = expresso_mail_archive.queryconfig.query(objfolder);
 
-        expresso_mail_archive.getFolderInfo(local_folder_id);
+        expresso_mail_archive.getFolderInfo(folderid); 
         expresso_mail_archive.currentfolder = folderid;
         
Index: /trunk/expressoMail1_2/js/messages_controller.js
===================================================================
--- /trunk/expressoMail1_2/js/messages_controller.js	(revision 8112)
+++ /trunk/expressoMail1_2/js/messages_controller.js	(revision 8118)
@@ -12,14 +12,5 @@
         if(this.is_local_folder(folder)) {
             //MAILARCHIVER-01
-            // tratado o caso do id da pasta vir com local_messages_ ou messages_
-            var baseFolder = folder;
-            if(baseFolder){
-                if(baseFolder.substr(0,5) == 'local'){
-                    baseFolder = baseFolder.replace("local_messages_","");
-                } else if(baseFolder.substr(0,8) == 'messages'){
-                    baseFolder = baseFolder.replace("messages_","");
-                }  
-            }   
-
+            var baseFolder = folder.replace('local_messages_', ''); 
             var tree_name;
             var drawinginfo = {};
