Index: /trunk/prototype/modules/mail/js/followupflag.js
===================================================================
--- /trunk/prototype/modules/mail/js/followupflag.js	(revision 5625)
+++ /trunk/prototype/modules/mail/js/followupflag.js	(revision 5640)
@@ -163,95 +163,101 @@
 	
 	.filter('.menu-configure-followupflag .save').click(function(){	
+		var saveFollowupflagged = function(){
+				var isDone = winElement.find('[name="done"]').is(':checked') ? 1 : 0;
+				var alarmDate = false;
+				var doneDate  = false;
+				var folder_name;
+				var folders = [];
+				var messages = [];
+				var roles = get_selected_messages_search_role().split(',');
+				for (var i=0; i < selectedMessageIds.length; i++ ){
+					if (currentTab == 0) {
+						folder_name = current_folder;
+						var messageNumber = selectedMessageIds[i];
+					}else{
+						var tr = $('[role="'+roles[i]+'"]');
+						folder_name = $(tr).attr('name'); 
+						var id = $(tr).attr('id'); 
+						var messageNumber = id.replace(/_[a-zA-Z0-9]+/,"");
+					}
+					folders.push(folder_name);
+					
+					var idFollowupflagged = winElement.find('[name="followupflagId"]').val();
+					var followupflagged = DataLayer.merge({
+						uid : User.me.id,
+						followupflagId : followupflagId, 
+						folderName : folder_name, 
+						messageNumber : messageNumber,
+						isDone: isDone,
+						backgroundColor : backgroundColor
+					}, !!idFollowupflagged ? {id: idFollowupflagged} : {});
+					
+					if (alarmDate = winElement.find('[name="alarmDate"]').datepicker("getDate")) {
+						if (alarmTime = winElement.find('[name="alarmTime"]').datepicker("getDate")) {
+							alarmDate.set({hour:alarmTime.getHours(), minute:alarmTime.getMinutes()});
+						}
+						followupflagged.alarmDeadline = alarmDate.toString('yyyy-MM-dd hh:mm:ss');
+					}
+
+					if (doneDate = winElement.find('[name="doneDate"]').datepicker("getDate")) {
+						if (doneTime = winElement.find('[name="doneTime"]').datepicker("getDate")) {
+							doneDate.set({hour:doneTime.getHours(), minute:doneTime.getMinutes()});
+						}
+						followupflagged.doneDeadline = doneDate.toString('yyyy-MM-dd hh:mm:ss');
+					}
+					
+					/**
+					 * Aplica o ícone correspondente na lista de mensagens do expressoMail
+					 */
+					if(current_folder == folder_name){
+						var flagged = $('#td_message_followup_' + messageNumber + ', tr[role="'+messageNumber+'_'+folder_name+'"] #td_message_followup_search_' + messageNumber).find(".flag-edited");
+					} else{
+						var flagged = $('tr[role="'+messageNumber+'_'+folder_name+'"] #td_message_followup_search_' + messageNumber).find(".flag-edited");
+					}
+					if(isDone){
+						flagged.find("img").attr("src", "../prototype/modules/mail/img/flagChecked.png").css("margin-left","-3px");
+					}else{
+						flagged.find("img").attr("src", "../prototype/modules/mail/img/flagEditor.png").css("margin-left","0");			
+					}
+					
+
+					if(current_folder == folder_name){
+						$('#td_message_followup_' + messageNumber + ', ' + 
+						'tr[role="'+messageNumber+'_'+folder_name+'"] #td_message_followup_search_' + messageNumber).find(".flag-edited").css("background", backgroundColor); 
+					}else{
+						$('tr[role="'+messageNumber+'_'+folder_name+'"] #td_message_followup_search_' + messageNumber).find(".flag-edited").css("background", backgroundColor); 
+					}  
+					/**
+					 * Salva ou, caso já exista, atualiza
+					 */
+					DataLayer.put('followupflagged', followupflagged);
+				}
 				
+				DataLayer.commit(false, false, function(data){
+					followupflags = DataLayer.get('followupflagged',{criteria:{order: 'id'}}, true);		
+					var id = followupflags[followupflags.length - 1].id;
+					winElement.find('[name="followupflagId"]').val(id);
+					winElement.find('.menu-configure-followupflag .save').button("option", "disabled", true);
+					winElement.find('.menu-configure-followupflag .delete').button("option", "disabled", false);
+					updateCacheFollowupflag(selectedMessageIds, folders, true);
+				});
+		
+		}		
 		var backgroundColor = winElement.find('[name="backgroundColor"]').val();
 		var followupflagId  = winElement.find('[name="name"] option:selected').val();
 		if (followupflagId == 'custom') {
 			DataLayer.put('followupflag', {name:winElement.find('[name="name"] option:selected').text(), uid:User.me.id});
-			DataLayer.commit();
-			
-			followupflags = DataLayer.get('followupflag',{criteria:{order: 'id'}}, true);		
-			followupflagId = followupflags[followupflags.length - 1].id;
-			winElement.find('[name="name"] option[value="custom"]').val(followupflagId);
-		}
-		
-		
-		var isDone = winElement.find('[name="done"]').is(':checked') ? 1 : 0;
-		var alarmDate = false;
-		var doneDate  = false;
-		var folder_name;
-		var folders = [];
-		var messages = [];
-		var roles = get_selected_messages_search_role().split(',');
-		for (var i=0; i < selectedMessageIds.length; i++ ){
-			if (currentTab == 0) {
-				folder_name = current_folder;
-				var messageNumber = selectedMessageIds[i];
-			}else{
-				var tr = $('[role="'+roles[i]+'"]');
-				folder_name = $(tr).attr('name'); 
-				var id = $(tr).attr('id'); 
-				var messageNumber = id.replace(/_[a-zA-Z0-9]+/,"");
-			}
-			folders.push(folder_name);
-			
-			var idFollowupflagged = winElement.find('[name="followupflagId"]').val();
-			var followupflagged = DataLayer.merge({
-				uid : User.me.id,
-				followupflagId : followupflagId, 
-				folderName : folder_name, 
-				messageNumber : messageNumber,
-				isDone: isDone,
-				backgroundColor : backgroundColor
-			}, !!idFollowupflagged ? {id: idFollowupflagged} : {});
-			
-			if (alarmDate = winElement.find('[name="alarmDate"]').datepicker("getDate")) {
-				if (alarmTime = winElement.find('[name="alarmTime"]').datepicker("getDate")) {
-					alarmDate.set({hour:alarmTime.getHours(), minute:alarmTime.getMinutes()});
-				}
-				followupflagged.alarmDeadline = alarmDate.toString('yyyy-MM-dd hh:mm:ss');
-			}
-
-			if (doneDate = winElement.find('[name="doneDate"]').datepicker("getDate")) {
-				if (doneTime = winElement.find('[name="doneTime"]').datepicker("getDate")) {
-					doneDate.set({hour:doneTime.getHours(), minute:doneTime.getMinutes()});
-				}
-				followupflagged.doneDeadline = doneDate.toString('yyyy-MM-dd hh:mm:ss');
-			}
-			
-			/**
-			 * Aplica o ícone correspondente na lista de mensagens do expressoMail
-			 */
-			if(current_folder == folder_name){
-				var flagged = $('#td_message_followup_' + messageNumber + ', tr[role="'+messageNumber+'_'+folder_name+'"] #td_message_followup_search_' + messageNumber).find(".flag-edited");
-			} else{
-				var flagged = $('tr[role="'+messageNumber+'_'+folder_name+'"] #td_message_followup_search_' + messageNumber).find(".flag-edited");
-			}
-			if(isDone){
-				flagged.find("img").attr("src", "../prototype/modules/mail/img/flagChecked.png").css("margin-left","-3px");
-			}else{
-				flagged.find("img").attr("src", "../prototype/modules/mail/img/flagEditor.png").css("margin-left","0");			
-			}
-			
-
-			if(current_folder == folder_name){
-				$('#td_message_followup_' + messageNumber + ', ' + 
-				'tr[role="'+messageNumber+'_'+folder_name+'"] #td_message_followup_search_' + messageNumber).find(".flag-edited").css("background", backgroundColor); 
-			}else{
-				$('tr[role="'+messageNumber+'_'+folder_name+'"] #td_message_followup_search_' + messageNumber).find(".flag-edited").css("background", backgroundColor); 
-			}  
-			/**
-			 * Salva ou, caso já exista, atualiza
-			 */
-			DataLayer.put('followupflagged', followupflagged);
-		}
-		
-		DataLayer.commit(false, false, function(data){
-			followupflags = DataLayer.get('followupflagged',{criteria:{order: 'id'}}, true);		
-			var id = followupflags[followupflags.length - 1].id;
-			winElement.find('[name="followupflagId"]').val(id);
-			winElement.find('.menu-configure-followupflag .save').button("option", "disabled", true);
-			winElement.find('.menu-configure-followupflag .delete').button("option", "disabled", false);
-			updateCacheFollowupflag(selectedMessageIds, folders, true);
-		});
+			DataLayer.commit(false, false, function(data){
+				DataLayer.remove('followupflag', false);
+				DataLayer.get('followupflag');		
+				followupflags = DataLayer.get('followupflag',{criteria:{order: 'id'}}, true);		
+				followupflagId = followupflags[followupflags.length - 1].id;
+				winElement.find('[name="name"] option[value="custom"]').val(followupflagId);
+				saveFollowupflagged();
+			});
+		}else{
+			saveFollowupflagged();
+		}	
+
 	}).end()
 	
