Index: trunk/expressoMail1_2/js/search.js
===================================================================
--- trunk/expressoMail1_2/js/search.js	(revision 7891)
+++ trunk/expressoMail1_2/js/search.js	(revision 8153)
@@ -568,4 +568,16 @@
 					$(td).click(function(event, ui){	
 						var messageClickedId = $(this).attr('id').match(/td_message_followup_search_([\d]+)/)[1];
+
+						var loading = $('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
+                    		.find('img[alt=Carregando]');
+
+                    	//Verificar se está carregando a bandeira.
+                    	//Caso esteja ele sai da função até que seja carregado. 
+            			if( loading.length ) {
+                			return false;
+            			}
+
+ 						var followupColor = $('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css('backgroundColor');
+
 						
 						var followupColor = $('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css('backgroundColor');
@@ -607,5 +619,6 @@
 								
 								$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
-								.css({"background-image":"url(../prototype/modules/mail/img/flagEditor.png)"});
+								.css({"background-image":"url(../prototype/modules/mail/img/flagEditor.png)"})
+								.find('img').remove();;
 								
 								if (fail) {
@@ -613,4 +626,8 @@
 								    var isCurrentFolder = current_folder == mailbox ? '#td_message_followup_' + messageClickedId + ', ' : ''; 	
 								    $(isCurrentFolder + 'tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "#CCCCCC");
+								    
+								    $('#td_message_followup_search_' + messageClickedId).find(".flag-edited")
+								    .append("<img src='../prototype/modules/mail/img/flagEditor.png'/>");
+
 								    MsgsCallbackFollowupflag[fail]();
 								    return false;
@@ -619,7 +636,11 @@
 								if(current_folder == mailbox){
 									$('#td_message_followup_' + messageClickedId + ', ' + 
-									'tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).attr('title', get_lang('Follow up')).find(".flag-edited").css("background", aux.followupflagged.backgroundColor);	
+									'tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).attr('title', get_lang('Follow up')).find(".flag-edited").css("background", aux.followupflagged.backgroundColor);
+
+									$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).attr('title', get_lang('Follow up')).find(".flag-edited").css("background", aux.followupflagged.backgroundColor)
+									.append("<img src='../prototype/modules/mail/img/flagEditor.png'/>");	
 								}else{								
-									$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).attr('title', get_lang('Follow up')).find(".flag-edited").css("background", aux.followupflagged.backgroundColor);		
+									$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).attr('title', get_lang('Follow up')).find(".flag-edited").css("background", aux.followupflagged.backgroundColor)
+									.append("<img src='../prototype/modules/mail/img/flagEditor.png'/>");			
 								}								
 								updateCacheFollowupflag(messageClickedId, mailbox, true);
@@ -651,5 +672,6 @@
 									
 									$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
-										.css({"background-image":"url(../prototype/modules/mail/img/flagEditor.png)"});
+										.css({"background-image":"url(../prototype/modules/mail/img/flagEditor.png)"})
+										.append("<img src='../prototype/modules/mail/img/flagEditor.png'/>");
 								}
 							});
@@ -657,7 +679,17 @@
 						} else {
 							$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
-							.css({"background-image":"url(../prototype/modules/mail/img/flagEditor.png)"});
-							$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", followupColor);
-							$(this).parents('[role="'+messageClickedId+'_'+mailbox+'"]').attr('class', 'selected_msg').find(':checkbox').trigger('click');
+							.css({"background-image":"url(../prototype/modules/mail/img/flagEditor.png)"}).find('img').remove();
+							
+							$('tr[role="'+messageClickedId+'_'+mailbox+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", followupColor)
+							.append("<img src='../prototype/modules/mail/img/flagEditor.png'/>");
+
+							//Pega id do checkbox
+							var id = $(this).parents('[role="'+messageClickedId+'_'+mailbox+'"]').attr('class', 'selected_msg').find(':checkbox').attr('id');
+							
+							//verifica se o checkbox já está selecionada
+							if($('#' + id).attr('checked') != 'checked')
+								$(this).parents('[role="'+messageClickedId+'_'+mailbox+'"]').attr('class', 'selected_msg').find(':checkbox').trigger('click');
+							
+							updateSelectedMsgs(true,messageClickedId);
 							configureFollowupflag();
 						}
@@ -676,5 +708,5 @@
 					if (aux.labels) {
 						//td1 = '<img src="../prototype/modules/mail/img/tag.png">';
-						$(td1).css({'background-image':'url(../prototype/modules/mail/img/mail-sprites.png)','background-position': '0 -1711px',"margin-left":"0",'margin-top':'3px','background-repeat':'no-repeat'});
+						$(td).css({'background-image':'url(../prototype/modules/mail/img/mail-sprites.png)','margin-left': '0px', 'margin-top':'3px', 'background-position': '0px -1706px', 'background-repeat':'no-repeat no-repeat'});
 						updateLabelsColumn(aux)		
 					} else {
