Index: trunk/prototype/modules/attach_message/attach_message.js
===================================================================
--- trunk/prototype/modules/attach_message/attach_message.js	(revision 5760)
+++ trunk/prototype/modules/attach_message/attach_message.js	(revision 5777)
@@ -114,7 +114,7 @@
 		};
 	for(var flag in cell){
-		classes += '<span class="flags '+ (cell[flag]).toLowerCase() +((cell[flag]) == '' ? '"' : '" title="'+ get_lang((cell[flag])))+'"> </span>';	
-	}
-
+		classes += '<span class="flags '+ (cell[flag]) +'" title="'+ (cell[flag]) +'"> </span>';	
+	}
+	
 	if(rowObject.labels){		
 		classes += '<span class="flags labeled"> </span>';
@@ -122,11 +122,7 @@
 		classes += '<span class="flags"> </span>';
 	}
+	
 	if(rowObject.followupflagged){		
-		if(rowObject.followupflagged.followupflag.id < 7){
-			var nameFollowupflag = get_lang(rowObject.followupflagged.followupflag.name);
-		}else{
-			var nameFollowupflag = rowObject.followupflagged.followupflag.name;
-		}
-		classes += '<span class="flags followupflagged" title="'+nameFollowupflag+'" style="background:'+rowObject.followupflagged.backgroundColor+';"><img src="../prototype/modules/mail/img/flagEditor.png"></span>';
+		classes += '<span class="flags followupflagged" style="background:'+rowObject.followupflagged.backgroundColor+';"><img src="../prototype/modules/mail/img/flagEditor.png"></span>';
 	}
 	return classes;
@@ -337,9 +333,9 @@
 			colModel:[
 				{name:'msg_number',index:'msg_number', width:45, hidden:true, sortable:false},
-				{name:'flags',index:'msg_number',edittype: 'image', width:100, sortable:false, formatter:flags2Class, title :false},
+				{name:'flags',index:'msg_number',edittype: 'image', width:100, sortable:false, formatter:flags2Class},
 				{name:'from.name',index:'msg_number', width:70, sortable:false, formatter:NormaliseFrom},
 				{name:'subject',index:'subject', width:245, sortable:false},
 				{name:'timestamp',index:'timestamp', width:65, align:"center", sortable:false, formatter:date2Time},
-				{name:'size',index:'size', width:55, align:"right", sortable:false, formatter:bytes2Size}
+				{name:'size',index:'size', width:55, align:"right", sortable:false, formatter:bytes2Size} 
 			],
 			jsonReader : {
@@ -395,7 +391,10 @@
 				
 				var tabPanelTemplateId = 'mailpreview_tab_' + selectedFolder.id.replace(/[.\/]/, '_') + '_' + message.msg_number;
-				
-				if (selected) {		
+				var tabPanelTemplateId = tabPanelTemplateId.replace(/[\s\/]/g, '-');
+	
+				if (selected) {
+					
 					if (onceOpenedMessages[selectedFolder.id] && onceOpenedMessages[selectedFolder.id][message.msg_number]) {
+
 						if (!selectedMessages[selectedFolder.id])
 							selectedMessages[selectedFolder.id] = {};
@@ -407,6 +406,8 @@
 						if (tabPanelTemplateLabel.length > $mailpreview_tabs_label_length + 3)
 							tabPanelTemplateLabel = tabPanelTemplateLabel.substring(0, $mailpreview_tabs_label_length) + '...';
-						
-						if (!$('#' + tabPanelTemplateId).length) {								
+							
+								
+						if (!$('#' + tabPanelTemplateId).length) {	
+								
 							$mailpreview_tabs.tabs("add", '#' + tabPanelTemplateId, tabPanelTemplateLabel)
 							.find('.message.empty-container').hide().end()
@@ -442,22 +443,20 @@
 						if (!selectedMessages[selectedFolder.id])
 							selectedMessages[selectedFolder.id] = {};
-						selectedMessages[selectedFolder.id][message.msg_number] = true;
+						selectedMessages[selectedFolder.id][message.msg_number] = true;	
 						$.ajax({
 							accepts: 'text/html',
 							url: BASE_PATH + 'REST.php'+offlineCase+'?q=folder/'+selectedFolder.id.replace(dashes, '.')+'/message/'+id,
 							dataType: 'json',
-							success: function( mail_preview ){		
-								//selectedMessagesCount();
+							success: function( mail_preview ){	
+									
 								if (!onceOpenedMessages[selectedFolder.id])
 									onceOpenedMessages[selectedFolder.id] = {};
 								onceOpenedMessages[selectedFolder.id][message.msg_number] = jQuery.extend(true, message, mail_preview);
-
 								$('#mailpreview_container').unblock();
-
 								var tabPanelTemplateLabel = onceOpenedMessages[selectedFolder.id][message.msg_number].subject;
+									selectedMessagesCount();	
 								if (tabPanelTemplateLabel.length > $mailpreview_tabs_label_length + 3)
 									tabPanelTemplateLabel = tabPanelTemplateLabel.substring(0, $mailpreview_tabs_label_length) + '...';
-						
-								if (!$('#' + tabPanelTemplateId).length) {								
+								if (!$('#' + tabPanelTemplateId).length) {						
 									$mailpreview_tabs.tabs("add", '#' + tabPanelTemplateId, tabPanelTemplateLabel)
 									.find('.message.empty-container').hide().end()
@@ -470,9 +469,9 @@
 									)
 									.find('[class^="ExpressoCssWrapper"]').addClass("mailpreview-message-body");
+									
 								} else {
 									$mailpreview_tabs.tabs('select', '#' + tabPanelTemplateId)
 									.find('#' + tabPanelTemplateId + ', [href="#' + tabPanelTemplateId + '"]').removeClass('preview-message-unselected');
-								}
-								selectedMessagesCount();
+								}	
 							}
 						});
@@ -493,6 +492,7 @@
 				}
 				
-				if (onceOpenedMessages[selectedFolder.id] && onceOpenedMessages[selectedFolder.id][message.msg_number])
+				if (onceOpenedMessages[selectedFolder.id] && onceOpenedMessages[selectedFolder.id][message.msg_number]){
 					selectedMessagesCount();
+				}
 			},
 			caption: '<span class="'+selectedFolder['class']+'">'+selectedFolder.name+'</span>'
