Index: /trunk/expressoMail1_2/js/draw_api.js
===================================================================
--- /trunk/expressoMail1_2/js/draw_api.js	(revision 6107)
+++ /trunk/expressoMail1_2/js/draw_api.js	(revision 6108)
@@ -1407,11 +1407,7 @@
 }
 
-function html_entities(string) {
-		return String(string).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
-}
-
 // Passar o parâmetro offset para esta função
 function make_tr_message(headers_msgs, msg_folder, offsetToGMT){
-		headers_msgs.subject = html_entities(headers_msgs.subject);
+
 		if (typeof offsetToGMT == 'undefined')
 		{
@@ -2913,5 +2909,5 @@
 	var subject = document.createElement("TD");
 	subject.id = "subject_"+ID;
-	subject.innerHTML = html_entities(info_msg.subject);
+	subject.innerHTML = info_msg.subject;
 	subject.className = "header_message_field";
 	if(defaultCalendar == "expressoCalendar" && $("#expressoCalendarid")[0]){
@@ -3475,53 +3471,4 @@
 	return mySplit( term ).pop();
 }
-
-function input_binds(input, ID){
-	var mySource = new Array();
-	var myArray = contacts.split(",");
-	for(var i in myArray){
-		var teste = myArray[i].split(";");
-		if(teste.length > 1)
-			mySource.push({name : teste[0], email: teste[1], value : (teste[0] +" - "+teste[1])});
-		else
-			mySource.push({name : "", email: teste[0], value :teste[0]});
-	}
-	input.bind( "keydown", function( event ) {
-		if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) {
-			event.preventDefault();
-		}
-		if((event.keyCode) == 120){
-			emQuickSearch($(this).val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true);
-		}
-	}).autocomplete({
-		minLength: 0,			
-		source: function( request, response ) {
-			response( $.ui.autocomplete.filter(
-				mySource, extractLast( request.term ) ) );
-		},
-		focus: function() {
-			return false;
-		},
-		select: function( event, ui ) {
-			var terms = mySplit( this.value );
-			terms.pop();
-			terms.push( (ui.item.name != "" ? "\""+ui.item.name+"\" " : "") + (ui.item.email ? "<"+ui.item.email+">" : ""));
-			terms.push( "" );
-			this.value = terms.join( ", " );
-			return false;
-		}
-	}).data( "autocomplete" )._renderItem = function( ul, item ) {
-		ul.css({"max-height" : "115px", "overflow-y" : "auto"});
-		if( $(ul).find("li").length > 10 ){
-			return;
-		}
-		return $( "<li></li>" )
-			.data( "item.autocomplete", item )
-			.append( "<a>" + item.name + " - " + item.email + "</a>" )
-			.appendTo( ul );
-	};
-	input.parents("tr:first").find("button").button().click(function(){
-		emQuickSearch($(this).parents("tr:first").find("textarea").val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true);
-	});
-}
 		
 function draw_new_message(border_ID){
@@ -3592,6 +3539,54 @@
 	} 
 	
+	var input_binds = function(input){
+		var mySource = new Array();
+		var myArray = contacts.split(",");
+		for(var i in myArray){
+			var teste = myArray[i].split(";");
+			if(teste.length > 1)
+				mySource.push({name : teste[0], email: teste[1], value : (teste[0] +" - "+teste[1])});
+			else
+				mySource.push({name : "", email: teste[0], value :teste[0]});
+		}
+		input.bind( "keydown", function( event ) {
+			if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) {
+				event.preventDefault();
+			}
+			if((event.keyCode) == 120){
+				emQuickSearch($(this).val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true);
+			}
+		}).autocomplete({
+			minLength: 0,			
+			source: function( request, response ) {
+				response( $.ui.autocomplete.filter(
+					mySource, extractLast( request.term ) ) );
+			},
+			focus: function() {
+				return false;
+			},
+			select: function( event, ui ) {
+				var terms = mySplit( this.value );
+				terms.pop();
+				terms.push( (ui.item.name != "" ? "\""+ui.item.name+"\" " : "") + (ui.item.email ? "<"+ui.item.email+">" : ""));
+				terms.push( "" );
+				this.value = terms.join( ", " );
+				return false;
+			}
+		}).data( "autocomplete" )._renderItem = function( ul, item ) {
+			ul.css({"max-height" : "115px", "overflow-y" : "auto"});
+			if( $(ul).find("li").length > 10 ){
+				return;
+			}
+			return $( "<li></li>" )
+				.data( "item.autocomplete", item )
+				.append( "<a>" + item.name + " - " + item.email + "</a>" )
+				.appendTo( ul );
+		};
+		input.parents("tr:first").find("button").button().click(function(){
+			emQuickSearch($(this).parents("tr:first").find("textarea").val(), "."+$(this).parents("tr:first").attr('class').split("-")[0], ID, undefined, true);
+		});
+	}
 	
-	input_binds(content.find('[name="input_to"]').css({"max-height" : "115px", "overflow-y" : "auto"}).addClass("elastic").elastic().unbind('blur').focus(), ID);	
+	input_binds(content.find('[name="input_to"]').css({"max-height" : "115px", "overflow-y" : "auto"}).addClass("elastic").elastic().unbind('blur').focus());	
 	
 	//Botão TextoRico/TextoSimples
