Index: trunk/expressoMail1_2/js/main.js
===================================================================
--- trunk/expressoMail1_2/js/main.js	(revision 5134)
+++ trunk/expressoMail1_2/js/main.js	(revision 5158)
@@ -405,5 +405,10 @@
 
 function refresh(alert_new_msg){
+
 	var handler_refresh = function(data){
+		
+		if(data['msg_range_end'])
+			if(data['msg_range_end'] > 0)
+				current_page = data['msg_range_end']/preferences.max_email_per_page;
 		if(!verify_session(data))
 			return;
@@ -850,5 +855,5 @@
                     msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf('_r'));
 	}
-
+	refresh();
 	if (parseInt(msgs_number) > 0 || msgs_number.length > 0){
 		if(!not_opem_previus){
@@ -1168,4 +1173,5 @@
 		data.cc = data.cc.replace(/&lt;/gi,"<");
 		data.cc = data.cc.replace(/&gt;/gi,">");
+		var _array_cc = data.cc.split(",");
 	}
 	if (document.getElementById("cco_" + border_ID)){
@@ -1308,5 +1314,17 @@
 			Element("to_" + new_border_ID).value = data.to;
 			Element("to_" + new_border_ID).value += ', ' + data.to_all;
+			
 			if (data.cc){
+			data.cc = new Array();
+			var j = 0;
+				for(i = 0; i < _array_cc.length; i++) {
+				if(_array_cc[i].lastIndexOf(Element("user_email").value) == "-1"){
+					data.cc[j++] = _array_cc[i];
+				}
+			}
+                        if (data.cc != get_lang("undisclosed-recipient"))
+                                data.cc = data.cc.join(",");
+                        else
+								data.cc = "";			
 				document.getElementById("cc_" + new_border_ID).value = data.cc;
 				document.getElementById("a_cc_link_" + new_border_ID).style.display='none';
@@ -1503,6 +1521,15 @@
 		default:
 	}
-
-	
+	//Insere o conteúdo da mensagem e a assinatura no editor de texto simples
+     if (preferences.plain_text_editor == 1){
+	   Element('textplain_rt_checkbox_'+new_border_ID).checked = true;
+	   var txtarea = Element('body_'+new_border_ID);
+	   if (txtarea != null){
+		   if (data.body != undefined)
+		    txtarea.value = data.body;
+	      if (preferences.use_signature == "1")
+            txtarea.value += '\n' + signature;     
+       }
+	 } 
 	Element("border_id_" + new_border_ID).title = title;
 	set_border_caption("border_id_" + new_border_ID, title);
@@ -2382,5 +2409,5 @@
 
 	var folder= Element('border_id_0').innerHTML;
-	var thead = Element('divScrollHead_'+numBox).firstChild.firstChild.innerHTML;
+	//var thead = Element('divScrollHead_'+numBox).firstChild.firstChild.innerHTML; 
 	
 	msgs_number = get_selected_messages();
@@ -2399,14 +2426,13 @@
 	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'");
+	//thead = thead.replace(seekDot, "style='display:none'"); 
+	var thead = "<tr class=\"message_header\"><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'");
+	//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'");
+	//thead = thead.replace(seekDot, "style='display:none'"); 
 	tbody = tbody.replace(seekDot, "style='display:none'");
-	thead = thead.replace("<td style=\"cursor: pointer;\"></td>", "");		
-	thead = thead.replace("<td style=\"cursor: pointer;\" style='display:none'><input title=\"Selecionar todas as mensagens.\" class=\"checkbox\" id=\"chk_box_select_all_messages\" type=\"checkbox\"></td>", "");
 	while (1){
 		try{
