Index: branches/2.5/expressoMail1_2/assetic.php
===================================================================
--- branches/2.5/expressoMail1_2/assetic.php	(revision 7777)
+++ branches/2.5/expressoMail1_2/assetic.php	(revision 7919)
@@ -47,7 +47,5 @@
         new FileAsset('../prototype/plugins/watermark/jquery.watermarkinput.js'),
         new FileAsset('../prototype/plugins/fileupload/jquery.iframe-transport.js'),
-        new FileAsset('../prototype/plugins/qtip/jquery.qtip-1.0.0-rc3.min.js'),     
-        new FileAsset('../prototype/plugins/dateFormat/dateFormat.js'),
-        new FileAsset('../prototype/modules/calendar/js/calendar.date.js'),
+        new FileAsset('../prototype/plugins/qtip/jquery.qtip-1.0.0-rc3.min.js'), 
         new FileAsset('../prototype/plugins/treeview/jquery.treeview.js'),
         new FileAsset('../prototype/plugins/treeview/lib/jquery.cookie.js'),    
Index: branches/2.5/expressoMail1_2/index.php
===================================================================
--- branches/2.5/expressoMail1_2/index.php	(revision 7864)
+++ branches/2.5/expressoMail1_2/index.php	(revision 7919)
@@ -251,4 +251,6 @@
     }
 
+    echo '<script type="text/javascript"> var preferences  = '.json_encode($_SESSION['phpgw_info']['user']['preferences']['expressoMail']).'</script>'; 
+ 
     echo '
 	<script> var special_folders = new Array(4);
@@ -361,4 +363,6 @@
 	    '<script src="../prototype/plugins/datejs/date-pt-BR.js" language="javascript" ></script>
 		<script src="../prototype/modules/calendar/js/timezone.js" language="javascript" ></script>
+                <script src="../prototype/plugins/dateFormat/dateFormat.js" language="javascript" ></script> 
+                <script src="../prototype/modules/calendar/js/calendar.date.js" language="javascript" ></script> 
 		<script src="../prototype/modules/calendar/js/calendar.codecs.js" language="javascript" ></script>
 		<script src="../prototype/modules/calendar/js/calendar.alarms.js" language="javascript" ></script>
Index: branches/2.5/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- branches/2.5/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 7863)
+++ branches/2.5/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 7919)
@@ -5503,9 +5503,9 @@
 					$headers = imap_fetch_overview($this->mbox, $m, FT_UID);
 
-					$date = explode(" ", $headers[0]->date); 
+					$date = explode(" ", $headers[0]->date);
 					$result[$m."_".$folder] = array (
 						'udate'      => $headers[0]->udate,
-						'from'       => $headers[0]->from,
-						'subject'    =>	self::decodeMimeString($headers[0]->subject),
+						'from'       => $this->decodeMimeString($headers[0]->from),
+						'subject'    =>	$this->decodeMimeString($headers[0]->subject),
 						'msg_number' => $m,
 						'msg_folder' => $folder
Index: branches/2.5/expressoMail1_2/js/main.js
===================================================================
--- branches/2.5/expressoMail1_2/js/main.js	(revision 7777)
+++ branches/2.5/expressoMail1_2/js/main.js	(revision 7919)
@@ -1,4 +1,4 @@
 // Tempo do auto refresh (em milisegundos)
-var time_refresh = 300000;
+var time_refresh = 150000;
 
 //MAILARCHIVER-01
@@ -151,163 +151,138 @@
     }
 
