Index: branches/2.0/expressoMail1_2/js/abas.js
===================================================================
--- branches/2.0/expressoMail1_2/js/abas.js	(revision 2202)
+++ branches/2.0/expressoMail1_2/js/abas.js	(revision 2605)
@@ -127,5 +127,5 @@
 
 	td.setAttribute("align", "right");
-	td.onclick = function(){alternate_border(ID);};
+	td.onclick = function(){alternate_border(ID);resizeWindow()};
 	td.setAttribute("noWrap","true");
         td.alt = borderTitle;
@@ -155,10 +155,4 @@
 	div.style.display='';
 
-	var bar = document.getElementById("toolbar");
-	var offset = 0;
-	if(bar.style.visibility != 'hidden')
-		offset = bar.offsetHeight ? bar.offsetHeight :  bar.clientHeight;
-
-	div.style.height = document.body.clientHeight - offset - (is_ie ? 76 : 86);
 	div.style.overflow = "hidden";
 
@@ -276,4 +270,5 @@
 	content = Element('content_id_' + ID);
 	content.parentNode.removeChild(content);
+	resizeWindow();
 	return true;
 }
Index: branches/2.0/expressoMail1_2/js/common_functions.js
===================================================================
--- branches/2.0/expressoMail1_2/js/common_functions.js	(revision 2133)
+++ branches/2.0/expressoMail1_2/js/common_functions.js	(revision 2605)
@@ -1,3 +1,2 @@
-// BEGIN: FUNCTION RESIZE WINDOW
 if (!expresso_offline) {
 	var _showBar = showBar;
@@ -32,14 +31,14 @@
     }
 }
-
+// BEGIN: FUNCTION RESIZE WINDOW
 function resizeWindow(){
-
-	var bar = Element("toolbar");
-	var offset = 0;
-	if(bar.style.visibility != 'hidden') 
-		offset = (bar.offsetHeight ? bar.offsetHeight :  bar.clientHeight);	
-
-	var screenHeight = document.body.clientHeight ? document.body.clientHeight : document.body.offsetHeight;
-	var defaultHeight = screenHeight - offset;
+	var divScrollMain = Element("divScrollMain_"+numBox);
+	var table_message = Element("table_message");
+	var content_folders = Element("content_folders");
+	var clientHeight = ((window.innerHeight ? window.innerHeight : document.body.offsetHeight) - 8);	
+
+	if(divScrollMain){
+		divScrollMain.style.height = (clientHeight - (findPosY(divScrollMain) + (table_message.clientHeight ? table_message.clientHeight : table_message.offsetHeight))) + "px";
+	}
 
 	if(typeof(BordersArray) != 'undefined') {
@@ -47,19 +46,18 @@
 			var div_scroll = Element("div_message_scroll_"+BordersArray[i].sequence);
 			var div = Element("content_id_"+BordersArray[i].sequence);
-
-			// This comented code cause/avoid (!?) Firefox to stuck some request
-			if(div)
-//				div.setAttribute("style","height: "+parseInt(defaultHeight - 90)+"px;");
-				div.style.height = defaultHeight - 90;
-			if(div_scroll)
-//				div_scroll.setAttribute("style","height: "+parseInt(defaultHeight - 130)+"px;");
-				div_scroll.style.height = defaultHeight - 130;
-		}
-	}
-
-	if(Element('content_folders'))
-		Element('content_folders').style.height = defaultHeight - (is_ie ? 165 : 150);
-	if(Element("divScrollMain_"+numBox))
-		Element("divScrollMain_"+numBox).style.height 	= defaultHeight - (is_ie ? 111 : 110);
+			if(div){
+				div.style.height = (clientHeight - (findPosY(div) + (table_message.clientHeight ? table_message.clientHeight : table_message.offsetHeight)+2)) + "px";
+			}
+			if(div_scroll){
+				div_scroll.style.height = (clientHeight - (findPosY(div_scroll) + (table_message.clientHeight ? table_message.clientHeight : table_message.offsetHeight)+5)) + "px";
+			}
+		}
+	}
+
+	if(content_folders){
+		var search_div = Element("search_div");
+		var contentFoldersY = findPosY(content_folders);
+		content_folders.style.height = (clientHeight - (contentFoldersY + (contentFoldersY > findPosY(search_div) ? 0 : (search_div.clientHeight ? search_div.clientHeight : search_div.offsetHeight) + 5))) + "px";
+	}
 }
 // END: FUNCTION RESIZE WINDOW
