Index: /branches/1.2/phpgwapi/inc/class.jscalendar.inc.php
===================================================================
--- /branches/1.2/phpgwapi/inc/class.jscalendar.inc.php	(revision 2)
+++ /branches/1.2/phpgwapi/inc/class.jscalendar.inc.php	(revision 1342)
@@ -31,6 +31,6 @@
 			$this->jscalendar_url = $GLOBALS['phpgw_info']['server']['webserver_url'].'/phpgwapi/js/'.$path;
 			$this->dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
-			if ($do_header && !strstr($GLOBALS['phpgw_info']['flags']['java_script'],'jscalendar'))
+			
+			if ($do_header && !strpos($GLOBALS['phpgw_info']['flags']['java_script'],'jscalendar'))
 			{
 				$GLOBALS['phpgw_info']['flags']['java_script'] .=
Index: /branches/1.2/phpgwapi/inc/class.preferences.inc.php
===================================================================
--- /branches/1.2/phpgwapi/inc/class.preferences.inc.php	(revision 54)
+++ /branches/1.2/phpgwapi/inc/class.preferences.inc.php	(revision 1342)
@@ -1116,5 +1116,5 @@
 			// is it possible to use Trash and Sent folders - i.e. using IMAP server
 			// if not - force settings to false
-			if (stristr($prefs['email']['mail_server_type'], 'imap') == False)
+			if (strpos($prefs['email']['mail_server_type'], 'imap') == False)
 			{
 				if (isset($prefs['email']['use_trash_folder']))
Index: /branches/1.2/phpgwapi/js/dftree/dftree.js
===================================================================
--- /branches/1.2/phpgwapi/js/dftree/dftree.js	(revision 709)
+++ /branches/1.2/phpgwapi/js/dftree/dftree.js	(revision 1342)
@@ -224,5 +224,5 @@
 {
 	var captionSpan;
-	if ((this.id != 'root') && (this.id != 'user') && (this.id !='local_root')){
+	if ((this.id != 'root') && (this.id != 'user')){
 		captionSpan = getObjectById("l"+this.id+this._myTree.name);
 		captionSpan.style.backgroundColor = 'white';
@@ -234,5 +234,5 @@
 {
 	var captionSpan;
-	if ((this.id != 'root') && (this.id != 'user') && (this.id !='local_root')){
+	if ((this.id != 'root') && (this.id != 'user')){
 		captionSpan = getObjectById("l"+this.id+this._myTree.name);
 		captionSpan.style.backgroundColor = '';
@@ -300,5 +300,5 @@
 	else //Nao tem onClick
 	{
-		if ((this.id != 'root') && (this.id != 'user') && (this.id !='local_root')) //e nao seja raiz(root) ou pastas compartilhadas(user).
+		if ((this.id != 'root') && (this.id != 'user')) //e nao seja raiz(root) ou pastas compartilhadas(user).
 			captionEventHandler = function () { _this._select();};
 	}
Index: /branches/1.2/expressoMail1_2/preferences.php
===================================================================
--- /branches/1.2/expressoMail1_2/preferences.php	(revision 689)
+++ /branches/1.2/expressoMail1_2/preferences.php	(revision 1342)
@@ -133,31 +133,4 @@
 		else
 			$GLOBALS['phpgw']->template->set_var('font_size_option_11_selected','selected');
-	    $c = CreateObject('phpgwapi.config','expressoMail1_2');
-	    $c->read_repository();
-	    $current_config = $c->config_data;
-		
-		if($current_config['enable_local_messages']!='True') {
-			$GLOBALS['phpgw']->template->set_var('open_comment_local_messages_config',"<!--");
-			$GLOBALS['phpgw']->template->set_var('close_comment_local_messages_config',"-->");
-		}
-		else {
-			$GLOBALS['phpgw']->template->set_var('open_comment_local_messages_config'," ");
-			$GLOBALS['phpgw']->template->set_var('close_comment_local_messages_config'," ");
-		}
-		
-		if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'])
-			$GLOBALS['phpgw']->template->set_var('use_local_messages_option_Yes_selected','selected');
-		else {
-			$GLOBALS['phpgw']->template->set_var('use_local_messages_option_No_selected','');
-			$GLOBALS['phpgw']->template->set_var('use_local_messages_option_Yes_selected','');
-		}
-		
-		if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'])
-			$GLOBALS['phpgw']->template->set_var('keep_archived_messages_option_Yes_selected','selected');
-		else {
-			$GLOBALS['phpgw']->template->set_var('keep_archived_messages_option_No_selected','');
-			$GLOBALS['phpgw']->template->set_var('keep_archived_messages_option_Yes_selected','');
-		}		
-		
 	}
 	else //Save Config
@@ -259,13 +232,4 @@
 		else
 			$GLOBALS['phpgw']->preferences->add('expressoMail','font_size',$_POST['font_size']);		
-		if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'])
-			$GLOBALS['phpgw']->preferences->change('expressoMail','use_local_messages',$_POST['use_local_messages']);
-		else
-			$GLOBALS['phpgw']->preferences->add('expressoMail','use_local_messages',$_POST['use_local_messages']);
-			
-		if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'])
-			$GLOBALS['phpgw']->preferences->change('expressoMail','keep_archived_messages',$_POST['keep_archived_messages']);
-		else
-			$GLOBALS['phpgw']->preferences->add('expressoMail','keep_archived_messages',$_POST['keep_archived_messages']);			
 
 		$GLOBALS['phpgw']->preferences->save_repository();
@@ -312,8 +276,4 @@
 	$GLOBALS['phpgw']->template->set_var('lang_type_signature',lang('Signature type'));
 	$GLOBALS['phpgw']->template->set_var('big',lang('Big'));
-	$GLOBALS['phpgw']->template->set_var('lang_Would_you_like_to_keep_archived_messages_?',lang('Would you like to keep archived messages?'));
-	$GLOBALS['phpgw']->template->set_var('lang_Yes',lang('Yes'));
-	$GLOBALS['phpgw']->template->set_var('lang_No',lang('No'));
-	$GLOBALS['phpgw']->template->set_var('lang_Would_you_like_to_use_local_messages_?',lang('Would you like to use local messages?'));
 	$GLOBALS['phpgw']->template->set_var('lang_use_signature',lang('Insert signature automatically in new messages?'));
 
Index: /branches/1.2/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- /branches/1.2/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 708)
+++ /branches/1.2/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 1342)
@@ -10,5 +10,4 @@
 		'get_range_msgs'				=> True,
 		'get_info_msg'					=> True,
-		'get_info_msgs'					=> True,
 		'get_folders_list'				=> True,
 		'import_msgs'					=> True
@@ -71,4 +70,6 @@
 	function get_range_msgs2($params)
 	{
+		include("class.imap_attachment.inc.php");
+		$imap_attachment = new imap_attachment();
 		$folder = $params['folder'];
 		$msg_range_begin = $params['msg_range_begin'];
@@ -84,88 +85,74 @@
 		if($num_msgs) { 
 			for ($msg_range_begin; (($msg_range_begin <= $msg_range_end) && ($msg_range_begin <= $num_msgs)); $msg_range_begin++)
-			{
-				$msg_number = $sort_array_msg[$msg_range_begin-1];
-				$temp = $this->get_info_head_msg($msg_number);
-				if(!$temp)
-					return false;
-	
-				$return[$i] = $temp;
-				$i++;
-			}
-		}
-		$return['num_msgs'] = $num_msgs;		
-		
-		return $return;
-	}
-	
-	function get_info_head_msg($msg_number) {
-		$head_array = array();
-		include_once("class.imap_attachment.inc.php");
-		$imap_attachment = new imap_attachment();
-		
-		/*A função imap_headerinfo não traz o cabeçalho completo, e sim alguns
-		* atributos do cabeçalho. Como eu preciso do atributo Importance 
-		* para saber se o email é importante ou não, uso abaixo a função
-		* imap_fetchheader e busco o atributo importance nela para passar
-		* para as funções ajax. Isso faz com que eu acesse o cabeçalho
-		* duas vezes e de duas formas diferentes, mas em contrapartida, eu
-		* não preciso reimplementar o método utilizando o fetchheader.
-		* Como as mensagens são renderizadas de X em X, não parece ter
-		* perda considerável de performance.
-		*/
-		$flag = preg_match('/importance *: *(.*)\r/i',
+		{
+			$msg_number = $sort_array_msg[$msg_range_begin-1];
+
+			/*A função imap_headerinfo não traz o cabeçalho completo, e sim alguns
+			* atributos do cabeçalho. Como eu preciso do atributo Importance 
+			* para saber se o email é importante ou não, uso abaixo a função
+			* imap_fetchheader e busco o atributo importance nela para passar
+			* para as funções ajax. Isso faz com que eu acesse o cabeçalho
+			* duas vezes e de duas formas diferentes, mas em contrapartida, eu
+			* não preciso reimplementar o método utilizando o fetchheader.
+			* Como as mensagens são renderizadas em um número pequeno por vez,
+			* não parece ter perda considerável de performance.
+			*/
+			$flag = preg_match('/importance *: *(.*)\r/i',
 					imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number))
 					,$importance);		
-		$head_array['Importance'] = $flag==0?"Normal":$importance[1];
-
-		
-		$header = $this->get_header($msg_number);
+			$return[$i]['Importance'] = $flag==0?"":$importance[1];
+			
+			
+			$header = $this->get_header($msg_number);
 			if (!is_object($header))
-				return false;
-		$head_array['Recent'] = $header->Recent;
-		$head_array['Unseen'] = $header->Unseen;
-		if($header->Answered =='A' && $header->Draft == 'X'){
-			$head_array['Forwarded'] = 'F';
-		}
-		else {
-			$head_array['Answered']	= $header->Answered;
-			$head_array['Draft']	= $header->Draft;	
-		}
-		$head_array['Deleted'] = $header->Deleted;
-		$head_array['Flagged'] = $header->Flagged;
-		
-		$head_array['msg_number'] = $msg_number;
-		//$return[$i]['msg_folder'] = $folder;
-		
-		$date_msg = gmdate("d/m/Y",$header->udate);
-		if (date("d/m/Y") == $date_msg)
-			$head_array['udate'] = gmdate("H:i",$header->udate);
-		else
-			$head_array['udate'] = $date_msg;
-		
-		$head_array['aux_date'] = $date_msg; //Auxiliar apenas para mensagens locais.
-		
-		$from = $header->from;
-		$head_array['from'] = array();
-		$tmp = imap_mime_header_decode($from[0]->personal);
-		$head_array['from']['name'] = $this->decode_string($tmp[0]->text);
-		$head_array['from']['email'] = $this->decode_string($from[0]->mailbox) . "@" . $from[0]->host;
-		if(!$head_array['from']['name'])
-			$head_array['from']['name'] = $head_array['from']['email'];
-		$to = $header->to;
-		$head_array['to'] = array();
-		$tmp = imap_mime_header_decode($to[0]->personal);
-		$head_array['to']['name'] = $this->decode_string($this->decode_string($tmp[0]->text));
-		$head_array['to']['email'] = $this->decode_string($to[0]->mailbox) . "@" . $to[0]->host;
-		if(!$head_array['to']['name'])
-			$head_array['to']['name'] = $head_array['to']['email'];
-		$head_array['subject'] = $this->decode_string($header->fetchsubject);
-		
-		$head_array['Size'] = $header->Size;
-		
-		$head_array['attachment'] = array();
-		$head_array['attachment'] = $imap_attachment->get_attachment_headerinfo($this->mbox, $msg_number);
-		
-		return $head_array;
+				return false;			
+			
+			$return[$i]['Recent'] = $header->Recent;
+			$return[$i]['Unseen'] = $header->Unseen;
+			if($header->Answered =='A' && $header->Draft == 'X'){
+				$return[$i]['Forwarded'] = 'F';
+			}
+			else {
+				$return[$i]['Answered']	= $header->Answered;
+				$return[$i]['Draft']	= $header->Draft;	
+			}
+			$return[$i]['Deleted'] = $header->Deleted;
+			$return[$i]['Flagged'] = $header->Flagged;
+			
+			$return[$i]['msg_number'] = $msg_number;
+			//$return[$i]['msg_folder'] = $folder;
+			
+			$date_msg = gmdate("d/m/Y",$header->udate);
+			if (gmdate("d/m/Y") == $date_msg)
+				$return[$i]['udate'] = gmdate("H:i",$header->udate);
+			else
+				$return[$i]['udate'] = $date_msg;
+			
+			$from = $header->from;
+			$return[$i]['from'] = array();
+			$tmp = imap_mime_header_decode($from[0]->personal);
+			$return[$i]['from']['name'] = $this->decode_string($tmp[0]->text);
+			$return[$i]['from']['email'] = $this->decode_string($from[0]->mailbox) . "@" . $from[0]->host;
+			if(!$return[$i]['from']['name'])
+				$return[$i]['from']['name'] = $return[$i]['from']['email'];
+			$to = $header->to;
+			$return[$i]['to'] = array();
+			$tmp = imap_mime_header_decode($to[0]->personal);
+			$return[$i]['to']['name'] = $this->decode_string($this->decode_string($tmp[0]->text));
+			$return[$i]['to']['email'] = $this->decode_string($to[0]->mailbox) . "@" . $to[0]->host;
+			if(!$return[$i]['to']['name'])
+				$return[$i]['to']['name'] = $return[$i]['to']['email'];
+			$return[$i]['subject'] = $this->decode_string($header->fetchsubject);
+
+			$return[$i]['Size'] = $header->Size;
+			
+			$return[$i]['attachment'] = array();
+			$return[$i]['attachment'] = $imap_attachment->get_attachment_headerinfo($this->mbox, $msg_number);			
+			$i++;
+		}
+		}
+		$return['num_msgs'] = $num_msgs;		
+		
+		return $return;
 	}
 	
@@ -310,40 +297,4 @@
 	}
 
-/**
-	 * 
-	 * @return 
-	 * @param $params Object
-	 */
-	function get_info_msgs($params) {
-		include_once("class.exporteml.inc.php");
-		$return = array();
-		$new_params = array();
-		$attach_params = array();
-		$new_params["msg_folder"]=$params["folder"];
-		$attach_params["folder"] = $params["folder"];
-		$msgs = explode(",",$params["msgs_number"]);
-		$exporteml = new ExportEml();
-		foreach($msgs as $msg_number) {
-			$new_params["msg_number"] = $msg_number;
-			//ini_set("display_errors","1");
-			$msg_info = $this->get_info_msg($new_params);
-
-			$this->mbox = $this->open_mbox($params['folder']); //Não sei porque, mas se não abrir de novo a caixa dá erro.
-			$msg_info['header'] = $this->get_info_head_msg($msg_number);
-
-			$attach_params["num_msg"] = $msg_number;
-			$msg_info['array_attach'] = $exporteml->get_attachments_in_array($attach_params);
-			$msg_info['url_export_file'] = $exporteml->export_to_archive($msg_number,$params["folder"]);
-			imap_close($this->mbox);
-			$this->mbox=false;
-
-
-			array_push($return,serialize($msg_info));
-
-		}
-
-		return $return;
-	}
-
 	function get_info_msg($params)
 	{
@@ -366,5 +317,5 @@
 		//Substituição de links em email para abrir no próprio expresso
 		$body = ereg_replace("<a[^>]*href=[\'\"]mailto:([^\"\']+)[\'\"]>([^<]+)</a>","<a href=\"javascript:new_message_to('\\1')\">\\2</a>",$return_get_body['body']);
-		
+			
 		$return['body'] 		= $body;
 		$return['attachments'] 	= $return_get_body['attachments'];
@@ -598,11 +549,5 @@
 		$return['subject'] = $this->decode_string($header->fetchsubject);
 		$return['Size'] = $header->Size;
-		$return['reply_toaddress'] = $header->reply_toaddress;	
-	
-		//All this is to help in local messages
-		$return['timestamp'] = $header->udate;
-		$return['login'] = $_SESSION['phpgw_info']['expressomail']['user']['account_id'];//$GLOBALS['phpgw_info']['user']['account_id'];
-		$return['reply_toaddress'] = $header->reply_toaddress;
-		
+		$return['reply_toaddress'] = $header->reply_toaddress;		
 		return $return;
 	}
@@ -1072,5 +1017,5 @@
 	function refresh($params)
 	{
-		include_once("class.imap_attachment.inc.php");
+		include("class.imap_attachment.inc.php");
 		$imap_attachment = new imap_attachment();		
 		$folder = $params['folder'];
@@ -1152,5 +1097,5 @@
 					imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number))
 					,$importance);		
