Index: branches/2.3/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- branches/2.3/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 6340)
+++ branches/2.3/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 6474)
@@ -360,5 +360,4 @@
                     //reconstrói o email
                     $email = implode("", file($params['FILES'][0]['tmp_name']));
-                    $email = preg_replace('/(?<!\r)\n/', "\r\n", $email);
                     //coloca o email na pasta selecionada
                     $status = @imap_append($this->mbox, $folder, $email);
@@ -1092,7 +1091,7 @@
 										$msg->encoding[ $msg_number ][ $values ] = 'quoted-printable'; 
 								} 
-                                                                /*
+
 								$body = $this->decodeBody( 
-                                                                		imap_fetchbody( 
+									imap_fetchbody( 
 										$this->mbox, 
 										$msg_number, 
@@ -1102,17 +1101,6 @@
 									$msg->encoding[ $msg_number ][ $values ], 
 									$msg->charset[ $msg_number ][ $values ] 
-								);
-                                                                */
-								$body = $this->decodeBody( 
-									imap_fetchbody( 
-										$this->mbox, 
-										$msg_number, 
-										$attachment['part_in_msg'] . ".1", 
-										FT_UID 
-									), 
-									$msg->encoding[ $msg_number ][ $values ], 
-									$msg->charset[ $msg_number ][ $values ] 
-								);
-                                                                
+								); 
+
 								if ( strtolower( $msg->structure[$msg_number]->parts[1]->parts[0]->subtype ) == 'plain' ) 
 								{ 
@@ -1574,5 +1562,5 @@
                             $this->db = new db_functions();
                             
-                            // TODO: testar se existe um certificado no banco e verificar qual ï¿œ o mais atual.
+                            // TODO: testar se existe um certificado no banco e verificar qual é o mais atual.
                             if(!$certificado->dados['EXPIRADO'] && !$certificado->dados['REVOGADO'] && count($certificado->erros_ssl) < 1)
                                 $this->db->insert_certificate(strtolower($certificado->dados['EMAIL']), $certificado->cert_assinante, $certificado->dados['SERIALNUMBER'], $certificado->dados['AUTHORITYKEYIDENTIFIER']);
@@ -1856,48 +1844,63 @@
 			$i = 0;
 			while (list($key, $val) = each($folders_list)) {
-                            $status = imap_status($mbox_stream, $val->name, SA_UNSEEN);
-
-                            //$tmp_folder_id = explode("}", imap_utf7_decode($val->name));
-                            $tmp_folder_id = explode("}", $val->name );
-
-                            $tmp_folder_id[1] = mb_convert_encoding( $tmp_folder_id[1], "ISO-8859-1", "UTF7-IMAP" );
-
-                            if( $tmp_folder_id[1]=='INBOX'.$this->imap_delimiter.'decifradas')
+				$status = imap_status($mbox_stream, $val->name, SA_UNSEEN);
+
+				//$tmp_folder_id = explode("}", imap_utf7_decode($val->name));
+				$tmp_folder_id = explode("}", $val->name );
+
+				$folderUser = trim( strpos( $tmp_folder_id[1], $this->imap_delimiter , 5 ) );
+
+                            $folderUser = trim( substr( $tmp_folder_id[1], 0, $folderUser ) );
+
+                            $Permission = true;
+
+                            if( $folderUser != "INBOX" && $folderUser != "" )
                             {
-                                    continue;
+                               $Permission = imap_getacl( $mbox_stream, $folderUser );
                             }
-                            $result[$i]['folder_unseen'] = $status->unseen;
-                            $folder_id = $tmp_folder_id[1];
-                            $result[$i]['folder_id'] = $folder_id;
-
-                            $tmp_folder_parent = explode($this->imap_delimiter, $folder_id);
-                            $result[$i]['folder_name'] = array_pop($tmp_folder_parent);
-                            $result[$i]['folder_name'] = $result[$i]['folder_name'] == 'INBOX' ? 'Inbox' : $result[$i]['folder_name'];
-
-                            if ($uid2cn && substr($folder_id,0,4) == 'user') {
-                                    //$this->ldap = new ldap_functions();
-                                    if ($cn = $this->ldap->uid2cn($result[$i]['folder_name'])) {
-                                            $result[$i]['folder_name'] = $cn;
-                                    }
-                            }
-
-                            $tmp_folder_parent = implode($this->imap_delimiter, $tmp_folder_parent);
-                            $result[$i]['folder_parent'] = $tmp_folder_parent == 'INBOX' ? '' : $tmp_folder_parent;
-
-                            if (($val->attributes == 32) && ($result[$i]['folder_name'] != 'Inbox'))
-                                    $result[$i]['folder_hasChildren'] = 1;
-                            else
-                                    $result[$i]['folder_hasChildren'] = 0;
-
-                            switch ($tmp_folder_id[1]) {
-                                    case $inbox:
-                                    case $sent:
-                                    case $drafts:
-                                    case $spam:
-                                    case $trash:
-                                            $resultDefault[]=$result[$i];
-                                            break;
-                                    default:
-                                            $resultMine[]=$result[$i];
+
+                            if( $Permission )
+                            {
+                                $tmp_folder_id[1] = mb_convert_encoding( $tmp_folder_id[1], "ISO-8859-1", "UTF7-IMAP" );
+
+                                if( $tmp_folder_id[1]=='INBOX'.$this->imap_delimiter.'decifradas')
+                                {
+					continue;
+				}
+				$result[$i]['folder_unseen'] = $status->unseen;
+				$folder_id = $tmp_folder_id[1];
+				$result[$i]['folder_id'] = $folder_id;
+
+				$tmp_folder_parent = explode($this->imap_delimiter, $folder_id);
+				$result[$i]['folder_name'] = array_pop($tmp_folder_parent);
+				$result[$i]['folder_name'] = $result[$i]['folder_name'] == 'INBOX' ? 'Inbox' : $result[$i]['folder_name'];
+			
+				if ($uid2cn && substr($folder_id,0,4) == 'user') {
+					//$this->ldap = new ldap_functions();
+					if ($cn = $this->ldap->uid2cn($result[$i]['folder_name'])) {
+						$result[$i]['folder_name'] = $cn;
+					}
+				}
+
+				$tmp_folder_parent = implode($this->imap_delimiter, $tmp_folder_parent);
+				$result[$i]['folder_parent'] = $tmp_folder_parent == 'INBOX' ? '' : $tmp_folder_parent;
+
+				if (($val->attributes == 32) && ($result[$i]['folder_name'] != 'Inbox'))
+					$result[$i]['folder_hasChildren'] = 1;
+				else
+					$result[$i]['folder_hasChildren'] = 0;
+
+				switch ($tmp_folder_id[1]) {
+					case $inbox:
+					case $sent:
+					case $drafts:
+					case $spam:
+					case $trash:
+						$resultDefault[]=$result[$i];
+						break;
+					default:
+						$resultMine[]=$result[$i];
+				}
+
                             }
                             $i++;
@@ -3241,5 +3244,7 @@
 		else
 			$folder_id = "INBOX";
-
+                
+                $folderQuotas = $this->get_folders_with_quota();
+                
 		if(!$this->mbox || !is_resource($this->mbox))
 			$this->mbox = $this->open_mbox();
@@ -3269,13 +3274,88 @@
 			$quotaPercent = (($quotaPercent)* 100 + .5 )* .01;
 			}
+                        
 			return array(
 				'quota_percent' => floor($quotaPercent),
 				'quota_used' => $quota_used,
-				'quota_limit' =>  $quota_limit
+				'quota_limit' =>  $quota_limit,
+                                'quota_folder' => $folderQuotas
 			);
+                        
 		}
 		else
 			return array();
 	}
