Index: /branches/2.2/expressoMail1_2/setup/phpgw_pt-br.lang
===================================================================
--- /branches/2.2/expressoMail1_2/setup/phpgw_pt-br.lang	(revision 3805)
+++ /branches/2.2/expressoMail1_2/setup/phpgw_pt-br.lang	(revision 3806)
@@ -38,4 +38,5 @@
 At least one message have the same origin	expressoMail1_2	pt-br	Pelo menos uma das mensagens está sendo movida para a mesma pasta
 at least, one of selected mails is already archived, expresso tried to archive the others, check them later	expressoMail1_2	pt-br	Pelo menos uma das mensagens selecionadas já foi arquivada anteriormente, o expresso tentou arquivar as outras, verifique-as mais tarde.
+this message cant be marked as normal	expressoMail1_2	pt-br	Esta mensagem não pode ser marcada como normal
 At least one of selected message cant be marked as normal	expressoMail1_2	pt-br	Pelo menos uma das mensagens selecionadas não pode ser marcada como normal
 attachment	expressoMail1_2	pt-br	anexo
Index: /branches/2.2/expressoMail1_2/js/main.js
===================================================================
--- /branches/2.2/expressoMail1_2/js/main.js	(revision 3798)
+++ /branches/2.2/expressoMail1_2/js/main.js	(revision 3806)
@@ -2012,5 +2012,5 @@
 
 		if(!data.status) {
-			alert(data.msg);
+			write_msg(data.msg);
 			Element('chk_box_select_all_messages').checked = false;
 			for (var i = 0; i < msgs_to_set.length; i++) {
@@ -2086,9 +2086,19 @@
 
 // By message number
-function set_message_flag(msg_number, flag){
-	var msg_number_folder = Element("new_input_folder_"+msg_number+"_r");
+function set_message_flag(msg_number, flag, func_after_flag_change){
+	var msg_number_folder = Element("new_input_folder_"+msg_number+"_r"); //Mensagens respondidas/encaminhadas
+	if(!msg_number_folder)
+		var msg_number_folder = Element("input_folder_"+msg_number+"_r"); //Mensagens abertas
+	
 	var handler_set_messages_flag = function (data){
 		if(!verify_session(data))
 			return;
+		if(!data.status) {
+			write_msg(get_lang("this message cant be marked as normal"));
+			return;
+		}
+		else if(func_after_flag_change) {
+			func_after_flag_change(true);
+		}
 		if (data.status && Element("td_message_answered_"+msg_number)) {
 			
Index: /branches/2.2/expressoMail1_2/js/messages_controller.js
===================================================================
--- /branches/2.2/expressoMail1_2/js/messages_controller.js	(revision 3750)
+++ /branches/2.2/expressoMail1_2/js/messages_controller.js	(revision 3806)
@@ -78,12 +78,14 @@
 	}
 	
-	messages_proxy.prototype.proxy_set_message_flag = function (msg_number,flag){
-		var msg_number_folder = Element("new_input_folder_"+msg_number+"_r");
-		var folder = msg_number_folder ?  msg_number_folder.value : get_current_folder()
+	messages_proxy.prototype.proxy_set_message_flag = function (msg_number,flag,func_after_flag_change){
+		var msg_number_folder = Element("new_input_folder_"+msg_number+"_r"); //Mensagens respondidas/encaminhadas
+		if(!msg_number_folder)
+			var msg_number_folder = Element("input_folder_"+msg_number+"_r"); //Mensagens abertas
+		var folder = msg_number_folder ?  msg_number_folder.value : get_current_folder();
 		if(this.is_local_folder(folder)) {
-			expresso_local_messages.set_message_flag(msg_number,flag);
-		}
-		else {
-			set_message_flag(msg_number,flag);
+			expresso_local_messages.set_message_flag(msg_number,flag, func_after_flag_change);
+		}
+		else {
+			set_message_flag(msg_number,flag, func_after_flag_change);
 		}
 	}
Index: /branches/2.2/expressoMail1_2/js/local_messages.js
===================================================================
--- /branches/2.2/expressoMail1_2/js/local_messages.js	(revision 3788)
+++ /branches/2.2/expressoMail1_2/js/local_messages.js	(revision 3806)
@@ -631,12 +631,15 @@
 local_messages.prototype.set_messages_flag = function(msgs_number, flag) {
     this.init_local_messages();
+	var no_errors = true;
     var msgs_to_set;
+	var one_message = false;
     if (msgs_number == 'get_selected_messages') {
-	var msgs_to_set = get_selected_messages();
-	msgs_to_set= msgs_to_set.split(",");
+		var msgs_to_set = get_selected_messages();
+		msgs_to_set= msgs_to_set.split(",");
     }
     else { //Just one message
-	msgs_to_set = new Array();
-	msgs_to_set[0] = msgs_number;
+	    one_message = true;
+		msgs_to_set = new Array();
+		msgs_to_set[0] = msgs_number;
     }
     for (var i in msgs_to_set) {
@@ -666,6 +669,6 @@
 			break;
 	    case "unflagged":
-			if (header["Importance"].indexOf("High") != -1)
-			    write_msg(get_lang("At least one of selected message cant be marked as normal"));
+			if (header["Importance"].indexOf("High") != -1) 
+				no_errors = false;
 			else {
 			    set_msg_as_unflagged(msgs_to_set[i]);
@@ -713,9 +716,19 @@
 	Element('chk_box_select_all_messages').checked = false;
     this.finalize();
-
-}
-	
-local_messages.prototype.set_message_flag = function(msg_number,flag) {
-    this.set_messages_flag(msg_number,flag);
+	if (!no_errors) {
+		if(one_message)
+			write_msg(get_lang("this message cant be marked as normal"));
+		else
+			write_msg(get_lang("At least one of selected message cant be marked as normal"));
+		return false;
+	}
+	return true;
+
+}
+	
+local_messages.prototype.set_message_flag = function(msg_number,flag,func_after_flag_change) {
+    no_errors = this.set_messages_flag(msg_number,flag);
+	if(no_errors && func_after_flag_change)
+		func_after_flag_change(true);
 }
 	
Index: /branches/2.2/expressoMail1_2/js/draw_api.js
===================================================================
--- /branches/2.2/expressoMail1_2/js/draw_api.js	(revision 3798)
+++ /branches/2.2/expressoMail1_2/js/draw_api.js	(revision 3806)
@@ -1386,7 +1386,13 @@
 
 	if (info_msg.Flagged == "F"){
-		option_mark_important.onclick = function() { changeLinkState(this,'important');
-			proxy_mensagens.proxy_set_message_flag(folder_id,'unflagged');
-			write_msg(get_lang('Message marked as ')+get_lang("Normal"));
+		option_mark_important.onclick = function() { 
+			var _this = this;
+			proxy_mensagens.proxy_set_message_flag(folder_id,'unflagged', function(success){
+				if (success) {
+					changeLinkState(_this, 'important');
+					write_msg(get_lang('Message marked as ') + get_lang("Normal"));
+				}
+			} );
+			
 		};
 		option_mark_important.innerHTML = get_lang("Normal");
@@ -2126,5 +2132,13 @@
 		case 'normal':
 			{
-				el.onclick = function(){  changeLinkState(el,'important');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'unflagged');write_msg(get_lang('Message marked as ')+get_lang("Normal"))}
+				el.onclick = function(){ 
+					var _this = this;
+					proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'unflagged', function(success){
+						if (success) {
+							changeLinkState(_this, 'important');
+							write_msg(get_lang('Message marked as ') + get_lang("Normal"));
+						}
+					} );
+				}
 				break;
 			}