-	var save_preferences = function(data){
-
-
-		preferences = data;
-                
 		
- 	                if(preferences.show_name_print_messages == "1") { 
-				var getUserName = document.getElementById("user_info"); 
- 	                        var userName = getUserName.innerHTML; 
- 	                        var position = userName.indexOf("-"); 
- 	                        var userName = userName.substring(3, position); 
- 	                        cabecalho = '<h4>' + userName; 
- 	                }
-		
-		
-		current_folder="INBOX";
-		
-		/*if( (window.google && google.gears) && !google.gears.factory.getPermission())
-		    preferences.use_local_messages=0;
-                
-		if ((preferences.use_local_messages==1) && (!window.google || !google.gears)) {
-		    temp = confirm(get_lang("To use local messages you have to install google gears. Would you like to be redirected to gears installation page?"));
-		    if (temp) {
-			    location.href = "http://gears.google.com/?action=install&message="+
-			    "Para utilizar o recurso de mensagens locais, instale o google gears&return=" + document.location.href;
-		    }
-		    else {
-			    preferences.use_local_messages=0;
-		    }
-		}
-		if (preferences.use_local_messages==1) { //O I.E 7 estava se atrapalhando caso esses loads fossem feitos após as chamadas ajax. Antes não apresentou problemas...
-			connector.loadScript('mail_sync');
-			setTimeout('auto_archiving()', 30000);
-			
-		}*/
-
-        //MAILARCHIVER-02
-        //Try to get ArchiveServices object directly
-        if(ArchiveServices)
-            expresso_mail_archive.Startup();
-        //ArchiveServices not runnnig: catch the user preferences to set up message at header
-        else{
-            if(preferences.use_local_messages=="1")
-                write_msg(get_lang('Sorry, but Mail Archiver does not seems to be running or installed at this workstation. By now, we are turning off local messages!'));
+    if(preferences.show_name_print_messages == "1") { 
+        var getUserName = document.getElementById("user_info"); 
+        var userName = getUserName.innerHTML; 
+        var position = userName.indexOf("-"); 
+        var userName = userName.substring(3, position); 
+        cabecalho = '<h4>' + userName; 
+    } 
+ 
+        current_folder="INBOX"; 
+ 
+    //MAILARCHIVER-02 
+    //Try to get ArchiveServices object directly 
+    if(ArchiveServices) 
+        expresso_mail_archive.Startup(); 
+    //ArchiveServices not runnnig: catch the user preferences to set up message at header 
+    else{ 
+        if(preferences.use_local_messages=="1") 
+            write_msg(get_lang('Sorry, but Mail Archiver does not seems to be running or installed at this workstation. By now, we are turning off local messages!')); 
+    } 
+ 
+    //cExecute ("$this.db_functions.get_dropdown_contacts", save_contacts); //Save contacts needs preferences. 
+    $.ajax({ 
+        async: false, 
+        url: "controller.php?" + $.param( {action: "$this.imap_functions.getMessagesIds", 
+            folder: get_current_folder(), 
+             msg_range_begin: "0", 
+             msg_range_end: "0", 
+            sort_box_type: "SORTARRIVAL", 
+            search_box_type: search_box_type, 
+            sort_box_reverse: "1" 
+            }), 
+        success: function(data){ 
+            data = connector.unserialize(data); 
+            if(data){ 
+                var _data = {}; 
+                $.each(data,function(index,value){ 
+                    if (data[index]){ 
+                        _data[data[index]] = data[index]; 
+                    } 
+                }); 
+                populateSelectedMsgs(_data); 
+            } 
+        }, 
+        beforeSend: function( jqXHR, settings ){ 
+            connector.showProgressBar(); 
+        }, 
+        complete: function( jqXHR, settings ){ 
+            connector.hideProgressBar(); 
         }
-
-		//cExecute ("$this.db_functions.get_dropdown_contacts", save_contacts); //Save contacts needs preferences.
-		$.ajax({
-            async: false,
-			url: "controller.php?" + $.param( {action: "$this.imap_functions.getMessagesIds", 
-				folder: get_current_folder(),
-				 msg_range_begin: "0",
-				 msg_range_end: "0", 					
-				sort_box_type: "SORTARRIVAL", 
-				search_box_type: search_box_type,
-				sort_box_reverse: "1"
-				}),
-			success: function(data){
-				data = connector.unserialize(data);
-				if(data){                   
-					var _data = {};
-					$.each(data,function(index,value){
-						if (data[index]){
-							_data[data[index]] = data[index];
-						}
-					});
-					populateSelectedMsgs(_data);
-				}
-			},
-			beforeSend: function( jqXHR, settings ){
-				connector.showProgressBar();
-			},
-			complete: function( jqXHR, settings ){
-				connector.hideProgressBar();
-			}
-    	});
-
-        cExecute ("$this.imap_functions.get_range_msgs2&folder=INBOX&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type=SORTARRIVAL&search_box_type=ALL&sort_box_reverse=1", handler_draw_box);
-
-		if(preferences.hide_folders == "1")
-			Element('divAppboxHeader').innerHTML =  title_app_menu;
-
-        //Desbilitado limpeza de lixeira por request. Ticket #3253
-		//if (preferences.delete_trash_messages_after_n_days != 0)
-	    ///	cExecute ("$this.imap_functions.automatic_trash_cleanness&before_date="+preferences.delete_trash_messages_after_n_days+"&cyrus_delimiter="+cyrus_delimiter, handler_automatic_trash_cleanness);
-		
-		//if(preferences.outoffice == "1")
-		//	
-
-		//Troca da forma de construção de menu para o plugin jquery.contextMenu
-		//ConstructMenuTools();
-		//MAILARCHIVER-00
-		//if ( (preferences.use_local_messages==1) && (expresso_local_messages.is_offline_installed()) )  //Precisa ser feito após a renderização da caixa de emails
-			//check_mail_in_queue();
-		
-		// Insere a applet de criptografia
-		if (preferences.use_signature_digital_cripto == '1'){
-			loadApplet();
-		}
-		// Fim da inserção da applet
-		cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu);	
-		
-		if($.cookie('collapse_folders') == "true"){
-			if(!is_ie)
-				$("#folderscol").addClass( "hidden");
-			else
-				$("#folderscol").hide();
-			$(".collapse_folders").addClass("ui-icon ui-icon-triangle-1-e").children().attr('title', "Expandir");
-			refresh();
-			resizeWindow();
-		}	
-		else{
-			$(".collapse_folders").addClass("ui-icon ui-icon-triangle-1-w").children().attr('title', "Ocultar");
-			refresh();
-			resizeWindow();
-		}
-		
-		$(".collapse_folders_td").attr('title', "Ocultar/Expandir").click(function(){
-			if($("#folderscol").css("display") != "none"){
-				if(!is_ie)
-					$("#folderscol").addClass( "hidden");
-				else
-					$("#folderscol").hide();
-					
-				$(".collapse_folders").removeClass("ui-icon-triangle-1-w");
-				$(".collapse_folders").addClass("ui-icon-triangle-1-e");
-				$(".collapse_folders").parent().attr('title', "Expandir");
-				$.cookie('collapse_folders', "true");
-				refresh();
-				resizeWindow();
-			}else{
-				if(!is_ie)
-					$("#folderscol").removeClass( "hidden");
-				else
-					$("#folderscol").show();
-				$(".collapse_folders").removeClass("ui-icon-triangle-1-e");
-				$(".collapse_folders").addClass("ui-icon-triangle-1-w");
-				$(".collapse_folders").parent().attr('title', "Ocultar");
-				$.cookie('collapse_folders', "false");
-				refresh();
-				resizeWindow();
-			}
-			resizeWindow();
-			
-		}).hover(
-			function(){
-				$(this).addClass("collapse_folders_td_over");
-			},
-			function(){
-				$(this).removeClass("collapse_folders_td_over");
-			}
-		);
-		
-		if(parseInt(preferences.use_dynamic_contacts)){
-            updateDynamicContact();
-		}
-
-	}
-	var handler_automatic_trash_cleanness = function(data){
+    }); 
+     cExecute ("$this.imap_functions.get_range_msgs2&folder=INBOX&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type=SORTARRIVAL&search_box_type=ALL&sort_box_reverse=1", handler_draw_box); 
+ 
+    if(preferences.hide_folders == "1") 
+        Element('divAppboxHeader').innerHTML =  title_app_menu; 
+ 
+    //Desbilitado limpeza de lixeira por request. Ticket #3253 
+    //if (preferences.delete_trash_messages_after_n_days != 0) 
+    /// cExecute ("$this.imap_functions.automatic_trash_cleanness&before_date="+preferences.delete_trash_messages_after_n_days+"&cyrus_delimiter="+cyrus_delimiter, handler_automatic_trash_cleanness); 
+ 
+    //if(preferences.outoffice == "1") 
+    // 
+ 
+    //Troca da forma de construção de menu para o plugin jquery.contextMenu 
+    //ConstructMenuTools(); 
+    //MAILARCHIVER-00 
+    //if ( (preferences.use_local_messages==1) && (expresso_local_messages.is_offline_installed()) )  //Precisa ser feito após a renderização da caixa de emails 
+        //check_mail_in_queue(); 
+ 
+    // Insere a applet de criptografia 
+    if (preferences.use_signature_digital_cripto == '1'){ 
+        loadApplet(); 
+    } 
+    // Fim da inserção da applet 
+    cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu); 
+ 
+    if($.cookie('collapse_folders') == "true"){ 
+        if(!is_ie) 
+            $("#folderscol").addClass( "hidden"); 
+        else 
+            $("#folderscol").hide(); 
+        $(".collapse_folders").addClass("ui-icon ui-icon-triangle-1-e").children().attr('title', "Expandir"); 
+        refresh(); 
+        resizeWindow(); 
+    } 
+    else{ 
+        $(".collapse_folders").addClass("ui-icon ui-icon-triangle-1-w").children().attr('title', "Ocultar"); 
+        refresh(); 
+        resizeWindow(); 
+    } 
+ 
+    $(".collapse_folders_td").attr('title', "Ocultar/Expandir").click(function(){ 
+        if($("#folderscol").css("display") != "none"){ 
+            if(!is_ie) 
+                $("#folderscol").addClass( "hidden"); 
+            else 
+                $("#folderscol").hide(); 
+ 
+            $(".collapse_folders").removeClass("ui-icon-triangle-1-w"); 
+            $(".collapse_folders").addClass("ui-icon-triangle-1-e"); 
+            $(".collapse_folders").parent().attr('title', "Expandir"); 
+            $.cookie('collapse_folders', "true"); 
+            refresh(); 
+            resizeWindow(); 
+        }else{ 
+            if(!is_ie) 
+                $("#folderscol").removeClass( "hidden"); 
+            else 
+                $("#folderscol").show(); 
+            $(".collapse_folders").removeClass("ui-icon-triangle-1-e"); 
+            $(".collapse_folders").addClass("ui-icon-triangle-1-w"); 
+            $(".collapse_folders").parent().attr('title', "Ocultar"); 
+            $.cookie('collapse_folders', "false"); 
+            refresh(); 
+            resizeWindow(); 
+        } 
+        resizeWindow(); 
+ 
+    }).hover( 
+        function(){ 
+            $(this).addClass("collapse_folders_td_over"); 
+        }, 
+        function(){ 
+            $(this).removeClass("collapse_folders_td_over"); 
+        } 
+    ); 
+ 
+    if(parseInt(preferences.use_dynamic_contacts)){ 
+        updateDynamicContact(); 
+    } 
+ 
+ 
+    var handler_automatic_trash_cleanness = function(data) 
+    { 
 		if (data != false){
 			write_msg(data.length +' '+ Element('txt_clear_trash').value);
@@ -321,5 +296,4 @@
 	cyrus_delimiter = Element('cyrus_delimiter').value;
 
-	cExecute ("$this.functions.get_preferences", save_preferences);
     cExecute ("phpgwapi.browser.isMobile", function( data ){
 		mobile_device = ( ( data.constructor == Boolean ) ? data : ( data === 'true' ) );
@@ -727,7 +701,10 @@
 		if(differenceOfNewCriteria > 0){
 			for(var i=data.length - differenceOfNewCriteria; i < data.length; i++){
-	
+                var msg_folder = data[i].msg_folder; 
+                var msg_number = data[i].msg_number; 
 				desktopNotification.sentNotification("",get_lang("Filter criteria"),  truncate(new Date(data[i].udate).toString('dd/MM HH:mm') + ' - ' + data[i].from+' - '+data[i].subject, 75));
-				desktopNotification.showNotification(false, function(){
+                                desktopNotification.showNotification(function(){ 
+                    cExecute ("$this.imap_functions.removeFlagMessagesFilter&folder="+msg_folder+"&msg_number="+msg_number, function(){}); 
+                }, function(){ 
 					window.focus();
 					this.cancel();
Index: branches/2.5/expressoMail1_2/js/connector.js
===================================================================
--- branches/2.5/expressoMail1_2/js/connector.js	(revision 7748)
+++ branches/2.5/expressoMail1_2/js/connector.js	(revision 7919)
@@ -451,13 +451,20 @@
 	{
 		var div = document.getElementById('divProgressBar');
-		div.style.visibility = 'hidden';
-		this.isVisibleBar = false;
+ 
+        if(div) 
+        { 
+            div.style.visibility = 'hidden'; 
+            this.isVisibleBar = false; 
+        } 
 	}
 	
 	cConnector.prototype.showProgressBar = function(){
+ 
 		var div = document.getElementById('divProgressBar');
-		div.style.visibility = 'visible';			
-
-		this.isVisibleBar = true;
+                if(div) 
+        { 
+            div.style.visibility = 'visible'; 
+            this.isVisibleBar = true; 
+        } 
 	}
 
