Index: branches/2.2/expressoMail1_2/js/main.js
===================================================================
--- branches/2.2/expressoMail1_2/js/main.js	(revision 3693)
+++ branches/2.2/expressoMail1_2/js/main.js	(revision 3716)
@@ -2067,8 +2067,25 @@
 			return;
 		if (data.status && Element("td_message_answered_"+msg_number)) {
-			if(flag == 'answered')
-				Element("td_message_answered_"+msg_number).innerHTML = '<img src=templates/'+template+'/images/answered.gif title=Respondida>';
-			else if(flag == 'forwarded')
-				Element("td_message_answered_"+msg_number).innerHTML = '<img src=templates/'+template+'/images/forwarded.gif title=Encaminhada>';
+			
+			switch(flag){
+				case "unseen":
+					set_msg_as_unread(msg_number);
+					break;
+				case "seen":
+					set_msg_as_read(msg_number);
+					break;
+				case "flagged":
+					set_msg_as_flagged(msg_number);
+					break;
+				case "unflagged":
+					set_msg_as_unflagged(msg_number);
+					break;
+				case "answered":
+					Element("td_message_answered_"+msg_number).innerHTML = '<img src=templates/'+template+'/images/answered.gif title=Respondida>';
+					break;
+				case "forwarded":
+					Element("td_message_answered_"+msg_number).innerHTML = '<img src=templates/'+template+'/images/forwarded.gif title=Encaminhada>';
+					break;
+			}				
 		}
 	}
Index: branches/2.2/expressoMail1_2/js/local_messages.js
===================================================================
--- branches/2.2/expressoMail1_2/js/local_messages.js	(revision 3572)
+++ branches/2.2/expressoMail1_2/js/local_messages.js	(revision 3716)
@@ -647,40 +647,57 @@
 	}
 			
-	var rs = this.dbGears.execute("select header,unseen from mail where rowid=" + msgs_to_set[i]);
+	var rs = this.dbGears.execute("select header,unseen,mail from mail where rowid=" + msgs_to_set[i]);
 	header = connector.unserialize(rs.field(0));
+	var mail = connector.unserialize(rs.field(2));
 	unseen = rs.field(1);
 	switch(flag) {
 	    case "unseen":
-		set_msg_as_unread(msgs_to_set[i]);
-		header["Unseen"] = "U";
-		unseen = 1;
-		break;
+			set_msg_as_unread(msgs_to_set[i]);
+			header["Unseen"] = "U";
+			mail["Unseen"] = "U";
+			mail["header"]["Unseen"] = "U";
+			unseen = 1;
+			break;
 	    case "flagged":
-		set_msg_as_flagged(msgs_to_set[i]);
-		header["Flagged"] = "F";
-		break;
+			set_msg_as_flagged(msgs_to_set[i]);
+			header["Flagged"] = "F";
+			mail["Flagged"] = "F";
+			mail["header"]["Flagged"] = "F";
+			break;
 	    case "unflagged":
-		if (header["Importance"].indexOf("High") != -1)
-		    write_msg(get_lang("At least one of selected message cant be marked as normal"));
-		else {
-		    set_msg_as_unflagged(msgs_to_set[i]);
-		    header["Flagged"] = "N";
-		}
+			if (header["Importance"].indexOf("High") != -1)
+			    write_msg(get_lang("At least one of selected message cant be marked as normal"));
+			else {
+			    set_msg_as_unflagged(msgs_to_set[i]);
+			    header["Flagged"] = "N";
+				mail["Flagged"] = "N";
+				mail["header"]["Flagged"] = "N";
+			}
 		break;
 	    case "seen":
-		header["Unseen"] = "N";
-		set_msg_as_read(msgs_to_set[i],true);
-		unseen = 0;
-		break;
+			header["Unseen"] = "N";
+			mail["Unseen"] = "N";
+			mail["header"]["Unseen"] = "N";
+			set_msg_as_read(msgs_to_set[i],true);
+			unseen = 0;
+			break;
 	    case "answered":
-		header["Draft"]="";
-		header["Answered"]="A";
-		Element("td_message_answered_"+msgs_to_set[i]).innerHTML = '<img src=templates/default/images/answered.gif title=Respondida>';
+			header["Draft"]="";
+			mail["Draft"] = "";
+			mail["header"]["Draft"] = "";
+			header["Answered"]="A";
+			mail["Answered"] = "A";
+			mail["header"]["Answered"] = "A";
+			Element("td_message_answered_"+msgs_to_set[i]).innerHTML = '<img src=templates/default/images/answered.gif title=Respondida>';
 		break;
 	    case "forwarded":
-		header["Draft"]="X";
-		header["Answered"]="A";
-		Element("td_message_answered_"+msgs_to_set[i]).innerHTML = '<img src=templates/default/images/forwarded.gif title=Encaminhada>';
-		break;
+			header["Draft"]="X";
+			mail["Draft"] = "X";
+			mail["header"]["Draft"] = "X";
+			header["Answered"]="A";
+			mail["Answered"] = "A";
+			mail["header"]["Answered"] = "A";
+			Element("td_message_answered_"+msgs_to_set[i]).innerHTML = '<img src=templates/default/images/forwarded.gif title=Encaminhada>';
+			break;
 	}
 		
