Index: trunk/expressoMail1_2/js/jscode/draw_messages.js
===================================================================
--- trunk/expressoMail1_2/js/jscode/draw_messages.js	(revision 2793)
+++ trunk/expressoMail1_2/js/jscode/draw_messages.js	(revision 2793)
@@ -0,0 +1,833 @@
+draw_message.prototype.draw_message_header = function(header,border_id){
+	this.id = border_id;
+	var defaultWidth = document.body.offsetWidth - 37;
+	if(Element("folderscol").style.display != 'none')
+		defaultWidth -= Element("folderscol").offsetWidth;
+
+	var table_message = createAndSet("TABLE",['id','border','width'],['table_message_'+border_id,"0",defaultWidth]);
+	table_message.id = 'table_message_'+border_id;
+	var tbody_message = document.createElement("TBODY");
+	if (!this.make_options_message(header,tbody_message))
+		return;
+
+	table_message.appendChild(tbody_message);
+	var content = document.getElementById('content_id_' + border_id);
+	content.appendChild(table_message);
+	loading_img = content.appendChild(loading_img);
+};
+
+
+draw_message.prototype.draw_message_body = function (info_msg){
+	var defaultWidth = document.body.offsetWidth - 37;
+	if(Element("folderscol").style.display != 'none')
+		defaultWidth -= Element("folderscol").offsetWidth;
+
+	var table_message = Element('table_message_'+this.id);
+	var tbody_message = table_message.childNodes[0];
+
+	var tbody_message_others_options = document.createElement("TBODY");
+	var tr1 = document.createElement("TR");
+	tr1.className = "tr_message_header";
+	var td1 = createAndSet('TD',['width'],['7%'],get_lang("From: "));
+	td1.appendChild(deny_email(info_msg.from.email));
+	var id=this.id;
+
+	if (info_msg.sender){
+		var tr111 = document.createElement("TR");
+		tr111.className = "tr_message_header";
+		var td111 = createAndSet('TD',['noWrap'],['true'],get_lang("Sent by")+": ");
+		td111.appendChild(deny_email(info_msg.sender.email));
+		var sender = document.createElement("TD");
+		sender.className = "header_message_field";
+		sender.id = "sender_"+id;
+		sender.innerHTML += this.draw_plugin_cc(info_msg.sender.full);
+		var sender_values = createAndSet("INPUT",['id','type','value'],["sender_values_"+id,"HIDDEN",info_msg.sender.full]);
+
+		tbody_message_others_options.appendChild(appendChilds(tr111, td111, sender, sender_values));
+	}
+
+	var from = createAndSet('TD',['id','class'],["from_"+this.id,"header_message_field"],info_msg.from.full);
+
+	if (info_msg.Draft != "X"){
+		from.innerHTML += this.draw_plugin_cc(info_msg.from);
+		tbody_message_others_options.appendChild(tr1);
+	}
+	var from_values = createAndSet('INPUT',['id','type','value'],["from_values_"+id,"HIDDEN",info_msg.from.full]);
+	var local_message = createAndSet("INPUT",['id','name','type','value'],["is_local_"+this.id,"is_local","HIDDEN",(info_msg.local_message)?"1":"0"]);
+	appendChilds(tr1,td1,from,from_values,local_message);
+
+	if (info_msg.reply_to){
+		var tr11 = document.createElement("TR");
+		tr11.className = "tr_message_header";
+		var _td11 = createAndSet('TD',['noWrap'],['true'],get_lang("Reply to")+": ");
+		var _reply_to = createAndSet('TD',['id', 'class'],["reply_to_"+id, "header_message_field"],this.draw_plugin_cc(info_msg.reply_to));
+		var _reply_to_values = createAndSet('INPUT',['id', 'type', 'value'],["reply_to_values_"+id,"HIDDEN",info_msg.reply_to]);
+		tbody_message_others_options.appendChild(appendChilds(tr11,_td11,_reply_to,_reply_to_values));
+	}
+	//////////////////////////////////////////////////////////////////////////////////////////////////////
+	var tr2 = document.createElement("TR");
+	tr2.className = "tr_message_header";
+	var td2 = document.createElement("TD");
+	td2.innerHTML = get_lang("To: ");
+	var to = document.createElement("TD");
+	to.id = "to_"+id;
+
+	var _to_values = createAndSet('INPUT',['id', 'type', 'value'],["to_values_"+id, "HIDDEN", info_msg.toaddress2]);
+	// Salva a pasta da mensagem
+	var _input_cfolder = createAndSet('INPUT',['id', 'name', 'type', 'value'],["input_folder_"+id, "input_folder", "hidden", info_msg.msg_folder]);
+	td2.appendChild(_input_cfolder);
+
+	toaddress_array[id] = info_msg.toaddress2.split(",");
+	if (toaddress_array[id].length > 1){
+		to.innerHTML += this.draw_plugin_cc(toaddress_array[id][0]);
+		var _div_toaddrs = createAndSet('SPAN',['id','style'],["div_toaddress_"+id,'display: inline']," (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+id+"','to');>"+get_lang('more')+"</a>)");
+		to.appendChild(_div_toaddrs);
+	}
+	else {
+		toAdd = toaddress_array[id].toString().replace("<","&lt;");
+		toAdd = toAdd.replace(">","&gt;");
+		to.innerHTML += this.draw_plugin_cc(toAdd);
+	}
+	to.className = "header_message_field";
+	tbody_message_others_options.appendChild(appendChilds(tr2,td2,to,_to_values));
+
+	if (info_msg.cc){
+		var tr3 = document.createElement("TR");
+		tr3.className = "tr_message_header";
+		var td3 = document.createElement("TD");
+		td3.innerHTML = "CC: ";
+		var cc = createAndSet("TD",['id', 'class'],["cc_"+this.id,"header_message_field"]);
+
+		var cc_values = createAndSet("INPUT",['id', 'type', 'value'],["cc_values_"+this.id, "HIDDEN", info_msg.cc]);
+		ccaddress_array[this.id] = info_msg.cc.split(",");		
+		if (ccaddress_array[this.id].length > 1){
+			var div_ccaddress = document.createElement("SPAN");
+			div_ccaddress.id = "div_ccaddress_"+this.id;
+			var div_ccaddress_full = createAndSet("SPAN",['id', 'style'],["div_ccaddress_full_"+this.id, "display: inline"]);
+			cc.innerHTML = this.draw_plugin_cc(ccaddress_array[this.id][0]);
+			div_ccaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+this.id+"','cc');>"+get_lang('more')+"</a>)";
+			cc.appendChild(div_ccaddress);
+		}
+		else{
+			cc.innerHTML = this.draw_plugin_cc(info_msg.cc);
+		}
+		tbody_message_others_options.appendChild(appendChilds(tr3,td3,cc,cc_values));
+	}
+
+	if (info_msg.bcc)
+	{
+		tbody_message_others_options.appendChild(this.getBcc(info_msg.bcc));
+	}
+
+	var tr4 = document.createElement("TR");
+	tr4.className = "tr_message_header";
+	var td4 = document.createElement("TD");
+	td4.innerHTML = get_lang("Date: ");
+	var msgFull = info_msg.fulldate.split(' ');
+
+	var date = createAndSet('TD',['id','class'],["date_"+id,"header_message_field"],info_msg.fulldate);
+	var date_day = createAndSet('INPUT',['id', 'type', 'value'],["date_day_"+id, "HIDDEN", msgFull[0]]);
+	var date_hour = createAndSet('INPUT',['id', 'type', 'value'],["date_hour_"+id, "HIDDEN", msgFull[1]]);
+	tbody_message_others_options.appendChild(appendChilds(tr4,td4,date,date_day,date_hour));
+
+	var tr5 = document.createElement("TR");
+	tr5.className = "tr_message_header";
+	var td5 = document.createElement("TD");
+	td5.innerHTML = get_lang("Subject");
+	var subject = createAndSet('TD',['id', 'class'],["subject_"+this.id, "header_message_field"],info_msg.subject);
+	tbody_message_others_options.appendChild(appendChilds(tr5,td5,subject));
+	if (info_msg.attachments.length > 0){
+		var tr6 = document.createElement("TR");
+		tr6.className = "tr_message_header";
+		var td6 = document.createElement("TD");
+		td6.innerHTML = get_lang("Attachments: ");
+
+		var attachments = document.createElement("TD");
+		attachments.align='left';
+		td6.vAlign = "top";
+
+		var zipped_attachments = '';
+		if(info_msg.attachments.length >= 1) {
+			var zipped_attachments  = createAndSet("TABLE",['style','cellPadding','cellSpacing'],['margin-bottom: 4px','0','0']);
+			var td = document.createElement("TD");
+			if(info_msg.attachments.length > 1) {
+				var link_attachment     = document.createElement("A");
+				if(proxy_mensagens.is_local_folder(current_folder))
+					link_attachment.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')");
+				else
+					link_attachment.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')");
+				link_attachment.innerHTML = " "+info_msg.attachments.length+' '+get_lang('files')+' :: '+get_lang('Download all atachments');
+				link_attachment.innerHTML += '<BR>';
+				td.appendChild(link_attachment);
+			}
+			var tr = document.createElement("TR");
+			if(parseInt(preferences.remove_attachments_function))
+			{
+				var del_attachments = document.createElement("A");
+				del_attachments.setAttribute("href", "javascript:remove_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')");
+				del_attachments.innerHTML = get_lang('remove all attachments');
+				del_attachments.appendChild(document.createElement('BR'));
+				td.appendChild(del_attachments);
+				tr.appendChild(td);
+			}
+			tr.appendChild(td);
+			zipped_attachments.appendChild(tr);
+			attachments.appendChild(zipped_attachments);
+		}
+
+		attachments.id = "attachments_" + this.id;
+		for (var i=0; i<info_msg.attachments.length; i++){
+			var link_attachment = document.createElement("A");
+			link_attachment.setAttribute("href", proxy_mensagens.link_anexo(info_msg,i));
+			//link_attachment.setAttribute("href", "javascript:download_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"',"+i+",'"+info_msg.attachments[i].pid+"','"+info_msg.attachments[i].encoding+"')");
+			link_attachment.innerHTML = url_decode(info_msg.attachments[i].name);
+			link_attachment.innerHTML += "&nbsp;"+borkb(info_msg.attachments[i].fsize);
+
+			if((url_decode(info_msg.attachments[i].name).indexOf(".ics")!=-1) || (url_decode(info_msg.attachments[i].name).indexOf(".vcard")!=-1)){
+				//Link para importar calendÃ¡rio
+				var link_import_attachment = createAndSet("IMG",['src','onclick','title','align','style'],["templates/"+template+"/images/new.png","javascript:import_calendar('"+info_msg.msg_folder+"&msg_number="+info_msg.msg_number+"&msg_part="+info_msg.attachments[i].pid+"&idx_file="+i+"&encoding="+info_msg.attachments[i].encoding+"');",get_lang("Import to calendar"),"top","cursor: pointer"]);
+				var space = document.createElement("span");
+				space.innerHTML = "&nbsp;";
+				appendChilds(attachments,link_attachment,space,link_import_attachment);
+			}
+			else {
+				link_attachment.innerHTML += '<BR>';
+				attachments.appendChild(link_attachment);
+			}
+		}
+		tr6.appendChild(td6);
+		tr6.appendChild(attachments);
+		tbody_message_others_options.appendChild(tr6);
+	}
+
+
+	// 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_"+this.id;
+	div.style.background = 'WHITE';
+	div.style.height = document.body.clientHeight - offset - 125;
+	div.style.overflow = "auto";
+	div.style.width = defaultWidth - (is_ie ? 5 : 0);
+	// END MAKE THE SCROLL HEIGHT
+
+	var table_msg_details = createAndSet("TABLE",['id','width','class'],['table_msg_details_' + this.id,defaultWidth - 30,'table_message']);
+	table_msg_details.style.display = 'none';
+	table_msg_details.appendChild(tbody_message_others_options);
+	div.appendChild(table_msg_details);
+
+	var tr = document.createElement("TR");
+	var td = document.createElement("TD");
+	td.colSpan = '2';
+
+	var newBody = this.blockImage(info_msg,this.id,td);
+
+	td.appendChild(div);
+	tr.appendChild(td);
+	tbody_message.appendChild(tr);
+
+	//////////////////////////////////////////////////////////////////////////////////////////////////////	
+	//Make the body message.
+	///////////////////////////////////////////////////////////////////////////////////////////////////////
+	var tr = document.createElement("TR");
+	tr.className = "tr_message_body";
+	var td = document.createElement("TD");
+	//td.setAttribute("colSpan","2");
+	newBody = newBody.replace("<body","<span");
+	newBody = newBody.replace("<BODY","<span");
+	div.innerHTML+= "<span id='body_"+this.id+"' style='font-size:16px;'>"+newBody+"</span><br><br>";
+	function mailto( link )
+	{
+		var mail = link.href.substr( 7 );
+		link.onclick = function( )
+		{
+			new_message_to( mail );
+			return false;
+		};
+	}
+	var links = div.getElementsByTagName( 'a' );
+	for ( var i = 0; i < links.length; i++ )
+		if ( links.item( i ).href.indexOf( 'mailto:' ) === 0 )
+			mailto( links.item( i ) );
+		else
+		{
+			if ( links.item( i ).href.indexOf( 'javascript:' ) !== 0 )
+				links.item( i ).setAttribute( 'target', '_blank' );
+		}
+
+	if ((info_msg.thumbs)&&(info_msg.thumbs.length > 0)){
+		//////////////////////////////////////////////////////////////////////////////////////////////////////	
+		//Make the thumbs of the message.
+		//////////////////////////////////////////////////////////////////////////////////////////////////////
+		div.appendChild(this.getThumbs(info_msg.attachments, info_msg.thumbs, info_msg.msg_number, info_msg.msg_folder));
+	}
+
+
+	var msg_number = createAndSet("INPUT",['id','type','value'],["msg_number_" + this.id, "hidden", info_msg.msg_number]);
+	var content = document.getElementById('content_id_' + this.id);
+	try{
+		loading_img = content.removeChild( loading_img );
+	}catch(e){};
+	content.style.height = document.body.clientHeight - offset - 90;
+	content.appendChild(msg_number);
+	//////////////////////////////////////////////////////////////////////////////////////////////////////
+
+	//Exibe o cabecalho da mensagem totalmente aberto caso esteja setado nas preferencias do usuario
+	if (preferences.show_head_msg_full == 1)
+	{
+		option_hide_more.onclick();
+
+		if (Element('div_toaddress_'+this.id) != null)
+		{
+			show_div_address_full(this.id,'to');
+		}	
+		if (Element('div_ccaddress_'+this.id) != null)
+		{
+			show_div_address_full(this.id,'cc');
+		}
+	}
+
+};
+
+draw_message.prototype.make_options_message = function(info_msg, tbody_message){
+	var tr0 = document.createElement("TR");
+	tr0.className = "tr_message_header";
+	var td0 = document.createElement("TD");
+	var table_message_options = createAndSet("TABLE",['border','width','class'],["0","100%",'table_message']);
+	var tbody_message_options = document.createElement("TBODY");
+	var tr = document.createElement("TR");
+	var td = document.createElement("TD");
+	td.setAttribute("noWrap","true");
+	var _name = '';
+	var menuHidden = Element("folderscol").style.display == 'none' ? true : false;
+
+	var folder_id = info_msg.msg_number;
+	var folder = document.getElementById(folder_id);
+	if (!folder){
+		delete_border(this.id);
+		return false;
+	}
+
+	var next_previous_msg_td = this.createNxtPrevButtons(info_msg.msg_folder,folder_id);
+	if (typeof(next_previous_msg_td) == 'undefined')
+		return false;
+
+
+	var _maxChar = menuHidden ? 40 : 15;
+
+	if (info_msg.from.name)
+	{
+		var spanName = document.createElement("SPAN");
+		spanName.innerHTML = info_msg.from.name;
+		_name = spanName.innerHTML.length > _maxChar ? spanName.innerHTML.substring(0,_maxChar) + "..." : spanName.innerHTML;
+	}
+	else
+		_name = info_msg.from.email.length > _maxChar ? info_msg.from.email.substring(0,_maxChar) + "..." : info_msg.from.email;
+	var id = this.id;
+	td.innerHTML = _name.bold() + ', ' + info_msg.udate;
+	if (info_msg.attachment.names.length > 0)
+		td.innerHTML += "&nbsp<img style='cursor:pointer' onclick='javascript:Element(\"option_hide_more_"+id+"\").onclick()' src ='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/clip.gif' title='"+info_msg.attachment.names+"'>";
+
+	if (typeof(info_msg.signature) == 'string')
+	{
+		if (info_msg.signature != "void")
+			td.innerHTML += '&nbsp;<img style="cursor:pointer" onclick="alert(\''+ get_lang("This message is signed, and you can trust.") + info_msg.signature +'\');" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/signed.gif">';
+		else
+			td.innerHTML += "&nbsp;<img style='cursor:pointer' onclick='alert(\""+get_lang("This message is signed, but it is invalid. You should not trust on it.")+"\");' title='"+get_lang("Voided message")+"' src='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/invalid.gif'>";
+	}
+
+	if (info_msg.DispositionNotificationTo)
+	{
+		td.innerHTML += '&nbsp;<img style="cursor:pointer" alt="'+ get_lang('Message with read notification') + '" title="'+ get_lang('Message with read notification') + '" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/notification.gif">';
+	}
+
+	// NORMAL MSG
+	if(info_msg.Draft != 'X')
+	{
+		var options = createAndSet("TD",['noWrap','width','align'],['true','30%','right']);
+		var option_hide_more = createAndSet("SPAN",['class','value','id'],['message_options','more_options','option_hide_more_'+id],get_lang('show details'));
+		option_hide_more.onclick = function(){
+			try{
+				var _height = Element("div_message_scroll_"+id).style.height;
+			}
+			catch(e){
+				return;
+			}
+			_height = parseInt(_height.replace("px",""));
+			var _offset = 35;
+			if (this.value != 'hide_options'){
+				this.innerHTML = "<b><u>"+get_lang('hide details')+"</u></b>";
+				this.value = 'hide_options';
+				Element("div_message_scroll_"+id).style.height = (_height - _offset)+"px";
+				Element('table_msg_details_'+id).style.display = '';
+
+			}
+			else{
+				this.innerHTML = get_lang('show details');
+				this.value = 'more_options';
+				Element("div_message_scroll_"+id).style.height = (_height + _offset)+"px";
+				Element('table_msg_details_'+id).style.display = 'none';
+			}
+		};
+		var option_mark = createAndSet("TD",['width','align'],['50%','left']);
+
+		var option_mark_as_unseen = '<span class="message_options" onclick="changeLinkState(this,\'seen\');set_messages_flag(\'unseen\','+
+						folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Unseen")+
+						'.\');">'+get_lang("Unseen")+'</span>, ';
+
+		if (info_msg.Flagged == "F")
+			var option_mark_important = '<span class="message_options" onclick="changeLinkState(this,\'important\');set_messages_flag(\'unflagged\','+
+							folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Normal")+
+							'.\');">'+get_lang("Normal")+'</span>';
+		else
+			var option_mark_important = '<span class="message_options" onclick="changeLinkState(this,\'normal\');set_messages_flag(\'flagged\','+folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Important")+
+								    '.\');">'+get_lang("Important")+'</span>';
+		option_mark.innerHTML = option_mark_as_unseen+option_mark_important;
+
+		var option_forward = createAndSet("SPAN",['id','class'],['msg_opt_forward_'+this.id, 'message_options'],get_lang('Forward'));
+		option_forward.onclick = function(){new_message('forward', this.id);};
+		appendChilds(options,option_hide_more,createAndSet('SPAN',false,false,'&nbsp;|&nbsp;'),option_forward);
+
+		var option_reply_options = createAndSet("IMG",['id', 'src', 'value'],['msg_opt_reply_options_'+id,URL_SERVER+'expressoMail1_2/templates/default/images/down.png','show']);
+		option_reply_options.onmouseover = function(){
+				option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/over.png';
+		};
+		option_reply_options.onmouseout = function(){
+			if (this.value == 'show')
+			{
+				option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/down.png';
+			}
+			else
+			{
+				option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/pressed.png';
+			}
+		};
+		option_reply_options.onclick = function(){
+			if (this.value != 'hide'){
+				this.value = 'hide';
+				option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/pressed.png';
+				Element('tr_other_options_'+id).style.display = '';
+
+			}
+			else{
+				this.value = 'show';
+				option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/down.png';
+				Element('tr_other_options_'+id).style.display = 'none';
+			}
+		};
+
+		var _option_reply = createAndSet("SPAN",['id','class'],['msg_opt_reply_'+id,'message_options'],get_lang('Reply'));
+		_option_reply.onclick = function(){new_message('reply_with_history', id);};
+
+		appendChilds(options,createAndSet('SPAN',false,false,'&nbsp;|&nbsp;'),option_reply_options,_option_reply);
+		appendChilds(tr,td,option_mark,options,next_previous_msg_td);
+		tbody_message_options.appendChild(tr);
+
+		////////// OTHER OPTIONS ////////////////////
+		var _tr_other_options = createAndSet("TR",['id'],['tr_other_options_' + id]);
+		_tr_other_options.style.display = 'none';
+
+		var div_other_options = document.createElement("DIV");
+
+		var option_mark_as	= '<span>'+get_lang("Mark as")+'</span>: ';
+		var option_mark_as_unseen	= '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'unseen\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Unseen")+'.\');">'+get_lang("Unseen")+'</span>, ';
+		var option_mark_as_important			= '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'flagged\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Important")+'.\');">'+get_lang("Important")+'</span>, ';
+		var option_mark_as_normal				= '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'unflagged\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Normal")+'.\');">'+get_lang("Normal")+'</span> | ';
+
+		var option_reply_without_history		= '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_without_history","'+id+'");>'+get_lang("Reply without history")+'</span>';
+		var option_reply_to_all					= '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_to_all_with_history","'+id+'");>'+get_lang("Reply to all")+'</span> | ';
+
+		var option_reply_to_all_without_history	= '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_to_all_without_history","'+id+'");>'+get_lang("Reply to all without history")+'</span> | </div>';
+
+		div_other_options.innerHTML = option_reply_to_all + option_reply_to_all_without_history + option_reply_without_history;
+		if (use_spam_filter) {
+			if(info_msg.msg_folder == 'INBOX'+cyrus_delimiter+'Spam')
+				div_other_options.innerHTML += ' | <span class="reply_options" onclick="nospam('+info_msg.msg_number+',\'null\', \''+info_msg.msg_folder+'\')";>'+get_lang("Not Spam")+'</span>';
+			else
+				div_other_options.innerHTML += ' | <span class="reply_options" onclick="spam(\''+info_msg.msg_folder+'\', '+info_msg.msg_number+',\'null\')";>'+get_lang("Mark as Spam")+'</span>';
+		}
+
+		var td_other_options = createAndSet("TD",['colSpan','align','noWrap'],['3','right','true']);
+		td_other_options.appendChild(div_other_options);
+
+		_tr_other_options.appendChild(td_other_options);
+		tbody_message_options.appendChild(_tr_other_options);
+		////////// END OTHER OPTIONS ////////////////
+		table_message_options.appendChild(tbody_message_options);
+		td0.appendChild(table_message_options);
+		tr0.appendChild(td0);
+		tbody_message.appendChild(tr0);
+                if (info_msg.signature && info_msg.signature.length > 0)
+		{
+			tbody_message.appendChild(putSignature(this.id,info_msg,td));
+		}
+	}
+	else 	// IF DRAFT
+	{
+		var options = createAndSet('TD',['width','noWrap','align'],['1%','true','right']);
+		var option_hide_more = createAndSet("SPAN",['class','value','id'],['message_options','more_options','option_hide_more_'+this.id],get_lang('Show details'));
+		option_hide_more.onclick = function(){
+			var _height = Element("div_message_scroll_"+id).style.height;
+			_height = parseInt(_height.replace("px",""));
+			var _offset = 35;
+			if (this.value != 'hide_options'){
+				this.innerHTML = "<b><u>"+get_lang('Hide details')+"</u></b>";
+				this.value = 'hide_options';
+				Element("div_message_scroll_"+id).style.height = (_height - _offset)+"px";
+				Element('table_msg_details_'+id).style.display = '';
+			}
+			else{
+				this.innerHTML = get_lang('show details');
+				this.value = 'more_options';
+				Element("div_message_scroll_"+id).style.height = (_height + _offset)+"px";
+				Element('table_msg_details_'+id).style.display = 'none';
+			}
+		};
+		var option_edit = createAndSet('SPAN',['class'],['message_options'], get_lang('Edit'));
+		option_edit.onclick= function () { new_message('edit',this.id); };
+		appendChilds(options, option_hide_more, createAndSet('SPAN',false,false,"&nbsp;|&nbsp;"), option_edit);
+
+		tbody_message_options.appendChild(appendChilds(tr, td, options, next_previous_msg_td));
+		table_message_options.appendChild(tbody_message_options);
+		td0.appendChild(table_message_options);
+		tr0.appendChild(td0);
+		tbody_message.appendChild(tr0);
+	}
+	return true;
+};
+
+
+/* Class draw_message */
+function draw_message(){
+	this.id=0;
+}
+draw_message.prototype.createNxtPrevButtons = function(msg_folder,folder_id){
+	var next_previous_msg_td = createAndSet("TD",[ "noWrap", "align", "width" ], [ "true", "right", "40px"]);
+	var img_next_msg = createAndSet("IMG", [ 'id', 'src', 'title' ], [
+			'msg_opt_next_' + this.id,
+			URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/down.button.png',
+			get_lang('Next') ]);
+	img_next_msg.style.cursor = 'pointer';
+
+	var folder = document.getElementById(folder_id);
+	if (folder){ // mensagem local criptografada nao tem ID da pasta local
+		if (folder.nextSibling){
+			var nextMsgBox = folder.nextSibling.name?folder.nextSibling.name:msg_folder;
+
+			if (nextMsgBox == "INBOX/decifradas")// teste para ver se a mensagem vem da pasta oculta decifradas
+				nextMsgBox = get_current_folder();
+
+			img_next_msg.onclick = function()
+			{
+				openTab.type[currentTab] = 2;
+				if ( nextMsgBox == undefined )
+				       nextMsgBox = current_folder;
+				for (var i=0; i < draw_box.headers_msgs.length; i++)
+					if (draw_box.headers_msgs[i].msg_number == folder.nextSibling.id){
+						var nextHeader = draw_box.headers_msgs[i];
+						break;
+					}
+				proxy_mensagens.get_msg(nextHeader,nextMsgBox,true,show_msg,currentTab);
+			};
+		}
+		else
+		{
+			img_next_msg.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/down.gray.button.png';
+			img_next_msg.style.cursor = 'default';
+		}
+	}
+	else
+	{
+		img_next_msg.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/down.gray.button.png';
+		img_next_msg.style.cursor = 'default';
+		if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(msg_folder == "INBOX/decifradas")) // testa se a mensagem e local
+		{
+			img_next_msg.onclick = function()
+			{
+				delete_border(this.id);
+			};
+		}
+	}
+	var img_space = document.createElement("SPAN");
+        img_space.innerHTML = "&nbsp;";
+	var img_previous_msg = createAndSet("IMG",['id','src','title'],['msg_opt_previous_' + this.id,
+			URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/up.button.png',
+			get_lang('Previous')]);
+	img_previous_msg.style.cursor = 'pointer';
+
+	if (!folder){
+		delete_border(this.id);
+		return;
+	}
+	if (folder){ // mensagem local criptografada nao tem this.id da pasta local
+		if (folder.previousSibling)
+		{
+			var previousMsgBox = folder.previousSibling.name?folder.previousSibling.name:msg_folder;
+
+			if (previousMsgBox == "INBOX/decifradas") // teste para ver se a mensagem vem da pasta oculta decifradas
+				previousMsgBox = get_current_folder();
+
+			img_previous_msg.onclick = function()
+			{
+				openTab.type[currentTab] = 2;
+				if ( previousMsgBox == undefined )
+				       previousMsgBox = current_folder;
+				 for (var i=0; i < draw_box.headers_msgs.length; i++)
+					if (draw_box.headers_msgs[i].msg_number == folder.previousSibling.id){
+						var previousHeader = draw_box.headers_msgs[i];
+						break;
+					}
+				proxy_mensagens.get_msg(previousHeader,previousMsgBox,true,show_msg,currentTab);
+			};
+		}
+		else
+		{
+			img_previous_msg.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/up.gray.button.png';
+			img_previous_msg.style.cursor = 'default';
+		}
+	}
+	else
+	{
+		img_previous_msg.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/up.gray.button.png';
+		img_previous_msg.style.cursor = 'default';
+		if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(msg_folder == "INBOX/decifradas")) // testa se a mensagem e local
+		{
+			img_previous_msg.onclick = function()
+			{
+				delete_border(this.id);
+			};
+		}
+	}
+	next_previous_msg_td.appendChild(img_previous_msg);
+	next_previous_msg_td.appendChild(img_space);
+	next_previous_msg_td.appendChild(img_next_msg);
+	return next_previous_msg_td;
+
+};
+var idx_cc = 0;
+draw_message.prototype.draw_plugin_cc = function(addrs)
+{
+    expresso.connector.loadScript("jscode/ccQuickAdd");
+    var id=this.id;
+
+    var array_addrs = '';
+    var array_name      = '';
+    var cc_data = new Array();
+    if(typeof(addrs.name) != 'undefined') {
+        array_name      = LTrim(addrs.name).split(" ");
+        array_addrs = new Array(addrs.email);
+    }
+    else {
+        array_addrs = (typeof addrs == 'object' ? addrs.toString().split("\" ") : addrs.split("\" "));
+        array_name      = LTrim(array_addrs[0]).replace('"','').split(" ");
+    }
+
+    var _split = array_name[0].split('@');
+    cc_data[0] = _split[0];
+    cc_data[1] = _split[0];
+    cc_data[2] = '';
+
+    for (i=1; i < array_name.length; i++)
+        cc_data[2] += array_name[i] + " ";
+
+
+    if(array_addrs.length > 1)
+        cc_data[3] = array_addrs[1] ? array_addrs[1].replace("&lt;",'').replace("&gt;",'') : '';
+    else
+        cc_data[3] = array_addrs[0];
+
+    var sm_envelope_img1 = '<img style="cursor:'+ (is_ie ? 'hand' : 'pointer') +'" title="' + get_lang("Add Contact") +
+    '" onclick="ccQuickAddOne.showList(\''+cc_data+'\')" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/user_card.png">';
+    var to_addybook_add = "<SPAN id='insert_plugin_"+idx_cc+"_"+id+"'>";
+    to_addybook_add += addrs;
+    to_addybook_add +=  sm_envelope_img1;
+    idx_cc++;
+    to_addybook_add += "</SPAN>";
+    return to_addybook_add;
+};
+
+
+draw_message.prototype.show_signature_certificate_data = function(){
+	var _height = Element("div_message_scroll_"+this.id).style.height;
+	_height = parseInt(_height.replace("px",""));
+	var _offset = 130;
+	if (this.value == 'more_cert'){
+		//this.innerHTML += "<b><u>Mais InformaÃ¯Â¿ÅÃ¯Â¿Åes</u></b>";
+		this.value = 'hide_cert';
+		Element("div_message_scroll_"+this.id).style.height = (_height + _offset)+"px";
+		Element('tr_signature_'+this.id).style.display = 'none';
+		Element('td_signature_'+this.id).style.display = 'none';
+
+	}
+	else{
+		//this.innerHTML += "Mais InformaÃ¯Â¿ÅÃ¯Â¿Åes";
+		this.value = 'more_cert';
+		Element("div_message_scroll_"+this.id).style.height = (_height - _offset)+"px";
+		Element('tr_signature_'+this.id).style.display = '';
+		Element('td_signature_'+this.id).style.display = '';
+	}
+};
+
+draw_message.prototype.putSignature = function(info_msg,tdx){
+        var tr_signature = document.createElement("TR");
+        var td_signature = document.createElement("TD");
+        td_signature.className = 'tr_message_header';
+        tr_signature.id = 'tr_signature_'+this.id;
+        td_signature.colSpan = "5";
+        tr_signature.style.display = 'none';
+
+        for (i=0; i < info_msg.signature.length; i++)
+                td_signature.innerHTML += '<span>'+info_msg.signature[i]+'</span> <br /> ';
+        td_signature.innerHTML += '<hr></hr>';
+        var signature_status_pos = info_msg.signature[0].indexOf('Message untouched');
+        td_signature.id = "td_signature_"+this.id;
+        if(signature_status_pos < 0 )
+        {
+                tdx.innerHTML += '&nbsp;<img style="cursor:pointer" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/signed_error.gif" title="'+get_lang("Details")+'" onclick="show_signature_certificate_data(\'' + this.id + '\')">';
+                tr_signature.style.display = '';
+        }
+        else
+        {
+                tdx.innerHTML += '&nbsp;<img style="cursor:pointer" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/signed_table.gif" title="'+get_lang("Details")+'" onclick="show_signature_certificate_data(\'' + this.id + '\')">';
+        }
+        tr_signature.appendChild(td_signature);
+        return tr_signature;
+    };
+
+
+draw_message.prototype.getThumbs = function(attachments, thumbs, msg_number, msg_folder){
+		var table_message_thumbs = document.createElement("TABLE");
+		table_message_thumbs.width = "80%";
+		table_message_thumbs.style.borderTop = "2px solid rgb(170, 170, 170)";
+		var tbody_message_thumbs = document.createElement("TBODY");
+		var tr = document.createElement("TR");
+		tr.className = "tr_message_body";
+		var td = document.createElement("TD");
+		td.setAttribute("colSpan","2");
+		td.id = "body_thumbs_"+msg_number;
+		td.innerHTML += "&nbsp;<font color='DARKBLUE' size='2'><b>"+attachments.length+" "+get_lang("attachment")+(attachments.length > 1 ? "s" : "")+" "+get_lang("in this message")+"</font></b>";
+		var _link_attachments = '';
+		if(thumbs.length > 1){
+			_link_attachments 	= document.createElement("A");
+			_link_attachments.className = "message_options";
+			if(proxy_mensagens.is_local_folder(current_folder))
+				_link_attachments.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+msg_folder+"','"+msg_number+"')");
+			else
+				_link_attachments.setAttribute("href", "javascript:download_all_attachments('"+msg_folder+"','"+msg_number+"')");
+			_link_attachments.innerHTML = get_lang('Download all atachments');
+		}
+
+		if(_link_attachments){
+			td.innerHTML +=	" :: ";
+			td.appendChild(_link_attachments);
+		}
+
+		td.innerHTML +=	"<BR><img src='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/menu/ktip.png'>"+get_lang("<b>Tip:</b> For faster save, click over the image with <u>right button</u>.");
+		td.innerHTML += "<BR>";
+
+		for (var i=0; i<thumbs.length; i++){
+			if ((i % 4) == 0)
+				td.innerHTML += "<BR>";
+			td.innerHTML += thumbs[i];
+			td.innerHTML += "&nbsp;&nbsp;";
+		}
+		tr.appendChild(td);
+		tbody_message_thumbs.appendChild(tr);
+		table_message_thumbs.appendChild(tbody_message_thumbs);
+		return table_message_thumbs;
+};
+
+draw_message.prototype.getBcc = function(bccField){
+	/*
+	 * @AUTHOR Rodrigo Souza dos Santos
+	 * @MODIFY-DATE 2008/09/11
+	 * @BRIEF Adding routine to create bcc (blind carbon copy) field if there is one.
+	 */
+	var tr3 = document.createElement("tr");
+	tr3.className = "tr_message_header";
+	var td3 = document.createElement("td");
+	td3.innerHTML = get_lang("BCC") + " : ";
+	var cco = document.createElement("td");
+	cco.id = "cco_"+this.id;
+
+	var cco_values = createAndSet("INPUT",['id', 'type', 'value'],["cco_values_"+this.id,"hidden",bccField]);
+	ccoaddress_array[this.id] = bccField.split(",");		
+	if (ccoaddress_array[this.id].length > 1){
+		var div_ccoaddress = document.createElement("SPAN");
+		div_ccoaddress.id = "div_ccoaddress_"+this.id;
+		var div_ccoaddress_full = createAndSet("SPAN",['id', 'style'],["div_ccoaddress_full_"+this.id, "display:inline"]);
+		/*
+		 * The function below is ugly, doesn't possible use this.
+		 * The problem is that the code's function was written
+		 * on a hardcode concept.
+		 */
+		//cco.innerHTML = this.draw_plugin_cc(ccoaddress_array[this.id][0]);
+		cco.innerHTML = ccoaddress_array[this.id][0];
+		div_ccoaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+this.id+"','cco');>"+get_lang('more')+"</a>)";
+		cco.appendChild(div_ccoaddress);
+	}
+	else{
+		/*
+		 * The function below is ugly, it is not possible to use this.
+		 * The problem is that the code's function was written
+		 * on a hardcode concept.
+		 */
+		//cco.innerHTML = this.draw_plugin_cc(info_msg.cco);
+		cco.innerHTML = bccField;
+	}
+	cco.className = "header_message_field";
+	return appendChilds(tr3,td3,cco,cco_values);
+};
+
+draw_message.prototype.blockImage = function(info_msg,ID,td){
+	var imgTag = info_msg.body.match(/(<img[^>]*src[^>=]*=['"]?[^'">]*["']?[^>]*>)|(<[^>]*(style[^=>]*=['"][^>]*background(-image)?:[^:;>]*url\()[^>]*>)/gi);
+
+	var newBody = info_msg.body;
+	if(!info_msg.showImg && imgTag)
+	{
+		var domains = '';
+		var blocked = false;
+		var forbidden = true;
+
+		if (preferences.notification_domains != null && typeof(preferences.notification_domains) != 'undefined')
+		{
+			domains = preferences.notification_domains.split(',');
+			for(var j = 0; j < imgTag.length; j++)
+			{
+				for (var i = 0; i < domains.length; i++)
+				{
+					if (imgTag[j].match(/cid:([\w\d]){5,}/) || imgTag[j].match(/src=\"\.\/inc\/show_embedded_attach\.php/g))
+					{
+						forbidden = false;
+						continue;
+					}
+					imgSource = imgTag[j].match(/=['"](http:\/\/)+[^'"\/]*/);
+					if (imgSource && imgSource.toString().substr(5).match(domains[i]))
+						forbidden = false;
+				}
+				if (forbidden)
+				{
+					newBody = newBody.replace(imgTag[j],"<img src='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/forbidden.jpg'>");
+					blocked=true;
+				}
+			}
+			if (blocked)
+			{
+				var showImgLink = document.createElement('DIV');
+				showImgLink.id="show_img_link_"+ID;
+				showImgLink.onclick = function(){show_msg_img(info_msg.msg_number,info_msg.msg_folder)};
+				showImgLink.className="show_img_link";
+				showImgLink.innerHTML = get_lang("Show images from")+": "+info_msg.from.email;
+				td.appendChild(showImgLink);
+			}
+		}
+	}
+	return newBody;
+
+};
+
+draw_msg = new draw_message();
+
Index: trunk/expressoMail1_2/js/jscode/messages.js
===================================================================
--- trunk/expressoMail1_2/js/jscode/messages.js	(revision 2755)
+++ 	(revision )
@@ -1,835 +1,0 @@
-draw_message.prototype.draw_message_header = function(header,border_id){
-	this.id = border_id;
-	var defaultWidth = document.body.offsetWidth - 37;
-	if(Element("folderscol").style.display != 'none')
-		defaultWidth -= Element("folderscol").offsetWidth;
-
-	var table_message = createAndSet("TABLE",['id','border','width'],['table_message_'+border_id,"0",defaultWidth]);
-	table_message.id = 'table_message_'+border_id;
-	var tbody_message = document.createElement("TBODY");
-	if (!this.make_options_message(header,tbody_message))
-		return;
-
-	table_message.appendChild(tbody_message);
-	var content = document.getElementById('content_id_' + border_id);
-	content.appendChild(table_message);
-	loading_img = content.appendChild(loading_img);
-};
-
-
-draw_message.prototype.draw_message_body = function (info_msg){
-	var defaultWidth = document.body.offsetWidth - 37;
-	if(Element("folderscol").style.display != 'none')
-		defaultWidth -= Element("folderscol").offsetWidth;
-
-	var table_message = Element('table_message_'+this.id);
-	var tbody_message = table_message.childNodes[0];
-	if(tbody_message.childNodes.length >1)
-		tbody_message.removeChild(tbody_message.lastChild);
-
-	var tbody_message_others_options = document.createElement("TBODY");
-	var tr1 = document.createElement("TR");
-	tr1.className = "tr_message_header";
-	var td1 = createAndSet('TD',['width'],['7%'],get_lang("From: "));
-	td1.appendChild(deny_email(info_msg.from.email));
-	var id=this.id;
-
-	if (info_msg.sender){
-		var tr111 = document.createElement("TR");
-		tr111.className = "tr_message_header";
-		var td111 = createAndSet('TD',['noWrap'],['true'],get_lang("Sent by")+": ");
-		td111.appendChild(deny_email(info_msg.sender.email));
-		var sender = document.createElement("TD");
-		sender.className = "header_message_field";
-		sender.id = "sender_"+id;
-		sender.innerHTML += this.draw_plugin_cc(info_msg.sender.full);
-		var sender_values = createAndSet("INPUT",['id','type','value'],["sender_values_"+id,"HIDDEN",info_msg.sender.full]);
-
-		tbody_message_others_options.appendChild(appendChilds(tr111, td111, sender, sender_values));
-	}
-
-	var from = createAndSet('TD',['id','class'],["from_"+this.id,"header_message_field"],info_msg.from.full);
-
-	if (info_msg.Draft != "X"){
-		from.innerHTML += this.draw_plugin_cc(info_msg.from);
-		tbody_message_others_options.appendChild(tr1);
-	}
-	var from_values = createAndSet('INPUT',['id','type','value'],["from_values_"+id,"HIDDEN",info_msg.from.full]);
-	var local_message = createAndSet("INPUT",['id','name','type','value'],["is_local_"+this.id,"is_local","HIDDEN",(info_msg.local_message)?"1":"0"]);
-	appendChilds(tr1,td1,from,from_values,local_message);
-
-	if (info_msg.reply_to){
-		var tr11 = document.createElement("TR");
-		tr11.className = "tr_message_header";
-		var _td11 = createAndSet('TD',['noWrap'],['true'],get_lang("Reply to")+": ");
-		var _reply_to = createAndSet('TD',['id', 'class'],["reply_to_"+id, "header_message_field"],this.draw_plugin_cc(info_msg.reply_to));
-		var _reply_to_values = createAndSet('INPUT',['id', 'type', 'value'],["reply_to_values_"+id,"HIDDEN",info_msg.reply_to]);
-		tbody_message_others_options.appendChild(appendChilds(tr11,_td11,_reply_to,_reply_to_values));
-	}
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-	var tr2 = document.createElement("TR");
-	tr2.className = "tr_message_header";
-	var td2 = document.createElement("TD");
-	td2.innerHTML = get_lang("To: ");
-	var to = document.createElement("TD");
-	to.id = "to_"+id;
-
-	var _to_values = createAndSet('INPUT',['id', 'type', 'value'],["to_values_"+id, "HIDDEN", info_msg.toaddress2]);
-	// Salva a pasta da mensagem
-	var _input_cfolder = createAndSet('INPUT',['id', 'name', 'type', 'value'],["input_folder_"+id, "input_folder", "hidden", info_msg.msg_folder]);
-	td2.appendChild(_input_cfolder);
-
-	toaddress_array[id] = info_msg.toaddress2.split(",");
-	if (toaddress_array[id].length > 1){
-		to.innerHTML += this.draw_plugin_cc(toaddress_array[id][0]);
-		var _div_toaddrs = createAndSet('SPAN',['id','style'],["div_toaddress_"+id,'display: inline']," (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+id+"','to');>"+get_lang('more')+"</a>)");
-		to.appendChild(_div_toaddrs);
-	}
-	else {
-		toAdd = toaddress_array[id].toString().replace("<","&lt;");
-		toAdd = toAdd.replace(">","&gt;");
-		to.innerHTML += this.draw_plugin_cc(toAdd);
-	}
-	to.className = "header_message_field";
-	tbody_message_others_options.appendChild(appendChilds(tr2,td2,to,_to_values));
-
-	if (info_msg.cc){
-		var tr3 = document.createElement("TR");
-		tr3.className = "tr_message_header";
-		var td3 = document.createElement("TD");
-		td3.innerHTML = "CC: ";
-		var cc = createAndSet("TD",['id', 'class'],["cc_"+this.id,"header_message_field"]);
-
-		var cc_values = createAndSet("INPUT",['id', 'type', 'value'],["cc_values_"+this.id, "HIDDEN", info_msg.cc]);
-		ccaddress_array[this.id] = info_msg.cc.split(",");		
-		if (ccaddress_array[this.id].length > 1){
-			var div_ccaddress = document.createElement("SPAN");
-			div_ccaddress.id = "div_ccaddress_"+this.id;
-			var div_ccaddress_full = createAndSet("SPAN",['id', 'style'],["div_ccaddress_full_"+this.id, "display: inline"]);
-			cc.innerHTML = this.draw_plugin_cc(ccaddress_array[this.id][0]);
-			div_ccaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+this.id+"','cc');>"+get_lang('more')+"</a>)";
-			cc.appendChild(div_ccaddress);
-		}
-		else{
-			cc.innerHTML = this.draw_plugin_cc(info_msg.cc);
-		}
-		tbody_message_others_options.appendChild(appendChilds(tr3,td3,cc,cc_values));
-	}
-
-	if (info_msg.bcc)
-	{
-		tbody_message_others_options.appendChild(this.getBcc(info_msg.bcc));
-	}
-
-	var tr4 = document.createElement("TR");
-	tr4.className = "tr_message_header";
-	var td4 = document.createElement("TD");
-	td4.innerHTML = get_lang("Date: ");
-	var msgFull = info_msg.fulldate.split(' ');
-
-	var date = createAndSet('TD',['id','class'],["date_"+id,"header_message_field"],info_msg.fulldate);
-	var date_day = createAndSet('INPUT',['id', 'type', 'value'],["date_day_"+id, "HIDDEN", msgFull[0]]);
-	var date_hour = createAndSet('INPUT',['id', 'type', 'value'],["date_hour_"+id, "HIDDEN", msgFull[1]]);
-	tbody_message_others_options.appendChild(appendChilds(tr4,td4,date,date_day,date_hour));
-
-	var tr5 = document.createElement("TR");
-	tr5.className = "tr_message_header";
-	var td5 = document.createElement("TD");
-	td5.innerHTML = get_lang("Subject");
-	var subject = createAndSet('TD',['id', 'class'],["subject_"+this.id, "header_message_field"],info_msg.subject);
-	tbody_message_others_options.appendChild(appendChilds(tr5,td5,subject));
-	if (info_msg.attachments.length > 0){
-		var tr6 = document.createElement("TR");
-		tr6.className = "tr_message_header";
-		var td6 = document.createElement("TD");
-		td6.innerHTML = get_lang("Attachments: ");
-
-		var attachments = document.createElement("TD");
-		attachments.align='left';
-		td6.vAlign = "top";
-
-		var zipped_attachments = '';
-		if(info_msg.attachments.length >= 1) {
-			var zipped_attachments  = createAndSet("TABLE",['style','cellPadding','cellSpacing'],['margin-bottom: 4px','0','0']);
-			var td = document.createElement("TD");
-			if(info_msg.attachments.length > 1) {
-				var link_attachment     = document.createElement("A");
-				if(proxy_mensagens.is_local_folder(current_folder))
-					link_attachment.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')");
-				else
-					link_attachment.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')");
-				link_attachment.innerHTML = " "+info_msg.attachments.length+' '+get_lang('files')+' :: '+get_lang('Download all atachments');
-				link_attachment.innerHTML += '<BR>';
-				td.appendChild(link_attachment);
-			}
-			var tr = document.createElement("TR");
-			if(parseInt(preferences.remove_attachments_function))
-			{
-				var del_attachments = document.createElement("A");
-				del_attachments.setAttribute("href", "javascript:remove_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')");
-				del_attachments.innerHTML = get_lang('remove all attachments');
-				del_attachments.appendChild(document.createElement('BR'));
-				td.appendChild(del_attachments);
-				tr.appendChild(td);
-			}
-			tr.appendChild(td);
-			zipped_attachments.appendChild(tr);
-			attachments.appendChild(zipped_attachments);
-		}
-
-		attachments.id = "attachments_" + this.id;
-		for (var i=0; i<info_msg.attachments.length; i++){
-			var link_attachment = document.createElement("A");
-			link_attachment.setAttribute("href", proxy_mensagens.link_anexo(info_msg,i));
-			//link_attachment.setAttribute("href", "javascript:download_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"',"+i+",'"+info_msg.attachments[i].pid+"','"+info_msg.attachments[i].encoding+"')");
-			link_attachment.innerHTML = url_decode(info_msg.attachments[i].name);
-			link_attachment.innerHTML += "&nbsp;"+borkb(info_msg.attachments[i].fsize);
-
-			if((url_decode(info_msg.attachments[i].name).indexOf(".ics")!=-1) || (url_decode(info_msg.attachments[i].name).indexOf(".vcard")!=-1)){
-				//Link para importar calendÃ¡rio
-				var link_import_attachment = createAndSet("IMG",['src','onclick','title','align','style'],["templates/"+template+"/images/new.png","javascript:import_calendar('"+info_msg.msg_folder+"&msg_number="+info_msg.msg_number+"&msg_part="+info_msg.attachments[i].pid+"&idx_file="+i+"&encoding="+info_msg.attachments[i].encoding+"');",get_lang("Import to calendar"),"top","cursor: pointer"]);
-				var space = document.createElement("span");
-				space.innerHTML = "&nbsp;";
-				appendChilds(attachments,link_attachment,space,link_import_attachment);
-			}
-			else {
-				link_attachment.innerHTML += '<BR>';
-				attachments.appendChild(link_attachment);
-			}
-		}
-		tr6.appendChild(td6);
-		tr6.appendChild(attachments);
-		tbody_message_others_options.appendChild(tr6);
-	}
-
-
-	// 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_"+this.id;
-	div.style.background = 'WHITE';
-	div.style.height = document.body.clientHeight - offset - 125;
-	div.style.overflow = "auto";
-	div.style.width = defaultWidth - (is_ie ? 5 : 0);
-	// END MAKE THE SCROLL HEIGHT
-
-	var table_msg_details = createAndSet("TABLE",['id','width','class'],['table_msg_details_' + this.id,defaultWidth - 30,'table_message']);
-	table_msg_details.style.display = 'none';
-	table_msg_details.appendChild(tbody_message_others_options);
-	div.appendChild(table_msg_details);
-
-	var tr = document.createElement("TR");
-	var td = document.createElement("TD");
-	td.colSpan = '2';
-
-	var newBody = this.blockImage(info_msg,this.id,td);
-
-	td.appendChild(div);
-	tr.appendChild(td);
-	tbody_message.appendChild(tr);
-
-	//////////////////////////////////////////////////////////////////////////////////////////////////////	
-	//Make the body message.
-	///////////////////////////////////////////////////////////////////////////////////////////////////////
-	var tr = document.createElement("TR");
-	tr.className = "tr_message_body";
-	var td = document.createElement("TD");
-	//td.setAttribute("colSpan","2");
-	newBody = newBody.replace("<body","<span");
-	newBody = newBody.replace("<BODY","<span");
-	div.innerHTML+= "<span id='body_"+this.id+"' style='font-size:16px;'>"+newBody+"</span><br><br>";
-	function mailto( link )
-	{
-		var mail = link.href.substr( 7 );
-		link.onclick = function( )
-		{
-			new_message_to( mail );
-			return false;
-		};
-	}
-	var links = div.getElementsByTagName( 'a' );
-	for ( var i = 0; i < links.length; i++ )
-		if ( links.item( i ).href.indexOf( 'mailto:' ) === 0 )
-			mailto( links.item( i ) );
-		else
-		{
-			if ( links.item( i ).href.indexOf( 'javascript:' ) !== 0 )
-				links.item( i ).setAttribute( 'target', '_blank' );
-		}
-
-	if ((info_msg.thumbs)&&(info_msg.thumbs.length > 0)){
-		//////////////////////////////////////////////////////////////////////////////////////////////////////	
-		//Make the thumbs of the message.
-		//////////////////////////////////////////////////////////////////////////////////////////////////////
-		div.appendChild(this.getThumbs(info_msg.attachments, info_msg.thumbs, info_msg.msg_number, info_msg.msg_folder));
-	}
-
-
-	var msg_number = createAndSet("INPUT",['id','type','value'],["msg_number_" + this.id, "hidden", info_msg.msg_number]);
-	var content = document.getElementById('content_id_' + this.id);
-	try{
-		loading_img = content.removeChild( loading_img );
-	}catch(e){};
-	content.style.height = document.body.clientHeight - offset - 90;
-	content.appendChild(msg_number);
-	//////////////////////////////////////////////////////////////////////////////////////////////////////
-
-	//Exibe o cabecalho da mensagem totalmente aberto caso esteja setado nas preferencias do usuario
-	if (preferences.show_head_msg_full == 1)
-	{
-		option_hide_more.onclick();
-
-		if (Element('div_toaddress_'+this.id) != null)
-		{
-			show_div_address_full(this.id,'to');
-		}	
-		if (Element('div_ccaddress_'+this.id) != null)
-		{
-			show_div_address_full(this.id,'cc');
-		}
-	}
-
-};
-
-draw_message.prototype.make_options_message = function(info_msg, tbody_message){
-	var tr0 = document.createElement("TR");
-	tr0.className = "tr_message_header";
-	var td0 = document.createElement("TD");
-	var table_message_options = createAndSet("TABLE",['border','width','class'],["0","100%",'table_message']);
-	var tbody_message_options = document.createElement("TBODY");
-	var tr = document.createElement("TR");
-	var td = document.createElement("TD");
-	td.setAttribute("noWrap","true");
-	var _name = '';
-	var menuHidden = Element("folderscol").style.display == 'none' ? true : false;
-
-	var folder_id = info_msg.msg_number;
-	var folder = document.getElementById(folder_id);
-	if (!folder){
-		delete_border(this.id);
-		return false;
-	}
-
-	var next_previous_msg_td = this.createNxtPrevButtons(info_msg.msg_folder,folder_id);
-	if (typeof(next_previous_msg_td) == 'undefined')
-		return false;
-
-
-	var _maxChar = menuHidden ? 40 : 15;
-
-	if (info_msg.from.name)
-	{
-		var spanName = document.createElement("SPAN");
-		spanName.innerHTML = info_msg.from.name;
-		_name = spanName.innerHTML.length > _maxChar ? spanName.innerHTML.substring(0,_maxChar) + "..." : spanName.innerHTML;
-	}
-	else
-		_name = info_msg.from.email.length > _maxChar ? info_msg.from.email.substring(0,_maxChar) + "..." : info_msg.from.email;
-	var id = this.id;
-	td.innerHTML = _name.bold() + ', ' + info_msg.udate;
-	if (info_msg.attachment.names.length > 0)
-		td.innerHTML += "&nbsp<img style='cursor:pointer' onclick='javascript:Element(\"option_hide_more_"+id+"\").onclick()' src ='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/clip.gif' title='"+info_msg.attachment.names+"'>";
-
-	if (typeof(info_msg.signature) == 'string')
-	{
-		if (info_msg.signature != "void")
-			td.innerHTML += '&nbsp;<img style="cursor:pointer" onclick="alert(\''+ get_lang("This message is signed, and you can trust.") + info_msg.signature +'\');" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/signed.gif">';
-		else
-			td.innerHTML += "&nbsp;<img style='cursor:pointer' onclick='alert(\""+get_lang("This message is signed, but it is invalid. You should not trust on it.")+"\");' title='"+get_lang("Voided message")+"' src='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/invalid.gif'>";
-	}
-
-	if (info_msg.DispositionNotificationTo)
-	{
-		td.innerHTML += '&nbsp;<img style="cursor:pointer" alt="'+ get_lang('Message with read notification') + '" title="'+ get_lang('Message with read notification') + '" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/notification.gif">';
-	}
-
-	// NORMAL MSG
-	if(info_msg.Draft != 'X')
-	{
-		var options = createAndSet("TD",['noWrap','width','align'],['true','30%','right']);
-		var option_hide_more = createAndSet("SPAN",['class','value','id'],['message_options','more_options','option_hide_more_'+id],get_lang('show details'));
-		option_hide_more.onclick = function(){
-			try{
-				var _height = Element("div_message_scroll_"+id).style.height;
-			}
-			catch(e){
-				return;
-			}
-			_height = parseInt(_height.replace("px",""));
-			var _offset = 35;
-			if (this.value != 'hide_options'){
-				this.innerHTML = "<b><u>"+get_lang('hide details')+"</u></b>";
-				this.value = 'hide_options';
-				Element("div_message_scroll_"+id).style.height = (_height - _offset)+"px";
-				Element('table_msg_details_'+id).style.display = '';
-
-			}
-			else{
-				this.innerHTML = get_lang('show details');
-				this.value = 'more_options';
-				Element("div_message_scroll_"+id).style.height = (_height + _offset)+"px";
-				Element('table_msg_details_'+id).style.display = 'none';
-			}
-		};
-		var option_mark = createAndSet("TD",['width','align'],['50%','left']);
-
-		var option_mark_as_unseen = '<span class="message_options" onclick="changeLinkState(this,\'seen\');set_messages_flag(\'unseen\','+
-						folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Unseen")+
-						'.\');">'+get_lang("Unseen")+'</span>, ';
-
-		if (info_msg.Flagged == "F")
-			var option_mark_important = '<span class="message_options" onclick="changeLinkState(this,\'important\');set_messages_flag(\'unflagged\','+
-							folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Normal")+
-							'.\');">'+get_lang("Normal")+'</span>';
-		else
-			var option_mark_important = '<span class="message_options" onclick="changeLinkState(this,\'normal\');set_messages_flag(\'flagged\','+folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Important")+
-								    '.\');">'+get_lang("Important")+'</span>';
-		option_mark.innerHTML = option_mark_as_unseen+option_mark_important;
-
-		var option_forward = createAndSet("SPAN",['id','class'],['msg_opt_forward_'+this.id, 'message_options'],get_lang('Forward'));
-		option_forward.onclick = function(){new_message('forward', this.id);};
-		appendChilds(options,option_hide_more,createAndSet('SPAN',false,false,'&nbsp;|&nbsp;'),option_forward);
-
-		var option_reply_options = createAndSet("IMG",['id', 'src', 'value'],['msg_opt_reply_options_'+id,URL_SERVER+'expressoMail1_2/templates/default/images/down.png','show']);
-		option_reply_options.onmouseover = function(){
-				option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/over.png';
-		};
-		option_reply_options.onmouseout = function(){
-			if (this.value == 'show')
-			{
-				option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/down.png';
-			}
-			else
-			{
-				option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/pressed.png';
-			}
-		};
-		option_reply_options.onclick = function(){
-			if (this.value != 'hide'){
-				this.value = 'hide';
-				option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/pressed.png';
-				Element('tr_other_options_'+id).style.display = '';
-
-			}
-			else{
-				this.value = 'show';
-				option_reply_options.src= URL_SERVER+'expressoMail1_2/templates/default/images/down.png';
-				Element('tr_other_options_'+id).style.display = 'none';
-			}
-		};
-
-		var _option_reply = createAndSet("SPAN",['id','class'],['msg_opt_reply_'+id,'message_options'],get_lang('Reply'));
-		_option_reply.onclick = function(){new_message('reply_with_history', id);};
-
-		appendChilds(options,createAndSet('SPAN',false,false,'&nbsp;|&nbsp;'),option_reply_options,_option_reply);
-		appendChilds(tr,td,option_mark,options,next_previous_msg_td);
-		tbody_message_options.appendChild(tr);
-
-		////////// OTHER OPTIONS ////////////////////
-		var _tr_other_options = createAndSet("TR",['id'],['tr_other_options_' + id]);
-		_tr_other_options.style.display = 'none';
-
-		var div_other_options = document.createElement("DIV");
-
-		var option_mark_as	= '<span>'+get_lang("Mark as")+'</span>: ';
-		var option_mark_as_unseen	= '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'unseen\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Unseen")+'.\');">'+get_lang("Unseen")+'</span>, ';
-		var option_mark_as_important			= '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'flagged\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Important")+'.\');">'+get_lang("Important")+'</span>, ';
-		var option_mark_as_normal				= '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'unflagged\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Normal")+'.\');">'+get_lang("Normal")+'</span> | ';
-
-		var option_reply_without_history		= '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_without_history","'+id+'");>'+get_lang("Reply without history")+'</span>';
-		var option_reply_to_all					= '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_to_all_with_history","'+id+'");>'+get_lang("Reply to all")+'</span> | ';
-
-		var option_reply_to_all_without_history	= '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_to_all_without_history","'+id+'");>'+get_lang("Reply to all without history")+'</span> | </div>';
-
-		div_other_options.innerHTML = option_reply_to_all + option_reply_to_all_without_history + option_reply_without_history;
-		if (use_spam_filter) {
-			if(info_msg.msg_folder == 'INBOX'+cyrus_delimiter+'Spam')
-				div_other_options.innerHTML += ' | <span class="reply_options" onclick="nospam('+info_msg.msg_number+',\'null\', \''+info_msg.msg_folder+'\')";>'+get_lang("Not Spam")+'</span>';
-			else
-				div_other_options.innerHTML += ' | <span class="reply_options" onclick="spam(\''+info_msg.msg_folder+'\', '+info_msg.msg_number+',\'null\')";>'+get_lang("Mark as Spam")+'</span>';
-		}
-
-		var td_other_options = createAndSet("TD",['colSpan','align','noWrap'],['3','right','true']);
-		td_other_options.appendChild(div_other_options);
-
-		_tr_other_options.appendChild(td_other_options);
-		tbody_message_options.appendChild(_tr_other_options);
-		////////// END OTHER OPTIONS ////////////////
-		table_message_options.appendChild(tbody_message_options);
-		td0.appendChild(table_message_options);
-		tr0.appendChild(td0);
-		tbody_message.appendChild(tr0);
-                if (info_msg.signature && info_msg.signature.length > 0)
-		{
-			tbody_message.appendChild(putSignature(this.id,info_msg,td));
-		}
-	}
-	else 	// IF DRAFT
-	{
-		var options = createAndSet('TD',['width','noWrap','align'],['1%','true','right']);
-		var option_hide_more = createAndSet("SPAN",['class','value','id'],['message_options','more_options','option_hide_more_'+this.id],get_lang('Show details'));
-		option_hide_more.onclick = function(){
-			var _height = Element("div_message_scroll_"+id).style.height;
-			_height = parseInt(_height.replace("px",""));
-			var _offset = 35;
-			if (this.value != 'hide_options'){
-				this.innerHTML = "<b><u>"+get_lang('Hide details')+"</u></b>";
-				this.value = 'hide_options';
-				Element("div_message_scroll_"+id).style.height = (_height - _offset)+"px";
-				Element('table_msg_details_'+id).style.display = '';
-			}
-			else{
-				this.innerHTML = get_lang('show details');
-				this.value = 'more_options';
-				Element("div_message_scroll_"+id).style.height = (_height + _offset)+"px";
-				Element('table_msg_details_'+id).style.display = 'none';
-			}
-		};
-		var option_edit = createAndSet('SPAN',['class'],['message_options'], get_lang('Edit'));
-		option_edit.onclick= function () { new_message('edit',this.id); };
-		appendChilds(options, option_hide_more, createAndSet('SPAN',false,false,"&nbsp;|&nbsp;"), option_edit);
-
-		tbody_message_options.appendChild(appendChilds(tr, td, options, next_previous_msg_td));
-		table_message_options.appendChild(tbody_message_options);
-		td0.appendChild(table_message_options);
-		tr0.appendChild(td0);
-		tbody_message.appendChild(tr0);
-	}
-	return true;
-};
-
-
-/* Class draw_message */
-function draw_message(){
-	this.id=0;
-}
-draw_message.prototype.createNxtPrevButtons = function(msg_folder,folder_id){
-	var next_previous_msg_td = createAndSet("TD",[ "noWrap", "align", "width" ], [ "true", "right", "40px"]);
-	var img_next_msg = createAndSet("IMG", [ 'id', 'src', 'title' ], [
-			'msg_opt_next_' + this.id,
-			URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/down.button.png',
-			get_lang('Next') ]);
-	img_next_msg.style.cursor = 'pointer';
-
-	var folder = document.getElementById(folder_id);
-	if (folder){ // mensagem local criptografada nao tem ID da pasta local
-		if (folder.nextSibling){
-			var nextMsgBox = folder.nextSibling.name?folder.nextSibling.name:msg_folder;
-
-			if (nextMsgBox == "INBOX/decifradas")// teste para ver se a mensagem vem da pasta oculta decifradas
-				nextMsgBox = get_current_folder();
-
-			img_next_msg.onclick = function()
-			{
-				openTab.type[currentTab] = 2;
-				if ( nextMsgBox == undefined )
-				       nextMsgBox = current_folder;
-				for (var i=0; i < draw_box.headers_msgs.length; i++)
-					if (draw_box.headers_msgs[i].msg_number == folder.nextSibling.id){
-						var nextHeader = draw_box.headers_msgs[i];
-						break;
-					}
-				proxy_mensagens.get_msg(nextHeader,nextMsgBox,true,show_msg,currentTab);
-			};
-		}
-		else
-		{
-			img_next_msg.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/down.gray.button.png';
-			img_next_msg.style.cursor = 'default';
-		}
-	}
-	else
-	{
-		img_next_msg.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/down.gray.button.png';
-		img_next_msg.style.cursor = 'default';
-		if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(msg_folder == "INBOX/decifradas")) // testa se a mensagem e local
-		{
-			img_next_msg.onclick = function()
-			{
-				delete_border(this.id);
-			};
-		}
-	}
-	var img_space = document.createElement("SPAN");
-        img_space.innerHTML = "&nbsp;";
-	var img_previous_msg = createAndSet("IMG",['id','src','title'],['msg_opt_previous_' + this.id,
-			URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/up.button.png',
-			get_lang('Previous')]);
-	img_previous_msg.style.cursor = 'pointer';
-
-	if (!folder){
-		delete_border(this.id);
-		return;
-	}
-	if (folder){ // mensagem local criptografada nao tem this.id da pasta local
-		if (folder.previousSibling)
-		{
-			var previousMsgBox = folder.previousSibling.name?folder.previousSibling.name:msg_folder;
-
-			if (previousMsgBox == "INBOX/decifradas") // teste para ver se a mensagem vem da pasta oculta decifradas
-				previousMsgBox = get_current_folder();
-
-			img_previous_msg.onclick = function()
-			{
-				openTab.type[currentTab] = 2;
-				if ( previousMsgBox == undefined )
-				       previousMsgBox = current_folder;
-				 for (var i=0; i < draw_box.headers_msgs.length; i++)
-					if (draw_box.headers_msgs[i].msg_number == folder.previousSibling.id){
-						var previousHeader = draw_box.headers_msgs[i];
-						break;
-					}
-				proxy_mensagens.get_msg(previousHeader,previousMsgBox,true,show_msg,currentTab);
-			};
-		}
-		else
-		{
-			img_previous_msg.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/up.gray.button.png';
-			img_previous_msg.style.cursor = 'default';
-		}
-	}
-	else
-	{
-		img_previous_msg.src = URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/up.gray.button.png';
-		img_previous_msg.style.cursor = 'default';
-		if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(msg_folder == "INBOX/decifradas")) // testa se a mensagem e local
-		{
-			img_previous_msg.onclick = function()
-			{
-				delete_border(this.id);
-			};
-		}
-	}
-	next_previous_msg_td.appendChild(img_previous_msg);
-	next_previous_msg_td.appendChild(img_space);
-	next_previous_msg_td.appendChild(img_next_msg);
-	return next_previous_msg_td;
-
-};
-var idx_cc = 0;
-draw_message.prototype.draw_plugin_cc = function(addrs)
-{
-    expresso.connector.loadScript("jscode/ccQuickAdd");
-    var id=this.id;
-
-    var array_addrs = '';
-    var array_name      = '';
-    var cc_data = new Array();
-    if(typeof(addrs.name) != 'undefined') {
-        array_name      = LTrim(addrs.name).split(" ");
-        array_addrs = new Array(addrs.email);
-    }
-    else {
-        array_addrs = (typeof addrs == 'object' ? addrs.toString().split("\" ") : addrs.split("\" "));
-        array_name      = LTrim(array_addrs[0]).replace('"','').split(" ");
-    }
-
-    var _split = array_name[0].split('@');
-    cc_data[0] = _split[0];
-    cc_data[1] = _split[0];
-    cc_data[2] = '';
-
-    for (i=1; i < array_name.length; i++)
-        cc_data[2] += array_name[i] + " ";
-
-
-    if(array_addrs.length > 1)
-        cc_data[3] = array_addrs[1] ? array_addrs[1].replace("&lt;",'').replace("&gt;",'') : '';
-    else
-        cc_data[3] = array_addrs[0];
-
-    var sm_envelope_img1 = '<img style="cursor:'+ (is_ie ? 'hand' : 'pointer') +'" title="' + get_lang("Add Contact") +
-    '" onclick="ccQuickAddOne.showList(\''+cc_data+'\')" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/user_card.png">';
-    var to_addybook_add = "<SPAN id='insert_plugin_"+idx_cc+"_"+id+"'>";
-    to_addybook_add += addrs;
-    to_addybook_add +=  sm_envelope_img1;
-    idx_cc++;
-    to_addybook_add += "</SPAN>";
-    return to_addybook_add;
-};
-
-
-draw_message.prototype.show_signature_certificate_data = function(){
-	var _height = Element("div_message_scroll_"+this.id).style.height;
-	_height = parseInt(_height.replace("px",""));
-	var _offset = 130;
-	if (this.value == 'more_cert'){
-		//this.innerHTML += "<b><u>Mais InformaÃ¯Â¿ÅÃ¯Â¿Åes</u></b>";
-		this.value = 'hide_cert';
-		Element("div_message_scroll_"+this.id).style.height = (_height + _offset)+"px";
-		Element('tr_signature_'+this.id).style.display = 'none';
-		Element('td_signature_'+this.id).style.display = 'none';
-
-	}
-	else{
-		//this.innerHTML += "Mais InformaÃ¯Â¿ÅÃ¯Â¿Åes";
-		this.value = 'more_cert';
-		Element("div_message_scroll_"+this.id).style.height = (_height - _offset)+"px";
-		Element('tr_signature_'+this.id).style.display = '';
-		Element('td_signature_'+this.id).style.display = '';
-	}
-};
-
-draw_message.prototype.putSignature = function(info_msg,tdx){
-        var tr_signature = document.createElement("TR");
-        var td_signature = document.createElement("TD");
-        td_signature.className = 'tr_message_header';
-        tr_signature.id = 'tr_signature_'+this.id;
-        td_signature.colSpan = "5";
-        tr_signature.style.display = 'none';
-
-        for (i=0; i < info_msg.signature.length; i++)
-                td_signature.innerHTML += '<span>'+info_msg.signature[i]+'</span> <br /> ';
-        td_signature.innerHTML += '<hr></hr>';
-        var signature_status_pos = info_msg.signature[0].indexOf('Message untouched');
-        td_signature.id = "td_signature_"+this.id;
-        if(signature_status_pos < 0 )
-        {
-                tdx.innerHTML += '&nbsp;<img style="cursor:pointer" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/signed_error.gif" title="'+get_lang("Details")+'" onclick="show_signature_certificate_data(\'' + this.id + '\')">';
-                tr_signature.style.display = '';
-        }
-        else
-        {
-                tdx.innerHTML += '&nbsp;<img style="cursor:pointer" src="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/signed_table.gif" title="'+get_lang("Details")+'" onclick="show_signature_certificate_data(\'' + this.id + '\')">';
-        }
-        tr_signature.appendChild(td_signature);
-        return tr_signature;
-    };
-
-
-draw_message.prototype.getThumbs = function(attachments, thumbs, msg_number, msg_folder){
-		var table_message_thumbs = document.createElement("TABLE");
-		table_message_thumbs.width = "80%";
-		table_message_thumbs.style.borderTop = "2px solid rgb(170, 170, 170)";
-		var tbody_message_thumbs = document.createElement("TBODY");
-		var tr = document.createElement("TR");
-		tr.className = "tr_message_body";
-		var td = document.createElement("TD");
-		td.setAttribute("colSpan","2");
-		td.id = "body_thumbs_"+msg_number;
-		td.innerHTML += "&nbsp;<font color='DARKBLUE' size='2'><b>"+attachments.length+" "+get_lang("attachment")+(attachments.length > 1 ? "s" : "")+" "+get_lang("in this message")+"</font></b>";
-		var _link_attachments = '';
-		if(thumbs.length > 1){
-			_link_attachments 	= document.createElement("A");
-			_link_attachments.className = "message_options";
-			if(proxy_mensagens.is_local_folder(current_folder))
-				_link_attachments.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+msg_folder+"','"+msg_number+"')");
-			else
-				_link_attachments.setAttribute("href", "javascript:download_all_attachments('"+msg_folder+"','"+msg_number+"')");
-			_link_attachments.innerHTML = get_lang('Download all atachments');
-		}
-
-		if(_link_attachments){
-			td.innerHTML +=	" :: ";
-			td.appendChild(_link_attachments);
-		}
-
-		td.innerHTML +=	"<BR><img src='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/menu/ktip.png'>"+get_lang("<b>Tip:</b> For faster save, click over the image with <u>right button</u>.");
-		td.innerHTML += "<BR>";
-
-		for (var i=0; i<thumbs.length; i++){
-			if ((i % 4) == 0)
-				td.innerHTML += "<BR>";
-			td.innerHTML += thumbs[i];
-			td.innerHTML += "&nbsp;&nbsp;";
-		}
-		tr.appendChild(td);
-		tbody_message_thumbs.appendChild(tr);
-		table_message_thumbs.appendChild(tbody_message_thumbs);
-		return table_message_thumbs;
-};
-
-draw_message.prototype.getBcc = function(bccField){
-	/*
-	 * @AUTHOR Rodrigo Souza dos Santos
-	 * @MODIFY-DATE 2008/09/11
-	 * @BRIEF Adding routine to create bcc (blind carbon copy) field if there is one.
-	 */
-	var tr3 = document.createElement("tr");
-	tr3.className = "tr_message_header";
-	var td3 = document.createElement("td");
-	td3.innerHTML = get_lang("BCC") + " : ";
-	var cco = document.createElement("td");
-	cco.id = "cco_"+this.id;
-
-	var cco_values = createAndSet("INPUT",['id', 'type', 'value'],["cco_values_"+this.id,"hidden",bccField]);
-	ccoaddress_array[this.id] = bccField.split(",");		
-	if (ccoaddress_array[this.id].length > 1){
-		var div_ccoaddress = document.createElement("SPAN");
-		div_ccoaddress.id = "div_ccoaddress_"+this.id;
-		var div_ccoaddress_full = createAndSet("SPAN",['id', 'style'],["div_ccoaddress_full_"+this.id, "display:inline"]);
-		/*
-		 * The function below is ugly, doesn't possible use this.
-		 * The problem is that the code's function was written
-		 * on a hardcode concept.
-		 */
-		//cco.innerHTML = this.draw_plugin_cc(ccoaddress_array[this.id][0]);
-		cco.innerHTML = ccoaddress_array[this.id][0];
-		div_ccoaddress.innerHTML += " (<a STYLE='color: RED;' onclick=javascript:show_div_address_full('"+this.id+"','cco');>"+get_lang('more')+"</a>)";
-		cco.appendChild(div_ccoaddress);
-	}
-	else{
-		/*
-		 * The function below is ugly, it is not possible to use this.
-		 * The problem is that the code's function was written
-		 * on a hardcode concept.
-		 */
-		//cco.innerHTML = this.draw_plugin_cc(info_msg.cco);
-		cco.innerHTML = bccField;
-	}
-	cco.className = "header_message_field";
-	return appendChilds(tr3,td3,cco,cco_values);
-};
-
-draw_message.prototype.blockImage = function(info_msg,ID,td){
-	var imgTag = info_msg.body.match(/(<img[^>]*src[^>=]*=['"]?[^'">]*["']?[^>]*>)|(<[^>]*(style[^=>]*=['"][^>]*background(-image)?:[^:;>]*url\()[^>]*>)/gi);
-
-	var newBody = info_msg.body;
-	if(!info_msg.showImg && imgTag)
-	{
-		var domains = '';
-		var blocked = false;
-		var forbidden = true;
-
-		if (preferences.notification_domains != null && typeof(preferences.notification_domains) != 'undefined')
-		{
-			domains = preferences.notification_domains.split(',');
-			for(var j = 0; j < imgTag.length; j++)
-			{
-				for (var i = 0; i < domains.length; i++)
-				{
-					if (imgTag[j].match(/cid:([\w\d]){5,}/) || imgTag[j].match(/src=\"\.\/inc\/show_embedded_attach\.php/g))
-					{
-						forbidden = false;
-						continue;
-					}
-					imgSource = imgTag[j].match(/=['"](http:\/\/)+[^'"\/]*/);
-					if (imgSource && imgSource.toString().substr(5).match(domains[i]))
-						forbidden = false;
-				}
-				if (forbidden)
-				{
-					newBody = newBody.replace(imgTag[j],"<img src='" + URL_SERVER + "expressoMail1_2/templates/"+template+"/images/forbidden.jpg'>");
-					blocked=true;
-				}
-			}
-			if (blocked)
-			{
-				var showImgLink = document.createElement('DIV');
-				showImgLink.id="show_img_link_"+ID;
-				showImgLink.onclick = function(){show_msg_img(info_msg.msg_number,info_msg.msg_folder)};
-				showImgLink.className="show_img_link";
-				showImgLink.innerHTML = get_lang("Show images from")+": "+info_msg.from.email;
-				td.appendChild(showImgLink);
-			}
-		}
-	}
-	return newBody;
-
-};
-
-draw_msg = new draw_message();
-