-			$return[$i]['Importance'] = $flag==0?"Normal":$importance[1];
+			$return[$i]['Importance'] = $flag==0?"":$importance[1];
 			
 			$header = $this->get_header($msg_number);
@@ -1392,8 +1337,4 @@
 				return "The server denied your request to send a mail, you cannot use this mail address.";
 		}
-		
-		//new_message_to backs to mailto: pattern
-		$params['body'] = eregi_replace("<a href=\"javascript:new_message_to\('([^>]+)'\)\">[^>]+</a>","<a href='mailto:\\1'>\\1</a>",$params['body']);
-		
 		$toaddress = implode(',',$db->getAddrs(explode(',',$params['input_to'])));
 		$ccaddress = implode(',',$db->getAddrs(explode(',',$params['input_cc'])));
@@ -1407,5 +1348,4 @@
 		$attachments = $params['FILES'];
 		$forwarding_attachments = $params['forwarding_attachments'];
-		$local_attachments = $params['local_attachments'];
 		 
 		$folder =$params['folder'];
@@ -1491,5 +1431,5 @@
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 		//	Build Uploading Attachments!!!
-		if ((count($attachments)) && ($params['is_local_forward']!="1")) //Caso seja forward normal...
+		if (count($attachments))
 		{
 			$total_uploaded_size = 0;
@@ -1503,20 +1443,4 @@
 				return $this->parse_error("message file too big");			
 		}			
-		else if(($params['is_local_forward']=="1") && (count($local_attachments))) { //Caso seja forward de mensagens locais
-			
-			$total_uploaded_size = 0;
-			$upload_max_filesize = str_replace("M","",ini_get('upload_max_filesize')) * 1024 * 1024;			
-			foreach($local_attachments as $local_attachment) {
-				$file_description = unserialize(rawurldecode($local_attachment));
-				$tmp = array_values($file_description);
-				foreach($file_description as $i => $descriptor){				
-					$tmp[$i]  = eregi_replace('\'*\'','',$descriptor);
-				}
-				$mail->AddAttachment($_FILES[$tmp[1]]['tmp_name'], $tmp[2], "base64", $this->get_file_type($tmp[2]));  // optional name
-				$total_uploaded_size = $total_uploaded_size + $_FILES[$tmp[1]]['size'];
-			}
-			if( $total_uploaded_size > $upload_max_filesize)
-				return 'false';	
-		}
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 		//	Build Forwarding Attachments!!!
@@ -1719,61 +1643,4 @@
 	}
 	