Index: branches/2.0/expressoMail1_2/js/main.js
===================================================================
--- branches/2.0/expressoMail1_2/js/main.js	(revision 2523)
+++ branches/2.0/expressoMail1_2/js/main.js	(revision 2605)
@@ -294,6 +294,8 @@
 
 		
-		if(Element("border_id_" + id_msg_read)) 
-			alternate_border(id_msg_read);		
+		if(Element("border_id_" + id_msg_read)){ 
+			alternate_border(id_msg_read);
+			resizeWindow();
+		}
 		else {
 			var border_id = create_border(msg_info.subject, id_msg_read);
Index: branches/2.0/expressoMail1_2/js/search.js
===================================================================
--- branches/2.0/expressoMail1_2/js/search.js	(revision 1607)
+++ branches/2.0/expressoMail1_2/js/search.js	(revision 2605)
@@ -472,22 +472,13 @@
 		table.appendChild(tbody);
 
-	var content_search =  Element('content_id_search_' + numBox);
-	// BEGIN MAKE THE SCROLL HEIGHT		
+	var content_search =  Element('content_id_search_' + numBox);	
 	var defaultWidth = document.body.offsetWidth - 31;
 	var menuHidden = Element("folderscol").style.display == 'none' ? true : false;
 	if(!menuHidden)
 		defaultWidth -= Element("folderscol").offsetWidth;			
-	var bar = Element("toolbar");
-	var offset = 0;
-	if(bar.style.visibility != 'hidden') 
-		offset = bar.offsetHeight ? bar.offsetHeight :  bar.clientHeight;		
 	var div_scroll_result = document.createElement("DIV");
 	div_scroll_result.id = "divScrollMain_"+numBox;
-	div_scroll_result.style.height = document.body.clientHeight - offset - 120;
-	content_search.style.height = document.body.clientHeight - offset - 80;
 	div_scroll_result.style.overflow = "auto";
 	div_scroll_result.style.width = defaultWidth - (is_ie ? 7 : 0);
-	// END MAKE THE SCROLL HEIGHT		
-		
 	
 		if(is_ie)
@@ -634,4 +625,5 @@
 			content_search.appendChild(div_scroll_result);
 		}
+		resizeWindow();
 	}
 
Index: branches/2.0/expressoMail1_2/js/draw_api.js
===================================================================
--- branches/2.0/expressoMail1_2/js/draw_api.js	(revision 2523)
+++ branches/2.0/expressoMail1_2/js/draw_api.js	(revision 2605)
@@ -617,7 +617,4 @@
 	var _divScroll = document.getElementById("divScrollMain_"+numBox);
 
-	var bar = document.getElementById("toolbar");
-	var offset = 0;
-
 	if(!_divScroll){		
 		_divScroll = document.createElement("DIV");
@@ -633,14 +630,4 @@
 		_divScroll.style.width	="99.3%";
 	}
-	// Inicio: Redimensiona DIV SCROLL
-	var bar = Element("toolbar");
-	var offset = 0;
-	if(bar.style.visibility != 'hidden') 
-		offset = (bar.offsetHeight ? bar.offsetHeight :  bar.clientHeight);		
-	var screenHeight = document.body.clientHeight ? document.body.clientHeight : document.body.offsetHeight;
-	var defaultHeight = screenHeight - offset;		
-	_divScroll.style.height 	= defaultHeight - 110;
-	Element('content_folders').style.height = defaultHeight - (is_ie ? 165 : 150);
-	// Fim: Redimensiona DIV SCROLL
 	_divScroll.appendChild(table_element);
 	openTab.content_id[numBox].appendChild(_divScroll);
@@ -684,4 +671,8 @@
 	draw_footer_box(headers_msgs.num_msgs);	
 	Element('main_table').style.display = '';