Index: /trunk/expressoMail1_2/templates/default/expressomail.css
===================================================================
--- /trunk/expressoMail1_2/templates/default/expressomail.css	(revision 5626)
+++ /trunk/expressoMail1_2/templates/default/expressomail.css	(revision 5640)
@@ -133,5 +133,5 @@
 .context-menu-item.icon-share-mailbox { background-image: url(images/menu/usersfolders.png); }
 .context-menu-item.icon-label { background-image: url(images/menu/usersfolders.png); }
-.context-menu-item.icon-tag { background-image: url(images/menu/tag.png); margin: 3px; }
+.context-menu-item.icon-tag { background-image: url(images/menu/tag.png); background-size: 12px; background-position: 6px 2px !important;}
 .context-menu-item.icon-empty-trash { background-image: url(images/menu/trash.png); }
 .context-menu-item.icon-queue { background-image: url(images/menu/queue.png); }
Index: /trunk/expressoMail1_2/templates/default/index.tpl
===================================================================
--- /trunk/expressoMail1_2/templates/default/index.tpl	(revision 5576)
+++ /trunk/expressoMail1_2/templates/default/index.tpl	(revision 5640)
@@ -22,9 +22,9 @@
 						<tr>
 							<td>
-								<div id="search_div" align="center" style="white-space:nowrap"></div>
-								<input type="text" id="em_message_search" size="17" style="margin-left: 5px;"/>
-								<a style="padding:1 8px; width:16px; height:16px; background: url(templates/default/images/search.gif) no-repeat center; margin: 0 3px;" class="" onMouseOut="window.status='';return true;" title='{lang_Open_Search_Window}' onMouseOver="window.status='{lang_Open_Search_Window}';return true;" href="javascript:void(0);"  onClick="javascript:search_emails(Element('em_message_search').value)"></a> 
-								
-								<a style="padding:1 8px; width:16px; height:16px; background: url(templates/default/images/users.gif) no-repeat center;" class="" onMouseOut="window.status='';return true;" title='{lang_search_user}' onMouseOver="window.status='{lang_search_user}' ;return true;" href="javascript:void(0);"  onClick="javascript:emQuickSearch(Element('em_message_search').value, 'null', 'null', 'expressoMail')"></a> 
+								<div id="search_div" class="class_search_div" style="white-space:nowrap">
+									<input type="text" id="em_message_search" size="17" style="margin-left: 5px;"/>
+									<a style="padding:1 8px; width:16px; height:16px; background: url(templates/default/images/search.gif) no-repeat center; margin: 0 3px;" class="" onMouseOut="window.status='';return true;" title='{lang_Open_Search_Window}' onMouseOver="window.status='{lang_Open_Search_Window}';return true;" href="javascript:void(0);"  onClick="javascript:search_emails(Element('em_message_search').value)"></a> 
+									<a style="padding:1 8px; width:16px; height:16px; background: url(templates/default/images/users.gif) no-repeat center;" class="" onMouseOut="window.status='';return true;" title='{lang_search_user}' onMouseOver="window.status='{lang_search_user}' ;return true;" href="javascript:void(0);"  onClick="javascript:emQuickSearch(Element('em_message_search').value, 'null', 'null', 'expressoMail')"></a> 
+								</div>
 							</td>
 						</tr>