-	/**
-	 * Deprecated
-	 * 
-	 * Replaced for the method messages_sort
-	 */
-	function imap_sortfrom($sort_box_reverse, $search_box_type)
-	{
-		$sortfrom = array();
-		$sortfrom_uid = array();
-		
-		$num_msgs = imap_num_msg($this->mbox);
-		for ($i=1; $i<=$num_msgs; $i++)
-		{
-			$header = $this->get_header(imap_uid($this->mbox,$i));
-			// List UNSEEN messages.
-			if($search_box_type == "UNSEEN" &&  (!trim($header->Recent) && !trim($header->Unseen))){
-				continue;
-			}
-			// List SEEN messages.
-			elseif($search_box_type == "SEEN" && (trim($header->Recent) || trim($header->Unseen))){
-				continue;
-			}
-			// List ANSWERED messages.			
-			elseif($search_box_type == "ANSWERED" && !trim($header->Answered)){
-				continue;				
-			}
-			// List FLAGGED messages.			
-			elseif($search_box_type == "FLAGGED" && !trim($header->Flagged)){
-				continue;
-			}
-						
-			if (($header->from[0]->mailbox . "@" . $header->from[0]->host) == $_SESSION['phpgw_info']['expressomail']['user']['email'])				
-				$from = $header->to;
-			else
-				$from = $header->from;
-			
-			$tmp = imap_mime_header_decode($from[0]->personal);			
-			
-			if ($tmp[0]->text != "")
-				$sortfrom[$i] = $tmp[0]->text;
-			else
-				$sortfrom[$i] = $from[0]->mailbox . "@" . $from[0]->host;
-		}
-		
-		natcasesort($sortfrom);
-		
-		foreach($sortfrom as $index => $header_msg)
-		{	
-			$sortfrom_uid[] = imap_uid($this->mbox, $index);
-		}
-		
-		if ($sort_box_reverse)
-			$sortfrom_uid = array_reverse($sortfrom_uid);
-		
-		return $sortfrom_uid;
-	}
-
 	function move_search_messages($params){		
 		$params['selected_messages'] = urldecode($params['selected_messages']);	
@@ -2565,11 +2432,5 @@
 		$retorno = "";
 		$mbox_stream = "";
-		if(strpos($params['condition'],"#")===false) { //local messages
-			$search=false;
-		}
-		else {
-			$search = explode(",",$params['condition']);			
-		}
-
+		$search = explode(",",$params['condition']);
 		if($search){
 			$search_criteria = '';
@@ -2832,5 +2693,5 @@
 		$array_parts_attachments = array();		
 		$array_parts_attachments['names'] = '';
-		include_once("class.imap_attachment.inc.php");
+		include("class.imap_attachment.inc.php");
 		$imap_attachment = new imap_attachment();		
 		
Index: /branches/1.2/expressoMail1_2/inc/class.exporteml.inc.php
===================================================================
--- /branches/1.2/expressoMail1_2/inc/class.exporteml.inc.php	(revision 711)
+++ /branches/1.2/expressoMail1_2/inc/class.exporteml.inc.php	(revision 1342)
@@ -186,29 +186,4 @@
 	}
 
-	function export_to_archive($id_msg,$folder) {
-		$this->folder = $folder;
-		$this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8");
-		$tempDir = dirname( __FILE__ ) . '/../tmpLclAtt';
-		
-		$phpheader = "<?php header('Content-Type: text/plain');
-				header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-				header('Pragma: public');
-				header('Expires: 0'); // set expiration time
-	 	 		header('Content-Disposition: attachment; filename=\"fonte_da_mensagem.txt\"');?>";
-		
-		$this->connectImap();
-		$header	 	= $this-> getHeader($id_msg);
-		$body		= $this-> getBody($id_msg);
-		
-		$file = "source_".md5(microtime()).".php";
-		$f = fopen($tempDir.'/'.$file,"w");
-		fputs($f,$phpheader.$header ."\r\n\r\n". $body);
-		fclose($f);
-		$urlPath = 'tmpLclAtt/'.$file;
-		
-		imap_close($this->mbox_stream);
-		return $urlPath;
-	}
-
 	function remove_accents($string) {
 		/*
@@ -220,166 +195,4 @@
 			"áàâãäéèêëíìîïóòôõöúùûüç?\"!@#$%š&*()-=+Ž`[]{}~^,<>;:/?\\|¹²³£¢¬§ªº°ÁÀÂÃÄÉÈÊËÍÌÎÏÓÒÔÕÖÚÙÛÜÇ",
 			"aaaaaeeeeiiiiooooouuuuc__________________________________________AAAAAEEEEIIIIOOOOOUUUUC");
-	}
-	
-	function get_attachments_in_array($params) {
-		$return_attachments = array();
-
-		$id_number = $params['num_msg'];		
-		$attachments =unserialize(rawurldecode($params['s_attachments']));
-		
-		$tempDir = dirname( __FILE__ ) . '/../tmpLclAtt';
-//		$tempDir = $_SERVER["DOCUMENT_ROOT"]."tmpLclAtt";
-		$tempSubDir = md5(microtime());
-		exec('mkdir ' . $tempDir . '/'.$tempSubDir.'; cd ' . $tempDir . '/'.$tempSubDir);
-		
-		$this-> folder = $params['folder'];
-		$this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8");
-		$this->connectImap();
-
-		include_once("class.imap_attachment.inc.php");
-
-		$imap_attachment = new imap_attachment();
-		$attachments = $imap_attachment->download_attachment($this->mbox_stream, $id_number);
-		
-
-		
-		foreach($attachments as $i => $attachment){
-			if($i && $i == 'names')
-				continue;
-			$fileNameReal = $this->remove_accents($attachment['name']);
-			$ContentType = $this->getFileType($fileNameReal);
-			$fileName = $fileNameReal . ".php";
-			$f = fopen($tempDir . '/'.$tempSubDir.'/'.$fileName,"wb");
-			if(!$f)
-				return $tempDir . '/'.$tempSubDir.'/'.$fileName;			
-
-			$fileContent = imap_fetchbody($this->mbox_stream, $id_number,$attachment['pid'], FT_UID);
-			$urlPath = 'tmpLclAtt/'.$tempSubDir.'/'.$fileName;
-			
-			$headers = "<?php header('Content-Type: ".$ContentType."');
-				header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-				header('Pragma: public');
-				header('Expires: 0'); // set expiration time
-	 	 		header('Content-Disposition: attachment; filename=\"". addslashes($fileNameReal) ."\"');\n echo ";
-			
-			if($attachment['encoding'] == 'base64') {
-				$headers.=" imap_base64('".$fileContent."');?>";
-			}
-			else if($attachment['encoding'] == 'quoted_printable_decode') {
-				$headers.=" quoted_printable_decode('".$fileContent."');?>";
-			}
-			else {
-				$headers.=" '".$fileContent."';?>";
-			}
-			
-			fputs($f,$headers);
-
-			array_push($return_attachments,array('name' => $fileName,'url' => $urlPath,'pid' =>$attachment['pid']));
-			fclose($f);
-		}
-		imap_close($this->mbox_stream);
-		return $return_attachments;
-	}
-	
-	private function getFileType($nameFile) {
-		$strFileType = strrev(substr(strrev(strtolower($nameFile)),0,4));
-		$ContentType = "application/octet-stream";
-	   	if ($strFileType == ".asf") 
-	   		$ContentType = "video/x-ms-asf";
-	   	if ($strFileType == ".avi")
-	   		$ContentType = "video/avi";
-	   	if ($strFileType == ".doc")
-	   		$ContentType = "application/msword";
-	   	if ($strFileType == ".zip")
-	   		$ContentType = "application/zip";
-	   	if ($strFileType == ".xls")
-	   		$ContentType = "application/vnd.ms-excel";
-	   	if ($strFileType == ".gif")
-	   		$ContentType = "image/gif";
-	   	if ($strFileType == ".jpg" || $strFileType == "jpeg")
-	   		$ContentType = "image/jpeg";
-	   	if ($strFileType == ".wav")
-	   		$ContentType = "audio/wav";
-	   	if ($strFileType == ".mp3")
-	   		$ContentType = "audio/mpeg3";
-	   	if ($strFileType == ".mpg" || $strFileType == "mpeg")
-	   		$ContentType = "video/mpeg";
-	   	if ($strFileType == ".rtf")
-	   		$ContentType = "application/rtf";
-	   	if ($strFileType == ".htm" || $strFileType == "html")
-	   		$ContentType = "text/html";
-	   	if ($strFileType == ".xml") 
-	   		$ContentType = "text/xml";
-	   	if ($strFileType == ".xsl") 
-	   		$ContentType = "text/xsl";
-	   	if ($strFileType == ".css") 
-	   		$ContentType = "text/css";
-	   	if ($strFileType == ".php") 
-	   		$ContentType = "text/php";
-	   	if ($strFileType == ".asp") 
-	   		$ContentType = "text/asp";
-	   	if ($strFileType == ".pdf")
-	   		$ContentType = "application/pdf";
-	   	if ($strFileType == ".txt")
-	   		$ContentType = "text/plain";
-	   	if ($strFileType == ".log")
-	   		$ContentType = "text/plain";
-	   	if ($strFileType == ".wmv")
-	   		$ContentType = "video/x-ms-wmv";
-		if ($strFileType == ".sxc")
-			$ContentType = "application/vnd.sun.xml.calc";
-		if ($strFileType == ".odt")
-			$ContentType = "application/vnd.oasis.opendocument.text";
-		if ($strFileType == ".stc")
-			$ContentType = "application/vnd.sun.xml.calc.template";
-		if ($strFileType == ".sxd")
-			$ContentType = "application/vnd.sun.xml.draw";
-		if ($strFileType == ".std")
-			$ContentType = "application/vnd.sun.xml.draw.template";
-		if ($strFileType == ".sxi")
-			$ContentType = "application/vnd.sun.xml.impress";
-		if ($strFileType == ".sti")
-			$ContentType = "application/vnd.sun.xml.impress.template";
-		if ($strFileType == ".sxm")
-			$ContentType = "application/vnd.sun.xml.math";
-		if ($strFileType == ".sxw")
-			$ContentType = "application/vnd.sun.xml.writer";
-		if ($strFileType == ".sxq")
-			$ContentType = "application/vnd.sun.xml.writer.global";
-		if ($strFileType == ".stw")
-			$ContentType = "application/vnd.sun.xml.writer.template";
-		if ($strFileType == ".ps")
-			$ContentType = "application/postscript";
-		if ($strFileType == ".pps")
-			$ContentType = "application/vnd.ms-powerpoint";
-		if ($strFileType == ".odt")
-			$ContentType = "application/vnd.oasis.opendocument.text";
-		if ($strFileType == ".ott")
-			$ContentType = "application/vnd.oasis.opendocument.text-template";
-		if ($strFileType == ".oth")
-			$ContentType = "application/vnd.oasis.opendocument.text-web";
-		if ($strFileType == ".odm")
-			$ContentType = "application/vnd.oasis.opendocument.text-master";
-		if ($strFileType == ".odg")
-			$ContentType = "application/vnd.oasis.opendocument.graphics";
-		if ($strFileType == ".otg")
-			$ContentType = "application/vnd.oasis.opendocument.graphics-template";
-		if ($strFileType == ".odp")
-			$ContentType = "application/vnd.oasis.opendocument.presentation";
-		if ($strFileType == ".otp")
-			$ContentType = "application/vnd.oasis.opendocument.presentation-template";
-		if ($strFileType == ".ods")
-			$ContentType = "application/vnd.oasis.opendocument.spreadsheet";
-		if ($strFileType == ".ots")
-			$ContentType = "application/vnd.oasis.opendocument.spreadsheet-template";
-		if ($strFileType == ".odc")
-			$ContentType = "application/vnd.oasis.opendocument.chart";
-		if ($strFileType == ".odf")
-			$ContentType = "application/vnd.oasis.opendocument.formula";
-		if ($strFileType == ".odi")
-			$ContentType = "application/vnd.oasis.opendocument.image";
-		if ($strFileType == ".ndl")
-			$ContentType = "application/vnd.lotus-notes";
-		return $ContentType;
 	}
 	
Index: /branches/1.2/expressoMail1_2/js/search.js
===================================================================
--- /branches/1.2/expressoMail1_2/js/search.js	(revision 689)
+++ /branches/1.2/expressoMail1_2/js/search.js	(revision 1342)
@@ -101,5 +101,5 @@
 						     "</tr>"+
 						     "<tr>"+
-						     "<td valign='top'><input type='checkBox' id='check_all_msg' name='check_all_msg'><b>" + get_lang('In all the folders') + "</b></td>"+
+						     "<td valign='top'><input type='checkBox' id='check_all_msg' name='check_all_msg' onclick='EsearchE.all_mailboxes()'><b>" + get_lang('In all the folders') + "</b></td>"+
 						     "</tr>"+
 						     "</table>"+
@@ -353,7 +353,4 @@
 					if(td1 == "INBOX"){
 						var td1  = get_lang("Inbox");
-					}
-						if(proxy_mensagens.is_local_folder(td1)) {
-							var td1 = this.aux_local_folder_display(td1);
 					}
 				}
@@ -497,5 +494,5 @@
 		if (span_options)
 			span_options.innerHTML = '<span title="'+get_lang("Delete")+'" style="margin-top:3px;margin-left:8px" class="message_options" onclick="javascript:move_search_msgs(\''+content_search.id+'\');">'+get_lang("Delete")+'</span> | '+
-				'<span title="'+get_lang("Move")+'" class="message_options" onclick=wfolders.makeWindowNew(\"'+content_search.id+'\",\"move_to\",true)>'+get_lang("Move")+'</span>';
+				'<span title="'+get_lang("Move")+'" class="message_options" onclick=wfolders.makeWindow(\"'+content_search.id+'\",\"move_to\")>'+get_lang("Move")+'</span>';
 		div_scroll_result.appendChild(table);
 		content_search.appendChild(div_scroll_result);	
@@ -510,8 +507,7 @@
 			//set_msg_as_read(msgs_to_set[i], false);
 		}
-		proxy_mensagens.get_msg(uid_msg,mailbox,false,handler_get_msg);
-		/*var args   = "$this.imap_functions.get_info_msg";
-		var params = "msg_number=" + uid_msg + "&msg_folder=" + mailbox;
-		cExecute(args,handler_get_msg,params);*/
+		var args   = "$this.imap_functions.get_info_msg";
+		var params = "&msg_number=" + uid_msg + "&msg_folder=" + mailbox;
+		cExecute(args+params,handler_get_msg);
 
 	}
@@ -520,22 +516,12 @@
 	searchE.prototype.add_mailboxes = function(){
 		var sel = Element("sel_search_nm_box1");
-		if (!proxy_mensagens.is_local_folder(this.name_box_search)) {
-			var name_box     = this.name_box_search.split(cyrus_delimiter);
-			if(this.name_box_search == "")
-				return false;
-			var name_box_def = "";
-			if(name_box.length != 1){
-				name_box_def = name_box[(name_box.length-1)];
-			}else{
-				name_box_def = get_lang("Inbox");		
-			}
-		}
-		else {
-			if(this.name_box_search=='local_root')
-				return;
-			if(this.name_box_search=='local_Inbox')
-				name_box_def = get_lang("Inbox");
-			else
-				name_box_def = this.name_box_search.substr(6);//Retira o 'local_'
+		var name_box     = this.name_box_search.split(cyrus_delimiter);
+		if(this.name_box_search == "")
+			return false;
+		var name_box_def = "";
+		if(name_box.length != 1){
+			name_box_def = name_box[(name_box.length-1)];
+		}else{
+			name_box_def = get_lang("Inbox");		
 		}
 		if( sel.length > 0){
@@ -607,18 +593,9 @@
 			return false;
 		}
-		var local_folders = new Array();
-		var temp;
 		
 		if(Element("check_all_msg").checked){
-			this.all_mailboxes();
 			var nm_box = new Array;
 			for(var i=0; i < EsearchE.all_boxes.length; i++){
 				nm_box[i] = EsearchE.all_boxes[i] + fields;
-			}
-			if (preferences.use_local_messages == 1) {
-				temp = expresso_local_messages.list_local_folders();
-				for (var x in temp) {
-					local_folders.push(temp[x][0]);
-				}
 			}
 		}else{
@@ -635,25 +612,12 @@
 			for(var i=0; i < sel_combo.options.length; i++){
 				if(sel_combo.options[i].selected == true){
-					if(!proxy_mensagens.is_local_folder(sel_combo.options[i].value))
-						nm_box[nm_box.length] = sel_combo.options[i].value + fields;
-					else
-						local_folders.push(sel_combo.options[i].value.substr(6));
+					nm_box[nm_box.length] = sel_combo.options[i].value + fields;
 				}
 			}
 		}
 		var handler = function(data){
-			var tmp;
-			var countTmp= new Array();
-			if (local_folders.length > 0) {
-				tmp = expresso_local_messages.search(local_folders, fields);
-				if (tmp!=false) {
-					var tmp2 = tmp.substr(2, data.length - 4);
-					countTmp = tmp.split('####');
-				}
-			}
-			if((data == "none") && (countTmp.length==0)){alert(get_lang("None result was found."));}
-			else if(countTmp.length > 50){alert(get_lang("More than %1 results. Please, try to refine your search.",50));}
+			if(data == "none"){alert(get_lang("None result was found."));}
 			else if(data == "many results"){alert(get_lang("More than %1 results. Please, try to refine your search.",50));}
-			else{EsearchE.mount_result((data=='none')?tmp:(countTmp.length==0)?data:data+tmp);}
+			else{EsearchE.mount_result(data);}
 		}
 		var args   = "$this.imap_functions.search_msg";
@@ -715,9 +679,4 @@
 		win.open();	
 	}
-	
-	searchE.prototype.aux_local_folder_display = function(folder) {
-		return "(Local) " + lang_folder(folder.substr(6));
-	}
-	
 // Cria o objeto
 	var EsearchE;
Index: /branches/1.2/expressoMail1_2/js/drag_area.js
===================================================================
--- /branches/1.2/expressoMail1_2/js/drag_area.js	(revision 689)
+++ /branches/1.2/expressoMail1_2/js/drag_area.js	(revision 1342)
@@ -216,13 +216,14 @@
 			if(new_folder_name == 'INBOX')
 				new_folder_name = get_lang("Inbox");
-			if (_dragArea.from_list) {
-				if (numBox != 0) 
+				
+			if(_dragArea.from_list)
+				if (numBox != 0)
 					move_search_msgs("content_id_search_" + numBox, new_folder, new_folder_name);
-				else 
-					proxy_mensagens.proxy_move_messages("null", 'selected', 0, new_folder, new_folder_name);
-			}
-			else {
-				var msg_number = _dragArea.from_list ? _dragArea.msg_number : _dragArea.msg_number.replace('_r', '');
-				proxy_mensagens.proxy_move_messages("null", msg_number, msg_number + "_r", new_folder, new_folder_name);
+				else	
+					move_msgs(_dragArea.folder, 'selected', 0, new_folder, new_folder_name);
+				
+			else{
+				var msg_number = _dragArea.from_list ? _dragArea.msg_number : _dragArea.msg_number.replace('_r','');
+				move_msgs(_dragArea.folder, msg_number, msg_number+"_r", new_folder, new_folder_name);
 			}
 		}
Index: /branches/1.2/expressoMail1_2/js/shortcut.js
===================================================================
--- /branches/1.2/expressoMail1_2/js/shortcut.js	(revision 689)
+++ /branches/1.2/expressoMail1_2/js/shortcut.js	(revision 1342)
@@ -262,5 +262,5 @@
 		
 		selected_shortcut_msgs = selected_shortcut_msgs.substring(0,(selected_shortcut_msgs.length-1));
-		proxy_mensagens.delete_msgs(current_folder, selected_shortcut_msgs, 'null');
+		delete_msgs(current_folder, selected_shortcut_msgs, 'null');
 	}
 	else
Index: /branches/1.2/expressoMail1_2/js/common_functions.js
===================================================================
--- /branches/1.2/expressoMail1_2/js/common_functions.js	(revision 689)
+++ /branches/1.2/expressoMail1_2/js/common_functions.js	(revision 1342)
@@ -178,5 +178,8 @@
 }
 
