Index: trunk/expressoMail1_2/js/messages_controller.js
===================================================================
--- trunk/expressoMail1_2/js/messages_controller.js	(revision 4790)
+++ trunk/expressoMail1_2/js/messages_controller.js	(revision 4826)
@@ -44,4 +44,5 @@
 			expresso_local_messages.delete_msgs(msgs_number, border_ID);
 			draw_tree_local_folders();
+                         update_local_box();
 		}
 	}
@@ -228,4 +229,5 @@
 				this.aux_interface_remove_mails(msgs_number, new_folder_name, border_ID);
 				draw_tree_local_folders();
+                                update_local_box();
 			}
 			else 
Index: trunk/expressoMail1_2/js/draw_api.js
===================================================================
--- trunk/expressoMail1_2/js/draw_api.js	(revision 4821)
+++ trunk/expressoMail1_2/js/draw_api.js	(revision 4826)
@@ -345,49 +345,61 @@
 	 * Pastas locais
 	 */
-	if(preferences.use_local_messages==1 || expresso_offline) {
-		var local_folders = expresso_local_messages.list_local_folders();
-		var has_changes = false;
-		for (var i in local_folders) { //Coloca as pastas locais.
-
-			var new_caption = local_folders[i][0];
-			if(local_folders[i][0].indexOf("/")!="-1") {
-				final_pos = local_folders[i][0].lastIndexOf("/");
-				new_caption = local_folders[i][0].substr(final_pos+1);
-			}
-
-			var folder_unseen = Element('dftree_local_'+local_folders[i][0]+'_unseen');
-
-			if ((folder_unseen) && (local_folders[i][1] > 0))
-			{
-				folder_unseen.innerHTML = local_folders[i][1];
-				has_changes = true;
-			}
-			else if (local_folders[i][1] > 0)
-			{
-				tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(new_caption) + '<font style=color:red>&nbsp(</font><span id="dftree_local_'+local_folders[i][0]+'_unseen" style=color:red>'+local_folders[i][1]+'</span><font style=color:red>)</font>'});
-				tree_folders.getNodeById("local_"+local_folders[i][0])._refresh();
-				has_changes = true;
-			}
-			else if (local_folders[i][1] <= 0)
-			{
-				tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(new_caption)});
-				tree_folders.getNodeById("local_"+local_folders[i][0])._refresh();
-				has_changes = true;
-			}
+		if(preferences.use_local_messages==1 || expresso_offline) {
+			var local_folders = expresso_local_messages.list_local_folders();
+			var has_changes = false;
+			for (var i in local_folders) { //Coloca as pastas locais.
+
+				var new_caption = local_folders[i][0];
+				if(local_folders[i][0].indexOf("/")!="-1") {
+					final_pos = local_folders[i][0].lastIndexOf("/");
+					new_caption = local_folders[i][0].substr(final_pos+1);
+				}
+
+				var folder_unseen = Element('dftree_local_'+local_folders[i][0]+'_unseen');
+
+				if ((folder_unseen) && (local_folders[i][1] > 0))
+				{
+					folder_unseen.innerHTML = local_folders[i][1];
+					has_changes = true;
+				}
+				else if (local_folders[i][1] > 0)
+				{
+					tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(new_caption) + '<font style=color:red>&nbsp(</font><span id="dftree_local_'+local_folders[i][0]+'_unseen" style=color:red>'+local_folders[i][1]+'</span><font style=color:red>)</font>'});
+					tree_folders.getNodeById("local_"+local_folders[i][0])._refresh();
+					has_changes = true;
+				}
+				else if (local_folders[i][1] <= 0)
+				{
+					tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(new_caption)});
+					tree_folders.getNodeById("local_"+local_folders[i][0])._refresh();
+					has_changes = true;
+				}
 
 			if("local_"+local_folders[i][0] == get_current_folder()){
-				var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML);
-				if(!isNaN(old_new_m) && old_new_m < local_folders[i][1]){
-					Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) + (parseInt(local_folders[i][1])-old_new_m);
-				}
-				Element('new_m').innerHTML = local_folders[i][1] ? '<font color="RED">'+local_folders[i][1]+'</font>' : 0;
-				draw_paging(Element('tot_m').innerHTML);
-				has_changes = true;
-			}
-		}
-		if(has_changes)
-			tree_folders.getNodeById("local_root").open();
-
-	}
+					var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML);
+					if(!isNaN(old_new_m) && old_new_m < local_folders[i][1]){
+						Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) + (parseInt(local_folders[i][1])-old_new_m);
+					}
+					Element('new_m').innerHTML = local_folders[i][1] ? '<font color="RED">'+local_folders[i][1]+'</font>' : 0;
+					draw_paging(Element('tot_m').innerHTML);
+					has_changes = true;
+			}
+		}
+			if(has_changes)
+				tree_folders.getNodeById("local_root").open();
+ 	}
+}
+
+
+function update_local_box(){
+    msg_range_end = (current_page*preferences.max_email_per_page);
+    msg_range_begin = (msg_range_end-(preferences.max_email_per_page)+1);
+    folder=get_current_folder();
+    var msgs  = expresso_local_messages.get_local_range_msgs(folder.substr(6),msg_range_begin,preferences.max_email_per_page,sort_box_type,sort_box_reverse,search_box_type,preferences.preview_msg_subject,preferences.preview_msg_tip);
+    alternate_border(0);
+    draw_box(msgs, folder, true);
+    draw_paging(msgs.num_msgs);
+    Element("tot_m").innerHTML = msgs.num_msgs;
+    update_menu();
 }
 