@@ -690,5 +707,6 @@
 	    Element("check_box_message_" + msgs_to_set[i]).checked = false;
 
-	this.dbGears.execute("update mail set header='"+connector.serialize(header)+"',unseen="+unseen+" where rowid="+msgs_to_set[i]);
+	this.dbGears.execute("update mail set mail='"+connector.serialize(mail)+"',header='"+connector.serialize(header)+
+								"',unseen="+unseen+" where rowid="+msgs_to_set[i]);
     }
     if(Element('chk_box_select_all_messages'))
Index: branches/2.2/expressoMail1_2/js/draw_api.js
===================================================================
--- branches/2.2/expressoMail1_2/js/draw_api.js	(revision 3712)
+++ branches/2.2/expressoMail1_2/js/draw_api.js	(revision 3716)
@@ -1372,5 +1372,5 @@
 	option_mark_as_unseen.className = "message_options";
 	option_mark_as_unseen.onclick = function () { changeLinkState(this,'seen');
-		set_messages_flag('unseen',folder_id);
+		proxy_mensagens.proxy_set_message_flag(folder_id,'unseen');
 		write_msg(get_lang('Message marked as ')+get_lang("Unseen"));
 	};
@@ -1387,5 +1387,5 @@
 	if (info_msg.Flagged == "F"){
 		option_mark_important.onclick = function() { changeLinkState(this,'important');
-			set_messages_flag('unflagged',folder_id);
+			proxy_mensagens.proxy_set_message_flag(folder_id,'unflagged');
 			write_msg(get_lang('Message marked as ')+get_lang("Normal"));
 		};
@@ -1394,5 +1394,5 @@
 	else{
 		option_mark_important.onclick = function() { changeLinkState(this,'normal');
-			set_messages_flag('flagged',folder_id);
+			proxy_mensagens.proxy_set_message_flag(folder_id,'flagged');
 			write_msg(get_lang('Message marked as ')+get_lang("Important"));
 		};
@@ -2110,15 +2110,15 @@
 		case 'important':
 			{
-				el.onclick = function(){changeLinkState(el,'normal');set_messages_flag('unflagged',currentTab.substr(0,currentTab.indexOf("_r"))); write_msg(get_lang('Message marked as ')+get_lang("Normal"))}
+				el.onclick = function(){changeLinkState(el,'normal');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'flagged'); write_msg(get_lang('Message marked as ')+get_lang("Important"))}
 				break;
 			}
 		case 'normal':
 			{
-				el.onclick = function(){  changeLinkState(el,'important');set_messages_flag('flagged',currentTab.substr(0,currentTab.indexOf("_r")));write_msg(get_lang('Message marked as ')+get_lang("Important"))}
+				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"))}
 				break;
 			}
 		case 'unseen':
 			{
-				el.onclick = function(){  changeLinkState(el,'seen');set_messages_flag('unseen',currentTab.substr(0,currentTab.indexOf("_r")));write_msg(get_lang('Message marked as ')+get_lang("unseen"))}
+				el.onclick = function(){  changeLinkState(el,'seen');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'unseen');write_msg(get_lang('Message marked as ')+get_lang("unseen"))}
 				break;
 
@@ -2126,5 +2126,5 @@
 		case 'seen':
 			{
-				el.onclick = function(){  changeLinkState(el,'unseen');set_messages_flag('seen',currentTab.substr(0,currentTab.indexOf("_r")));write_msg(get_lang('Message marked as ')+get_lang("seen"))}
+				el.onclick = function(){  changeLinkState(el,'unseen');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'seen');write_msg(get_lang('Message marked as ')+get_lang("seen"))}
 				break;
 