-function download_local_attachment(url) {
+function download_attachments(msg_folder, msg_number, idx_file, msg_part, encoding, new_file_name, show_iframe){
+	div_attachment = document.getElementById("id_div_attachment");
+	var params = '';
+	
 	if (div_attachment == null){
 		var div_attachment = document.createElement("DIV");
@@ -184,16 +187,4 @@
 		document.body.appendChild(div_attachment);
 	}
-	div_attachment.innerHTML="<iframe style='display:none;width:0;height:0' name='attachment' src='"+url+"'></iframe>";
-}
-
-function download_attachments(msg_folder, msg_number, idx_file, msg_part, encoding, new_file_name, show_iframe){
-	div_attachment = document.getElementById("id_div_attachment");
-	var params = '';
-	
-	if (div_attachment == null){
-		var div_attachment = document.createElement("DIV");
-		div_attachment.id="id_div_attachment";
-		document.body.appendChild(div_attachment);
-	}
 	if(new_file_name)
 		params = "&newfilename="+new_file_name;
@@ -210,78 +201,4 @@
 	cExecute("$this.exporteml.download_all_attachments",handler_source,"folder="+msg_folder+"&num_msg="+msg_number);
 }
-//ADD forwarded files
-function addForwardedFile(id_border,file_name,link){
-	divFiles = document.getElementById("divFiles_"+id_border);
-
-	if (! divFiles)
-		return false;
-	
-	if (divFiles.lastChild)
-		var countDivFiles = parseInt(divFiles.lastChild.id.split('_')[2]) + 1;
-
-	if (! countDivFiles)
-		var countDivFiles = 1;
-	
-	divFile = document.createElement('DIV');
-	
-
-	if (!is_ie) {
-		var inputFile = document.createElement("INPUT");
-		
-		var tmp_id_border = document.createAttribute('id_border');
-		tmp_id_border.value = id_border;
-		
-		inputFile.setAttributeNode(tmp_id_border);
-		inputFile.id = "inputFile_" + id_border + "_" + countDivFiles;
-		inputFile.type = 'file';
-		inputFile.size = 50;
-		inputFile.maxLength = 255;
-		inputFile.name = 'file_' + countDivFiles;
-		inputFile.style.display = "none";
-		divFile.appendChild(inputFile);
-	}
-	else {
-		var inputFile = document.createElement("link");
-		
-		var tmp_id_border = document.createAttribute('id_border');
-		tmp_id_border.value = id_border;
-		
-		inputFile.setAttributeNode(tmp_id_border);
-		inputFile.id = "inputFile_" + id_border + "_" + countDivFiles;
-		inputFile.name = 'file_' + countDivFiles;
-		
-		
-		divFile.appendChild(inputFile);		
-	}
-
-	var a_tmp = new Array();
-	a_tmp[0] = "local_";
-	a_tmp[1] = 'file_' + countDivFiles;
-	a_tmp[2] = file_name;
-	s_tmp = escape(connector.serialize(a_tmp));
-	var checkbox = document.createElement("INPUT");
-	checkbox.type = "checkbox";
-	checkbox.id = "checkbox_"+id_border+"_"+countDivFiles;
-	checkbox.name = "local_attachments[]";
-	
-	checkbox.value = s_tmp;
-	divFile.appendChild(checkbox);
-	
-	var link_attachment = document.createElement("A");
-	link_attachment.setAttribute("href", link);
-	
-	link_attachment.innerHTML = file_name;
-	divFile.appendChild(link_attachment);
-	
-	countDivFiles++;
-	divFile.id = "divFile_"+id_border+"_"+countDivFiles;	
-	divFiles.appendChild(divFile);
-
-	divFile.id = "divFile_"+id_border+"_"+countDivFiles;	
-	divFiles.appendChild(divFile);
-	checkbox.checked = true; //IncrÃ­vel, mas no Internet Explorer o checked sÃ³ funciona efetivamente se o elemente jÃ¡ estiver renderizado... por isso sÃ³ aqui eu seleciono ele...
-	return inputFile;
-}
-
 // Add Input File Dynamically.
 function addFile(id_border){
@@ -322,6 +239,4 @@
 	divFile.id = "divFile_"+id_border+"_"+countDivFiles;	
 	divFiles.appendChild(divFile);
-
-	return inputFile;
 }
 //	Remove Input File Dynamically.
@@ -762,5 +677,5 @@
 
  function lang_folder(fn) {
- 	if (fn.toUpperCase() == "INBOX") return get_lang("Inbox");
+ 	if (fn == "Inbox") return get_lang("Inbox");
  	if (special_folders[fn] && typeof(special_folders[fn]) == 'string') {
  		return get_lang(special_folders[fn]);
Index: /branches/1.2/expressoMail1_2/js/TreeS.js
===================================================================
--- /branches/1.2/expressoMail1_2/js/TreeS.js	(revision 689)
+++ /branches/1.2/expressoMail1_2/js/TreeS.js	(revision 1342)
@@ -36,11 +36,11 @@
 		div_buttons.innerHTML = "<table border='0' cellpading='0' cellspacing='0'>"+
 							    "<tr>"+
-							    "<td><input type='button' value='"+get_lang('New folder')+"' onclick='proxy_mensagens.proxy_create_folder()'></td>"+
+							    "<td><input type='button' value='"+get_lang('New folder')+"' onclick='ttreeBox.validate(\"newpast\")'></td>"+
 							    "</tr>"+
 							    "<tr>"+
-							    "<td><input type='button' value='"+get_lang('Delete folder')+"' onclick='proxy_mensagens.proxy_remove_folder()'></td>"+
+							    "<td><input type='button' value='"+get_lang('Delete folder')+"' onclick='ttreeBox.del()'></td>"+
 							    "</tr>"+
 							    "<tr>"+
-							    "<td><input type='button' value='"+get_lang('Rename folder')+"' onclick='proxy_mensagens.proxy_rename_folder()'></td>"+
+							    "<td><input type='button' value='"+get_lang('Rename folder')+"' onclick='ttreeBox.validate(\"rename\")'></td>"+
 							    "</tr>"+
 							    "<tr>"+
@@ -161,30 +161,5 @@
 			folders_tree.add(nn,data[i].folder_parent);
 		}
-		//Pastas locais
-		if (preferences.use_local_messages == 1) {
-			var n_root_local = new dNode({
-				id: 'local_root',
-				caption: get_lang("local messages"),
-				plusSign: true
-			});
-			folders_tree.add(n_root_local, 'root');
-			
-			var local_folders = expresso_local_messages.list_local_folders();
-			for (var i in local_folders) { //Coloca as pastas locais.
-				if (local_folders[i][1] > 0) 
-					var nodeLocal = new dNode({
-						id: "local_" + local_folders[i][0],
-						caption: lang_folder(local_folders[i][0]) + '<font style=color:red>&nbsp(</font><span id="local_unseen" style=color:red>' + local_folders[i][1] + '</span><font style=color:red>)</font>',
-						plusSign: 0
-					});
-				else 
-					var nodeLocal = new dNode({
-						id: "local_" + local_folders[i][0],
-						caption: lang_folder(local_folders[i][0]),
-						plusSign: 0
-					});
-				folders_tree.add(nodeLocal, "local_root");
-			}
-		}
+		
 		folders_tree.draw(Element(destination));
 		n_root.changeState();
Index: /branches/1.2/expressoMail1_2/js/main.js
===================================================================
--- /branches/1.2/expressoMail1_2/js/main.js	(revision 706)
+++ /branches/1.2/expressoMail1_2/js/main.js	(revision 1342)
@@ -40,8 +40,4 @@
 	cExecute ("$this.functions.get_preferences", save_preferences);
 	setTimeout('auto_refresh()', time_refresh);
-}
-function disable_field(field,condition) {
-	var comando = "if ("+condition+") { document.getElementById('"+field.id+"').disabled=true;} else { document.getElementById('"+field.id+"').disabled=false; }";
-	eval(comando);
 }
 /*
@@ -240,10 +236,11 @@
 }
 
-function delete_msgs2(folder, msgs_number, border_ID, show_success_msg) {
+function delete_msgs(folder, msgs_number, border_ID)
+{
 	if (folder == 'null')
 		folder = get_current_folder();
 
 	if ((parseInt(preferences.save_deleted_msg)) && (folder!='INBOX'+cyrus_delimiter+trashfolder)){
-		move_msgs2(folder, msgs_number, border_ID, 'INBOX'+cyrus_delimiter+trashfolder,trashfolder,show_success_msg );
+		move_msgs(folder, msgs_number, border_ID, 'INBOX'+cyrus_delimiter+trashfolder,trashfolder );
 		return;
 	}
@@ -274,10 +271,8 @@
 			}
 		}
-		if (show_success_msg) {
-			if (data.msgs_number.length == 1) 
-				write_msg(get_lang("The message was deleted."));
-			else 
-				write_msg(get_lang("The messages were deleted."));
-		}
+		if (data.msgs_number.length == 1)
+			write_msg(get_lang("The message was deleted."));
+		else
+			write_msg(get_lang("The messages were deleted."));
 
 		if (data.border_ID != 'null'){
@@ -298,21 +293,11 @@
 		write_msg(get_lang('No selected message.'));		
 }
-function delete_msgs(folder, msgs_number, border_ID)
-{ 
-	delete_msgs2(folder, msgs_number, border_ID, true);
-}
-
 
 function move_search_msgs(border_id, new_folder, new_folder_name){
 	var selected_messages = '';
-	var temp_msg;
 	var main_list = Element("tbody_resultsearch_"+border_id.substr(18)).childNodes;	
 	for (j = 0; j < main_list.length; j++)	{
 		var check_box = main_list[j].firstChild.firstChild; 
 		if(check_box && check_box.checked) {
-			if (proxy_mensagens.is_local_folder(main_list[j].name)) {
-				alert(get_lang("You cant manipulate local messages on search"));
-				return;
-			}
 			selected_messages += main_list[j].id + ',';
 		}
@@ -375,6 +360,5 @@
 }
 
-function move_msgs2(folder, msgs_number, border_ID, new_folder, new_folder_name,show_success_msg){
-
+function move_msgs(folder, msgs_number, border_ID, new_folder, new_folder_name){
 	if (! folder || folder == 'null')
 		folder = Element("input_folder_"+msgs_number+"_r") ? Element("input_folder_"+msgs_number+"_r").value : get_current_folder();
@@ -410,7 +394,6 @@
 		if( typeof(msgs_number) == 'string' )
 			all_search_msg = msgs_number.split(',');
-		else
+		else if( typeof(msgs_number) == 'number')
 			all_search_msg = msgs_number;
-
 		for (var i=0; i <= all_search_msg.length; i++)
 		{
@@ -441,10 +424,4 @@
 		}
 		
-		if (show_success_msg) {
-			if (data.msgs_number.length == 1)
-				write_msg(get_lang("The message was moved to folder ") + lang_folder(data.new_folder_name));
-			else 
-				write_msg(get_lang("The messages were moved to folder ") + lang_folder(data.new_folder_name));
-		}
 
 		if (data.msgs_number.length == 1)
@@ -480,56 +457,4 @@
 }
 
-function move_msgs(folder, msgs_number, border_ID, new_folder, new_folder_name) {
-	move_msgs2(folder, msgs_number, border_ID, new_folder, new_folder_name,true);
-}
-
-function archive_msgs(folder,folder_dest,id_msgs) {
-	if(proxy_mensagens.is_local_folder(folder)) {
-		write_msg(get_lang("You cant archive local mails"));
-		return;
-	}
-	var has_local_messages_before = expresso_local_messages.has_local_mails(); //vejo se já tinha mensagens locais
-	var handler_arquivar_mensagens = function(data) {
-		var sucess = true;
-		var temp;
-		var msgs_to_remove = new Array();
-		var update_tree;
-
-
-		for (var i = 0; i < data.length; i++) {
-			msg_info = connector.unserialize(data[i]);
-			temp = expresso_local_messages.insert_mail(msg_info, msg_info['header'],msg_info['array_attach'],folder_dest );
-			Element("check_box_message_" + msg_info.msg_number).checked = false;
-			if(!temp)
-				sucess = false;
-			else
-				msgs_to_remove.push(msg_info.msg_number);//As mensagens arquivadas devem ser removidas, caso o usuï¿œrio tenha isso configurado.
-		}
-		
-		if (preferences.keep_archived_messages == 0) { //Remove as mensagens
-				delete_msgs2(folder,msgs_to_remove,'null',false);
-		}
-		update_tree=(!has_local_messages_before) && expresso_local_messages.has_local_mails();
-		
-		Element('chk_box_select_all_messages').checked = false;
-		if(update_tree)
-			ttreeBox.update_folder();
-		else
-			update_menu();
-		if(sucess) 
-			write_msg(get_lang("selected messages have been archived"));
-		else
-			write_msg(get_lang("at least, one of selected mails is already archived, expresso tried to archive the others, check them later"));
-
-	}	
-	if(!id_msgs)
-		id_msgs = get_selected_messages();
-	if (parseInt(id_msgs) > 0 || id_msgs.length > 0) 
-		cExecute("$this.imap_functions.get_info_msgs&folder=" + folder + "&msgs_number=" + id_msgs , handler_arquivar_mensagens);
-	else 
-		write_msg(get_lang('No selected message.'));
-	
-}
-
 function get_selected_messages(){
 	main = document.getElementById("divScrollMain_"+numBox).firstChild.firstChild;
@@ -576,11 +501,4 @@
 	else
 		return selected_messages;
-}
-
-function replaceAll(string, token, newtoken) {
-	while (string.indexOf(token) != -1) {
- 		string = string.replace(token, newtoken);
-	}
-	return string;
 }
 
@@ -802,5 +720,4 @@
 			break;
 		case "forward":
-			data.is_local_message = (document.getElementById("is_local_"+border_ID).value=="1")?true:false;
 			msg_forward_from = document.createElement('input');
 			msg_forward_from.id = "msg_forward_from_" + new_border_ID;
@@ -811,37 +728,17 @@
 			document.getElementById("subject_" + new_border_ID).value = "Fw: " + data.subject;
 			var divFiles = Element("divFiles_"+new_border_ID);
-			var campo_arquivo
 			if (Element("attachments_" + border_ID)){
 				var attachments = document.getElementById("attachments_" + border_ID).childNodes;
 				for (var i = (attachments.length > 1 ? 1 : 0); i < attachments.length; i++){
-					if((attachments[i].tagName=="SPAN") || (attachments[i].tagName=="IMG") ||
-							((attachments[i].href.indexOf("javascript:download_local_attachment")==-1)&&(attachments[i].href.indexOf("javascript:download_attachments")==-1)))
-						continue; 
 					var link_attachment = document.createElement("A");
 					link_attachment.setAttribute("href", attachments[i].href);
 					link_attachment.innerHTML = attachments[i].innerHTML;
-					if (data.is_local_message) {//Local messages
-						document.getElementById("is_local_forward"+new_border_ID).value = "1";
-						var tmp = link_attachment.href.substring(link_attachment.href.indexOf("(") + 2);//Pula o parenteses e a aspas
-						tmp = tmp.substring(0, tmp.length - 2);//corta a aspas e o parenteses
-						tmp = replaceAll(tmp,"%20"," ");
-						var tempNomeArquivo = tmp.split("/");
-						var nomeArquivo = tempNomeArquivo[tempNomeArquivo.length-1];
-						nomeArquivo = nomeArquivo.substring(0,nomeArquivo.length - 4); //Anexos no gears são todos com extensão .php. tenho que tirar a extensão para ficar o nome real do arquivo.
-						campo_arquivo = addForwardedFile(new_border_ID,nomeArquivo,link_attachment.href);
-						
-						expresso_local_messages.getInputFileFromAnexo(campo_arquivo, tmp);
-					}
-					else {
-						var tmp = link_attachment.href.replace("javascript:download_attachments(", "").replace(")", "");
-						var a_tmp = tmp.split(',');
-						tmp = link_attachment.innerHTML.substring(0,link_attachment.innerHTML.lastIndexOf("("));
-						a_tmp[2] = "'"+tmp.substring(0,tmp.length-1)+"'";
-						s_tmp = escape(connector.serialize(a_tmp));			
-
-						divFiles.innerHTML += "<input style='border:0' type='CHECKBOX' name='forwarding_attachments[]' checked value=\""+s_tmp+"\"/>";
-						divFiles.innerHTML += "<link style='border:0' name='file_"+i+"' id='inputFile_"+border_ID+i+"'/>";
-						divFiles.appendChild(link_attachment);
-					}	
+					var tmp = link_attachment.href.replace("javascript:download_attachments(", "").replace(")", "");
+					var a_tmp = tmp.split(',');
+					tmp = link_attachment.innerHTML.substring(0,link_attachment.innerHTML.lastIndexOf("("));
+					a_tmp[2] = "'"+tmp.substring(0,tmp.length-1)+"'";
+					s_tmp = escape(connector.serialize(a_tmp));
+					divFiles.innerHTML += "<input style='border:0' type='CHECKBOX' name='forwarding_attachments[]' checked value=\""+s_tmp+"\"/>";
+					divFiles.appendChild(link_attachment);
 				}
 			}
@@ -1595,5 +1492,5 @@
 		else
 			set_message_flag(msgs_number, "unseen");
-   	    proxy_mensagens.proxy_move_messages(folder, msgs_number, border_ID, new_folder, new_folder_name);
+   	    move_msgs(folder, msgs_number, border_ID, new_folder, new_folder_name);
 	}
 
@@ -1615,5 +1512,5 @@
 		// debug
 		// alert(data);
-		proxy_mensagens.proxy_move_messages(folder, msgs_number, border_ID, new_folder, new_folder_name);
+		move_msgs(folder, msgs_number, border_ID, new_folder, new_folder_name);
 	}
     if(msgs_number == 'selected')
Index: /branches/1.2/expressoMail1_2/js/filter.js
===================================================================
--- /branches/1.2/expressoMail1_2/js/filter.js	(revision 689)
+++ /branches/1.2/expressoMail1_2/js/filter.js	(revision 1342)
@@ -128,6 +128,8 @@
 				}
 			}
-			for(var i=0; i < nm_folders.length; i++){
-				if(nm_folders[i].id != "root" && !proxy_mensagens.is_local_folder(nm_folders[i].id)){
+			for(var i=0; i < nm_folders.length; i++)
+			{
+				if(nm_folders[i].id != "root")
+				{
 					var opt = new Option(nm_folders[i].caption,nm_folders[i].id,false,true);
 					sel_nm[sel_nm.length] = opt;
Index: /branches/1.2/expressoMail1_2/js/wfolders.js
===================================================================
--- /branches/1.2/expressoMail1_2/js/wfolders.js	(revision 689)
+++ /branches/1.2/expressoMail1_2/js/wfolders.js	(revision 1342)
@@ -6,6 +6,6 @@
 	}
 
-	cWFolders.prototype.makeWindowNew = function(border_id, type,from_search)
-	{ //Javascript doesn't seems to have polimorfism
+	cWFolders.prototype.makeWindow = function(border_id, type)
+	{
 		_this = this;
 	
@@ -60,5 +60,5 @@
 					move_search_msgs(border_id, wfolders_tree._selected.id, wfolders_tree._selected.caption);	
 				else{
-					proxy_mensagens.proxy_move_messages('null',msg_number, border_id, wfolders_tree._selected.id, wfolders_tree._selected.caption);
+					move_msgs('null', msg_number, border_id, wfolders_tree._selected.id, wfolders_tree._selected.caption);
 					wfolders.alert = true;
 				}
@@ -87,32 +87,22 @@
 		el.appendChild(butt);
 
-		wfolders_tree = new dFTree({name: 'wfolders_tree'});
-		var n_root = new dNode({id:'root', caption:get_lang("My Folders")});
-		wfolders_tree.add(n_root,'anything'); //Places the root; second argument can be anything.
+		if (!Element('dftree_wfolders_tree'))
+		{
+			wfolders_tree = new dFTree({name: 'wfolders_tree'});
+			var n_root = new dNode({id:'root', caption:get_lang("My Folders")});
+			wfolders_tree.add(n_root,'anything'); //Places the root; second argument can be anything.
 
-		var folders = tree_folders.getNodesList(cyrus_delimiter);
-		for (var i=1; i<folders.length; i++)
-		{
-			if (proxy_mensagens.is_local_folder(folders[i].id) && from_search) {
-				continue;
+			var folders = tree_folders.getNodesList(cyrus_delimiter);
+			for (var i=1; i<folders.length; i++)
+			{
+				var nn = new dNode({id:folders[i].id, caption:lang_folder(folders[i].caption), plusSign:folders[i].plusSign});
+				wfolders_tree.add(nn,folders[i].parent);
 			}
-			var nn = new dNode({
-				id: folders[i].id,
-				caption: lang_folder(folders[i].caption),
-				plusSign: folders[i].plusSign
-			});
-			wfolders_tree.add(nn, folders[i].parent);
 			
+			wfolders_tree.draw(Element('wfolders_content_tree'));
+			n_root.changeState();
+			wfolders_tree.getNodeById('INBOX')._select();
 		}
-		Element('wfolders_content_tree').innerHTML = ""; //As buscas nÃ£o podem incluir mover entre pastas locais, pelo menos por enquanto
-		wfolders_tree.draw(Element('wfolders_content_tree'));
-		n_root.changeState();
-		wfolders_tree.getNodeById('INBOX')._select();
 		_this.showWindow(el, type);
-	}
-
-	cWFolders.prototype.makeWindow = function(border_id, type)
-	{
-		this.makeWindowNew(border_id,type,false);
 	}
 	
Index: /branches/1.2/expressoMail1_2/js/draw_api.js
===================================================================
--- /branches/1.2/expressoMail1_2/js/draw_api.js	(revision 710)
+++ /branches/1.2/expressoMail1_2/js/draw_api.js	(revision 1342)
@@ -53,49 +53,5 @@
 			}
 		}
-		cExecute ("$this.imap_functions.get_folders_list&folder="+current_folder, update_tree_folders);
-		
-		
-		/**
-		 * Pastas locais
-		 */
-		if(preferences.use_local_messages==1) {
-			var local_folders = expresso_local_messages.list_local_folders();
-			var has_changes = false;
-			for (var i in local_folders) { //Coloca as pastas locais.
-				var folder_unseen = Element('dftree_local_'+local_folders[i][0]+'_unseen');
-				
-				if ((folder_unseen) && (local_folders[i][1] > 0))
-				{
-					folder_unseen.innerHTML = local_folders[i][1];
-					has_changes = true;
-				}
-				else if (local_folders[i][1] > 0)
-				{
-					tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(local_folders[i][0]) + '<font style=color:red>&nbsp(</font><span id="dftree_local_'+local_folders[i][0]+'_unseen" style=color:red>'+local_folders[i][1]+'</span><font style=color:red>)</font>'});
-					tree_folders.getNodeById("local_"+local_folders[i][0])._refresh();
-					has_changes = true;
-				}
-				else if (local_folders[i][1] <= 0)
-				{
-					tree_folders.getNodeById("local_"+local_folders[i][0]).alter({caption:lang_folder(local_folders[i][0])});
-					tree_folders.getNodeById("local_"+local_folders[i][0])._refresh();
-					has_changes = true;
-				}
-	
-				if("local_"+local_folders[i][0] == get_current_folder()){					
-					var old_new_m = isNaN(parseInt(Element('new_m').innerHTML)) ? parseInt(Element('new_m').firstChild.innerHTML) : parseInt(Element('new_m').innerHTML);
-					if(!isNaN(old_new_m) && old_new_m < local_folders[i][1]){
-						Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) + (parseInt(local_folders[i][1])-old_new_m);
-					}
-					Element('new_m').innerHTML = local_folders[i][1] ? '<font color="RED">'+local_folders[i][1]+'</font>' : 0;
-					draw_paging(Element('tot_m').innerHTML);
-					has_changes = true;
-				}
-			}
-			if(has_changes)
-				tree_folders.getNodeById("local_root").open();
-
-		}
-		
+		cExecute ("$this.imap_functions.get_folders_list", update_tree_folders);
 		return;
 	}