@@ -3836,169 +3831,4 @@
 		});
 	});
-	/*
-	content.find('[name="files[]"]').fileupload({
-		sequentialUploads: true, 
-		limitConcurrentUploads: 1,
-		type: 'post',
-		dataType : 'json',
-		url: "../prototype/post.php",
-		forceIframeTransport: true,
-		dropZone : fileUploadMSG.find(".button").filter(".fileinput-button"),
-		formData: function(form) {
-			return [
-				{
-					name : "mailAttachment[0][source]",
-					value : "files0"
-				},
-				{
-					name : "mailAttachment[0][disposition]",
-					value : $(form[0]['attDisposition'+$(form[0]['abaID']).val()]).val()
-				},
-				{
-					name: "MAX_FILE_SIZE",
-					value : maxAttachmentSize
-				}
-			];
-		},		
-		add: function (e, data) {
-			if(!maxAttachmentSize || data.files[0].size < maxAttachmentSize || is_ie) {
-				setTimeout(function() {
-                    $('#attDisposition'+ID).val('attachment');
-					if(!data.fileInput){
-						data.fileInput = fileUploadMSG.find("input:file");
-						
-						//fileUploadMSG.find("input:file").trigger("change.undefined");
-					}
-					data.submit();
-				}, 3000);
-			}
-		},
-		done: function(e, data){
-			if(!!data.result && data.result != "[]" ){
-				var newAttach = data.result;                             
-				if(!newAttach.mailAttachment.error){
-					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');
-						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');   
-				}else{
-					fileUploadMSG.find('.in-progress:first').parents('p').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();
-		},
-		change: function (e, data) {
-			$.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);
-				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(){
-					var idAttach = $(this).parent().find('input[name="fileId[]"]').val();
-					fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove();
-                                        delAttachment(ID, idAttach)
-					$(this).parent().remove();
-				});
-                                
-                                fileUploadMSG.find('.attachments-list').append(upload);
-
-				if(!maxAttachmentSize || file.size < maxAttachmentSize){
-					fileUploadMSG.find('.fileinput-button.new').append(data.fileInput[0]).removeClass('new');
-					fileUploadMSG.find('.attachments-list').find('[type=file]').addClass('hidden');	
-				}else
-					fileUploadMSG.find(' .fileinput-button.new').removeClass('new');
-
-		})}
-	})
-	fileUploadMSG.find('[name="files[]"]').css({"height" : "20px", "width": "100px", "border-width": "0 0 0px 0px", "-moz-transform" : "none","-o-transform" : 'none'});
-	//fileUploadMSG.unbind('dragover.undefined');
-		
-       fileUploadMSG.find("span.message-attach-link").click(function(event){
-		jQuery('#message-attach-dialog').html(DataLayer.render("../prototype/modules/attach_message/attach_message.ejs", {}));
-		$( "#mailpreview_container span.ui-icon-close" ).click();
-		jQuery('#message-attach-dialog').dialog({
-			width:920,
-			height:550,
-			resizable:false,
-			modal: true,
-			closeOnEscape:true,
-			close:function(event, ui) {event.stopPropagation(); },
-			autoOpen:false
-		});
-		
-		
-		jQuery.getScript("../prototype/modules/attach_message/attach_message.js", function(){
-			jQuery('#message-attach-dialog').dialog('open');
-			jQuery('#message-attach-attach-btn').unbind('click');
-			jQuery('#message-attach-attach-btn').click(function(event){
-				jQuery.each(selectedMessages, function(folder_name, messages) {
-					jQuery.each(selectedMessages[folder_name], function(message_number, message) { 
-						if (message) {
-                                                        var att = new Object();
-                                                        att.folder = folder_name;
-                                                        att.uid = message_number;
-                                                        att.type = 'imapMSG';
-                                                        att.name = onceOpenedMessages[folder_name][message_number].subject + '.eml';
-                                                        var idATT = JSON.stringify(att);
-                                                        addAttachment( ID , idATT);                        
-                                                        var attach = {};
-                                                        attach.fileName = att.name
-                                                        if(attach.fileName.length > 45)
-                                                                attach.fileName = attach.fileName.substr(0, 32) + " ... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length);
-
-                                                        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.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).parent().find('input[name="fileId[]"]').val();
-                                                                    fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]');
-                                                                    delAttachment(ID,idAttach); 
-                                                                    $(this).parent().remove();
-                                                        });	
-                                                        
-                                                        fileUploadMSG.find('.attachments-list').append(upload);   
-						}
-
-					});
-				});
-				
-				jQuery('#message-attach-dialog').dialog('close');
-				
-			});
-			jQuery('#message-attach-cancel-btn').click(function(event){
-				jQuery('#message-attach-dialog').dialog('close');
-			});			
-		});
-
-	});
-	*/
-//   style="width: 100px; height: 20px;"/   
-	//$('[name="files[]"]').css({"height" : "20px", "width": "100px", "border-width": "0 0 0px 0px", "cursor" : "pointer"});// "display": "none"
- 	//$('[name="files[]"]').css({"display": "none"});-moz-transform : none;
 	return ID;
 }
