Index: sandbox/2.4.1-3/expressoMail1_2/js/draw_api.js
===================================================================
--- sandbox/2.4.1-3/expressoMail1_2/js/draw_api.js	(revision 6335)
+++ sandbox/2.4.1-3/expressoMail1_2/js/draw_api.js	(revision 6358)
@@ -3534,6 +3534,6 @@
 		//PEGA TODO O CONTEUDO E SETA COMO SE FOSSE O EMAIL
 		case 1:
-			ContactBox.email = email;
-			ContactBox.valid = reSimpleEmail.test(email.toLowerCase());
+			ContactBox.email = $.trim(email);
+			ContactBox.valid = reSimpleEmail.test($.trim(email.toLowerCase()));
 			break;
 		//CORRIGI ERRO DE DIGITAÇÃO COMO ( huahua"<huhau@hauhau.com>) ou (hahahaha"huahua@email.com) ou ainda (hahahaha"huahua@ema  il.com)
@@ -3563,5 +3563,7 @@
 //EVENTO DOS INPUTS PARA - CC - CCO
 function input_keydowns(input, ID){
+	var f9 = false;
 	input.keydown(function(e){
+		f9 = false;
 		var reEmail = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[_a-z0-9-]+(\.[_a-z0-9-]+)+$/;
 		var reEmail2 = /<([^<]*)>[\s]*$/;
@@ -3589,4 +3591,5 @@
 		//BUSCA COM A TECLA F9
 		if((e.keyCode) == 120){
+			f9 = true;
 			emQuickSearch($(this).val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true);
 			e.preventDefault();
@@ -3661,9 +3664,23 @@
 	//AO SAIR DO FOCO MONTAGEM DA CAIXA DE EMAIL
 	.focusout(function(){
-		if($(input).val() != "")
-			draw_email_box(input.val(), input);
-		if(input.hasClass("box-input"))
-			input.remove();
-		input.val("");
+		if(!($(this).parents("tr:first").find("button").hasClass("ui-state-active") || f9 || $(".expressomail-qs-container").dialog("isOpen"))){
+			if($(input).val() != "")
+				draw_email_box(input.val(), input);
+			if(input.hasClass("box-input"))
+				input.remove();
+		}
+		input_search = $(input).val();
+		$(input).val("");
+	}).bind("paste", function(e){
+		$(this).trigger("keydown");
+		var pthis = $(this);
+		setTimeout(function() {
+			var str = pthis.val().replace(/[,;\t\n]/gi, ",");
+			str = str.split(",");
+			$.each(str, function(index, value){
+				draw_email_box(value, pthis);
+			});
+			pthis.val("");
+		}, 50);
 	});
 	//SE FOR EDIÇÃO DE EMAILS RECALCULA O INPUT E SETA O FOCO
@@ -3673,5 +3690,5 @@
 	}
 }
-
+var input_search = "";
 //EVENTOS DA CAIXA
 function box_actions(box){
@@ -3694,8 +3711,10 @@
 			case $.ui.keyCode.HOME:
 				//SELECIONO A PRIMEIRA CAIXA
+				e.preventDefault();
 				$(this).parents(".email-area").find("div:first").focus();
 				break;
 			case $.ui.keyCode.END:
 				//SELECIONO A ULTIMA CAIXA
+				e.preventDefault();
 				$(this).parents(".email-area").find("div:last").focus();
 				break;
@@ -3746,4 +3765,15 @@
 	}).focusout(function(){
 		$(this).removeClass("box-selected");
+	}).draggable({
+		revert: 'invalid',
+		helper : 'clone',
+		stack: "body",
+		containment : ".new-msg-head-data",
+		start: function(e, ui){
+			$(this).parent().droppable( "disable" );
+		},
+		stop : function(e, ui){
+			$(this).parent().droppable( "enable" );
+		}
 	});
 }
@@ -3769,4 +3799,14 @@
 		if(!$(e.target).parents(".email-area:first").length)
 			$(this).find("div").removeClass("box-selected");
+	}).droppable({
+		hoverClass: "box-draggable-hover",
+		accept : ".box",
+		drop : function(e, ui){
+			ui.draggable.parent().droppable( "enable" );
+			var haha = ui.draggable.clone();
+			box_actions(haha)
+			$(this).prepend(haha);
+			ui.draggable.remove();
+		}
 	});
 	
@@ -3832,5 +3872,9 @@
 				return false;
 			},
-			autoFocus: true
+			autoFocus: true,
+			open : function(){
+				if($(this).val() == "")
+					$(this).autocomplete( "close" )
+			}
 		})
 		
@@ -3867,5 +3911,5 @@
 	//FUNÇÃO DOS BOTÕES PARA - CC - CCO
 	div.parents("tr:first").find("button").button().click(function(){
-		emQuickSearch($(this).parents("tr:first").find("input").val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true);
+		emQuickSearch(($(this).parents("tr:first").find("input").val() ? $(this).parents("tr:first").find("input").val() : input_search), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true);
 	});
 }