@@ -46,5 +46,5 @@
 						</tr>
 						<tr height="24">
-							<td id="link_tools" class='content-menu-td' onmouseover='javascript:set_menu_bg(Element("link_tools"));' onmouseout='javascript:unset_menu_bg(this);'>
+							<td id="link_tools" class='content-menu-td'>
 								<div class='em_div_sidebox_menu'>
 									<img height='16px' src='./templates/default/images/menu/tools.gif' />
Index: /trunk/expressoMail1_2/templates/default/main.css
===================================================================
--- /trunk/expressoMail1_2/templates/default/main.css	(revision 5436)
+++ /trunk/expressoMail1_2/templates/default/main.css	(revision 5640)
@@ -373,5 +373,8 @@
 .content-menu-td {
 /*	border: 1px solid #f7f7f7;*/
-}
+	margin-left: 5px;
+}
+
+.content-menu-td:hover{background-color: #ffffff; border: 1px solid #CCCCCC}
 
 .content-folders {
@@ -479,4 +482,8 @@
 }
 
+.class_search_div{
+	position: relative;
+	left: 12px;
+}
 
 .em_sidebox_menu {
@@ -494,5 +501,5 @@
 .em_div_sidebox_menu {
 	position: relative;
-	left: 5px;
+	left: 17px;
 	cursor: pointer;
 }
Index: /trunk/expressoMail1_2/js/common_functions.js
===================================================================
--- /trunk/expressoMail1_2/js/common_functions.js	(revision 5588)
+++ /trunk/expressoMail1_2/js/common_functions.js	(revision 5640)
@@ -683,5 +683,5 @@
 		dialogClass: 'dialog-configure-label'
 	});
