Index: sandbox/2.4.2-expresso2/expressoMail1_2/js/draw_api.js
===================================================================
--- sandbox/2.4.2-expresso2/expressoMail1_2/js/draw_api.js	(revision 6717)
+++ sandbox/2.4.2-expresso2/expressoMail1_2/js/draw_api.js	(revision 6752)
@@ -896,6 +896,4 @@
 	var _mouse_out;
 	var _cell;
-	var colGroupMain = document.getElementById("colgroup_main_"+numBox);
-	var colGroupHead = document.getElementById("colgroup_head_"+numBox);
 	for (var r=0;r<trM.length;r++) {
 		for (var c=0;c<trM[r].cells.length;c++) {
@@ -904,7 +902,7 @@
 			if (is_mozilla && !is_webkit) {
 				if (!emptyBody) {
-					colGroupMain.childNodes[c].setAttribute("width",colSizes[tbl][c]);
+					document.getElementById("colgroup_main_"+numBox).childNodes[c].setAttribute("width",colSizes[tbl][c]);
 				}
-				colGroupHead.childNodes[c].setAttribute("width",colSizes[tbl][c]);
+				document.getElementById("colgroup_head_"+numBox).childNodes[c].setAttribute("width",colSizes[tbl][c]);
 				if (tbH.rows[0].cells[c].className=="th_resizable") {
 					// lots of stupid fixes for FF to redraw cell content
@@ -921,8 +919,7 @@
 				}
 			}
-			/*
 			else {
 				tbH.rows[0].cells[c].setAttribute("width",_cell.offsetWidth);
-			}*/
+			}
 		}
 	}
@@ -4337,6 +4334,16 @@
 	var maxAttachmentSize = (preferences.max_attachment_size !== "" && preferences.max_attachment_size != 0) ? (parseInt(preferences.max_attachment_size.replace('M', '')) * 1048576 ) : false;
 	
+	content.find(".new-msg-head-data").scroll(function(){
+		$.each(fileUploadMSG.find(".attachments-list .att-box"), function(index, value){
+			$(this).qtip("api").updatePosition();
+		});
+	});
+	$("#fileupload_msg"+ID+"_droopzone").click(function(){
+		$(this).removeClass('in hover');
+    	$(this).hide();
+    	$(this).prev().show();
+	});
 	fileUploadMSG.find(".button").button().filter(".fileinput-button").find(".ui-button-text").css("margin-top", "2px").find("input:file").fileupload({
-		//singleFileUploads : true,
+		//singleFileUploads : true,fileUploadMSG
 		sequentialUploads: true, 
 		type: 'post',
@@ -4344,5 +4351,5 @@
 		url: "../prototype/post.php",
 		forceIframeTransport: false,
-		dropZone : fileUploadMSG,
+		dropZone : $("#fileupload_msg"+ID+"_droopzone"),
 		formData: function(form) {
 			return [
@@ -4368,28 +4375,58 @@
 				}, 3000);
 			}
+			fileUploadMSG.find(' .attachments-list').show();
 			$.each(data.files, function (index, file) {
 				var attach = {};
 				attach.fullFileName = file.name;
 				attach.fileName = file.name;
-				if(file.name.length > 50)
-					attach.fileName = file.name.substr(0, 32) + " ... " + file.name.substr(file.name.length-9, file.name.length);
+				if(file.name.length > 20)
+					attach.fileName = file.name.substr(0, 17) + " ... " + file.name.substr(file.name.length-6, file.name.length);
 				attach.fileSize = formatBytes(file.size);
 				if(maxAttachmentSize && file.size > maxAttachmentSize)
 					attach.error = 'Tamanho de arquivo nao permitido!!'
-				
-                                var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach}));				
-				upload.find('.button.close').button({
-					icons: {
-						primary: "ui-icon-close"
-					},
-					text: false
-				}).click(function(){
+				else
+					attach.error = 'Loading...';	
+				var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach}));				
+				upload.find('.att-box-delete').click(function(){
 					var idAttach = $(this).parent().find('input[name="fileId[]"]').val();
 					fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove();
-                                        delAttachment(ID, idAttach)
+                    delAttachment(ID, idAttach);
+                    $(this).parent().qtip("destroy");
 					$(this).parent().remove();
+					if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){
+						fileUploadMSG.find(' .attachments-list').hide();
+					}
 				});
