Index: /branches/2.2.0.1/expressoMail1_2/js/common_functions.js
===================================================================
--- /branches/2.2.0.1/expressoMail1_2/js/common_functions.js	(revision 3904)
+++ /branches/2.2.0.1/expressoMail1_2/js/common_functions.js	(revision 4062)
@@ -67,4 +67,5 @@
 	}
 	redim_borders(count_borders());
+	resizeMailList();
 }
 // END: FUNCTION RESIZE WINDOW
Index: /branches/2.2.0.1/expressoMail1_2/js/connector.js
===================================================================
--- /branches/2.2.0.1/expressoMail1_2/js/connector.js	(revision 3792)
+++ /branches/2.2.0.1/expressoMail1_2/js/connector.js	(revision 4062)
@@ -11,4 +11,5 @@
 		is_moz1_6 = false;
 		is_mozilla = false;
+		is_webkit = false;
 		is_ns4 = false;
 	}
@@ -16,4 +17,5 @@
 	{
 		navigator.userAgent.toLowerCase().match('mozilla.*rv[:]1\.6.*gecko') ? is_moz1_6 = true : is_moz1_6 = false;
+		navigator.userAgent.toLowerCase().match('applewebkit') ? is_webkit = true : is_webkit = false;
 		is_ie = false;
 		is_ie5 = false;
@@ -27,4 +29,5 @@
 		is_moz1_6 = false;
 		is_mozilla = false;
+		is_webkit = false;
 		is_ns4 = true;
 	}	