-	init_label({window:dialogElement, selectedItem:data.selectedItem});	
+	init_label({window:dialogElement, selectedItem:data.selectedItem, applyToSelectedMessages:data.applyToSelectedMessages});	
 	dialogElement.dialog("open");
 }
@@ -714,4 +714,5 @@
 
 	if(!User.followupflags)
+		DataLayer.remove('followupflag', false);
 		User.followupflags = DataLayer.get('followupflag', true);
 	var data = {
Index: /trunk/expressoMail1_2/js/doiMenuData.js
===================================================================
--- /trunk/expressoMail1_2/js/doiMenuData.js	(revision 5625)
+++ /trunk/expressoMail1_2/js/doiMenuData.js	(revision 5640)
@@ -159,5 +159,5 @@
 $.contextMenu({
 	selector: "#link_tools",
-	trigger: 'left',
+	trigger: 'hover',
 	className: 'context-menu-tools',
 	position: function($menu, x, y){
@@ -167,8 +167,19 @@
 		$menu.css('display', 'block').position({ my: "center top", at: "center bottom", of: this}).css('display', 'none');
 	},
+	delay:100,
+	autoHide:true,
 	events: {
 		show: function(opt) {
-			var $trigger = $(opt.selector).css({'background-color': '#EEEEEE', 'border': '1px solid #CCCCCC'});
+			var $trigger = $(opt.selector).css({'background-color': '#ffffff', 'border': '1px solid #CCCCCC'});
 			$('.context-menu-tools.context-menu-list.context-menu-root').css({'width': $trigger.css('width') });
+			$('.context-menu-tools.context-menu-list').css({'background': '#ffffff'})
+			.find(".context-menu-item").css({'background-color': '#ffffff'}).hover(
+				function(){
+					$(this).css({'background-color': '#CCCCCC'});
+				}, 
+				function(){
+					$(this).css({'background-color': '#ffffff'});
+				}
+			);
 			return true;
 		},