+
+        function get_quotaroot($params){
+                if(!$this->mbox || !is_resource($this->mbox))
+                        $this->mbox = $this->open_mbox();
+
+                $quota = imap_get_quotaroot($this->mbox, $params['folder']);
+                if($this->mbox && is_resource($this->mbox))
+                        imap_close($this->mbox);
+
+                if (!$quota){
+                        return array(
+                                'quota_percent' => 0,
+                                'quota_used' => 0,
+                                'quota_limit' =>  0,
+                                'quota_root' => ''
+                        );
+                }
+
+                // Additional Imap Class for not-implemented functions into PHP-IMAP extension.
+                include_once("class.imapfp.inc.php");
+                $imapfp = new imapfp();
+
+                if(!$imapfp->open($this->imap_server,$this->imap_port))
+                        return $imapfp->get_error();
+                if (!$imapfp->login($this->username,$this->password))
+                        return $imapfp->get_error();
+
+                if ($imapfp->put_line($imapfp->tag." GETQUOTAROOT \"".$params['folder']."\"")) {
+                        $response=$imapfp->get_server_responce();
+
+                        if(substr($response,strpos($response,"$imapfp->tag ")+strlen($imapfp->tag)+1,2)!="OK") {
+                                $imapfp->error= "Error : $response !<br>";
+                                return $imapfp->get_error();
+                        }
+                }
+                else
+                {
+                        $imapfp->error= "Error : Could not send User request. <br>";
+                        return $imapfp->get_error();
+                }
+                $response_array = split("\r\n", $response);
+                array_pop($response_array);
+                array_pop($response_array);
+                array_shift($response_array);
+               
+                $response_array[0]=substr($response_array[0],strpos($response_array[0],"QUOTAROOT"));
+                $quota['quota_root']=substr(str_replace("\"","",$response_array[0]),/*strlen("QUOTAROOT ... ")=*/11+strlen($params['folder']));
+                $imapfp->close();
+
+                if(count($quota) && $quota['limit']) {
+                        $quota_limit = $quota['limit'];
+                        $quota_used  = $quota['usage'];
+			$quota_root  = $quota['quota_root'];
+                        if($quota_used >= $quota_limit)
+                        {
+                                $quotaPercent = 100;
+                        }
+                        else
+                        {
+                        $quotaPercent = ($quota_used / $quota_limit)*100;
+                        $quotaPercent = (($quotaPercent)* 100 + .5 )* .01;
+                        }
+                        return array(
+                                'quota_percent' => floor($quotaPercent),
+                                'quota_used' => $quota_used,
+                                'quota_limit' =>  $quota_limit,
+                                'quota_root' => $quota_root
+                        );
+                }
+                else
+                        return array();
+        }
 
 	function send_notification($params){
@@ -4056,10 +4136,4 @@
             imap_createmailbox($mbox_stream,imap_utf7_encode("{".$imap_server."}".$folder));
     	}
