Index: trunk/expressoMail1_2/js/search.js
===================================================================
--- trunk/expressoMail1_2/js/search.js	(revision 569)
+++ trunk/expressoMail1_2/js/search.js	(revision 607)
@@ -461,6 +461,8 @@
 	searchE.prototype.open_msg = function(mailbox, uid_msg, subject){
 		var handler_get_msg = function(data){
+//		alert(mailbox);
 			if(Element("border_id_" + uid_msg + "_r")){alert(get_lang("This message is already opened!"));}
 			else{draw_message(data,create_border(url_decode(subject), uid_msg + "_r"));}
+			//set_msg_as_read(msgs_to_set[i], false);
 		}
 		var args   = "$this.imap_functions.get_info_msg";
Index: trunk/expressoMail1_2/js/draw_api.js
===================================================================
--- trunk/expressoMail1_2/js/draw_api.js	(revision 569)
+++ trunk/expressoMail1_2/js/draw_api.js	(revision 607)
@@ -1,7 +1,20 @@
-var openBox = {
+var openTab = {
+	'type' : [], // 8 types of tabs, further info. see expressolivre.org/dev/wiki/mail/Documentacao
 	'content_id' : [],
-	'tab_folder' : []
- };
-var numBox = 0; // Open Mailboxes at context
+	'imapUid' : [], // Stores the imap email number of current tab
+	'countFile' : [0,0,0,0,0,0,0,0,0,0], // Stores the number of files attached in current tab
+	'imapBox' : [], // Stores the folder name
+	'toPreserve' : [] // Check if the message should be removed from draft after send
+};
+var tabTypes = {
+	'new':4,
+	'forward':6,
+	'reply_with_history':7,
+	'reply_to_all_with_history':7,
+	'reply_without_history':7,
+	'reply_to_all_without_history':7,
+	'edit':5
+	}
+var currentTab,numBox = 0; // Open Tab and num of mailboxes opened at context
 
 function draw_tree_folders(folders){
@@ -143,5 +156,5 @@
 			}
 			folders = data;
-			cExecute ("$this.imap_functions.get_range_msgs2&folder=INBOX&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type=SORTARRIVAL&sort_box_reverse=1", handler_draw_box);
+			cExecute ("$this.imap_functions.get_range_msgs2&folder=INBOX&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type=SORTARRIVAL&search_box_type=ALL&sort_box_reverse=1", handler_draw_box);
 		}
 }