@@ -127,48 +83,4 @@
 			tree_folders.add(nn,folders[i].folder_parent);
 		}
-		//tree_local_folders = new dFTree({name: 'tree_local_folders'});
-		/**
-		 * Pastas locais
-		 */
-		if (preferences.use_local_messages==1) {
-			if (!window.google || !google.gears) {
-				temp = confirm(get_lang("To use local messages you have to install google gears. Would you like to be redirected to gears installation page?"));
-				if (temp) {
-					location.href = "http://gears.google.com/?action=install&message="+
-					get_lang("To use local messages, install Google Gears")+"&return=" + document.location.href;
-				}
-				else {
-					preferences.use_local_messages=0;
-				}
-			}
-			else{
-				var root_local = new dNode({
-					id: "local_root",
-					caption: get_lang('local folders')
-				});
-				tree_folders.add(root_local, "root"); //coloca root local
-				var local_folders = expresso_local_messages.list_local_folders();
-				for (var i in local_folders) { //Coloca as pastas locais.
-					if (local_folders[i][1] > 0) 
-						var nodeLocal = new dNode({
-							id: "local_" + local_folders[i][0],
-							caption: lang_folder(local_folders[i][0]) + '<font style=color:red>&nbsp(</font><span id="local_unseen" style=color:red>' + local_folders[i][1] + '</span><font style=color:red>)</font>',
-							onClick: "change_folder('local_" + local_folders[i][0] + "','" + local_folders[i][0] + "')",
-							plusSign: 0
-						});
-					else 
-						var nodeLocal = new dNode({
-							id: "local_" + local_folders[i][0],
-							caption: lang_folder(local_folders[i][0]),
-							onClick: "change_folder('local_" + local_folders[i][0] + "','" + local_folders[i][0] + "')",
-							plusSign: 0
-						});
-					tree_folders.add(nodeLocal, "local_root");
-				}
-			}
-		}
-
-		
-		
 		tree_folders.draw(Element('content_folders'));
 		n_root.changeState();
