Index: /trunk/expressoMail1_2/js/draw_api.js
===================================================================
--- /trunk/expressoMail1_2/js/draw_api.js	(revision 8149)
+++ /trunk/expressoMail1_2/js/draw_api.js	(revision 8150)
@@ -1726,7 +1726,16 @@
 			
                         $(this).addClass("selected_msg");
-					}
-					updateSelectedMsgs($(this).find("input:checkbox").is(':checked'),$(this).attr("id"));
-				}
+                }
+                updateSelectedMsgs($(this).find("input:checkbox").is(':checked'),$(this).attr("id"));
+                } else if ( typeof $(event.target).attr("style") == "undefined" || $(event.target).attr("style").match(/background/g) == null ) {
+                    if($(this).find("input:checkbox").attr("checked") != "checked"){
+
+                        $(this).find("input:checkbox").trigger('click');
+            
+                        $(this).addClass("selected_msg");
+                    }
+                    updateSelectedMsgs($(this).find("input:checkbox").is(':checked'),$(this).attr("id"));
+                }
+
 			});
 	}
@@ -2142,5 +2151,16 @@
 		$(td_element26).click(function() {	
 			var messageClickedId = $(this).attr('id').match(/td_message_followup_([\d]+)/)[1];
-			
+
+            var loading = $('#td_message_followup_' + messageClickedId + ', ' + 
+            'tr[role="'+messageClickedId+'_'+msg_folder+'"] #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 = $('#td_message_followup_' + messageClickedId).find(".flag-edited").css('backgroundColor');
 			
@@ -2195,12 +2215,17 @@
 					
 					if(fail != 'success'){
-					    $('#td_message_followup_' + messageClickedId + ', ' + 
-					    'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "#CCCCCC")
-						.find('img').remove();
-					    MsgsCallbackFollowupflag[fail]();
+					    var msgFlag =  $('#td_message_followup_' + messageClickedId + ', ' + 
+                        'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited").css("background", "#CCCCCC");
+
+                        msgFlag.find('img').remove();
+                        
+                        //Insere a imagem da flag quando ocorre erro ao marcar a msg
+                        msgFlag.append("<img src='../prototype/modules/mail/img/flagEditor.png'/>");
+
+                        MsgsCallbackFollowupflag[fail]();
 					}else{
 					    $('#td_message_followup_' + messageClickedId + ', ' + 
 					    'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).attr('title', get_lang('Follow up')).find(".flag-edited").css("background", headers_msgs.followupflagged.backgroundColor)
-						.find('img').remove();
+						.append("<img src='../prototype/modules/mail/img/flagEditor.png'/>");
 					    updateCacheFollowupflag(messageClickedId, msg_folder, true);
 					}				
@@ -2218,5 +2243,4 @@
 					$('#td_message_followup_' + messageClickedId + ', ' + 
 					'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
-					.css({"background-image":"url(../prototype/modules/mail/img/flagEditor.png)"})
 					.find('img').remove();
 					
@@ -2232,7 +2256,16 @@
 				$('#td_message_followup_' + messageClickedId + ', ' + 
 				'tr[role="'+messageClickedId+'_'+msg_folder+'"] #td_message_followup_search_' + messageClickedId).find(".flag-edited")
-				.css({"background-image":"url(../prototype/modules/mail/img/flagEditor.png)"}).css("background", followupColor);
+				.css("backgroundColor", followupColor)
+                .find('img').remove(); //remove imagem carregando da bandeira
+
+                $('#td_message_followup_' + messageClickedId).find('.flag-edited').append("<img src='../prototype/modules/mail/img/flagEditor.png'/>");
+
 				
-				$(tr_element).addClass('selected_msg').find(':checkbox').trigger('click');
+			   //Pega id do checkbox
+               var id = $(tr_element).addClass('selected_msg').find(':checkbox').attr('id');
+                
+                //Verifica se o checkbox está selecionado
+                if($('#' + id).attr('checked') != 'checked')
+                    $(tr_element).addClass('selected_msg').find(':checkbox').trigger('click');
 				
 				/**
@@ -2434,4 +2467,5 @@
 var msg_selected;
 function draw_message(info_msg, ID){
+    alert("1");
 	// remove a flag $FilteredMessage da mensagem ao ser lida
 	if(info_msg.Unseen == "U"){