-        
-        // string date ( string $format [, int $timestamp = time() ] )
-        // bool imap_append ( resource $imap_stream , string $mailbox , string $message [, string $options = NULL [, string $internal_date = NULL ]] )
-        // 'd-M-Y H:i:s O'
-        
-        $return = array();
         if($timestamp){
             $tempDir = $_SESSION['phpgw_info']['server']['temp_dir'];
@@ -4073,15 +4147,4 @@
             $return['append'] = imap_append($mbox_stream, "{".$imap_server.":".$imap_port."}".$folder, $source, "\\Seen");
         }
-        
-        if (!empty($return['command']))
-        {
-            list ($result, $msg) = explode(':',$return['command']);
-            if (strtoupper($result) === 'NO')
-            {
-                $return['error'] = $msg;
-                return $return;
-            }
-        }
-        
         $status = imap_status($mbox_stream, "{".$this->imap_server.":".$this->imap_port."}".$folder, SA_UIDNEXT);
 
@@ -4121,10 +4184,10 @@
             if (version_compare(PHP_VERSION, '5.2.0', '>=')){
                 if(!$source = base64_decode($source,true))
-                    return "error ".$source."Espaï¿œos ".$i;
+                    return "error ".$source."Espaï¿?os ".$i;
 
             }
             else {
                 if(!$source = base64_decode($source))
-                    return "error ".$source."Espaï¿œos ".$i;
+                    return "error ".$source."Espaï¿?os ".$i;
             }
 
@@ -4212,9 +4275,9 @@
                 {
                     $error[] = $ids[$index];
-                }
+            }
                 else 
                 {
                     $archived[] = $ids[$index];
-                }
+	}
             }
 	}
@@ -4223,10 +4286,10 @@
         {
             $return['error'] = $error;
-        }
+    }
         if (!empty($archived))
         {
             $return['archived'] = $archived;
         }
-        
+
         return $return;
     }
@@ -4257,7 +4320,7 @@
 		    return $imapfp->get_error(); 
 