@@ -1389,5 +1401,5 @@
 				var spanSender = document.createElement("SPAN");
 				spanSender.onmouseover = function (event) {this.style.textDecoration = "underline";try {InfoContact.begin(this,headers_msgs.from.email)} catch(e){};};
-				spanSender.onmouseout = function (){ try {this.style.textDecoration = "none"; clearTimeout(InfoContact.timeout);} catch(e){}};
+				spanSender.onmouseout = function (){try {this.style.textDecoration = "none";clearTimeout(InfoContact.timeout);} catch(e){}};
 				spanSender.innerHTML =  headers_msgs.from.name != null ? headers_msgs.from.name : headers_msgs.from.email;
 				if (spanSender.innerHTML.indexOf(" ") == '-1' && spanSender.innerHTML.length > 25){
@@ -1726,6 +1738,6 @@
 	var option_hide_more = document.createElement("SPAN");
 	option_hide_more.className = 'message_options';
-        option_hide_more.onmouseover=function () { this.className='message_options_active'; };
-        option_hide_more.onmouseout=function () { this.className='message_options' };
+        option_hide_more.onmouseover=function () {this.className='message_options_active';};
+        option_hide_more.onmouseout=function () {this.className='message_options'};
 	options.align = 'right';
 	option_hide_more.value = 'more_options';
@@ -1750,10 +1762,10 @@
 	var option_mark_as_unseen = document.createElement("SPAN");
 	option_mark_as_unseen.className = "message_options";
-	option_mark_as_unseen.onclick = function () { changeLinkState(this,'seen');
+	option_mark_as_unseen.onclick = function () {changeLinkState(this,'seen');
 		proxy_mensagens.proxy_set_message_flag(folder_id,'unseen');
 		write_msg(get_lang('Message marked as ')+get_lang("Unseen"));
 	};
-	option_mark_as_unseen.onmouseover=function () { this.className='message_options_active'; };
-	option_mark_as_unseen.onmouseout=function () { this.className='message_options' };
+	option_mark_as_unseen.onmouseover=function () {this.className='message_options_active';};
+	option_mark_as_unseen.onmouseout=function () {this.className='message_options'};
 	option_mark_as_unseen.innerHTML = get_lang("Unseen");
 
@@ -1761,6 +1773,6 @@
 	option_mark_important.className = 'message_options';
 	option_mark_important.style.paddingLeft = "10px";
-	option_mark_important.onmouseover=function () { this.className='message_options_active'; };
-	option_mark_important.onmouseout=function () { this.className='message_options' };
+	option_mark_important.onmouseover=function () {this.className='message_options_active';};
+	option_mark_important.onmouseout=function () {this.className='message_options'};
 
 	if (info_msg.Flagged == "F"){
@@ -1778,5 +1790,5 @@
 	}
 	else{
-		option_mark_important.onclick = function() { changeLinkState(this,'normal');
+		option_mark_important.onclick = function() {changeLinkState(this,'normal');
 			proxy_mensagens.proxy_set_message_flag(folder_id,'flagged');
 			write_msg(get_lang('Message marked as ')+get_lang("Important"));
@@ -1801,6 +1813,6 @@
 	option_forward.className = 'message_options';
 	option_forward.onclick = function(){new_message('forward', ID);};
-	option_forward.onmouseover=function () { this.className='message_options_active'; };
-        option_forward.onmouseout=function () { this.className='message_options' };
+	option_forward.onmouseover=function () {this.className='message_options_active';};
+        option_forward.onmouseout=function () {this.className='message_options'};
 	option_forward.innerHTML = get_lang('Forward');
 	options.appendChild(space1);
@@ -1811,6 +1823,6 @@
 	option_reply.onclick = function(){new_message('reply_with_history', ID);};
 	option_reply.innerHTML = get_lang('Reply');
-	option_reply.onmouseover=function () { this.className='message_options_active'; };
-	option_reply.onmouseout=function () { this.className='message_options' };
+	option_reply.onmouseover=function () {this.className='message_options_active';};
+	option_reply.onmouseout=function () {this.className='message_options'};
 
 	options.appendChild(space2);
@@ -2565,5 +2577,5 @@
 		case 'important':
 			{
-				el.onclick = function(){changeLinkState(el,'normal');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'flagged'); write_msg(get_lang('Message marked as ')+get_lang("Important"))}
+				el.onclick = function(){changeLinkState(el,'normal');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'flagged');write_msg(get_lang('Message marked as ')+get_lang("Important"))}
 				break;
 			}
@@ -2583,5 +2595,5 @@
 		case 'unseen':
 			{
-				el.onclick = function(){  changeLinkState(el,'seen');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'unseen');write_msg(get_lang('Message marked as ')+get_lang("unseen"))}
+				el.onclick = function(){changeLinkState(el,'seen');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'unseen');write_msg(get_lang('Message marked as ')+get_lang("unseen"))}
 				break;
 
@@ -2589,5 +2601,5 @@
 		case 'seen':
 			{
-				el.onclick = function(){  changeLinkState(el,'unseen');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'seen');write_msg(get_lang('Message marked as ')+get_lang("seen"))}
+				el.onclick = function(){changeLinkState(el,'unseen');proxy_mensagens.proxy_set_message_flag(currentTab.substr(0,currentTab.indexOf("_r")),'seen');write_msg(get_lang('Message marked as ')+get_lang("seen"))}
 				break;
 
@@ -2720,5 +2732,5 @@
         input_replyto.style.width = "100%";
 	input_replyto.setAttribute("wrap","soft");
-        input_replyto.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus', this.id);};
+        input_replyto.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer));search_contacts('onfocus', this.id);};
 	input_replyto.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);};
 