@@ -154,5 +167,5 @@
 // Action on change folders.
 function change_folder(folder, folder_name){
-	if (openBox.tab_folder[0] != folder)
+	if (openTab.imapBox[0] != folder)
 	{
 		current_folder = folder;
@@ -309,6 +322,6 @@
 		document.getElementById("border_table").width = "99.5%";
 
-	openBox.content_id[numBox] = document.getElementById("content_id_"+numBox);	
-	openBox.tab_folder[numBox] = msg_folder;
+	openTab.content_id[numBox] = document.getElementById("content_id_"+numBox);	
+	openTab.imapBox[numBox] = msg_folder;
 	
 	table_message_header_box = document.getElementById("table_message_header_box_"+numBox);
@@ -382,5 +395,5 @@
 		tbody_element.appendChild(tr_element);
 		table_element.appendChild(tbody_element);
-		openBox.content_id[numBox].appendChild(table_element);
+		openTab.content_id[numBox].appendChild(table_element);
 	}
 	draw_header_box();
@@ -450,5 +463,5 @@
 	// Fim: Redimensiona DIV SCROLL
 	_divScroll.appendChild(table_element);
-	openBox.content_id[numBox].appendChild(_divScroll);
+	openTab.content_id[numBox].appendChild(_divScroll);
 	
 	var f_unseen = 0;
@@ -709,5 +722,5 @@
 	search_box_type = search;
 
-	cExecute ("$this.imap_functions.get_range_msgs2&folder="+current_folder+"&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&search_box_type="+search+"&sort_box_type="+sort+"&sort_box_reverse="+sort_box_reverse+"", handler_draw_box);
+	cExecute ("$this.imap_functions.get_range_msgs2&folder="+current_folder+"&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type="+sort+"&search_box_type="+search+"&sort_box_reverse="+sort_box_reverse+"", handler_draw_box);
 	current_page = 1;
 	//Comentado para nao sobrepor o numero de msgs nao lidas ao utilizar os filtros
@@ -761,28 +774,27 @@
 	//img_next_msg.onclick = function () {cExecute ("$this.imap_functions.get_info_next_msg&msg_number="+ info_msg.msg_number + "&msg_folder="+ info_msg.msg_folder + "&sort_box_type="+ sort_box_type +  "&search_box_type="+ search_box_type +"&sort_box_reverse="+ sort_box_reverse +"&reuse_border="+ID, show_msg)};
 	var folder = document.getElementById(ID.substr(0, ID.indexOf('_')));
-	if (!folder)
-	        delete_border(ID);
-	if (folder.nextSibling)
-	{
-		var inbox = folder.nextSibling.name;
-	        if (inbox)
-	                info_msg.msg_folder = inbox;
-
-		var next_msg = folder.nextSibling.id;
+	if (!folder){
+		delete_border(ID);
+		return;
+		}
+	if (folder.nextSibling){
+		var nextMsgBox = folder.nextSibling.name?folder.nextSibling.name:info_msg.msg_folder;
 		img_next_msg.onclick = function()
 		{
-			cExecute("$this.imap_functions.get_info_msg&msg_number="+next_msg+"&msg_folder=" + info_msg.msg_folder+"&reuse_border="+ID, show_msg);
+			currentTab = ID;
+			openTab.type[ID] = 2;
+			cExecute("$this.imap_functions.get_info_msg&msg_number="+folder.nextSibling.id+"&msg_folder="+nextMsgBox, show_msg);
 		};
 	}
 	else
 		img_next_msg.onclick = function()
-		{
-			current_page++;
-			msg_range_end = (current_page*preferences.max_email_per_page);
-			msg_range_begin = (msg_range_end-(preferences.max_email_per_page)+1);
-			kill_current_box();
-			cExecute ('$this.imap_functions.get_range_msgs2&folder='+get_current_folder()+'&msg_range_begin='+msg_range_begin+'&msg_range_end='+msg_range_end+'&sort_box_reverse=1', function handler(data){draw_box(data, get_current_folder());})
-			delete_border(ID);
-		};
+			{
+				/*current_page++;
+				msg_range_end = (current_page*preferences.max_email_per_page);
+				msg_range_begin = (msg_range_end-(preferences.max_email_per_page)+1);
+				kill_current_box();
+				cExecute ('$this.imap_functions.get_range_msgs2&folder='+get_current_folder()+'&msg_range_begin='+msg_range_begin+'&msg_range_end='+msg_range_end+'&sort_box_reverse=1', function handler(data){draw_box(data, get_current_folder());}) */
+					delete_border(ID);
+			};
 
 	var img_space = document.createElement("SPAN");
@@ -797,16 +809,16 @@
 	//img_previous_msg.onclick = function () {cExecute ("$this.imap_functions.get_info_previous_msg&msgs_number="+ info_msg.msg_number + "&folder="+ info_msg.msg_folder + "&sort_box_type="+ sort_box_type+ "&search_box_type="+ search_box_type + "&sort_box_reverse="+ sort_box_reverse +"&reuse_border="+ID, show_msg)}
 	folder = document.getElementById(ID.substr(0, ID.indexOf('_')));
-	if (!folder)
+	if (!folder){
 	        delete_border(ID);
+		return;
+		}
 	if (folder.previousSibling)
 	{
-		var inbox = folder.previousSibling.name;
-		if (inbox)
-			info_msg.msg_folder = inbox;
-
-		var previous_msg = folder.previousSibling.id;
+		var previousMsgBox = folder.previousSibling.name?folder.previousSibling.name:info_msg.msg_folder;
 		img_previous_msg.onclick = function()
 		{
-			cExecute("$this.imap_functions.get_info_msg&msg_number="+previous_msg+"&msg_folder=" + info_msg.msg_folder+"&reuse_border="+ID, show_msg);			
+			currentTab = ID;
+			openTab.type[ID] = 2;
+			cExecute("$this.imap_functions.get_info_msg&msg_number="+folder.previousSibling.id+"&msg_folder=" + previousMsgBox, show_msg);
 		};
 	}
@@ -1445,5 +1457,5 @@
 	}
 //	var option_save_as		= '<span class="message_options" onclick=wfolders.makeWindow("'+ID+'","save");>'+get_lang("Save as")+'</span> | ';
-	var option_save			= '<span id="save_message_options" class="message_options" onclick="newMessageTab.toPreserve['+ID+'] = true; save_msg('+ID+');">'+get_lang("Save")+'</span> | ';
+	var option_save			= '<span id="save_message_options_'+ID+'" class="message_options" onclick="openTab.toPreserve['+ID+'] = true; save_msg('+ID+');">'+get_lang("Save")+'</span> | ';
 	var option_search		= '<span class="message_options" onclick=openListUsers("'+ID+'");>'+get_lang("Search")+'</span>';
 	td_menu_new_message.innerHTML = option_send + option_send_and_file + option_save + option_search;
Index: trunk/expressoMail1_2/js/rich_text_editor.js
===================================================================
--- trunk/expressoMail1_2/js/rich_text_editor.js	(revision 389)
+++ trunk/expressoMail1_2/js/rich_text_editor.js	(revision 607)
@@ -1,9 +1,2 @@
-var newMessageTab = {
-		'imapUid' : [], // Stores the imap email number of current tab
-		'countFile' : [0,0,0,0,0,0,0,0,0,0], // Stores the number of files attached in current tab
-		'imapBox' : [], // Stores the folder name
-		'toPreserve' : [] // Check if the message should be removed from draft after send
-		};
-
 function cRichTextEditor(){
 	this.emwindow   = new Array;
@@ -303,5 +296,5 @@
 
 	RichTextEditor.saveFlag = 0; // See if save function finished
-	var save_link = document.getElementById("save_message_options");
+	var save_link = document.getElementById("save_message_options_"+id);
 	//save_link.onclick = function () {};
 	save_msg(id);
@@ -314,5 +307,5 @@
 	else
 		if (RichTextEditor.saveFlag == 1)
-			this.editorCommand('Image', './inc/show_embedded_attach.php?msg_folder=INBOX/'+draftsfolder+'&msg_num='+newMessageTab.imapUid[id]+'&msg_part='+(newMessageTab.countFile[id]+1));
+			this.editorCommand('Image', './inc/show_embedded_attach.php?msg_folder=INBOX/'+draftsfolder+'&msg_num='+openTab.imapUid[id]+'&msg_part='+(openTab.countFile[id]+1));
 			// this.editorCommand('Image', '.inc/gotodownload.php?msg_folder="+msg_folder+"&msg_number="+msg_number+"&idx_file="+idx_file+"&msg_part="+msg_part+params'));
 }
Index: trunk/expressoMail1_2/js/QuickSearchUser.js
===================================================================
--- trunk/expressoMail1_2/js/QuickSearchUser.js	(revision 118)
+++ trunk/expressoMail1_2/js/QuickSearchUser.js	(revision 607)
@@ -83,6 +83,11 @@
 	emQuickSearchUser.prototype.create_new_message = function (cn, mail) {
 		_this.close_window();
-		Element("msg_number").value = cn+" <"+mail+">";
-		new_message("new","null");
+		if (openTab.type[currentTab] != 4)
+		{
+			Element("msg_number").value = cn+" <"+mail+">";
+			new_message("new","null");
+		}else{
+			Element('to_'+currentTab).innerHTML = cn+" <"+mail+">";
+		}
 	}
 
Index: trunk/expressoMail1_2/templates/default/config.tpl
===================================================================
--- trunk/expressoMail1_2/templates/default/config.tpl	(revision 569)
+++ trunk/expressoMail1_2/templates/default/config.tpl	(revision 607)
@@ -22,5 +22,5 @@
     </td>
    </tr>
-   <tr bgcolor="{row_on}">
+   <tr bgcolor="{row_off}">
    <td>{lang_Do_you_want_to_cache_php_requests_in_javascript?}</td>
    <td>
@@ -31,5 +31,5 @@
    </td>
    </tr>
-   <tr bgcolor="{row_off}">
+   <tr bgcolor="{row_on}">
     <td>{lang_Do_you_want_to_use_the_spam_filter?}</td>
     <td>
@@ -40,21 +40,27 @@
     </td>
    </tr>
-   <tr bgcolor="{row_on}">
+   <tr bgcolor="{row_off}">
     <td>{lang_Command_for_spam}</td>
     <td>
-	<input type="text" name="newsettings[expressoMail_command_for_spam]" value="{value_expressoMail_command_for_spam}" size="60" /> 
+    <input type="text" name="newsettings[expressoMail_command_for_spam]" value="{value_expressoMail_command_for_spam}" size="60" /> 
     </td>
-   <tr bgcolor="{row_off}">
+    <tr bgcolor="{row_on}">
     <td>{lang_Command_for_unmark_spam}</td>
     <td>
-	<input size="60" name="newsettings[expressoMail_command_for_ham]" value="{value_expressoMail_command_for_ham}"> 
+    <input size="60" name="newsettings[expressoMail_command_for_ham]" value="{value_expressoMail_command_for_ham}"> 
     </td>
-   </tr>
-   <tr bgcolor="{row_on}">
+    </tr>
+    <tr bgcolor="{row_off}">
+    <td>{lang_Always_confirm_notification_to_these_domains}</td>
+    <td>
+    <input size="60" name="newsettings[expressoMail_notification_domains]" value="{value_expressoMail_notification_domains}">
+    </td>
+    </tr>
+    <tr bgcolor="{row_on}">
     <td>{lang_Number_of_dynamic_contacts}</td>
     <td>
-	<input size="1" name="newsettings[expressoMail_Number_of_dynamic_contacts]" value="{value_expressoMail_Number_of_dynamic_contacts}"> 
+    <input size="1" name="newsettings[expressoMail_Number_of_dynamic_contacts]" value="{value_expressoMail_Number_of_dynamic_contacts}"> 
     </td>
-   </tr>
+    </tr>
 <!-- END body -->
 <!-- BEGIN footer -->