-	    $data = array(); 
-	    $quota_root = $this->get_quota(array('folder_id' => "INBOX")); 
-	    $data["quota_root"] = $quota_root; 
+	    $data = array();
+            $quota_root = $this->get_quota(array('folder_id' => "INBOX"));
+	    $data["quota_root"] = $quota_root;
 
 	    foreach ($response_array as $idx=>$line) { 
@@ -4266,5 +4329,8 @@
 		    list($folder,$size) = explode(";",$line2); 
 		    $quota_used = str_replace(")","",$size); 
-		    $quotaPercent = (($quota_used / 1024) / $data["quota_root"]["quota_limit"])*100; 
+                    $quota=$this->get_quotaroot(array('folder' => $folder));
+                    $hasquota=($quota['quota_root']!="");
+                    $isroot=(strpos($quota['quota_root'],$folder)!==false);
+		    $quotaPercent = ($hasquota?(($quota_used / 1024) / $quota['quota_limit'])*100:0); 
 		    $folder = mb_convert_encoding($folder, "ISO_8859-1", "UTF7-IMAP"); 
 		    if(!preg_match('/user\\'.$this->imap_delimiter.$this->username.'\\'.$this->imap_delimiter.'/i',$folder)){ 
@@ -4274,9 +4340,50 @@
 			    $folder = preg_replace('/user\\'.$this->imap_delimiter.$this->username.'\\'.$this->imap_delimiter.'/i','', $folder); 
 
-		    $data[$folder] = array("quota_percent" => sprintf("%.1f",round($quotaPercent,1)), "quota_used" => $quota_used); 
+		    $data[$folder] = array("quota_percent" => ($hasquota?sprintf("%.1f",round($quotaPercent,1)):''), "quota_used" => $quota_used, "quota_limit" => ($isroot && $folder!=$this->functions->getLang("Inbox")?$quota['quota_limit']:'')); 
 	    } 
 	    $imapfp->close(); 
 	    return $data; 
-    }  
+    }
+        function get_folders_with_quota(){ 
+
+	    // Additional Imap Class for not-implemented functions into PHP-IMAP extension. 
+	    include_once("class.imapfp.inc.php");            
+	    $imapfp = new imapfp(); 
+
+	    if(!$imapfp->open($this->imap_server,$this->imap_port)) 
+		    return $imapfp->get_error();             
+	    if (!$imapfp->login( $this->username,$this->password )) 
+		    return $imapfp->get_error(); 
+
+	    $response_array = $imapfp->get_mailboxes_size(); 
+	    if ($imapfp->error) 
+		    return $imapfp->get_error(); 
+
+	    $data = array();
+
+	    foreach ($response_array as $idx=>$line) { 
+		    $line2 = str_replace('"', "", $line); 
+		    $line2 = str_replace(" /vendor/cmu/cyrus-imapd/size (value.shared ",";",str_replace("* ANNOTATION ","",$line2)); 
+		    list($folder,$size) = explode(";",$line2); 
+		    $quota_used = str_replace(")","",$size); 
+                    $quota=$this->get_quotaroot(array('folder' => $folder));
+                    $hasquota=($quota['quota_limit']!="");
+                    $isroot=(strpos($quota['quota_root'],$folder)!==false);
+                    if($isroot){
+                        $quotaPercent = ($hasquota?(($quota_used / 1024) / $quota['quota_limit'])*100:0); 
+                        $folder = mb_convert_encoding($folder, "ISO_8859-1", "UTF7-IMAP"); 
+                        if(preg_match('/user\\'.$this->imap_delimiter.$this->username.'\\'.$this->imap_delimiter.'/i',$folder)){ 
+                             $folder = preg_replace('/user\\'.$this->imap_delimiter.$this->username.'\\'.$this->imap_delimiter.'/i','', $folder); 
+                             $data[$folder] = array("quota_percent" => ($hasquota?sprintf("%.1f",round($quotaPercent,1)):''), "quota_used" => $quota_used, "quota_limit" => ($isroot && $folder!=$this->functions->getLang("Inbox")?$quota['quota_limit']:'')); 
+                             return $data;
+                        } 
+                        
+                    }
+	    } 
+	    $imapfp->close(); 
+	    return false; 
+    }
+    
+    
 }
 ?>
Index: branches/2.3/expressoMail1_2/js/InfoQuota.js
===================================================================
--- branches/2.3/expressoMail1_2/js/InfoQuota.js	(revision 4536)
+++ branches/2.3/expressoMail1_2/js/InfoQuota.js	(revision 6474)
@@ -134,5 +134,5 @@
 		for(var x in data) {
 			if(x == 'quota_root') continue;				
-			q_used = borkb(data[x]['quota_used']);
+			q_used = borkb(data[x]['quota_used'])+(data[x]['quota_limit']!=''?'/'+borkb(data[x]['quota_limit']*1024):'');
 			value = data[x]['quota_percent'];
 			td01 = document.createElement("TD");
Index: branches/2.3/expressoMail1_2/js/draw_api.js
===================================================================
--- branches/2.3/expressoMail1_2/js/draw_api.js	(revision 6064)
+++ branches/2.3/expressoMail1_2/js/draw_api.js	(revision 6474)
@@ -3384,71 +3384,156 @@
 		div.innerHTML = '<span><font size="2" style="color:red"><strong>'+get_lang("Without Quota")+'</strong></font></span>';
 	}