@@ -2803,5 +2815,5 @@
 	input_to.style.width = "100%";
 	input_to.setAttribute("wrap","soft");
-	input_to.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus', this.id);};
+	input_to.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer));search_contacts('onfocus', this.id);};
 	input_to.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);};
 	if (!is_ie)
@@ -2899,5 +2911,5 @@
 	input_cc.setAttribute("tabIndex","1");
 	input_cc.style.width = "100%";
-	input_cc.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus',this.id);};
+	input_cc.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer));search_contacts('onfocus',this.id);};
 	input_cc.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);};
 	if (!is_ie)
@@ -2981,5 +2993,5 @@
 	input_cco.setAttribute("tabIndex","1");
 	input_cco.style.width = "100%";
-	input_cco.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer)); search_contacts('onfocus',this.id);};
+	input_cco.onfocus = function(){clearTimeout(parseInt(setTimeOutLayer));search_contacts('onfocus',this.id);};
 	input_cco.onblur = function(){setTimeOutLayer=setTimeout('search_contacts("lostfocus","'+this.id+'")',100);};
 
@@ -3057,5 +3069,5 @@
 	a_cc_link.setAttribute("href","javascript:void(0)");
 	a_cc_link.setAttribute("tabIndex","-1");
-	a_cc_link.onclick = function () {this.style.display='none';document.getElementById('tr_cc_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cc.focus(); return false;}
+	a_cc_link.onclick = function () {this.style.display='none';document.getElementById('tr_cc_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cc.focus();return false;}
 	td2_link.appendChild(a_cc_link);
 	var space = document.createElement("span");
@@ -3068,5 +3080,5 @@
 	a_cco_link.setAttribute("href","javascript:void(0)");
 	a_cco_link.setAttribute("tabIndex","-1");
-	a_cco_link.onclick = function () {this.style.display='none';document.getElementById('tr_cco_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cco.focus(); return false;}
+	a_cco_link.onclick = function () {this.style.display='none';document.getElementById('tr_cco_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cco.focus();return false;}
 	td2_link.appendChild(a_cco_link);
 	var space = document.createElement("span");
@@ -3079,5 +3091,5 @@
 	a_replyto_link.setAttribute("href","javascript:void(0)");
 	a_replyto_link.setAttribute("tabIndex","-1");
-	a_replyto_link.onclick = function () {this.style.display='none';document.getElementById('tr_replyto_'+ID).style.display='';document.getElementById('space_link_2_'+ID).style.display='none';input_replyto.focus(); return false;}
+	a_replyto_link.onclick = function () {this.style.display='none';document.getElementById('tr_replyto_'+ID).style.display='';document.getElementById('space_link_2_'+ID).style.display='none';input_replyto.focus();return false;}
 	td2_link.appendChild(a_replyto_link);
 	tr_link.appendChild(td1_link);