-                                
-                                fileUploadMSG.find('.attachments-list').append(upload);
+                   
+                fileUploadMSG.find('.attachments-list').append(upload);
+
+              	fileUploadMSG.find('.attachments-list .att-box:last').qtip({
+                	content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}),
+					position: {
+						corner: {
+							tooltip: 'bottomMiddle',
+							target: 'topMiddle'
+						},
+						adjust: {
+			               resize: true,
+			               scroll: true
+			            }
+					},
+					show: {
+						when: 'mouseover', // Don't specify a show event
+						ready: false // Show the tooltip when ready
+					},
+					hide: 'mouseout', // Don't specify a hide event
+					style: {
+						border: {
+							width: 1,
+							radius: 5
+						},
+						padding: 5, 
+						textAlign: 'center',
+						tip: true, // Give it a speech bubble tip with automatic corner detection
+						name: 'blue' // Style it according to the preset 'cream' style
+					}
+                });
 
 				if(!maxAttachmentSize || file.size < maxAttachmentSize){
@@ -4408,17 +4445,17 @@
 					if(newAttach.rollback !== false)
 					{
-						fileUploadMSG.find('.in-progress:first').parents('p').append('<input type="hidden" name="fileId[]" value="'+newAttach['mailAttachment'][0][0].id+'"/>').find('.status-upload').addClass('ui-icon ui-icon-check');
+						fileUploadMSG.find('.att-box-loading:first').parents('div:first').append('<input type="hidden" name="fileId[]" value="'+newAttach['mailAttachment'][0][0].id+'"/>');
 						addAttachment(ID,newAttach['mailAttachment'][0][0].id);
 					}
 					else                             
-						fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error');   
+						fileUploadMSG.find('.att-box-loading:first').parents('div:first').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error');   
 				}else{
-					fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append(newAttach.mailAttachment.error).addClass('message-attach-error');   
+					fileUploadMSG.find('.att-box-loading:first').parents('div:first').find('.status-upload').append(newAttach.mailAttachment.error).addClass('message-attach-error');   
 				}
                                 
 			}else {
-				fileUploadMSG.find(' .progress.on-complete:first').parents('p').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error');
-			}
-            fileUploadMSG.find(' .in-progress:first').remove();
+				fileUploadMSG.find(' .progress.on-complete:first').parents('div:first').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error');
+			}
+            fileUploadMSG.find(' .att-box-loading:first').remove();
 		}
 	}).css({
@@ -4449,4 +4486,5 @@
 					jQuery.each(selectedMessages[folder_name], function(message_number, message) { 
 						if (message) {
+							fileUploadMSG.find(' .attachments-list').show();	
 							var att = new Object();
 							att.folder = folder_name;
@@ -4458,26 +4496,57 @@
 							var attach = {};
 							attach.fileName = onceOpenedMessages[folder_name][message_number].subject + '.eml';
-							if(attach.fileName.length > 45)
-									attach.fileName = attach.fileName.substr(0, 32) + " ... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length);
-
+							attach.fullFileName = onceOpenedMessages[folder_name][message_number].subject + '.eml';
+							if(attach.fileName.length > 20)
+								attach.fileName = attach.fileName.substr(0, 17) + "... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length);
+
+							attach.error = "";
 							attach.fileSize = formatBytes(onceOpenedMessages[folder_name][message_number].size);
 							var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach}));
-							upload.find('.status-upload').addClass('ui-icon ui-icon-check');
-							upload.find('.in-progress').remove(); 
+							upload.find('.att-box-loading').remove();
 							upload.append('<input type="hidden" name="fileId[]" value=\''+idATT+'\'/>');
 							
-							upload.find('.button.close').button({
-								icons: {
-												primary: "ui-icon-close"
-										},
-										text: false
-								}).click(function(){
-										var idAttach = $(this).parents("li:first").find('input[name="fileId[]"]').val();
-										fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]');
-										delAttachment(ID,idAttach); 
-										$(this).parent().remove();
+							upload.find('.att-box-delete').click(function(){
+								var idAttach = $(this).parent().find('input[name="fileId[]"]').val();
+								fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove();
+								delAttachment(ID,idAttach); 
+								$(this).parent().qtip("destroy");
+								$(this).parent().remove();
+								if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){
+									fileUploadMSG.find(' .attachments-list').hide();
+								}
 							});	
 							
-							fileUploadMSG.find('.attachments-list').append(upload);   
+							fileUploadMSG.find('.attachments-list').append(upload); 
+
+							upload.find('.att-box-loading').remove();
+
+							fileUploadMSG.find('.attachments-list .att-box:last').qtip({
+			                	content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}),
+								position: {
+									corner: {
+										tooltip: 'bottomMiddle',
+										target: 'topMiddle'
+									},
+									adjust: {
+						               resize: true,
+						               scroll: true
+						            }
+								},
+								show: {
+									when: 'mouseover', // Don't specify a show event
+									ready: false // Show the tooltip when ready
+								},
+								hide: 'mouseout', // Don't specify a hide event
+								style: {
+									border: {
+										width: 1,
+										radius: 5
+									},
+									padding: 5, 
+									textAlign: 'center',
+									tip: true, // Give it a speech bubble tip with automatic corner detection
+									name: 'blue' // Style it according to the preset 'cream' style
+								}
+			                });
 						}
 					});