+	if(is_ie6)	// Stupid Fixing on IE6.
+		setTimeout("resizeWindow()",1);
+	else
+		resizeWindow();
 	if(debug) {
 		var _eTime = new Date();
@@ -1703,17 +1694,9 @@
 
 
-	// BEGIN MAKE THE SCROLL HEIGHT
-	var bar = document.getElementById("toolbar");
-	var offset = 0;
-	if(bar.style.visibility != 'hidden')
-		offset = bar.offsetHeight ? bar.offsetHeight :  bar.clientHeight;
 	var div = document.createElement("DIV");
 	div.id = "div_message_scroll_"+ID;
 	div.style.background = 'WHITE';
-	div.style.height = document.body.clientHeight - offset - 125;
-	content.style.height = document.body.clientHeight - offset - 90;
 	div.style.overflow = "auto";
 	div.style.width = defaultWidth - (is_ie ? 5 : 0);
-	// END MAKE THE SCROLL HEIGHT
 	table_message_others_options.appendChild(tbody_message_others_options);
 	var tr = document.createElement("TR");
@@ -1839,4 +1822,5 @@
 	table_message.appendChild(tbody_message);
 	content.appendChild(table_message);
+	resizeWindow();
 	var msg_number = document.createElement('INPUT');
 	msg_number.id = "msg_number_" + ID;
@@ -2361,17 +2345,9 @@
 	tr5.appendChild(td_body);
 	tbody_message.appendChild(tr5);
-// BEGIN MAKE THE SCROLL HEIGHT
 	var defaultWidth = document.body.clientWidth - (is_ie ? 200 : 195);
-	var _bar = document.getElementById("toolbar");
-	var _offset = 0;
-	if(_bar.style.visibility != 'hidden') 
-		_offset = _bar.offsetHeight ? _bar.offsetHeight :  _bar.clientHeight;		
 	var _div = document.createElement("DIV");
 	_div.id = "div_message_scroll_"+ID;
-	_div.style.height = document.body.clientHeight - _offset - 105;
-	content.style.height = document.body.clientHeight - _offset - 80;
 	_div.style.overflow = "auto";
 	_div.style.width = defaultWidth;
-	// END MAKE THE SCROLL HEIGHT
 
 	// Hide the contac tips and re-position the pallete color.
@@ -2392,4 +2368,6 @@
 	if(!expresso_offline)
 		draw_from_field(sel_from,tr1_1);
+
+	resizeWindow();
 	return ID;
 }
Index: branches/2.0/expressoMail1_2/templates/classic/index.tpl
===================================================================
--- branches/2.0/expressoMail1_2/templates/classic/index.tpl	(revision 2535)
+++ branches/2.0/expressoMail1_2/templates/classic/index.tpl	(revision 2605)
@@ -70,5 +70,5 @@
 						<tbody id="border_tbody">
 							<tr id="border_tr">
-								<td nowrap class="menu" onClick="alternate_border(0);"  id="border_id_0">&nbsp;{lang_inbox}&nbsp;<font face="Verdana" size="1" color="#505050">[<span id="new_m">0</span> / <span id="tot_m">0</span>]</font>
+								<td nowrap class="menu" onClick="alternate_border(0);resizeWindow();"  id="border_id_0">&nbsp;{lang_inbox}&nbsp;<font face="Verdana" size="1" color="#505050">[<span id="new_m">0</span> / <span id="tot_m">0</span>]</font>
 								</td>
 								<td nowrap id="border_blank" class="last_menu" width="100%">&nbsp;</td>								
Index: branches/2.0/expressoMail1_2/templates/default/index.tpl
===================================================================
--- branches/2.0/expressoMail1_2/templates/default/index.tpl	(revision 2535)
+++ branches/2.0/expressoMail1_2/templates/default/index.tpl	(revision 2605)
@@ -97,5 +97,5 @@
 				<tbody id="border_tbody">
 					<tr id="border_tr">
-						<td nowrap class="menu" onClick="alternate_border(0);"  id="border_id_0">
+						<td nowrap class="menu" onClick="alternate_border(0);resizeWindow();"  id="border_id_0">
 							&nbsp;{lang_inbox}&nbsp;<font face="Verdana" size="1" color="#505050">[
 							<span id="new_m">0</span> / 