-	else{
-	if(div)
+	else
+            if(div)
 		div.innerHTML = '';
-	value = data['quota_percent'];
+	
+        value = data['quota_percent'];
 	q_used = data['quota_used'];
 	table = document.getElementById("table_quota");
 	if(table)
 		table.parentNode.removeChild(table);
-	table = document.createElement("TABLE");
-	tbody = document.createElement("TBODY");
-	table.appendChild(tbody);
-	table.id = "table_quota";
-	table.width="102";
-	table.border="0";
-	table.cellSpacing = 0;
-	table.cellPadding = 0;
-
-	//tr1 = document.createElement("TR");
-	td11 = document.createElement("TD");
-	td11.align="center";
-	td11.setAttribute("noWrap","true");
-	td11.innerHTML += '&nbsp;<span class="boxHeaderText">' + value+"% ("+borkb(q_used*1024)+"/"+borkb(q_limit*1024)+")</span>";
-	//tr1.appendChild(td11);
-
-	tr2 = document.createElement("TR");
-	td21 = document.createElement("TD");
-	td21.setAttribute("noWrap","true");
-	td21.height="15";
-	td22 = document.createElement("TD");
-	td21.setAttribute("background","../phpgwapi/templates/"+template+"/images/dsunused.gif");
-	table221 = document.createElement("TABLE");
-	tbody221 = document.createElement("TBODY");
-	table221.appendChild(tbody221);
-	table221.style.width=value+"%";
-	td21.width="102";
-	table221.border="0";
-	table221.cellSpacing = 0;
-	table221.cellPadding = 0;
-	tr221 = document.createElement("TR");
-	td221 = document.createElement("TD");
-	td221.height="15";
-	if(value > 90) {
-		if(value >= 100)
-			write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages."));
-		else
-			write_msg(get_lang("Warning: Your Mailbox is almost full!"));
-		td221.setAttribute("background","templates/"+template+"/images/dsalert.gif");
-	}
-	else if(value > 80)
-		td221.setAttribute("background","templates/"+template+"/images/dswarn.gif");
-	else
-		td221.className = 'dsused';
-
-        td221.setAttribute("style","width: 100%");
-
-	tr221.appendChild(td221);
-	tbody221.appendChild(tr221);
-	td21.appendChild(table221);
-	tr2.appendChild(td21);
-	tr2.appendChild(td11);
-
-	//tr2.appendChild(td1);
-
-	tbody.appendChild(tr2); //Desenho
-	//tbody.appendChild(tr1); //Letras
-	div.appendChild(table);
-	}
+                    table = document.createElement("TABLE");
+        tbody = document.createElement("TBODY");
+        table.appendChild(tbody);
+        table.id = "table_quota";
+        table.width="102";
+        table.border="0";
+        table.cellSpacing = 0;
+        table.cellPadding = 0;
+        tr2 = document.createElement("TR");        
+
+        if(data['quota_folder']){
+            td10 = document.createElement("TD");
+            td10.setAttribute("noWrap","true");
+            td10.innerHTML += '<span class="boxHeaderText">&nbsp;Raiz&nbsp</span>';
+            td11 = document.createElement("TD");
+            td11.setAttribute("noWrap","true");
+            td11.height="15";
+            td11.setAttribute("background","../phpgwapi/templates/"+template+"/images/dsunused.gif");
+            td11.width="102";
+            div11 = document.createElement("DIV");
+            div11.height="15";
+            if(value > 90) {
+                    if(value >= 100)
+                            write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages."));
+                    else
+                            write_msg(get_lang("Warning: Your Mailbox is almost full!"));
+                    div11.setAttribute("background","templates/"+template+"/images/dsalert.gif");
+            }
+            else if(value > 80)
+                    div11.setAttribute("background","templates/"+template+"/images/dswarn.gif");
+            else
+                    div11.className = 'dsused';
+            div11.setAttribute("style","width: 100%");
+            div11.className = 'dsused';
+            div11.style.width=value+"%";
+            div11.innerHTML += '&nbsp;';
+            div11.innerHTML += value+"%";
+            td11.appendChild(div11);
+            td11.style.textAlign = 'left';
+            td12 = document.createElement("TD");
+            td12.align="center";
+            td12.setAttribute("noWrap","true");
+            td12.innerHTML += '&nbsp;<span class="boxHeaderText"> de ' + borkb(q_limit*1024)+"</span>";
+            tr2.appendChild(td10);
+            tr2.appendChild(td11);
+            tr2.appendChild(td12);
+            //----------------
+            for(folder in data['quota_folder']){
+                folderName = "Arquivo Remoto";
+                qFolderUsed = data['quota_folder'][folder]['quota_used'];
+                qFolderLimit = data['quota_folder'][folder]['quota_limit'];
+                qfolderPercent = data['quota_folder'][folder]['quota_percent'];
+            }
+            
+            td20 = document.createElement("TD");
+            td20.setAttribute("noWrap","true");
+            td20.innerHTML += '<span class="boxHeaderText">&nbsp;-&nbsp;'+folderName+"&nbsp;</span>";
+            
+            td21 = document.createElement("TD");
+            td21.setAttribute("noWrap","true");
+            td21.height="15";
+            td21.setAttribute("background","../phpgwapi/templates/"+template+"/images/dsunused.gif");
+            td21.width="102";
+            div21 = document.createElement("DIV");
+            div21.height="15";
+            if(qfolderPercent > 90) {
+                    if(qfolderPercent >= 100)
+                            write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages."));
+                    else
+                            write_msg(get_lang("Warning: Your Mailbox is almost full!"));
+                    div21.setAttribute("background","templates/"+template+"/images/dsalert.gif");
+            }
+            else if(qfolderPercent > 80)
+                    div21.setAttribute("background","templates/"+template+"/images/dswarn.gif");
+            else
+                    div21.className = 'dsused';
+            div21.setAttribute("style","width: 100%");
+            div21.className = 'dsused';
+            div21.style.width=qfolderPercent+"%";
+            div21.innerHTML += '&nbsp;';
+            div21.innerHTML += qfolderPercent+"%";
+            td21.appendChild(div21);
+            td21.style.textAlign = 'left';
+            
+            td22 = document.createElement("TD");
+            td22.align="center";
+            td22.setAttribute("noWrap","true");
+            td22.innerHTML += '&nbsp;<span class="boxHeaderText"> de ' + borkb(qFolderLimit*1024)+"</span>";
+            
+            tr2.appendChild(td20);
+            tr2.appendChild(td21);
+            tr2.appendChild(td22);
+            //----------------
+        
+            
+        }else{        
+            //tr1 = document.createElement("TR");
+            td11 = document.createElement("TD");
+            td11.align="center";
+            td11.setAttribute("noWrap","true");
+            td11.innerHTML += '&nbsp;<span class="boxHeaderText">' + value+"% ("+borkb(q_used*1024)+"/"+borkb(q_limit*1024)+")</span>";
+            //tr1.appendChild(td11);
+            td21 = document.createElement("TD");
+            td21.setAttribute("noWrap","true");
+            td21.height="15";
+            //td22 = document.createElement("TD");
+            td21.setAttribute("background","../phpgwapi/templates/"+template+"/images/dsunused.gif");
+            table221 = document.createElement("TABLE");
+            tbody221 = document.createElement("TBODY");
+            table221.appendChild(tbody221);
+            table221.style.width=value+"%";
+            td21.width="102";
+            table221.border="0";
+            table221.cellSpacing = 0;
+            table221.cellPadding = 0;
+            tr221 = document.createElement("TR");
+            td221 = document.createElement("TD");
+            td221.height="15";
+            if(value > 90) {
+                    if(value >= 100)
+                            write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages."));
+                    else
+                            write_msg(get_lang("Warning: Your Mailbox is almost full!"));
+                    td221.setAttribute("background","templates/"+template+"/images/dsalert.gif");
+            }
+            else if(value > 80)
+                    td221.setAttribute("background","templates/"+template+"/images/dswarn.gif");
+            else
+                    td221.className = 'dsused';
+
+            td221.setAttribute("style","width: 100%");
+
+            tr221.appendChild(td221);
+            tbody221.appendChild(tr221);
+            td21.appendChild(table221);
+            tr2.appendChild(td21);
+            tr2.appendChild(td11);
+            //tr2.appendChild(td1);
+        }
+    tbody.appendChild(tr2); //Desenho
+    //tbody.appendChild(tr1); //Letras
+    div.appendChild(table);
+        
 }
 