@@ -4492,4 +4561,51 @@
 		});
 	});
+	$(document).bind('drop dragover', function (e) {
+	    e.preventDefault();
+	});
+	//DRAG and DROP DE ARQUIVOS NÃO FUNCIONA NO IE
+	if(!is_ie){
+		$("body").bind('dragenter', function (e) {
+		    var dropZone = $("#fileupload_msg"+ID+"_droopzone");
+        	var timeout = window.dropZoneTimeout;
+			dropZone.show();
+			dropZone.prev().hide();
+		    if (!timeout) {
+		        dropZone.addClass('in');
+		    } else {
+		        clearTimeout(timeout);
+		    }
+		    if (e.target === dropZone[0]) {
+		        dropZone.addClass('hover');
+		    } else {
+		        dropZone.removeClass('hover');
+		    }
+		    $(window).unbind('dragleave');
+		    window.dropZoneTimeout = setTimeout(function () {
+        		$(window).bind('dragleave', function (e) {
+					window.dropZoneTimeout = null;
+		        	dropZone.removeClass('in hover');
+		        	dropZone.hide();
+		        	dropZone.prev().show();
+				});
+		    }, 1);
+		}).bind('dragleave', function (e) {
+			var dropZone = $("#fileupload_msg"+ID+"_droopzone");
+			window.dropZoneTimeout = setTimeout(function () {
+        		$(window).bind('dragleave', function (e) {
+					window.dropZoneTimeout = null;
+		        	dropZone.removeClass('in hover');
+		        	dropZone.hide();
+		        	dropZone.prev().show();
+				});
+		    }, 1);
+		}).bind('drop', function(e){
+			var dropZone = $("#fileupload_msg"+ID+"_droopzone");
+			window.dropZoneTimeout = null;
+        	dropZone.removeClass('in hover');
+        	dropZone.hide();
+        	dropZone.prev().show();
+		});
+	}	
 	return ID;
 }
