Index: /trunk/expressoMail1_2/js/main.js
===================================================================
--- /trunk/expressoMail1_2/js/main.js	(revision 7522)
+++ /trunk/expressoMail1_2/js/main.js	(revision 7523)
@@ -3894,52 +3894,80 @@
 }
 
+function newTbody(messages){
+	var tbody = $("<tbody>");
+	$.each(messages,function(index,msg){
+		var newTr = make_tr_message(msg,get_current_folder(),msg.offsetToGMT);
+		if (msg.attachments && msg.attachments.length){
+			$(newTr).find('td').eq(1).html("<img src ='templates/"+template+"/images/clip.gif'>");
+		}		
+		tbody.append(newTr);
+	});
+	return tbody.html();
+}
+
 function print_messages_list(){
-	var folder= Element('border_id_0').innerHTML;
-	//var thead = Element('divScrollHead_'+numBox).firstChild.firstChild.innerHTML; 
-	
+	var print_list = function(tbody,folder){
+		var print_width = screen.width - 200;
+		var x = ((screen.width - print_width) / 2);
+		var y = ((screen.height - 400) / 2) - 35;
+		var window_print = window.open('','ExpressoMail','width='+print_width+',height=400,resizable=yes,scrollbars=yes,left='+x+',top='+y);
+		seekDot = (is_ie ? /width=24/gi : /width="24"/gi);
+		//thead = thead.replace(seekDot, "style='display:none'"); 
+		var thead = "<tr class=\"message_header\"> <td width=\"3%\"></td><td width=\"2%\"></td><td width=\"1%\"></td><td width=\"1%\"></td><td width=\"1%\"></td><td width=\"1%\"></td><td width=\"2%\"></td><td width=\"2%\"></td><td width=\"2%\"></td><td id=\"message_header_SORTFROM_0\" class=\"th_resizable\" align=\"left\" width=\"20%\">De</td><td id=\"message_header_SORTSUBJECT_0\" class=\"th_resizable\" align=\"left\" width=\"*\">Assunto</td><td id=\"message_header_SORTARRIVAL_0\" class=\"th_resizable\" align=\"center\" width=\"11%\"><b>Data</b><img src=\"templates/default/images/arrow_descendant.gif\"></td><td id=\"message_header_SORTSIZE_0\" class=\"th_resizable\" align=\"left\" width=\"11%\">Tamanho</td></tr>";
+		tbody = tbody.replace(seekDot, "style='display:none'");
+		seekDot = (is_ie ? /width=16/gi : /width="16"/gi);
+		//thead = thead.replace(seekDot, "style='display:none'"); 
+		tbody = tbody.replace(seekDot, "style='display:none'");
+		seekDot = (is_ie ? /width=12/gi : /width="12"/gi);
+		//thead = thead.replace(seekDot, "style='display:none'"); 
+		tbody = tbody.replace(seekDot, "style='display:none'");
+		while (1){
+			try{
+				window_print.document.open();
+				var html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>'
+				+ '<head><link rel="stylesheet" type="text/css" href="templates/'+template+'/print.css"></head>'
+		 	    + cabecalho + '</h4><hr>' 
+				+ '<h2>'+$('#border_id_0').html()+'</h2><hr/><blockquote><font size="2">'
+				+ '<table width="100%" cellpadding="0" cellspacing="0">'
+				+ '<thead>' + thead + '</thead><tbody>' + tbody + '</tbody>'
+				+ '</table></font></blockquote></body></html>';
+				window_print.document.write(html);
+				window_print.document.close();
+				break;
+			}
+			catch(e){
+				//alert(e.message);
+			}
+		}
+		window_print.document.close();
+		window_print.print();
+	}
 	msgs_number = get_selected_messages();
 	if(msgs_number == false){
-		var tbody = Element('divScrollMain_'+numBox).firstChild.firstChild.innerHTML;
+		var tbody = Element('divScrollMain_0').firstChild.firstChild.innerHTML;
+		print_list(tbody);
 	}else{
-		msgs_number = msgs_number.split(",");
-		var tbody = "";
-		for(var i = 0; i < msgs_number.length; i++){
-			tbody += "<tr id="+msgs_number[i]+" class=\"tr_msg_unread tr_msg_read2\">"+$("#"+msgs_number[i]).clone().find(".checkbox").remove().end().html()+"</tr>";
-		}	
-	}
-	var print_width = screen.width - 200;
-	var x = ((screen.width - print_width) / 2);
-	var y = ((screen.height - 400) / 2) - 35;
-	var window_print = window.open('','ExpressoMail','width='+print_width+',height=400,resizable=yes,scrollbars=yes,left='+x+',top='+y);
-	seekDot = (is_ie ? /width=24/gi : /width="24"/gi);
-	//thead = thead.replace(seekDot, "style='display:none'"); 
-	var thead = "<tr class=\"message_header\"> <td width=\"3%\"></td><td width=\"2%\"></td><td width=\"1%\"></td><td width=\"1%\"></td><td width=\"1%\"></td><td width=\"1%\"></td><td width=\"2%\"></td><td width=\"2%\"></td><td width=\"2%\"></td><td id=\"message_header_SORTFROM_0\" class=\"th_resizable\" align=\"left\" width=\"20%\">De</td><td id=\"message_header_SORTSUBJECT_0\" class=\"th_resizable\" align=\"left\" width=\"*\">Assunto</td><td id=\"message_header_SORTARRIVAL_0\" class=\"th_resizable\" align=\"center\" width=\"11%\"><b>Data</b><img src=\"templates/default/images/arrow_descendant.gif\"></td><td id=\"message_header_SORTSIZE_0\" class=\"th_resizable\" align=\"left\" width=\"11%\">Tamanho</td></tr>";
-	tbody = tbody.replace(seekDot, "style='display:none'");
-	seekDot = (is_ie ? /width=16/gi : /width="16"/gi);
-	//thead = thead.replace(seekDot, "style='display:none'"); 
-	tbody = tbody.replace(seekDot, "style='display:none'");
-	seekDot = (is_ie ? /width=12/gi : /width="12"/gi);
-	//thead = thead.replace(seekDot, "style='display:none'"); 
-	tbody = tbody.replace(seekDot, "style='display:none'");
-	while (1){
-		try{
-			window_print.document.open();
-			var html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>'
-			+ '<head><link rel="stylesheet" type="text/css" href="templates/'+template+'/print.css"></head>'
-	 	    + cabecalho + '</h4><hr>' 
-			+ '<h2>'+folder+'</h2><hr/><blockquote><font size="2">'
-			+ '<table width="100%" cellpadding="0" cellspacing="0">'
-			+ '<thead>' + thead + '</thead><tbody>' + tbody + '</tbody>'
-			+ '</table></font></blockquote></body></html>';
-			window_print.document.write(html);
-			window_print.document.close();
-			break;
-		}
-		catch(e){
-			//alert(e.message);
-		}
-	}
-	window_print.document.close();
-	window_print.print();
+		var messages = {};
+		messages[get_current_folder()] = msgs_number.split(',');
+		$.ajax({			
+		url: "controller.php?" + $.param( {action: "$this.imap_functions.getMessages",
+            details : "all",
+            messages : messages,
+			}),
+		success: function(data){
+			data = connector.unserialize(data);
+			if(data){
+				data = data[get_current_folder()];
+              	print_list(newTbody(data));
+			}
+		},
+		beforeSend: function( jqXHR, settings ){
+			connector.showProgressBar();
+		},
+		complete: function( jqXHR, settings ){
+			connector.hideProgressBar();
+		}
+	});	
+	}
 }
 
Index: /trunk/expressoMail1_2/js/draw_api.js
===================================================================
--- /trunk/expressoMail1_2/js/draw_api.js	(revision 7494)
+++ /trunk/expressoMail1_2/js/draw_api.js	(revision 7523)
@@ -1897,5 +1897,5 @@
 
 		td_element2 = createTDElement(0,1,"td_msg");
-		if (headers_msgs.attachment == 1 || headers_msgs.attachment.number_attachments> 0)
+		if (headers_msgs.attachment && (headers_msgs.attachment == 1 || headers_msgs.attachment.number_attachments> 0))
 			td_element2.innerHTML = "<img src ='templates/"+template+"/images/clip.gif' >";
 