@@ -271,8 +183,6 @@
 			return true;
 		}
-		proxy_mensagens.messages_list(current_folder,1,preferences.max_email_per_page,sort_box_type,search_box_type,sort_box_reverse,handler_draw_box);
-//		cExecute ("$this.imap_functions.get_range_msgs2&folder="+current_folder+"&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type="+sort_box_type+ "&search_box_type="+ search_box_type +"&sort_box_reverse="+sort_box_reverse+"", handler_draw_box);
-	}
-	else
+		cExecute ("$this.imap_functions.get_range_msgs2&folder="+current_folder+"&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type="+sort_box_type+ "&search_box_type="+ search_box_type +"&sort_box_reverse="+sort_box_reverse+"", handler_draw_box);
+	} else
 		alternate_border(0);
 }
@@ -336,5 +246,5 @@
   	if(current_page != 1) {
 	  	lnk_page = document.createElement("A");
-		lnk_page.setAttribute("href", "javascript:current_page=1;kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+",function handler(data){draw_box(data, get_current_folder());});");
+		lnk_page.setAttribute("href", "javascript:current_page=1;kill_current_box(); draw_paging("+num_msgs+"); cExecute ('$this.imap_functions.get_range_msgs2&folder='+get_current_folder()+'&msg_range_begin="+msg_range_begin+"&msg_range_end="+msg_range_end+"&sort_box_type="+sort_box_type+ "&search_box_type="+ search_box_type +"&sort_box_reverse="+sort_box_reverse+"', function handler(data){draw_box(data, get_current_folder());})");
   	}
   	else {
@@ -375,5 +285,5 @@
   			msg_range_begin = ((i*preferences.max_email_per_page)-(preferences.max_email_per_page-1));
 			msg_range_end = (i*preferences.max_email_per_page);
-			lnk_page.setAttribute("href", "javascript:current_page="+i+";kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+",function handler(data){draw_box(data, get_current_folder());});");
+			lnk_page.setAttribute("href", "javascript:current_page="+i+";kill_current_box(); draw_paging("+num_msgs+"); cExecute ('$this.imap_functions.get_range_msgs2&folder='+get_current_folder()+'&msg_range_begin="+msg_range_begin+"&msg_range_end="+msg_range_end+"&sort_box_type="+sort_box_type+ "&search_box_type="+ search_box_type +"&sort_box_reverse="+sort_box_reverse+"', function handler(data){draw_box(data, get_current_folder());})");
   		}
   		