Index: /branches/2.2.0.1/expressoMail1_2/js/search.js
===================================================================
--- /branches/2.2.0.1/expressoMail1_2/js/search.js	(revision 3939)
+++ /branches/2.2.0.1/expressoMail1_2/js/search.js	(revision 4062)
@@ -402,4 +402,5 @@
 		{
 			var tr = document.createElement("TR");
+			if(typeof(preferences.line_height) != 'undefined')
 				tr.style.height = preferences.line_height;
 			
@@ -430,5 +431,5 @@
 				if (j == 0)
 				{
-					td.style.width = "1%";
+					td.setAttribute("width", colSizes[1][0]);
 					var td1 = '<input type="checkbox" id="check_box_message_'+uid_msg+'"></input>';
 					
@@ -436,5 +437,5 @@
 				if (j == 1)
 				{
-					td.style.width = "2%";
+					td.setAttribute("width", colSizes[1][1]);
 					if (aux.flag.match('T'))
 					{
@@ -447,5 +448,5 @@
 				if (j == 2)
 				{
-					td.style.width = "1%";
+					td.setAttribute("width", colSizes[1][2]);
 					td.id = "td_message_answered_"+uid_msg;
 					if (aux.flag.match('X'))
@@ -459,5 +460,5 @@
 				if (j == 3)
 				{
-					td.style.width = "1%";
+					td.setAttribute("width", colSizes[1][3]);
 					td.id = "td_message_important_"+uid_msg;
 					if (aux.flag.match("F"))
@@ -471,5 +472,5 @@
 				if (j == 4)
 				{
-					td.style.width = "1%";
+					td.setAttribute("width", colSizes[1][4]);
 					td.id = "td_message_sent_"+uid_msg;
 					td1 = '';
@@ -478,5 +479,6 @@
 				if ( j == 5 )
 				{
-					td.style.width = "20%";
+					td.setAttribute("width", colSizes[1][5]);
+					td.className = "td_resizable";
 					td.onclick = _onclick;
 					var nm_box = aux.boxname.split(cyrus_delimiter);
@@ -504,5 +506,6 @@
 						aux.from = aux.from.substr(0,29) + "...";
 					
-					td.style.width = "20%";
+					td.setAttribute("width", colSizes[1][6]);
+					td.className = "td_resizable";
 					td.onclick = _onclick;
 					td.setAttribute("NoWrap","true");
@@ -520,5 +523,6 @@
 						aux.subject = aux.subject.substr(0,70) + "...";
 					
-					td.style.width = "35%";
+					td.setAttribute("width", colSizes[1][7]);
+					td.className = "td_resizable";
 					td.onclick = _onclick;
 					td.setAttribute("NoWrap","true");
@@ -530,5 +534,6 @@
 				if( j == 8 )
 				{
-					td.style.width	= "13%";
+					td.setAttribute("width", colSizes[1][8]);
+					td.className = "td_resizable";
 					td.align		= "center";
 					td.onclick		= _onclick;
@@ -554,5 +559,6 @@
 				if( j == 9 )
 				{
-					td.style.width = "10%";
+					td.setAttribute("width", colSizes[1][9]);
+					td.className = "td_resizable";
 					td.align = "center";
 					td.onclick = _onclick;
@@ -568,6 +574,8 @@
 					var td1 = '';
 				}
+				if (j<10) {
 				td.innerHTML = td1;
 				tr.appendChild(td);
+			    }
 			}
 		
@@ -580,9 +588,20 @@
 		table.appendChild(tbody);
 
+		var colgr_element = buildColGroup(1);
+		colgr_element.setAttribute("id","colgroup_main_"+numBox);
+		table.appendChild(colgr_element);
+
 		var content_search =  Element('content_id_search_' + numBox);
 		var div_scroll_result = document.createElement("DIV");
-			div_scroll_result.id = "divScrollMain_"+numBox;
-			div_scroll_result.style.overflow = "auto";
+		div_scroll_result.id = "divScrollMain_"+numBox;
+		div_scroll_result.style.overflowY = "scroll";
+		div_scroll_result.style.overflowX = "hidden";
+		div_scroll_result.style.width	="100%";
 	
+		if (is_mozilla){
+			div_scroll_result.style.overflow = "-moz-scrollbars-vertical";
+			div_scroll_result.style.width	="100%";
+		}
+
 		if(is_ie)
 			Element("border_table").width = "99.5%";
@@ -591,10 +610,22 @@
 		var table_element = document.createElement("TABLE");
 		var tbody_element = document.createElement("TBODY");
-		table_element.setAttribute("id", "table_message_header_box");
+		if (is_ie)
+		{
+			table_element.attachEvent("onmousemove",changeCursorState);
+			table_element.attachEvent("onmousedown",startColResize);
+		}
+		else {
+			table_element.addEventListener("mousemove",changeCursorState,false);
+			table_element.addEventListener("mousedown",startColResize,false);
+		}
+		table_element.setAttribute("id", "table_message_header_box_"+numBox);
 		table_element.className = "table_message_header_box";
+		if (!is_ie)
+			table_element.style.width = "98.8%";
+		table_element.emptyBody = false;
+
 		tr_element = document.createElement("TR");
 		tr_element.className = "message_header";
-		td_element0 = document.createElement("TD");
-		td_element0.setAttribute("width", "7%");
+		td_element0 = createTDElement(1,0);
 		chk_box_element = document.createElement("INPUT");
 		chk_box_element.id  = "chk_box_select_all_messages";
@@ -618,7 +649,9 @@
 
 		td_element0.appendChild(chk_box_element);
-		td_element1 = document.createElement("TD");
-		td_element1.setAttribute("width", "20%");
-		td_element1.align = "left";
+		td_element01 = createTDElement(1,1);
+		td_element02 = createTDElement(1,2);
+		td_element03 = createTDElement(1,3);
+		td_element04 = createTDElement(1,4);
+		td_element1 = createTDElement(1,5,"th_resizable","left");
 		
 		var arrow_ascendant = function(Text)
@@ -654,7 +687,5 @@
 		
 		// Ordernar Quem
-		td_element2 = document.createElement("TD");
-		td_element2.setAttribute("width", "20%");
-		td_element2.align = "left";
+		td_element2 = createTDElement(1,6,"th_resizable","left");
 
 		if (sort_type == 'SORTWHO')
@@ -684,7 +715,5 @@
 		
 		// Ordernar Subject
-		td_element3 = document.createElement("TD");
-		td_element3.setAttribute("width", "35%");
-		td_element3.align = "left";
+		td_element3 = createTDElement(1,7,"th_resizable","left");
 		
 		if (sort_type == 'SORTSUBJECT')
@@ -714,7 +743,5 @@
 		
 		// Ordernar Data
-		td_element4 = document.createElement("TD");
-		td_element4.setAttribute("width", "12%");
-		td_element4.align = "center";
+		td_element4 = createTDElement(1,8,"th_resizable","center");
 		
 		if ( sort_type == 'SORTDATE' )
@@ -744,7 +771,5 @@
 
 		// Ordernar Tamanho
-		td_element5 = document.createElement("TD");
-		td_element5.setAttribute("width", "8%");
-		td_element5.align = "center";
+		td_element5 = createTDElement(1,9,"th_resizable","center");
 		
 		if ( sort_type == 'SORTSIZE' )
@@ -774,4 +799,8 @@
 		
 		tr_element.appendChild(td_element0);
+		tr_element.appendChild(td_element01);
+		tr_element.appendChild(td_element02);
+		tr_element.appendChild(td_element03);
+		tr_element.appendChild(td_element04);
 		tr_element.appendChild(td_element1);
 		tr_element.appendChild(td_element2);
@@ -782,4 +811,8 @@
 		table_element.appendChild(tbody_element);
 
+		var colgr_element = buildColGroup(1);
+		colgr_element.setAttribute("id","colgroup_head_"+numBox);
+		table_element.appendChild(colgr_element);
+
 		if( parseInt( Data['gears_num_msgs'] ) > 0 )
 		{
@@ -792,6 +825,19 @@
 		}		
 
-		content_search.appendChild(table_element);
-
+		var _divScroll = document.getElementById("divScrollHead_"+numBox);
+
+		if(!_divScroll){
+			_divScroll = document.createElement("DIV");
+			_divScroll.id = "divScrollHead_"+numBox;
+			_divScroll.style.overflowY = "hidden";
+			_divScroll.style.overflowX = "hidden";
+			_divScroll.style.width	="100%";
+
+			if (is_mozilla){
+				_divScroll.style.width	="99.3%";
+			}
+			_divScroll.appendChild(table_element);
+			content_search.appendChild(_divScroll);
+		}
 		/*end of "put header"*/
 		if ( !expresso_offline )
Index: /branches/2.2.0.1/expressoMail1_2/js/draw_api.js
===================================================================
--- /branches/2.2.0.1/expressoMail1_2/js/draw_api.js	(revision 4050)
+++ /branches/2.2.0.1/expressoMail1_2/js/draw_api.js	(revision 4062)
@@ -629,4 +629,264 @@
 }
 
+// stores the percentages of the cells
+var colSizes = [ ["24","24","12","12","12","16","16","20%","*","11%","11%"], ["16","16","12","12","12","20%","20%","*","10%","10%"] ];
+// stores the alignments of the cells
+var colAligns = [ ['','','','','','','','left','left','center','center'], ['','','','','','left','left','left','center','center'] ];
+var objCell = null;
+var adjCell = null;
+var cellClick = null;
+var cellResized = false;
+var maxWidth=0;
+var tblWidth=0;
+var bodyWidth=0;
+
+function changeCursorState(ev) {
+	if (cellResized)
+		cellResized = false;
+	var el = ev.target||ev.srcElement;
+	if (el.tagName != "TD")
+		el=getFirstParentOfType(el, "TD")
+	el.style.cursor ="hand";
+	el.style.cursor ="pointer";
+	var cellMouseX = (ev.clientX-parseInt(getColumnPosition(el, ev)));
+	var cellWidth = el.offsetWidth;
+	var tbl = getFirstParentOfType(el,"TABLE");
+	if (tbl.emptyBody)
+		return;
+	if ((((cellWidth-cellMouseX)<15)||((el.style.cursor=="e-resize")&&(detectLeftButton())))&&((el.className=="th_resizable")&&(el.cellIndex+1<el.parentNode.cells.length))){
+		if (tbl) tbl.style.cursor = "e-resize";
+		el.style.cursor ="e-resize";
+	}
+	else{
+		if (tbl) tbl.style.cursor = "pointer";
+		el.style.cursor ="hand";
+		el.style.cursor ="pointer";
+	}
+}
+
+function resizeColumn(ev) {
+	if (!objCell || !adjCell) {
+		stopColResize(ev);
+		return;
+	}
+	if (document.getElementById("table_message_header_box_"+numBox).emptyBody)
+		return;
+	if (objCell.style.cursor == "e-resize" && detectLeftButton(ev)) {
+		var cellIndex = objCell.cellIndex;
+		var adjIndex = adjCell.cellIndex;
+		var cellWidth = (ev.clientX-parseInt(getColumnPosition(objCell, ev)));
+
+		var tbl = getMessagesTable(objCell);
+		var trM = tbl.rows;
+		var tblType = ( (tbl.id=="table_box") ? 0 : 1);
+
+		if (cellWidth < 10) cellWidth = 10;
+		var adjWidth = maxWidth - cellWidth;
+		if (adjWidth < 10) {
+			cellWidth = (cellWidth+adjWidth)-10;
+			adjWidth = 10;
+		}
+
+		colSizes[tblType][adjIndex] = (colSizes[tblType][adjIndex]=="*" ? "*" : getPct(is_ie ? adjWidth : adjWidth-2));
+		colSizes[tblType][cellIndex] = (colSizes[tblType][cellIndex]=="*" ? "*" : getPct(cellWidth));
+
+		document.getElementById("table_message_ruler").style.left = ev.clientX;
+	}
+	ev.returnValue = false;
+	return (false);
+}
+
+function getPct(tdWidth) {
+	var suf = tdWidth.toString().substr(tdWidth.length-1,1);
+	if ( suf != "%" && suf != "*")
+		return (Math.round((tdWidth/bodyWidth)*10000)/100).toString()+"%";
+	else
+		return tdWidth;
+}
+
+function detectLeftButton(ev) {
+    ev = ev || window.event;
+    var button = ev.which || ev.button;
+    return (button == 1);
+}
+
+function startColResize(ev) {
+	var el = ev.target||ev.srcElement;
+	if (el.tagName != "TD")
+		el=getFirstParentOfType(el, "TD")
+	if (is_ie)
+		ev.cancelBubble = true;
+	else
+		ev.stopPropagation();
+	if (!el) return;
+	if (!is_ie) ev.preventDefault();
+	if (document.getElementById("table_message_header_box_"+numBox).emptyBody)
+		return;
+	if (el.style.cursor == "e-resize" && detectLeftButton(ev)) {
+		var incIndex = ( (el.parentNode.cells.length > el.cellIndex + 1) ? 1 : -1 );
+		var msgTable = getMessagesTable(el);
+		var bodyRows = msgTable.rows;
+		objCell = el;
+		adjCell = el.parentNode.cells[el.cellIndex+incIndex];
+		var tbl = getFirstParentOfType(el, "TABLE");
+		if (is_ie) {
+			tbl.detachEvent("onmousemove",changeCursorState);
+			document.attachEvent("onmousemove",resizeColumn);
+			document.attachEvent("onmouseup",stopColResize);
+			document.attachEvent("onselect",selectCancel);
+			tbl.attachEvent("onselectstart",selectCancel);
+		}
+		else {
+			tbl.removeEventListener("mousemove",changeCursorState,false);
+			document.addEventListener("mousemove",resizeColumn,false);
+			document.addEventListener("mouseup",stopColResize,false);
+			document.addEventListener("select",selectCancel,false);
+			tbl.addEventListener("selectstart",selectCancel,false);
+		}
+		cellClick = objCell.onclick;
+		objCell.onclick = "";
+		maxWidth = objCell.offsetWidth+adjCell.offsetWidth;
+		if (tblWidth==0) {
+			tblWidth = tbl.offsetWidth;
+			bodyWidth = msgTable.offsetWidth;
+		}
+		document.getElementById("table_message_ruler").style.display = "block";
+		document.getElementById("table_message_ruler").style.left = ev.clientX;
+		if (document.getElementById("content_id_"+numBox)==null)
+			document.getElementById("table_message_ruler").style.height = document.getElementById("content_id_search_"+numBox).offsetHeight;
+		else
+			document.getElementById("table_message_ruler").style.height = document.getElementById("content_id_"+numBox).offsetHeight;
+	}
+}
+
+function stopColResize(ev) {
+	if (!objCell)
+		return;
+	if (is_ie)
+		ev.cancelBubble = true;
+	else
+		ev.stopPropagation();
+	var tbl = getFirstParentOfType(objCell, "TABLE");
+	if (is_ie) {
+		tbl.detachEvent("onselectstart",selectCancel);
+		document.detachEvent("onselect",selectCancel);
+		document.detachEvent("onmousemove",resizeColumn);
+		document.detachEvent("onmouseup",stopColResize);
+		tbl.attachEvent("onmousemove",changeCursorState);
+	}
+	else {
+		tbl.removeEventListener("selectstart",selectCancel,false);
+		document.removeEventListener("select",selectCancel,false);
+		document.removeEventListener("mousemove",resizeColumn,false);
+		document.removeEventListener("mouseup",stopColResize,false);
+		tbl.addEventListener("mousemove",changeCursorState,false);
+	}
+	var trM = getMessagesTable(objCell).rows;
+	var adjIndex = adjCell.cellIndex;
+	document.getElementById("table_message_ruler").style.display = "none";
+	syncColumns();
+	maxWidth = 0;
+	objCell.onclick = cellClick;
+	objCell = null;
+	adjCell = null;
+	cellResized = true;
+}
+
+function getMessagesTable(el) {
+	var hT;
+	if (el.tagName == "TABLE")
+		hT = el;
+	else
+		hT = getFirstParentOfType(el,"TABLE");
+	return (hT.parentNode.nextSibling.childNodes[0]);
+}
+
+function getColumnPosition(oNode, pNode){
+	if (!pNode && !is_webkit){
+		var pos = getOffset(oNode);
+		return [pos.left, pos.top];
+	}
+	pNode = pNode||document.body;
+
+	var oCurrentNode = oNode;
+	var iLeft = 0;
+	var iTop = 0;
+
+	while ((oCurrentNode)&&(oCurrentNode != pNode)){
+		iLeft+=oCurrentNode.offsetLeft-oCurrentNode.scrollLeft;
+		iTop+=oCurrentNode.offsetTop-oCurrentNode.scrollTop;
+		oCurrentNode=oCurrentNode.offsetParent;
+	}
+
+	return [iLeft, iTop];
+}
+
+function getFirstParentOfType(obj, tag){
+	while (obj&&obj.tagName != tag&&obj.tagName != "BODY"){
+		obj=obj.parentNode;
+	}
+	return obj;
+}
+
+function syncColumns() {
+	var thisCell;
+	var tbl = (document.getElementById("content_id_"+numBox)==null ? 1 : 0);
+	if (objCell)
+		thisCell = objCell;
+	else
+		thisCell = document.getElementById("table_message_header_box_"+numBox).rows[0].cells[0];
+	var tbH = getFirstParentOfType(thisCell,"TABLE");
+	var tbM = getMessagesTable(thisCell);
+	var trM = tbM.rows;
+	for (var r=0;r<trM.length;r++) {
+		for (var c=0;c<trM[r].cells.length;c++) {
+			trM[r].cells[c].setAttribute("width",colSizes[tbl][c]);
+			if (is_mozilla && !is_webkit) {
+				document.getElementById("colgroup_head_"+numBox).childNodes[c].setAttribute("width",colSizes[tbl][c]);
+				trM[r].cells[c].innerHTML = trM[r].cells[c].innerHTML;
+			}
+			else {
+				tbH.rows[0].cells[c].setAttribute("width",trM[r].cells[c].offsetWidth);
+			}
+		}
+	}
+}
+
+function resizeMailList() {
+	var innerWidth = (window.innerWidth?window.innerWidth:document.body.clientWidth);
+	var scrollWidth = (innerWidth - 20 - getColumnPosition(Element("exmail_main_body"),"BODY")[0]);
+	document.getElementById("table_message_header_box_"+numBox).style.width = (scrollWidth-2)+'px';
+	if (document.getElementById("table_resultsearch_"+numBox)==null)
+		document.getElementById("table_box").style.width = scrollWidth+'px';
+	else
+		document.getElementById("table_resultsearch_"+numBox).style.width = scrollWidth+'px';
+	syncColumns();
+}
+
+function selectCancel(ev) {
+	return (false);
+}
+
+function buildColGroup(tbl) {
+	var col_element;
+	var colgr_element = document.createElement("COLGROUP");
+	if (tbl==null) tbl = 0;
+	for (i=0;i<colSizes[tbl].length;i++) {
+		col_element = document.createElement("COL");
+		//col_element.setAttribute("width", colSizes[0][i]);
+		col_element.setAttribute("align", colAligns[tbl][i]);
+		colgr_element.appendChild(col_element);
+	}
+	return (colgr_element);
+}
+
+function createTDElement(table_list,col_index,class_name,td_align,td_id) {
+	var td_element = document.createElement("TD");
+	td_element.setAttribute("width",colSizes[table_list][col_index]);
+	if (class_name) td_element.className = class_name;
+	if (td_align) td_element.align = td_align;
+	if (td_id) td_element.id = td_id;
+	return (td_element);
+}
 
 // Draw the inbox and another folders
@@ -646,12 +906,27 @@
 	if (table_message_header_box == null){
 		var table_element = document.createElement("TABLE");
+		var colgr_element = buildColGroup();
+		colgr_element.setAttribute("id","colgroup_head_"+numBox);
 		var tbody_element = document.createElement("TBODY");
+		//add events for column resizing
+		if (is_ie) {
+			table_element.attachEvent("onmousemove",changeCursorState);
+			table_element.attachEvent("onmousedown",startColResize);
+		}
+		else {
+			table_element.addEventListener("mousemove",changeCursorState,false);
+			table_element.addEventListener("mousedown",startColResize,false);
+		}
 		table_element.setAttribute("id", "table_message_header_box_"+numBox);
 		table_element.className = "table_message_header_box";
+		if (!is_ie)
+			table_element.style.width = "98.8%";
+		//if table is empty
+		table_element.emptyBody = false;
 
 		tr_element = document.createElement("TR");
 		tr_element.className = "message_header";
-		td_element1 = document.createElement("TD");
-		td_element1.setAttribute("width", "1%");
+
+		td_element1 = createTDElement(0,0);
 		chk_box_element = document.createElement("INPUT");
 		chk_box_element.id  = "chk_box_select_all_messages";
@@ -675,54 +950,77 @@
 		td_element1.appendChild(chk_box_element);
 
-		td_element2 = document.createElement("TD");
-		td_element2.setAttribute("width", "7%");
-		td_element3 = document.createElement("TD");
-		td_element3.setAttribute("width", "29%");
+		td_element2 = createTDElement(0,1);
+		td_element3 = createTDElement(0,7,"th_resizable","left","message_header_SORTFROM_"+numBox);
 		td_element3.onclick = function () {sort_box(search_box_type,'SORTFROM');};
-		td_element3.id = "message_header_SORTFROM_"+numBox;
-		td_element3.align = "left";
 		td_element3.innerHTML = get_lang("Who");
 
-		td_element4 = document.createElement("TD");
-		td_element4.setAttribute("width", "38%");
+		td_element4 = createTDElement(0,8,"th_resizable","left","message_header_SORTSUBJECT_"+numBox);
 		td_element4.onclick = function () {sort_box(search_box_type,'SORTSUBJECT');};
-		td_element4.id = "message_header_SORTSUBJECT_"+numBox;
-		td_element4.align = "left";
 		td_element4.innerHTML = get_lang("Subject");
 
-		td_element5 = document.createElement("TD");
-		td_element5.setAttribute("width", "14%");
+		td_element5 = createTDElement(0,9,"th_resizable","center","message_header_SORTARRIVAL_"+numBox);
 		td_element5.onclick = function () {sort_box(search_box_type,'SORTARRIVAL');};
-		td_element5.id = "message_header_SORTARRIVAL_"+numBox;
-		td_element5.align = "center";
 		td_element5.innerHTML = get_lang("Date");
-		td_element6 = document.createElement("TD");
-		td_element6.setAttribute("width", "14%");
+
+		td_element6 = createTDElement(0,10,"th_resizable","left","message_header_SORTSIZE_"+numBox);
 		td_element6.onclick = function () {sort_box(search_box_type,'SORTSIZE');}
-		td_element6.id = "message_header_SORTSIZE_"+numBox;
-		td_element6.align = "left";
 		td_element6.innerHTML = get_lang("Size");
 
 		tr_element.appendChild(td_element1);
 		tr_element.appendChild(td_element2);
-		var td_element21 = document.createElement("TD");
-		td_element21.innerHTML = "&nbsp;&nbsp;&nbsp;";
-		var td_element22 = document.createElement("TD");
-		td_element22.innerHTML = "&nbsp;&nbsp;&nbsp;";
-		var td_element23 = document.createElement("TD");
-		td_element23.innerHTML = "&nbsp;&nbsp;";
+
+		var td_element21 = createTDElement(0,2);
+		td_element21.innerHTML = "&nbsp;";
+
+		var td_element22 = createTDElement(0,3);
+		td_element22.innerHTML = "&nbsp;";
+
+		var td_element23 = createTDElement(0,4);
+		td_element23.innerHTML = "&nbsp;";
+
+		var td_element24 = createTDElement(0,5);
+		td_element24.innerHTML = "&nbsp;";
+
+		var td_element25 = createTDElement(0,6);
+		td_element25.innerHTML = "&nbsp;";
+
 		tr_element.appendChild(td_element21);
 		tr_element.appendChild(td_element22);
 		tr_element.appendChild(td_element23);
+		tr_element.appendChild(td_element24);
+		tr_element.appendChild(td_element25);
 		tr_element.appendChild(td_element3);
 		tr_element.appendChild(td_element4);
 		tr_element.appendChild(td_element5);
 		tr_element.appendChild(td_element6);
+
 		tbody_element.appendChild(tr_element);
 		table_element.appendChild(tbody_element);
-		openTab.content_id[numBox].appendChild(table_element);
+		table_element.appendChild(colgr_element);
+
+		var _divScroll = document.getElementById("divScrollHead_"+numBox);
+
+		if(!_divScroll){
+			_divScroll = document.createElement("DIV");
+			_divScroll.id = "divScrollHead_"+numBox;
+	}
+
+		_divScroll.style.overflowY = "hidden";
+		_divScroll.style.overflowX = "hidden";
+		_divScroll.style.width	="100%";
+
+		if (is_mozilla){
+			_divScroll.style.width	="99.3%";
+		}
+
+		_divScroll.appendChild(table_element);
+		openTab.content_id[numBox].appendChild(_divScroll);
+
 	}
 	draw_header_box();
 	var table_element = document.createElement("TABLE");
+	var colgr_element = buildColGroup();
+	colgr_element.setAttribute("id","colgroup_main_"+numBox);
+
 	var tbody_element = document.createElement("TBODY");
 	table_element.id = "table_box";
@@ -757,7 +1055,7 @@
 	tbody_element.setAttribute("id", "tbody_box");
 	table_element.appendChild(tbody_element);
+	table_element.appendChild(colgr_element);
 
 	var _divScroll = document.getElementById("divScrollMain_"+numBox);
-
 
 	if(!_divScroll){
@@ -766,5 +1064,5 @@
 	}
 
-	_divScroll.style.overflowY = "auto";
+	_divScroll.style.overflowY = "scroll";
 	_divScroll.style.overflowX = "hidden";
 	_divScroll.style.width	="100%";
@@ -772,5 +1070,5 @@
 	if (is_mozilla){
 		_divScroll.style.overflow = "-moz-scrollbars-vertical";
-		_divScroll.style.width	="99.3%";
+		_divScroll.style.width	="100%";
 	}
 	_divScroll.appendChild(table_element);
@@ -779,18 +1077,19 @@
 	var f_unseen = 0;
 
+	document.getElementById("table_message_header_box_"+numBox).emptyBody = false;
 		if (headers_msgs.num_msgs == 0){
-				var tr_info = document.createElement("TR");
-			   		var td_info = document.createElement("TD");
-						td_info.setAttribute("colspan", "10");
+		document.getElementById("table_message_header_box_"+numBox).emptyBody = true;
+		tr_info = document.createElement("TR");
+		td_info = document.createElement("TD");
+		h3_info = document.createElement("H3");
 			td_info.setAttribute("background", "#FFF");
-			td_info.setAttribute("id", "msg_info");
-			td_info.id = "msg_info";
-			td_info.align = "center";
-			td_info.style.padding = "25px";
-			td_info.style.fontWeight = "bold";
-						td_info.style.fontSize = "11pt";
-			td_info.innerHTML = get_lang("This mail box is empty");
+		td_info.setAttribute("width","100%");
+		h3_info.style.padding = "10px";
+		h3_info.setAttribute("id", "msg_info");
+		h3_info.align = "center";
+		h3_info.innerHTML = get_lang("This mail box is empty");
+		td_info.appendChild(h3_info);
 			tr_info.appendChild(td_info);
-			tbody_element.appendChild(td_info);
+		tbody_element.appendChild(tr_info);
 		}
 	for (var i=0; i < headers_msgs.length; i++){
@@ -839,4 +1138,15 @@
 	if(Element("table_quota"))
 		connector.loadScript("InfoQuota");
+
+	// creates the dotted ruler which helps user to visualize resizing of columns
+	var ruler_element = document.getElementById("table_message_ruler");
+	if (ruler_element == null) {
+		ruler_element = document.createElement("DIV");
+		ruler_element.setAttribute("id", "table_message_ruler");
+		ruler_element.className = "table_message_ruler";
+		ruler_element.style.top = getColumnPosition(document.getElementById("content_id_0"),"BODY")[1];
+		document.getElementById("exmail_main_body").appendChild(ruler_element);
+    }
+
 }
 
@@ -882,7 +1192,5 @@
 			add_className(tr_element,'flagged_msg');
 
-		td_element1 = document.createElement("TD");
-		td_element1.className = "td_msg";
-		td_element1.setAttribute("width", "1%");
+		td_element1 = createTDElement(0,0,"td_msg");
 		chk_box_element = document.createElement("INPUT");
 		chk_box_element.setAttribute("type", "checkbox");
@@ -897,14 +1205,9 @@
 		td_element1.appendChild(chk_box_element);
 
-		td_element2 = document.createElement("TD");
-		td_element2.className = "td_msg";
-		td_element2.setAttribute("width", "2%");
+		td_element2 = createTDElement(0,1,"td_msg");
 		if (headers_msgs.attachment && headers_msgs.attachment.number_attachments > 0)
 			td_element2.innerHTML = "<img src ='templates/"+template+"/images/clip.gif' title='" + url_decode(headers_msgs.attachment.names) + "'>";
 
-		td_element21 = document.createElement("TD");
-		td_element21.className = "td_msg";
-		td_element21.setAttribute("width", "1%");
-		td_element21.id = "td_message_answered_"+headers_msgs.msg_number;
+		td_element21 = createTDElement(0,2,"td_msg",null,"td_message_answered_"+headers_msgs.msg_number);
 
 		if (headers_msgs.attachment && headers_msgs.attachment.number_attachments > 0) {
@@ -934,8 +1237,5 @@
 			td_element21.innerHTML = "&nbsp;&nbsp;&nbsp;";
 
-		td_element22 = document.createElement("TD");
-		td_element22.className = "td_msg";
-		td_element22.setAttribute("width", "1%");
-		td_element22.id = "td_message_signed_"+headers_msgs.msg_number;
+		td_element22 = createTDElement(0,1,"td_msg",null,"td_message_signed_"+headers_msgs.msg_number);
 		switch(headers_msgs.ContentType)
 		{
@@ -956,8 +1256,5 @@
 		}
 
-		td_element23 = document.createElement("TD");
-		td_element23.className = "td_msg"
-		td_element23.setAttribute("width", "1%");
-		td_element23.id = "td_message_important_"+headers_msgs.msg_number;
+		td_element23 = createTDElement(0,4,"td_msg",null,"td_message_important_"+headers_msgs.msg_number);
 
 		if (headers_msgs.Flagged == 'F' || (parseInt(preferences.use_important_flag) && headers_msgs.Importance.toLowerCase().indexOf("high") != -1 ))
@@ -968,8 +1265,5 @@
 			td_element23.innerHTML = "&nbsp;&nbsp;&nbsp;";
 
-		td_element24 = document.createElement("TD");
-		td_element24.className = "td_msg";
-		td_element24.setAttribute("width", "1%");
-		td_element24.id = "td_message_sent_"+headers_msgs.msg_number;
+		td_element24 = createTDElement(0,5,"td_msg",null,"td_message_sent_"+headers_msgs.msg_number);
 		td_element24.innerHTML = "&nbsp;&nbsp;&nbsp;";
 		// preload image
@@ -979,8 +1273,5 @@
 
 
-		var td_element25 = document.createElement("TD");
-		td_element25.className = "td_msg";
-		td_element25.setAttribute("width", "1%");
-		td_element25.id = "td_message_unseen_"+headers_msgs.msg_number;
+		td_element25 = createTDElement(0,6,"td_msg",null,"td_message_unseen_s"+headers_msgs.msg_number);
 		if ((headers_msgs.Unseen == 'U') || (headers_msgs.Recent == 'N'))
 			td_element25.innerHTML = "<img src ='templates/"+template+"/images/unseen.gif' title='"+get_lang('Unseen')+"'>";
@@ -989,8 +1280,5 @@
 
 
-		td_element3 = document.createElement("TD");
-		td_element3.className = "td_msg";
-		td_element3.id = "td_who_"+ headers_msgs.msg_number;
-		td_element3.setAttribute("width", "20%");
+		td_element3 = createTDElement(0,7,"td_resizable","left","td_who_"+ headers_msgs.msg_number);
 		var _onclick = function(){InfoContact.hide();proxy_mensagens.get_msg(headers_msgs.msg_number, msg_folder,true, show_msg);};
 		td_element3.onclick = _onclick;
@@ -1040,7 +1328,6 @@
 			}
 		}
-		td_element4 = document.createElement("TD");
-		td_element4.className = "td_msg";
-		td_element4.setAttribute("width", "50%");
+
+		td_element4 = createTDElement(0,8,"td_resizable","left");
 		td_element4.onclick = _onclick;
 		td_element4.innerHTML = !is_ie ? "<a nowrap id='a_message_"+tr_element.id+"'>&nbsp;" : "&nbsp;";
@@ -1066,9 +1353,7 @@
 
 
-		td_element5 = document.createElement("TD");
-		td_element5.className = "td_msg";
-		td_element5.setAttribute("width", "14%");
+		td_element5 = createTDElement(0,9,"td_resizable","center");
 		td_element5.onclick = _onclick;
-		td_element5.setAttribute("align", "center");
+
 		var norm = function (arg) {return (arg < 10 ? '0'+arg : arg);};
 		var weekDays = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
@@ -1112,15 +1397,8 @@
 		td_element5.alt = td_element5.title;
 
-
-
-		td_element6 = document.createElement("TD");
-		td_element6.className = "td_msg";
-		td_element6.setAttribute("width", "14%");
+		td_element6 = createTDElement(0,10,"td_resizable","center");
 		td_element6.onclick = _onclick;
 		td_element6.setAttribute("noWrap","true");
-		td_element6.setAttribute("align", "center");
-
 		td_element6.innerHTML = borkb(headers_msgs.Size);
-
 
 		tr_element.appendChild(td_element1);
@@ -1139,4 +1417,6 @@
 
 function sort_box(search, sort){
+	if (cellResized)
+		return;
 	var message_header = Element("message_header_"+search);
 	var handler_draw_box = function(data){