@@ -392,5 +302,5 @@
   		msg_range_begin = ((total_pages*preferences.max_email_per_page)-(preferences.max_email_per_page-1));
 		msg_range_end = (total_pages*preferences.max_email_per_page);  		
-		lnk_page.setAttribute("href", "javascript:current_page="+total_pages+";kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+",function handler(data){draw_box(data, get_current_folder());});");
+		lnk_page.setAttribute("href", "javascript:current_page="+total_pages+";kill_current_box(); draw_paging("+num_msgs+"); cExecute ('$this.imap_functions.get_range_msgs2&folder='+get_current_folder()+'&msg_range_begin="+msg_range_begin+"&msg_range_end="+msg_range_end+"&sort_box_type="+sort_box_type+ "&search_box_type="+ search_box_type +"&sort_box_reverse="+sort_box_reverse+"', function handler(data){draw_box(data, get_current_folder());})");
 	}
 	else {
@@ -437,10 +347,10 @@
 			{
 				if ((window.event.keyCode) == 46)
-					proxy_mensagens.delete_msgs(get_current_folder(),'selected','null');
+					delete_msgs(get_current_folder(),'selected','null');
 			}
 			else
 			{
 				if ((e.keyCode) == 46)
-					proxy_mensagens.delete_msgs(get_current_folder(),'selected','null');
+					delete_msgs(get_current_folder(),'selected','null');
 			}
 		};
@@ -506,5 +416,5 @@
 			{
 				//delete_all_selected_msgs_imap();
-				proxy_mensagens.delete_msgs(get_current_folder(),'selected','null');
+				delete_msgs(get_current_folder(),'selected','null');
 			}
 		}
@@ -514,5 +424,5 @@
 			{
 				//delete_all_selected_msgs_imap();
-				proxy_mensagens.delete_msgs(get_current_folder(),'selected','null');
+				delete_msgs(get_current_folder(),'selected','null');
 			}
 		}
@@ -704,5 +614,5 @@
 		td_element3.id = "td_who_"+ headers_msgs.msg_number;
 		td_element3.setAttribute("width", "30%");
-		var _onclick = function(){InfoContact.hide();proxy_mensagens.get_msg(headers_msgs.msg_number, msg_folder,true, show_msg);};
+		var _onclick = function(){InfoContact.hide();cExecute("$this.imap_functions.get_info_msg&msg_number="+ headers_msgs.msg_number + "&msg_folder=" + msg_folder, show_msg);};
 		td_element3.onclick = _onclick;
 		td_element3.innerHTML = '&nbsp;';
@@ -824,6 +734,5 @@
 	search_box_type = search;
 
-	proxy_mensagens.messages_list(current_folder,1,preferences.max_email_per_page,sort,search,sort_box_reverse,handler_draw_box);
-//	cExecute ("$this.imap_functions.get_range_msgs2&folder="+current_folder+"&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&search_box_type="+search+"&sort_box_type="+sort+"&sort_box_reverse="+sort_box_reverse+"", handler_draw_box);
+	cExecute ("$this.imap_functions.get_range_msgs2&folder="+current_folder+"&msg_range_begin=1&msg_range_end="+preferences.max_email_per_page+"&sort_box_type="+sort+"&search_box_type="+search+"&sort_box_reverse="+sort_box_reverse+"", handler_draw_box);
 	current_page = 1;
 	//Comentado para nao sobrepor o numero de msgs nao lidas ao utilizar os filtros
@@ -1051,5 +960,5 @@
 	option_delete.id = 'msg_opt_delete_'+ID;
 	option_delete.className = 'message_options';
-	option_delete.onclick = function(){proxy_mensagens.delete_msgs(info_msg.msg_folder, info_msg.msg_number, ID);};
+	option_delete.onclick = function(){delete_msgs(info_msg.msg_folder, info_msg.msg_number, ID);};
 	option_delete.innerHTML = get_lang('Delete');
 	options.appendChild(space3);
@@ -1073,7 +982,7 @@
 
 	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_mark_as_unseen				= '<span class="message_options" onclick="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="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="set_messages_flag(\'unflagged\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Normal")+'.\');">'+get_lang("Normal")+'</span> | ';
 	
 	var option_move							= '<span class="message_options" onclick=wfolders.makeWindow("'+ID+'","move_to");>'+get_lang("Move")+'</span> | ';
@@ -1081,5 +990,5 @@
 	var option_reply_without_history		= '<span class="message_options" onclick=new_message("reply_without_history","'+ID+'");>'+get_lang("Reply without history")+'</span> | ';
 	var option_reply_to_all_without_history	= '<span class="message_options" onclick=new_message("reply_to_all_without_history","'+ID+'");>'+get_lang("Reply to all without history")+'</span> | ';
-	var option_source_msg					= '<span class="message_options" onclick=proxy_mensagens.proxy_source_msg("'+ID+'","'+url_encode(info_msg.msg_folder)+'");>'+get_lang("Message Font")+'</span>';	
+	var option_source_msg					= '<span class="message_options" onclick=source_msg("'+ID+'","'+url_encode(info_msg.msg_folder)+'");>'+get_lang("Message Font")+'</span>';	
 
 	div_other_options.innerHTML = option_mark_as + option_mark_as_unseen + option_mark_as_important + option_mark_as_normal + option_move + option_reply_to_all + option_reply_without_history + option_reply_to_all_without_history + option_source_msg;
@@ -1110,5 +1019,5 @@
 		var option_edit	  = '<span class="message_options" onclick="new_message(\'edit\',\''+ID+'\');">'+get_lang('Edit')+'</span> | ';
 		var option_print = '<span class="message_options" onclick="print_msg(\''+info_msg.msg_folder+'\',\''+info_msg.msg_number+'\',\''+ID+'\');">'+get_lang('Print')+'</span> | ';
-		var option_delete = '<span class="message_options" onclick="proxy_mensagens.delete_msgs(\''+info_msg.msg_folder+'\',\''+info_msg.msg_number+'\',\''+ID+'\');">'+get_lang('Delete')+'</span> | ';		
+		var option_delete = '<span class="message_options" onclick="delete_msgs(\''+info_msg.msg_folder+'\',\''+info_msg.msg_number+'\',\''+ID+'\');">'+get_lang('Delete')+'</span> | ';		
 		var option_hide_more = document.createElement("SPAN");
 		option_hide_more.className = 'message_options';
@@ -1196,18 +1105,7 @@
 	from_values.type = "HIDDEN";
 	from_values.value = info_msg.from.full; //Veio do IMAP, sem images nem links.
-	
-	var local_message = document.createElement("INPUT");
-	local_message.id = "is_local_"+ID;
-	local_message.name = "is_local";
-	local_message.type = "HIDDEN";
-	local_message.value = (info_msg.local_message)?"1":"0";
-	
 	tr1.appendChild(td1);
 	tr1.appendChild(from);
 	tr1.appendChild(from_values);
-	tr1.appendChild(local_message);
-	
-
-	
 	if (info_msg.reply_to){
 		var tr11 = document.createElement("TR");
@@ -1431,6 +1329,5 @@
 		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.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);
 			msg_size = info_msg.attachments[i].fsize;
@@ -1690,11 +1587,4 @@
 	}
 	td_to.appendChild(input_to);
-	
-	var forwarded_local_message = document.createElement("INPUT"); //Hidden para indicar se é um forward de uma mensagem local
-	forwarded_local_message.id = "is_local_forward"+ID;
-	forwarded_local_message.name = "is_local_forward";
-	forwarded_local_message.type = "HIDDEN";
-	forwarded_local_message.value = "0";
-	td_to.appendChild(forwarded_local_message);
 	
 	var img_search = document.createElement("IMG");
@@ -2260,5 +2150,5 @@
 			{
 				//delete_all_selected_msgs_imap();
-				proxy_mensagens.delete_msgs(get_current_folder(),'selected','null');
+				delete_msgs(get_current_folder(),'selected','null');
 			}
 		}
@@ -2268,5 +2158,5 @@
 			{
 				//delete_all_selected_msgs_imap();
-				proxy_mensagens.delete_msgs(get_current_folder(),'selected','null');
+				delete_msgs(get_current_folder(),'selected','null');
 			}
 		}
@@ -2367,5 +2257,5 @@
 			{
 				//delete_all_selected_msgs_imap();
-				proxy_mensagens.delete_msgs(get_current_folder(),'selected','null');
+				delete_msgs(get_current_folder(),'selected','null');
 			}
 		}
@@ -2375,5 +2265,5 @@
 			{
 				//delete_all_selected_msgs_imap();
-				proxy_mensagens.delete_msgs(get_current_folder(),'selected','null');
+				delete_msgs(get_current_folder(),'selected','null');
 			}
 		}
@@ -2460,5 +2350,4 @@
 }
 function draw_footer_box(num_msgs){
-	folder = get_current_folder();
 	var span_R = Element("table_message");	
 	var span_options = Element("span_options");	
@@ -2471,11 +2360,10 @@
 
 	span_options.innerHTML = 
-		'<span title="'+get_lang("Delete")+'" style="margin-left:8px" class="message_options" onclick=proxy_mensagens.delete_msgs(\'null\',\'selected\',\'null\')>'+get_lang("Delete")+'</span> | '+
+		'<span title="'+get_lang("Delete")+'" style="margin-left:8px" class="message_options" onclick=delete_msgs(\'null\',\'selected\',\'null\')>'+get_lang("Delete")+'</span> | '+
 		'<span title="'+get_lang("Move")+'" class="message_options" onclick=wfolders.makeWindow(\"\",\"move_to\")>'+get_lang("Move")+'</span> | '+
    		'<span title="'+get_lang("Print")+'" class="message_options" onclick=print_all()>'+get_lang("Print")+'</span> | '+
 	   	'<span title="'+get_lang("Export")+'" class="message_options" onclick="export_all_selected_msgs()">'+get_lang("Export")+'</span> | ' + 
 	   	'<span title="'+get_lang("Import")+'" class="message_options" onclick="import_window()">'+get_lang("Import")+'</span>';
-	if(preferences.use_local_messages==1)
-		span_options.innerHTML += ' | <span title="'+get_lang("Archive")+'" class="message_options" onclick="archive_msgs(\''+folder+'\',null)">'+get_lang("Archive")+'</span>';
+	
 	if (use_spam_filter) {
 		if ( get_current_folder() == 'INBOX'+cyrus_delimiter+'Spam' )	{
Index: /branches/1.2/expressoMail1_2/js/doiMenuData.js
===================================================================
--- /branches/1.2/expressoMail1_2/js/doiMenuData.js	(revision 689)
+++ /branches/1.2/expressoMail1_2/js/doiMenuData.js	(revision 1342)
@@ -152,11 +152,11 @@
 		var _sep = "<hr>";
 		var optionsMenu = new Array( 
-			_tab + get_lang("Mark as")+"&nbsp;"+get_lang('seen')+'|'+"proxy_mensagens.proxy_set_messages_flag('seen','get_selected_messages')",
-			_tab + get_lang("Mark as")+"&nbsp;"+get_lang('unseen')+'|'+"proxy_mensagens.proxy_set_messages_flag('unseen','get_selected_messages')",
-			_tab + get_lang("Mark as")+"&nbsp;"+get_lang('important')+'|'+"proxy_mensagens.proxy_set_messages_flag('flagged','get_selected_messages')",
-			_tab + get_lang("Mark as")+"&nbsp;"+get_lang('normal')+'|'+"proxy_mensagens.proxy_set_messages_flag('unflagged','get_selected_messages')",
+			_tab + get_lang("Mark as")+"&nbsp;"+get_lang('seen')+'|'+"set_messages_flag('seen','get_selected_messages')",
+			_tab + get_lang("Mark as")+"&nbsp;"+get_lang('unseen')+'|'+"set_messages_flag('unseen','get_selected_messages')",
+			_tab + get_lang("Mark as")+"&nbsp;"+get_lang('important')+'|'+"set_messages_flag('flagged','get_selected_messages')",
+			_tab + get_lang("Mark as")+"&nbsp;"+get_lang('normal')+'|'+"set_messages_flag('unflagged','get_selected_messages')",
 			_sep,
 			_tab + get_lang("Move to")+" ... |wfolders.makeWindow('', 'move_to')",
-			_tab + get_lang("Delete")+"|"+"proxy_mensagens.delete_msgs('null','selected','null')",
+			_tab + get_lang("Delete")+"|"+"delete_msgs('null','selected','null')",
 			_tab + get_lang("Export")+"|"+"export_all_selected_msgs()"
 		);
Index: /branches/1.2/expressoMail1_2/js/rich_text_editor.js
===================================================================
--- /branches/1.2/expressoMail1_2/js/rich_text_editor.js	(revision 690)
+++ /branches/1.2/expressoMail1_2/js/rich_text_editor.js	(revision 1342)
@@ -356,6 +356,6 @@
 									'<td align="right"><input type="text" readonly="true" id="border" size="2" maxlength="2" value="1"></input></td><td align="left"><img src="templates/default/images/plus.png" onclick="javascript:RichTextEditor.incrementField(\'border\');"></img><br><img src="templates/default/images/minus.png" onclick="javascript:RichTextEditor.decrementField(\'border\');"></img></td>'+
 									'</tr></tbody></table>'+
-	  								'&nbsp;&nbsp;&nbsp;<input title="'+get_lang('Close')+'"  value="' + get_lang('Close') + '" type="button" onclick="win.close()">&nbsp;'+
-									'<input title="' + get_lang('Include') + '"  value="' + get_lang('Include') + '" type="button" onclick="RichTextEditor.insertTableHtml();win.close();">';	
+	  								'&nbsp;&nbsp;&nbsp;<input title="Close"  value="' + get_lang('Close') + '" type="button" onclick="win.close()">&nbsp;'+
+									'<input title="Include"  value="' + get_lang('Include') + '" type="button" onclick="RichTextEditor.insertTableHtml();win.close();">';	
 		form.appendChild(form_table);
 		
@@ -403,6 +403,6 @@
 		form_upload.innerHTML = get_lang('Select the desired image file')+':<br>'+
 								'<input name="image_at" maxlength="255" size="50" id="inputFile_img" type="file"><br>' +
-								'<input title="' + get_lang('Include') + '"  value="' + get_lang('Include') + '"' + 'type="button" onclick="RichTextEditor.addInputFile();">&nbsp;' +
-								'<input title="' + get_lang('Close') + '"  value="' + get_lang('Close') + '"' +
+								'<input title="Include"  value="' + get_lang('Include') + '"' + 'type="button" onclick="RichTextEditor.addInputFile();">&nbsp;' +
+								'<input title="Close"  value="' + get_lang('Close') + '"' +
 								' type="button" onclick="win.close()">';
 		form.appendChild(form_upload);
Index: /branches/1.2/expressoMail1_2/js/TreeShow.js
===================================================================
--- /branches/1.2/expressoMail1_2/js/TreeShow.js	(revision 689)
+++ /branches/1.2/expressoMail1_2/js/TreeShow.js	(revision 1342)
@@ -98,10 +98,4 @@
 				if(func == "newpast"){
                     var button = prompt(get_lang('Enter the name of the new folder:'),"");
-					
-					if (button.indexOf("local_") != -1  || button.toUpperCase() == "INBOX") {
-						alert(get_lang("cannot create folder. try other folder name"));
-						return false; //Não posso criar pastas contendo a string local_					
-					}
-
 					if(trim(button) == "" || trim(button) == null){
 						return false;
@@ -120,8 +114,4 @@
 					}
                     var button1 = prompt(get_lang("Enter a name for the box"), "");
-					if (button1.indexOf("local_") != -1 || button1.toUpperCase() == "INBOX") {
-						alert(get_lang("cannot create folder. try other folder name"));
-						return false; //Não posso criar pastas contendo a string local_					
-					}
 					if(trim(button1) == "" || trim(button1) == null){
 						return false;
Index: /branches/1.2/expressoMail1_2/index.php
===================================================================
--- /branches/1.2/expressoMail1_2/index.php	(revision 689)
+++ /branches/1.2/expressoMail1_2/index.php	(revision 1342)
@@ -58,7 +58,4 @@
 	}
 
-	//Local messages
-	$_SESSION['phpgw_info']['server']['expressomail']['enable_local_messages'] = $current_config['enable_local_messages'];
-
 	// Get Data from ldap_manager and emailadmin.
 	$ldap_manager = CreateObject('contactcenter.bo_ldap_manager');
@@ -76,8 +73,5 @@
 	$_SESSION['phpgw_info']['expressomail']['user']['email'] = $GLOBALS['phpgw']->preferences->values['email'];
 	
-	if($current_config['enable_local_messages']!='True')  {
-		$GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'] = 0;
-	}
-
+	
 	$_SESSION['phpgw_info']['user']['preferences']['expressoMail'] = array(
 			'voip_enabled'						=> $voip_enabled,
@@ -105,8 +99,5 @@
 		'notification_domains'					=> $current_config['expressoMail_notification_domains'],
 		'remove_attachments_function'				=> $current_config['expressoMail_remove_attachments_function'],
-		'use_important_flag'					=> $current_config['expressoMail_enable_important_flag'],
-   		'use_local_messages'	 			=> $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'] : "0",			
-   		'keep_archived_messages'	 		=> $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'] : "0"
-
+		'use_important_flag'					=> $current_config['expressoMail_enable_important_flag']
 
 
@@ -171,6 +162,4 @@
 
     // End Set Imap Folder names options
-	//User info
-	echo "<script language='javascript'> var account_id = ".$GLOBALS['phpgw_info']['user']['account_id'].";</script>";
 
 	$obj = createobject("expressoMail1_2.functions");
@@ -185,7 +174,4 @@
 							"js/InfoContact.js," .
 							"js/main.js," .
-							"js/gears_init.js," .
-							"js/local_messages.js," .
-							"js/messages_proxy.js," .
 							"js/rich_text_editor.js," .
 							"js/wfolders.js,",
Index: /branches/1.2/expressoMail1_2/templates/default/preferences.tpl
===================================================================
--- /branches/1.2/expressoMail1_2/templates/default/preferences.tpl	(revision 695)
+++ /branches/1.2/expressoMail1_2/templates/default/preferences.tpl	(revision 1342)
@@ -1,4 +1,3 @@
 
-<script src="js/main.js"></script>
 <center>
 
@@ -40,24 +39,4 @@
         </td>
     </tr>
-    {open_comment_local_messages_config}
-	<tr bgcolor="{tr_color2}">
-        <td>{lang_Would_you_like_to_use_local_messages_?}</td>
-        <td align="center">
-        	<select name="use_local_messages" id="use_local_messages" onchange="disable_field(document.getElementById('keep_archived_messages'),'document.getElementById(\'use_local_messages\').value==\'0\'')">
-				<option {use_local_messages_option_No_selected} value="0">{lang_No}</option>
-				<option {use_local_messages_option_Yes_selected} value="1">{lang_Yes}</option>
-			</select>
-        </td>
-    </tr>
-	<tr bgcolor="{tr_color1}">
-        <td>{lang_Would_you_like_to_keep_archived_messages_?}</td>
-        <td align="center">
-        	<select name="keep_archived_messages" id="keep_archived_messages">				
-				<option {keep_archived_messages_option_No_selected} value="0">{lang_No}</option>
-				<option {keep_archived_messages_option_Yes_selected} value="1">{lang_Yes}</option>
-			</select>
-        </td>
-    </tr>
-    {close_comment_local_messages_config}
     <tr bgcolor="{tr_color2}">
         <td>{lang_delete_and_show_previous_message}</td>
@@ -182,6 +161,4 @@
 </center>
 <script language="JavaScript" type="text/javascript">
-	if(document.getElementById('keep_archived_messages'))
-		disable_field(document.getElementById('keep_archived_messages'),'document.getElementById(\'use_local_messages\').value==\'0\'')
 	var form = 	document.forms[0];
 
Index: /branches/1.2/expressoMail1_2/templates/default/config.tpl
===================================================================
--- /branches/1.2/expressoMail1_2/templates/default/config.tpl	(revision 689)
+++ /branches/1.2/expressoMail1_2/templates/default/config.tpl	(revision 1342)
@@ -12,13 +12,4 @@
    <tr bgcolor="{row_off}">
     <td colspan="2"><b>{lang_ExpressoMail_settings}</b></td>
-   </tr>
-	<tr class="{row_off}">
-    <td>{lang_Would_you_like_to_use_local_messages_?}:</td>
-    <td>
-     <select name="newsettings[enable_local_messages]">
-      <option value="">{lang_No}</option>
-      <option value="True"{selected_enable_local_messages_True}>{lang_Yes}</option>
-     </select>
-    </td>
    </tr>
    <tr bgcolor="{row_on}">
