Index: trunk/instant_messenger/IMManager.php
===================================================================
--- trunk/instant_messenger/IMManager.php	(revision 63)
+++ trunk/instant_messenger/IMManager.php	(revision 64)
@@ -3,5 +3,9 @@
 
    require_once('inc/IMConfigure.php');
-
+	require_once('inc/Jabberd2.abstract.php');
+
+	## limit to indefinite execution
+	set_time_limit (0);
+   
    ###
    # definitions of socket - BEGIN
@@ -21,13 +25,9 @@
    }
 
-   include 'inc/Jabberd2.abstract.php';
-
    $master = array(SOCKET_NON_SECURITY);
-
    $users = array();
-
    $send = false;
 
-   while ( 1 )
+   while ( true )
    {
       $read = $master;
@@ -36,7 +36,9 @@
        
       $mod_fd = @stream_select($read, $_w , $_e , READ_SOCKET_AFTER_OF );
-
+		
       if ( $mod_fd === FALSE )
+      {
          break;
+      }
 
       for ( $i = 0; $i < $mod_fd; ++$i )
@@ -65,5 +67,5 @@
                $headers = (split("\n", $sock_data));
 
-               preg_match('/^(GET|POST) \/(.+) HTTP\/1\.1/U', $headers[0], $request);
+               preg_match('/^(GET|POST) \/(.+) HTTP\/1\.\d/U', $headers[0], $request);
                preg_match('/^Host: \w*:(.+)/', $headers[1], $host);
 
@@ -90,10 +92,9 @@
       foreach ( $users as $key => $val )
       {
-         if($users[$key]['time0'] != $users[$key]['time1']  )
+         if( $users[$key]['time0'] > $users[$key]['time1'] )
          {
          	$users[$key]['time1'] = $users[$key]['time0'];
          	$users[$key]['attempt'] = 0;
-         	readSocket($key);
-         	//readSocket($users, $key);
+         	readSocket($users, $key);
          }
          else
@@ -107,20 +108,16 @@
 				else
 				{
-					readSocket($key);
-					//readSocket($users, $key);
+					readSocket($users, $key);
 				}         	
          }
-
-         //print_r("Session : " . $key . " | Count : " . count($users) . " | time 0 : " . $users[$key]['time0'] . " | time 1 : " . $users[$key]['time1'] . " | tentativas : " . $users[$key]['attempt'] . " \n");
-      }
-
-   }
-	
+      }
+   }
 	
    exit(0);
 
-	
    function connect(&$pUsers, $pSession)
    {
+		global $users;
+		      
       $sessionpath = explode(';', session_save_path());
       foreach ( $sessionpath as $path )
@@ -182,8 +179,6 @@
    }
 
-   //function readSocket(&$pUsers, $pSession)
-   function readSocket($pSession)
-   {
-      global $users;
+   function readSocket(&$pUsers, $pSession)
+   {
       global $send;
       $sessionpath = explode(';', session_save_path());
@@ -204,8 +199,11 @@
             if ( $is_user )
             {
-               $users[$pSession]['time0'] = $_SESSION['phpgw_info']['instant_messenger']['time'];
-					$readSocket = $users[$pSession]['jabber']->readSocket();
+               $pUsers[$pSession]['time0'] = $_SESSION['phpgw_info']['instant_messenger']['time'];
+					$readSocket = @$pUsers[$pSession]['jabber']->readSocket();
                
-               if ( $readSocket !== false )
+               $connection_close_timeout = strpos($readSocket, "<stream:error");
+               $connection_close_server = strpos($readSocket,"</stream:stream>");
+               
+               if ( ($readSocket !== false) && ($connection_close_timeout === false ) && ($connection_close_server === false ))
                {
                   if ( !empty($readSocket) )
@@ -221,5 +219,5 @@
 									if ( !is_null($value) )
 									{
-										$users[$pSession]['jabber']->writeSocket($value);
+										$pUsers[$pSession]['jabber']->writeSocket($value);
 										$_SESSION['phpgw_info']['instant_messenger']['socket']['out']['message'] = NULL;
 									}
@@ -231,5 +229,5 @@
 										foreach ( $value as $key => $val )
 										{
-											$users[$pSession]['jabber']->getVcard($val);
+											$pUsers[$pSession]['jabber']->getVcard($val);
 											unset($_SESSION['phpgw_info']['instant_messenger']['socket']['out']['vcard'][$key]);
 										}
@@ -238,9 +236,9 @@
 								else
 								{
-									if ( method_exists($users[$pSession]['jabber'], $action) )
+									if ( method_exists($pUsers[$pSession]['jabber'], $action) )
 										if ( $value )
-											$users[$pSession]['jabber']->$action($value);
+											$pUsers[$pSession]['jabber']->$action($value);
 										else
-											$users[$pSession]['jabber']->$action();
+											$pUsers[$pSession]['jabber']->$action();
 									unset($_SESSION['phpgw_info']['instant_messenger']['socket']['out'][$action]);
 								}
@@ -249,12 +247,16 @@
                else
                {
-                  close($pSession);
-               }
-               session_write_close();
+               	close($pSession);               	
+               }
                break;
             }
-            session_write_close();
-         }
-      }
+            else
+            {
+               close($pSession);
+            }
+            break;
+         }
+      }
+      session_write_close();
    }
 ?>
Index: trunk/instant_messenger/inc/im_acl.inc.php
===================================================================
--- trunk/instant_messenger/inc/im_acl.inc.php	(revision 63)
+++ trunk/instant_messenger/inc/im_acl.inc.php	(revision 64)
@@ -30,9 +30,9 @@
             $js = array(
                         $webserver_url . 'js/XMLTools.js',
-                        $webserver_url . 'js/json.js',
                         $webserver_url . 'js/im_functions.js',
                         $webserver_url . 'js/im_fcommon.js',
                         $webserver_url . 'js/im_var_globals.js',
                         $webserver_url . 'js/im_images.js',
+                        $webserver_url . 'js/im_smiles.js',
                         $webserver_url . 'js/im_templates.js',
                         $webserver_url . 'js/im_win.js',
@@ -41,19 +41,10 @@
                         $webserver_url . 'js/im_preferences.js',
                         $webserver_url . 'js/im_init.js',
-								$webserver_url . 'js/im_subscription.js',                        
+						      $webserver_url . 'js/im_subscription.js',
                        );
 
             require_once('load_lang.php');
 
-         /*
-           Os método PORTA (PROGRAMAÇÂO ORIENTADA A RECURSO TÉCNICO ALTERNATIVO) mais exatamente
-           métodos POG (PROGRAMAÇÂO ORIENTADO A GAMBIARRA) usados a seguir é devido a integração
-           dos diverso módulos do expresso com o mensageiro instantâneo e para manter a aplicação
-           crossbrowser!
-          
-           [NUTS] Rodrigo Souza - 29/01/2007
-          */
-
-         print '
+         	print '
                <link rel="stylesheet" href="' . $webserver_url . 'templates/default/css.css" />
                <link rel="stylesheet" href="' . $webserver_url . 'templates/default/messenger.css" />
@@ -69,12 +60,6 @@
                   }
                </script>';
-         /*
-           isso se faz necessário para que não seja carregado duas vezes o arquivo wz_dragdrop
-           e que a função SET_DHTML seja executada uma única vez, caso contrário causa um erro
-           que finaliza a execução de todos as chamadas javascript em execução e as futuras
-           chamadas também não serão executadas
-          */
-
-         print '
+         
+          print '
                <script>
                   if ( ini_wzdd )
@@ -82,16 +67,8 @@
                </script>';
 
-         foreach ( $js as $key => $val )
-            print '<script src="' . $val . '?' . filemtime($_SERVER['DOCUMENT_ROOT'] . '/' . $val) . '"></script>';
-
-         /*
-           instrução break utilizada decorrente ao fato que o usuário pode ter multiplas permissão de
-           acesso ao modulo de mensagem instantanea ou seja pode possuir permissão tanto nos diversos
-           grupos que faz parte assim como permissão individual de acesso (permissão de acesso dada
-           especificamente ao usuaário)
-          */
+          foreach ( $js as $key => $val )
+             print '<script src="' . $val . '?' . filemtime($_SERVER['DOCUMENT_ROOT'] . '/' . $val) . '"></script>';
           
          }
-         
          break;
       }
Index: trunk/instant_messenger/inc/class.Ujabber.inc.php
===================================================================
--- trunk/instant_messenger/inc/class.Ujabber.inc.php	(revision 63)
+++ trunk/instant_messenger/inc/class.Ujabber.inc.php	(revision 64)
@@ -10,9 +10,9 @@
    {
       $return = null;
-
+		
 		$_SESSION['phpgw_info']['instant_messenger']['time'] = time();
       $_SESSION['phpgw_info']['instant_messenger']['socket']['block'] = true;
       $xml = $_SESSION['phpgw_info']['instant_messenger']['socket']['in'];
-      
+
       unset($_SESSION['phpgw_info']['instant_messenger']['socket']['in']);
       $_SESSION['phpgw_info']['instant_messenger']['socket']['block'] = false;
@@ -110,5 +110,4 @@
       }
       ### - Fim vcard - ###
-      
       ## Final do Listen;
 
@@ -437,4 +436,5 @@
    function requireVcard()
    {
+
       $contacts = array();
       $contacts = $_SESSION['phpgw_info']['instant_messenger']['contacts'];
Index: trunk/instant_messenger/inc/Jabber.abstract.php
===================================================================
--- trunk/instant_messenger/inc/Jabber.abstract.php	(revision 55)
+++ trunk/instant_messenger/inc/Jabber.abstract.php	(revision 64)
@@ -35,5 +35,5 @@
    {
       try
-      {
+      {	
          if ( !preg_match('/^(.+)@(.+)\/(.+):(\d+)$/',$pUser, $matches) )
             throw new Exception('[connect] #1 ' . $pUser . ' must be [USER]@[DOMAIN]/[RESOURCE]:[PORT] and [PORT] is integer. File: ' . __FILE__ . '  ::  ' . __LINE__);
@@ -49,4 +49,5 @@
          $xml .= "<stream:stream to='" . $SERVER . "' xmlns='jabber:client' ";
          $xml .= "xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>";
+
          if ( $this->write($xml) === false )
             throw new Exception('[connect] #3 it isn\'t possible write in the socket ' . $socket . '. File: ' . __FILE__ . '  ::  ' . __LINE__);
@@ -65,11 +66,12 @@
 
    protected function connect( $pUser = false, $pPassword = false )
-   {
+   {   
       try
       {
          $this->_connect($pUser, $pPassword);
+			
          if ( ($xml = $this->read()) === false )
             throw new Exception('[connect] #1 it isn\'t possible read the socket. File: ' . __FILE__ . '  ::  ' . __LINE__);
-
+         
          if ( preg_match('/(<starttls .*<required\/><\/starttls>)/', $xml, $matches) )
          {
@@ -80,6 +82,8 @@
          }
          else
+	 		{
             if ( !$this->_plain() )
                throw new Exception('[connect] #3 it isn\'t possible carry out the verification. File: ' . __FILE__ . '  ::  ' . __LINE__);
+	 		}
 
          return true;
@@ -170,6 +174,9 @@
             throw new Exception('[_plain] #2 it isn\'t possible carry out the verification. File: ' . __FILE__ . '  ::  ' . __LINE__);
 
-         while ( !preg_match("/<iq xmlns='jabber:client' id='auth_1' type='result'\/>/", ($readSocket = $this->read()), $matches) )
-            usleep(10000);
+         while ( !preg_match("/<iq xmlns='jabber:client' id='auth_1' type='(result|error)'/", ($readSocket = $this->read()), $matches) )
+         	   usleep(10000);
+
+			if($matches[1] == "error")
+				return false;
 
          if ( ($xml = $this->read()) === false )
Index: trunk/instant_messenger/js/im_preferences.js
===================================================================
--- trunk/instant_messenger/js/im_preferences.js	(revision 60)
+++ trunk/instant_messenger/js/im_preferences.js	(revision 64)
@@ -433,9 +433,9 @@
 		{
 			var numbers = /^\d+$/;
-			if(numbers.test(func.byId('in_time').value))
+			if(numbers.test(func.byId('in_time').value) && func.byId('in_time').value != "0")
 				var minutes = func.byId('in_time').value;
 			else
 			{
-				alert('Informe valores numéricos');
+				alert('Informe valores válidos !');
 				func.byId('in_time').focus();
 				return false;
Index: trunk/instant_messenger/js/im_init.js
===================================================================
--- trunk/instant_messenger/js/im_init.js	(revision 55)
+++ trunk/instant_messenger/js/im_init.js	(revision 64)
@@ -3,5 +3,5 @@
    try
    {
-      if ( window.IM )
+      if ( window.IM && window.im_win && window.func )
          IM.load_im();
       else
Index: trunk/instant_messenger/js/im_images.js
===================================================================
--- trunk/instant_messenger/js/im_images.js	(revision 55)
+++ trunk/instant_messenger/js/im_images.js	(revision 64)
@@ -1,4 +1,4 @@
 // Instant Messenger
-// Images.js
+// im_images.js
 
 		var navbar = new Image();
@@ -8,8 +8,4 @@
 		var img_group_open = new Image();
 		img_group_open.src = im_path + "templates/default/images/group_open.gif";
-		var img_down = new Image();
-		img_down.src = im_path + "templates/default/images/down.gif";
-		var img_up = new Image();
-		img_up.src = im_path + "templates/default/images/up.gif";
 		var img_available = new Image();
 		img_available.src = im_path + "templates/default/images/available.gif";
@@ -18,18 +14,10 @@
 		var img_busy = new Image();
 		img_busy.src = im_path + "templates/default/images/busy.gif";
-		var img_not_authorized  = new Image();
-		img_not_authorized.src = im_path + "templates/default/images/not_authorized.gif";
 		var img_chat = new Image();
 		img_chat.src = im_path + "templates/default/images/chat.gif";
-		var img_open_box = new Image();
-		img_open_box.src = im_path + "templates/default/images/open_box.gif";
-		var img_close_box = new Image();
-		img_close_box.src = im_path + "templates/default/images/close_box.gif";
 		var img_photo = new Image();
 		img_photo.src = im_path + "templates/default/images/photo.png";
 		var img_menu = new Image();
 		img_menu.src = im_path + "templates/default/images/menu.gif";
-		var img_wait = new Image();
-		img_wait.src = im_path + "templates/default/images/wait.gif";
 		var img_chat_bubble = new Image();
 		img_chat_bubble.src = im_path + "templates/default/images/chat_bubble.gif";
@@ -38,5 +26,4 @@
 		var img_edit = new Image();
 		img_edit.src = im_path + "templates/default/images/img/icon_edit.gif";
-	
 		var img_xa = new Image();
 		img_xa.src = im_path + "templates/default/images/xa.gif";
@@ -45,112 +32,2 @@
 		var img_dnd = new Image();
 		img_dnd.src = im_path + "templates/default/images/dnd.gif";
-
-
-	   var smile_1 = new Image();
-	   smile_1.src = im_path + "templates/default/images/img/smiles/1.gif"
-	   var smile_2 = new Image();
-	   smile_2.src = im_path + "templates/default/images/img/smiles/2.gif"
-	   var smile_3 = new Image();
-	   smile_3.src = im_path + "templates/default/images/img/smiles/3.gif"
-	   var smile_4 = new Image();
-	   smile_4.src = im_path + "templates/default/images/img/smiles/4.gif"
-	   var smile_5 = new Image();
-	   smile_5.src = im_path + "templates/default/images/img/smiles/5.gif"
-	   var smile_6 = new Image();
-	   smile_6.src = im_path + "templates/default/images/img/smiles/6.gif"
-	   var smile_7 = new Image();
-	   smile_7.src = im_path + "templates/default/images/img/smiles/7.gif"
-	   var smile_8 = new Image();
-	   smile_8.src = im_path + "templates/default/images/img/smiles/8.gif"
-	   var smile_9 = new Image();
-	   smile_9.src = im_path + "templates/default/images/img/smiles/9.gif"
-	   var smile_10 = new Image();
-	   smile_10.src = im_path + "templates/default/images/img/smiles/10.gif"
-	   var smile_11 = new Image();
-	   smile_11.src = im_path + "templates/default/images/img/smiles/11.gif"
-	   var smile_12 = new Image();
-	   smile_12.src = im_path + "templates/default/images/img/smiles/12.gif"
-	   var smile_13 = new Image();
-	   smile_13.src = im_path + "templates/default/images/img/smiles/13.gif"
-	   var smile_14 = new Image();
-	   smile_14.src = im_path + "templates/default/images/img/smiles/14.gif"
-	   var smile_15 = new Image();
-	   smile_15.src = im_path + "templates/default/images/img/smiles/15.gif"
-	   var smile_16 = new Image();
-	   smile_16.src = im_path + "templates/default/images/img/smiles/16.gif"
-	   var smile_17 = new Image();
-	   smile_17.src = im_path + "templates/default/images/img/smiles/17.gif"
-	   var smile_18 = new Image();
-	   smile_18.src = im_path + "templates/default/images/img/smiles/18.gif"
-	   var smile_19 = new Image();
-	   smile_19.src = im_path + "templates/default/images/img/smiles/19.gif"
-	   var smile_20 = new Image();
-	   smile_20.src = im_path + "templates/default/images/img/smiles/20.gif"
-	   var smile_21 = new Image();
-	   smile_21.src = im_path + "templates/default/images/img/smiles/21.gif"
-	   var smile_22 = new Image();
-	   smile_22.src = im_path + "templates/default/images/img/smiles/22.gif"
-	   var smile_23 = new Image();
-	   smile_23.src = im_path + "templates/default/images/img/smiles/23.gif"
-	   var smile_24 = new Image();
-	   smile_24.src = im_path + "templates/default/images/img/smiles/24.gif"
-	   var smile_25 = new Image();
-	   smile_25.src = im_path + "templates/default/images/img/smiles/25.gif"
-	   var smile_26 = new Image();
-	   smile_26.src = im_path + "templates/default/images/img/smiles/26.gif"
-	   var smile_27 = new Image();
-	   smile_27.src = im_path + "templates/default/images/img/smiles/27.gif"
-	   var smile_28 = new Image();
-	   smile_28.src = im_path + "templates/default/images/img/smiles/28.gif"
-	   var smile_29 = new Image();
-	   smile_29.src = im_path + "templates/default/images/img/smiles/29.gif"
-	   var smile_30 = new Image();
-	   smile_30.src = im_path + "templates/default/images/img/smiles/30.gif"
-	   var smile_31 = new Image();
-	   smile_31.src = im_path + "templates/default/images/img/smiles/31.gif"
-	   var smile_32 = new Image();
-	   smile_32.src = im_path + "templates/default/images/img/smiles/32.gif"
-	   var smile_33 = new Image();
-	   smile_33.src = im_path + "templates/default/images/img/smiles/33.gif"
-	   var smile_34 = new Image();
-	   smile_34.src = im_path + "templates/default/images/img/smiles/34.gif"
-	   var smile_35 = new Image();
-	   smile_35.src = im_path + "templates/default/images/img/smiles/35.gif"
-	   var smile_36 = new Image();
-	   smile_36.src = im_path + "templates/default/images/img/smiles/36.gif"
-	   var smile_37 = new Image();
-	   smile_37.src = im_path + "templates/default/images/img/smiles/37.gif"
-	   var smile_38 = new Image();
-	   smile_38.src = im_path + "templates/default/images/img/smiles/38.gif"
-	   var smile_39 = new Image();
-	   smile_39.src = im_path + "templates/default/images/img/smiles/39.gif"
-	   var smile_40 = new Image();
-	   smile_40.src = im_path + "templates/default/images/img/smiles/40.gif"
-	   var smile_41 = new Image();
-	   smile_41.src = im_path + "templates/default/images/img/smiles/41.gif"
-	   var smile_42 = new Image();
-	   smile_42.src = im_path + "templates/default/images/img/smiles/42.gif"
-	   var smile_43 = new Image();
-	   smile_43.src = im_path + "templates/default/images/img/smiles/43.gif"
-	   var smile_44 = new Image();
-	   smile_44.src = im_path + "templates/default/images/img/smiles/44.gif"
-	   var smile_45 = new Image();
-	   smile_45.src = im_path + "templates/default/images/img/smiles/45.gif"
-	   var smile_46 = new Image();
-	   smile_46.src = im_path + "templates/default/images/img/smiles/46.gif"
-	   var smile_47 = new Image();
-	   smile_47.src = im_path + "templates/default/images/img/smiles/47.gif"
-	   var smile_48 = new Image();
-	   smile_48.src = im_path + "templates/default/images/img/smiles/48.gif"
-	   var smile_49 = new Image();
-	   smile_49.src = im_path + "templates/default/images/img/smiles/49.gif"
-	   var smile_50 = new Image();
-	   smile_50.src = im_path + "templates/default/images/img/smiles/50.gif"
-	   var smile_51 = new Image();
-	   smile_51.src = im_path + "templates/default/images/img/smiles/51.gif"
-	   var smile_52 = new Image();
-	   smile_52.src = im_path + "templates/default/images/img/smiles/52.gif"
-	   var smile_53 = new Image();
-	   smile_53.src = im_path + "templates/default/images/img/smiles/53.gif"
-	   var smile_54 = new Image();
-	   smile_54.src = im_path + "templates/default/images/img/smiles/54.gif"
Index: trunk/instant_messenger/js/im_functions.js
===================================================================
--- trunk/instant_messenger/js/im_functions.js	(revision 63)
+++ trunk/instant_messenger/js/im_functions.js	(revision 64)
@@ -9,10 +9,10 @@
 	   this.im_time_ 	= false;
 	}
-	
+
 	IM.prototype.load_im = function()
 	{
 		IM.listen();
 	    IM.requireContacts();
-	    
+
 	    var handler_Status = function(XmlData)
 	    {
@@ -27,10 +27,10 @@
 	    XMLTools.request('$this.Ujabber.MyPresence', 'GET', handler_Status);
 	};
-	
+
 	IM.prototype.listen = function()
 	{
 	   if ( !this._listen )
 	      return false;
-	
+
 	   var _this = this;
 	   var handler = function(data)
@@ -43,5 +43,5 @@
 						IM_Preferences.GetYourPreferences();
 				}
-				
+
 	            _this.getContacts(data);
 	            _this.getPresence(data);
@@ -49,5 +49,5 @@
 	            _this.getMessages(data);
 				_this.getVcard(data);
-				
+
             	if(!_this.vcards)
             	{
@@ -68,8 +68,8 @@
 	};
 
-   /*	
+   /*
 	*  Contacts
 	*/
-	
+
 	IM.prototype.requireContacts = function()
 	{
@@ -99,10 +99,10 @@
 	         var a = document.createElement('div');
 	         a.innerHTML = XMLTools.transform(node, xsl);
-	
+
 	         div.innerHTML = '';
 	         div.appendChild(img);
 	         div.appendChild(document.createTextNode(this.get_lang('List of Contacts')));
 	         div.appendChild(a);
-	
+
 			 var group = func.byId("all_groups").firstChild;
 			 while ( group )
@@ -123,7 +123,7 @@
 						img.id = "img_" + group.id;
 						var el_parent = group;
-						
+
 						el_parent.insertBefore(img,el_parent.firstChild);
-	
+
 					} catch(e){}
 					group = group.nextSibling;
@@ -136,8 +136,8 @@
 	      //alert('getContacts()' + e);
 	   }
-		
-	};
-
-   /*	
+
+	};
+
+   /*
 	*  Visible / Unvisible
 	*/
@@ -152,5 +152,5 @@
 		img.src = img_group_close.src;
 	}
-	
+
 	IM.prototype.unvisible_group = function(el)
 	{
@@ -162,9 +162,9 @@
 		img.src = img_group_open.src;
 	}
-	
+
 	/*
 	 * Presence
 	 */
-	
+
 	IM.prototype.getPresence = function(data)
 	{
@@ -187,6 +187,4 @@
 				else
 					var status_message = false;
-					
-
 
 				if( from )
@@ -203,15 +201,13 @@
 							}
 						break;
-			
 			         	case 'subscribed' :
 			         		//
 			         	break;
-			         	
-			         	case 'unsubscribe' : 
+			         	case 'unsubscribe' :
 			         		Subscription.unsubscribe(from);
 			         		type = 'unavailable';
 			         		func.byId(from).firstChild.src = eval('img_' + type + '.src');
 			         		break;
-			         	case 'unsubscribed' : 
+			         	case 'unsubscribed' :
 			         		Subscription.unsubscribed(from);
 			         		type = 'unavailable';
@@ -232,5 +228,4 @@
 						        	else
 						        		status.innerHTML = '';
-						        	
 						        }
 
@@ -244,5 +239,5 @@
 		     							if( status_message != "available" )
 				     						lbl.innerHTML = "<span style='margin-left:10px'><br/> ( " + status_message + " )</span>";
-									func.byId(from).appendChild(lbl);			     						
+									func.byId(from).appendChild(lbl);
 		     					}else{
 									var lbl = document.getElementById('status_message_' + from);
@@ -266,9 +261,9 @@
 	   }
 	};
-	
+
 	/*
 	 * Contatos - Offline
 	 */
-	
+
 	IM.prototype.Contacts_Offline = function()
 	{
@@ -296,9 +291,9 @@
          }
 	}
-	
+
 	/*
 	 * Get / Send - Messages
 	 */
-	
+
 	IM.prototype.getMessages = function(data)
 	{
@@ -325,5 +320,5 @@
 						    nickname = func.trim(nickname);
 				   }
-							
+
 	               var win = document.getElementById(from + '_chatMessages');
 	               if ( !win )
@@ -332,5 +327,5 @@
 	                  win = document.getElementById(from + '_chatMessages');
 	               }
-	
+
 	               var el = message.firstChild;
 	               while ( el )
@@ -338,10 +333,10 @@
 	                  var xsl = XMLTools.load(im_path + 'xsl/message.xsl?' + Date.parse(new Date));
 	                  var next = el.nextSibling;
-	
+
 	                  var label = document.createElement('strong');
 		              if(nickname)
 		                  label.appendChild(document.createTextNode(nickname));
 					  else
-		                  label.appendChild(document.createTextNode(from));		                  
+		                  label.appendChild(document.createTextNode(from));
 	                  win.appendChild(label);
 	                  win.appendChild(document.createElement('br'));
@@ -352,5 +347,5 @@
 	                  win.scrollTop = win.scrollHeight;
 			   		  im_win.newMessageNotification();
-			   		  	            	
+
 	                  el = next;
 	               }
@@ -370,5 +365,5 @@
 	   }
 	}
-	
+
 	IM.prototype.sendMessage = function (pJID)
 	{
@@ -391,5 +386,5 @@
 
 	      envio.innerHTML = '';
-	
+
 	      var message_element = document.getElementById(pJID + '_chatMessages');
 	      var nickname = "me ";
@@ -401,10 +396,10 @@
 			  nickname = nickname.substr(nickname.indexOf(':') + 1 , nickname.length);
 		  }
-			
+
 	      message_element.innerHTML += '<strong>' + nickname + ' ';
 	      message_element.innerHTML += ' ' + _this.get_lang('speak') + ':</strong><br/>';
 		  message_element.innerHTML += message_text + '<br/>';
 	      message_element.scrollTop = message_element.scrollHeight;
-		
+
 	      var handler_sendMessage = function(data)
 	      {
@@ -416,5 +411,5 @@
 	   }
 	};
-	
+
 	IM.prototype.getComposing = function(data)
 	{
@@ -429,5 +424,5 @@
 						if ( composing.style.display = 'none' )
 							composing.style.display = 'block';
-						
+
 				if ( node.nodeName == 'paused' )
 					if ( (composing = func.byId(node.getAttribute('from') + '_composing')) )
@@ -439,18 +434,18 @@
 		}
 	};
-	
+
 	/*
 	 * Get_lang
 	 */
-	
+
 	IM.prototype.get_lang = function(_key, _arg1, _arg2, _arg3, _arg4)
 	{
 	   var _value = "";
-	
+
 	   if ( !lang_im[_key.toLowerCase()] )
 	      return _key + "*";
-	
+
 	   _value = lang_im[_key.toLowerCase()];
-	
+
 	   if ( _arg1 || _arg2 ||_arg3 || _arg4 )
 	   {
@@ -462,8 +457,8 @@
 	         }
 	   }
-	
+
 	   return _value;
 	};
-	
+
 	IM.prototype.getWinContactsState = function()
 	{
@@ -474,8 +469,8 @@
 	          win_state = ( win_state ) ? win_state : ( windowItems['contacts'].state == WINDOW_STATE_MAXIMIZED ) ? true : false;
 	      return win_state;
-	      
+
 	   }catch(e){}
 	};
-	
+
 	IM.prototype.showContacts = function()
 	{
@@ -488,5 +483,5 @@
 	   }
 	};
-	
+
    /*
 	*  Smiles
@@ -503,5 +498,5 @@
        return pEmotion;
     }
-		
+
 	IM.prototype.atalho = function()
 	{
@@ -548,5 +543,5 @@
 	 * Vcard
 	 */
-	
+
 	IM.prototype.requireVcard = function()
 	{
@@ -561,10 +556,10 @@
    		XMLTools.request('$this.Ujabber.requireVcard','GET',handler_getVcard);
 	}
-	
+
 	IM.prototype.getVcard = function(data)
 	{
 		  var _this = this;
 		  try
-		  {	
+		  {
 			     if ( data.getElementsByTagName('vcard').length > 0  && !_this.statusvcard )
 			     {
@@ -572,5 +567,5 @@
 			         var xsl = XMLTools.load(im_path + 'xsl/vcard_contacts.xsl?' + Date.parse(new Date));
 			         _this.statusvcard = true;
-			         
+
 			         div.innerHTML = "";
 			         div.innerHTML += XMLTools.transform(data, xsl);
@@ -580,12 +575,12 @@
 		  }catch(e){}
 
-			
-	};
-	
+
+	};
+
 	IM.prototype.open_chat = function(pJID)
 	{
 	   im_win.open_chat(pJID);
 	};
-	
+
 	IM.prototype.action_button = function(pEv, pJid)
 	{
@@ -618,5 +613,5 @@
 		}
 	};
-	
+
 	IM.prototype.menu_button_right = function(pElement, pX, pY)
 	{
@@ -637,5 +632,5 @@
 	/*
 	 * Menu
-	 */	
+	 */
 
 	IM.prototype.menu_preferences = function()
@@ -644,5 +639,5 @@
 		  var posy = 0;
 		  var pEv = arguments[0];
-		  
+
 		  if (pEv.pageX || pEv.pageY)
 		  {
@@ -655,16 +650,16 @@
 			  posy = pEv.clientY + document.body.scrollTop + document.documentElement.scrollTop;
 		  }
-			
+
 		  var p_element = document.getElementById(arguments[1]);
-		  var _xmlDoc = "";	
+		  var _xmlDoc = "";
 		  var _this = this;
 
-		  _xmlDoc = '<menu>' +	
-						'<item function="IM_Preferences.Add_userLoad()" lang="'+IM.get_lang('Add Contact')+'"/>' +	
+		  _xmlDoc = '<menu>' +
+						'<item function="IM_Preferences.Add_userLoad()" lang="'+IM.get_lang('Add Contact')+'"/>' +
 						'<item function="IM_Preferences.Remove_userLoad()" lang="'+IM.get_lang('Remove Contact')+'"/>' +
 						'<item function="IM_Preferences.vCard()" lang="'+IM.get_lang('Information')+'"/>' +
 						'<item function="IM_Preferences.yourPreferences()" lang="'+IM.get_lang('preferences')+'"/>' +
 					'</menu>';
-		  
+
 	      im_menu_action.menu(p_element.id,parse_XmlXsl(_xmlDoc,'menu_preferences.xsl'));
 	      func.byId(p_element).style.top = posy;
@@ -674,5 +669,5 @@
 	      _this.Load_Images_menu();
 	}
-	
+
 	IM.prototype.Load_Images_menu = function(Element)
 	{
@@ -681,5 +676,5 @@
 			var group = document.getElementById("dl_im_menu_preferences");
 			var Child =  group.childNodes;
-			
+
 			for(var i = 0; i < Child.length; i++)
 			{
@@ -689,7 +684,6 @@
 			}
 		}catch (e){}
-		      
 	}
-	
+
    /*
  	*  Função Provisória - By AlC
@@ -698,8 +692,8 @@
 	function parse_XmlXsl(_xmlDoc, form_xsl)
 	{
-		  var xslWin = false;	  
-		
+		  var xslWin = false;
+
 		  if ( !xslWin ) xslWin = XMLTools.load(im_path + 'xsl/' + form_xsl + '?' + Date.parse(new Date));
-	
+
 		  a = document.createElement('div');
 		  if (window.ActiveXObject)
@@ -715,7 +709,7 @@
 		  }
 		  a.innerHTML = XMLTools.transform(xmlDoc, xslWin);
-	
+
 		  return a;
-	
+
 	}
 
@@ -724,5 +718,5 @@
 		 var _dt = func.newEl('dt', 'dt', 'dt', 'dt', 'dt');
 		 var _a  = func.newEl('a', 'a', 'a', 'a', 'a');
-		
+
 		 for ( var i in _dt )
 		 {
@@ -732,7 +726,7 @@
 		    eval('var option' + (parseInt(i)+1) + '_link = _a[' + i + '];');
 		 }
-		
+
 		 var _img = func.newEl('img', 'img', 'img', 'img','img');
-		
+
 		 for ( var i in _img )
 		 {
@@ -741,5 +735,5 @@
 		    eval('var option' + (parseInt(i)+1) + '_image = _img[' + i + '];');
 		 }
-		
+
 		 option1_link.onclick = function(){statusFlag = 'available'; IM.setStatus('available');};
 		 option2_link.onclick = function(){statusFlag = 'xa'; IM.setStatus('xa');};
@@ -747,5 +741,5 @@
 		 option4_link.onclick = function(){statusFlag = 'unavailable'; IM.setStatus('unavailable');};
 		 option5_link.onclick = function(){IM.setStatus('custom')};
-		
+
 		 func.confEl(option1_image, 'src', img_available.src);
 		 func.confEl(option1_image, 'style', 'width:16px;height:16px;cursor:pointer;');
@@ -758,5 +752,5 @@
 		 func.confEl(option5_image, 'src', img_edit.src);
 		 func.confEl(option5_image, 'style', 'width:16px;height:16px;cursor:pointer;');
-		
+
 		 func.insEl(option1_image, IM.get_lang('online'), option1_link);
 		 func.confEl(option1_link, 'style','cursor:pointer;');
@@ -778,5 +772,5 @@
 		 func.confEl(option5_link, 'style','cursor:pointer;');
 		 func.insEl(option5_link, option5);
-		
+
 		 im_menu_action.menu('fast_menu_im', option1, option2, option3, option4, option5);
    };
@@ -817,5 +811,5 @@
 	  catch(e){}
    };
-   
+
    IM.prototype.ImgStatus = function(pStatus)
    {
@@ -841,5 +835,5 @@
       }
    };
-   
+
    IM.prototype.infoContact = function(pUid)
    {
Index: trunk/instant_messenger/js/im_var_globals.js
===================================================================
--- trunk/instant_messenger/js/im_var_globals.js	(revision 55)
+++ trunk/instant_messenger/js/im_var_globals.js	(revision 64)
@@ -80,44 +80,2 @@
 	cod_emotions[11] = /\:\'\(/gi;
 	cod_emotions[12] = /\:\|/gi;
-	cod_emotions[13] = /\(6\)/gi;
-	cod_emotions[14] = /\(a\)/gi;
-	cod_emotions[15] = /\(l\)/gi;
-	cod_emotions[16] = /\(u\)/gi;
-	cod_emotions[17] = /\(m\)/gi;
-	cod_emotions[18] = /\(\@\)/gi;
-	cod_emotions[19] = /\(\&\)/gi;
-	cod_emotions[20] = /\(S\)/gi;
-	cod_emotions[21] = /\(\*\)/gi;
-	cod_emotions[22] = /\(\~\)/gi;
-	cod_emotions[23] = /\(8\)/gi;
-	cod_emotions[24] = /\(e\)/gi;
-	cod_emotions[25] = /\(f\)/gi;
-	cod_emotions[26] = /\(w\)/gi;
-	cod_emotions[27] = /\(o\)/gi;
-	cod_emotions[28] = /\(k\)/gi;
-	cod_emotions[29] = /\(g\)/gi;
-	cod_emotions[30] = /\(\^\)/gi;
-	cod_emotions[31] = /\(p\)/gi;
-	cod_emotions[32] = /\(i\)/gi;
-	cod_emotions[33] = /\(c\)/gi;
-	cod_emotions[34] = /\(t\)/gi;
-	cod_emotions[35] = /\(\{\)/gi;
-	cod_emotions[36] = /\(\}\)/gi;
-	cod_emotions[37] = /\(b\)/gi;
-	cod_emotions[38] = /\(d\)/gi;
-	cod_emotions[39] = /\(z\)/gi;
-	cod_emotions[40] = /\(x\)/gi;
-	cod_emotions[41] = /\(y\)/gi;
-	cod_emotions[42] = /\(n\)/gi;
-	cod_emotions[43] = /\:\[/gi;
-	cod_emotions[44] = /\(\?\)/gi;
-	cod_emotions[45] = /\(\%\)/gi;
-	cod_emotions[46] = /\(\#\)/gi;
-	cod_emotions[47] = /\(r\)/gi;
-	cod_emotions[48] = /\:\-\#/gi;
-	cod_emotions[49] = /8o\|/gi;
-	cod_emotions[50] = /8\-\|/gi;
-	cod_emotions[51] = /\^o\)/gi;
-	cod_emotions[52] = /\:\-\*/gi;
-	cod_emotions[53] = /\+o\(/gi;
-	cod_emotions[54] = /\(sn\)/gi;
Index: trunk/instant_messenger/js/im_smiles.js
===================================================================
--- trunk/instant_messenger/js/im_smiles.js	(revision 64)
+++ trunk/instant_messenger/js/im_smiles.js	(revision 64)
@@ -0,0 +1,27 @@
+// Instant Messenger
+// im_smiles.js
+
+	   var smile_1 = new Image();
+	   smile_1.src = im_path + "templates/default/images/img/smiles/1.gif"
+	   var smile_2 = new Image();
+	   smile_2.src = im_path + "templates/default/images/img/smiles/2.gif"
+	   var smile_3 = new Image();
+	   smile_3.src = im_path + "templates/default/images/img/smiles/3.gif"
+	   var smile_4 = new Image();
+	   smile_4.src = im_path + "templates/default/images/img/smiles/4.gif"
+	   var smile_5 = new Image();
+	   smile_5.src = im_path + "templates/default/images/img/smiles/5.gif"
+	   var smile_6 = new Image();
+	   smile_6.src = im_path + "templates/default/images/img/smiles/6.gif"
+	   var smile_7 = new Image();
+	   smile_7.src = im_path + "templates/default/images/img/smiles/7.gif"
+	   var smile_8 = new Image();
+	   smile_8.src = im_path + "templates/default/images/img/smiles/8.gif"
+	   var smile_9 = new Image();
+	   smile_9.src = im_path + "templates/default/images/img/smiles/9.gif"
+	   var smile_10 = new Image();
+	   smile_10.src = im_path + "templates/default/images/img/smiles/10.gif"
+	   var smile_11 = new Image();
+	   smile_11.src = im_path + "templates/default/images/img/smiles/11.gif"
+	   var smile_12 = new Image();
+	   smile_12.src = im_path + "templates/default/images/img/smiles/12.gif"
Index: trunk/instant_messenger/js/im_win.js
===================================================================
--- trunk/instant_messenger/js/im_win.js	(revision 63)
+++ trunk/instant_messenger/js/im_win.js	(revision 64)
@@ -50,5 +50,5 @@
 			font_size.innerHTML = Templates.font_size();
 			font_color.innerHTML = Templates.font_color();
-			font_style.innerHTML = Templates.font_style();
+			/*font_style.innerHTML = Templates.font_style();*/
 
 			var pId = 'contacts';
@@ -670,5 +670,5 @@
          text += '</dl>';
          text += '<div id="' + pId + '_divEdita" style="margin: 0px 2px"><iframe name="' + pId.replace('@', '_at_').replace(/\./g, '_dot_') + '_edita" class="edit_message" id="' + pId + '_edita" frameborder="0" style="margin: 3px 1px 0px 2px; width:220px; height:50px; float:left;"></iframe></div>';
-         text += '<br/><a onclick="javascript:IM.sendMessage(\'' + pId + '\')" title="Send a message" style="float:left;margin: 0px 2px;"><img src="' + im_path + 'templates/default/images/img/skins/deathdart/send.gif" width="50" height="25" border=0 style="margin-top:3px"></a>';
+         text += '<br/><a onclick="javascript:IM.sendMessage(\'' + pId + '\')" title="Send a message" style="float:left;margin: 0px 2px;"><img src="' + im_path + 'templates/default/images/send.gif" width="50" height="25" border=0 style="margin-top:3px"></a>';
          text += '<br style="clear:both" /><span id="' + pId + '_im_window_message" style="margin-left: 2px" />';
 
@@ -783,9 +783,9 @@
    "addEmotion" : function(emotion)
    {
-	 n_document = document.getElementById(this.chat_pJid + '_edita');
-	 var edita = n_document.contentWindow.document.getElementsByTagName('body').item(0);
-	 edita.innerHTML += IM.emotions_icons(emotion);
-
-     this.hideEmotionSelection();
+      var n_document = document.getElementById(this.chat_pJid + '_edita');
+      var edita = n_document.contentWindow.document.getElementsByTagName('body').item(0);
+      edita.innerHTML += IM.emotions_icons(emotion);
+
+      this.hideEmotionSelection();
    },
 
Index: trunk/instant_messenger/js/im_templates.js
===================================================================
--- trunk/instant_messenger/js/im_templates.js	(revision 59)
+++ trunk/instant_messenger/js/im_templates.js	(revision 64)
@@ -139,86 +139,40 @@
    Templates.prototype.emotions = function()
    {
+	  var smiles = new Array("\':)\'#smile_1.src","\':d\'#smile_2.src","\';)\'#smile_3.src","\':o\'#smile_4.src","\':p\'#smile_5.src","\'(h)\'#smile_6.src","\':@\'#smile_7.src","\':$\'#smile_8.src","\':s\'#smile_9.src","\':(\'#smile_10.src","\':\\\'\(\'#smile_11.src","\':|\'#smile_12.src");
 	  var grid = '';
 	      grid += '<table cellpadding="0" cellspacing="0" border="0">';
-	      grid += '    <tr>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':)\')" id="sendMessageMenuId"><img alt=":)" width="19" height="19" src="' + smile_1.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':d\')" id="sendMessageMenuId"><img alt=":d" width="19" height="19" src="' + smile_2.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\';)\')" id="sendMessageMenuId"><img alt=";)" width="19" height="19" src="' + smile_3.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':o\')" id="sendMessageMenuId"><img alt=":o" width="19" height="19" src="' + smile_4.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':p\')" id="sendMessageMenuId"><img alt=":p" width="19" height="19" src="' + smile_5.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(h)\')" id="sendMessageMenuId"><img alt="(h)" width="19" height="19" src="' + smile_6.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':@\')" id="sendMessageMenuId"><img alt=":@" width="19" height="19" src="' + smile_7.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':$\')" id="sendMessageMenuId"><img alt=":$" width="19" height="19" src="' + smile_8.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':s\')" id="sendMessageMenuId"><img alt=":s" width="19" height="19" src="' + smile_9.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':(\')" id="sendMessageMenuId"><img alt=":(" width="19" height="19" src="' + smile_10.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':\\\'\(\')" id="sendMessageMenuId"><img alt=":\'(" width="19" height="19" src="' + smile_11.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':|\')" id="sendMessageMenuId"><img alt=":|" width="19" height="19" src="' + smile_12.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(6)\')" id="sendMessageMenuId"><img alt="(6)" width="19" height="19" src="' + smile_13.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(a)\')" id="sendMessageMenuId"><img alt="(a)" width="19" height="19" src="' + smile_14.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(l)\')" id="sendMessageMenuId"><img alt="(l)" width="19" height="19" src="' + smile_15.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(u)\')" id="sendMessageMenuId"><img alt="(u)" width="19" height="19" src="' + smile_16.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(m)\')" id="sendMessageMenuId"><img alt="(m)" width="19" height="19" src="' + smile_17.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(@)\')" id="sendMessageMenuId"><img alt="(@)" width="19" height="19" src="' + smile_18.src + '" /></div></td>';
-	      grid += '    </tr>';
-	      grid += '    <tr>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(&)\')" id="sendMessageMenuId"><img alt="(&)" width="19" height="19" src="' + smile_19.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(S)\')" id="sendMessageMenuId"><img alt="(S)" width="19" height="19" src="' + smile_20.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(*)\')" id="sendMessageMenuId"><img alt="(*)" width="19" height="19" src="' + smile_21.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(~)\')" id="sendMessageMenuId"><img alt="(~)" width="19" height="19" src="' + smile_22.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(8)\')" id="sendMessageMenuId"><img alt="(8)" width="19" height="19" src="' + smile_23.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(e)\')" id="sendMessageMenuId"><img alt="(e)" width="19" height="19" src="' + smile_24.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(f)\')" id="sendMessageMenuId"><img alt="(f)" width="19" height="19" src="' + smile_25.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(w)\')" id="sendMessageMenuId"><img alt="(w)" width="19" height="19" src="' + smile_26.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(o)\')" id="sendMessageMenuId"><img alt="(o)" width="19" height="19" src="' + smile_27.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(k)\')" id="sendMessageMenuId"><img alt="(k)" width="19" height="19" src="' + smile_28.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(g)\')" id="sendMessageMenuId"><img alt="(g)" width="19" height="19" src="' + smile_29.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(^)\')" id="sendMessageMenuId"><img alt="(^)" width="19" height="19" src="' + smile_30.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(p)\')" id="sendMessageMenuId"><img alt="(p)" width="19" height="19" src="' + smile_31.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(i)\')" id="sendMessageMenuId"><img alt="(i)" width="19" height="19" src="' + smile_32.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(c)\')" id="sendMessageMenuId"><img alt="(c)" width="19" height="19" src="' + smile_33.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(t)\')" id="sendMessageMenuId"><img alt="(t)" width="19" height="19" src="' + smile_34.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'({)\')" id="sendMessageMenuId"><img alt="({)" width="19" height="19" src="' + smile_35.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(})\')" id="sendMessageMenuId"><img alt="(})" width="19" height="19" src="' + smile_36.src + '" /></div></td>';
-	      grid += '    </tr>';
-	      grid += '    <tr>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(b)\')" id="sendMessageMenuId"><img alt="(b)" width="19" height="19" src="' + smile_37.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(d)\')" id="sendMessageMenuId"><img alt="(d)" width="19" height="19" src="' + smile_38.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(z)\')" id="sendMessageMenuId"><img alt="(z)" width="19" height="19" src="' + smile_39.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(x)\')" id="sendMessageMenuId"><img alt="(x)" width="19" height="19" src="' + smile_40.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(y)\')" id="sendMessageMenuId"><img alt="(y)" width="19" height="19" src="' + smile_41.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(n)\')" id="sendMessageMenuId"><img alt="(n)" width="19" height="19" src="' + smile_42.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':[\')" id="sendMessageMenuId"><img alt=":["  width="19" height="19" src="' + smile_43.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(?)\')" id="sendMessageMenuId"><img alt="(?)" width="19" height="19" src="' + smile_44.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(%)\')" id="sendMessageMenuId"><img alt="(%)" width="19" height="19" src="' + smile_45.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(#)\')" id="sendMessageMenuId"><img alt="(#)" width="19" height="19" src="' + smile_46.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(r)\')" id="sendMessageMenuId"><img alt="(r)" width="19" height="19" src="' + smile_47.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':-#\')" id="sendMessageMenuId"><img alt=":-#" width="19" height="19" src="' + smile_48.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'8o|\')" id="sendMessageMenuId"><img alt="8o|" width="19" height="19" src="' + smile_49.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'8-|\')" id="sendMessageMenuId"><img alt="8-|" width="19" height="19" src="' + smile_50.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'^o)\')" id="sendMessageMenuId"><img alt="^o)" width="19" height="19" src="' + smile_51.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\':-*\')" id="sendMessageMenuId"><img alt=":-*" width="19" height="19" src="' + smile_52.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'+o(\')" id="sendMessageMenuId"><img alt="+o(" width="19" height="19" src="' + smile_53.src + '" /></div></td>';
-	      grid += '      <td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion(\'(sn)\')" id="sendMessageMenuId"><img alt="(sn)" width="19" height="19" src="' + smile_54.src + '" /></div></td>';
-	      grid += '    </tr>';
-	      grid += '    <tr>';
-	      grid += '      <td colspan="18"><hr style="background:#cccccc;margin:1px:size:1px;"/></td>';
-	      grid += '    </tr>';
-	      grid += '    <tr>';
-	      grid += '    </tr>';
-	      grid += '    	 <td colspan="18"><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideEmotionSelection()" id="closeEmotionSelectionDiv">Close This Menu</div></td>';
-	      grid += '   </tr>';
+	      grid += '<tr>';
+	   	  for(var i = 0 ; i < 4; i++)	
+		      grid += '<td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion('+smiles[i].substr(0,smiles[i].indexOf('#'))+')" id="sendMessageMenuId"><img width="19" height="19" src="'+eval(smiles[i].substr(smiles[i].indexOf('#') + 1))+'" /></div></td>';
+		  grid += '</tr>';	
+	      grid += '<tr>';
+	   	  for(var i = 4 ; i < 8; i++)	
+		      grid += '<td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion('+smiles[i].substr(0,smiles[i].indexOf('#'))+')" id="sendMessageMenuId"><img width="19" height="19" src="'+eval(smiles[i].substr(smiles[i].indexOf('#') + 1))+'" /></div></td>';
+		  grid += '</tr>';	
+	      grid += '<tr>';
+	   	  for(var i = 8 ; i < 12; i++)	
+		      grid += '<td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion('+smiles[i].substr(0,smiles[i].indexOf('#'))+')" id="sendMessageMenuId"><img width="19" height="19" src="'+eval(smiles[i].substr(smiles[i].indexOf('#') + 1))+'" /></div></td>';
+		  grid += '</tr>';	
+	      grid += '<tr>';
+	      grid += '<td colspan="18"><hr style="background:#cccccc;margin:1px:size:1px;"/></td>';
+	      grid += '</tr>';
+	      grid += '<tr>';
+	      grid += '<td colspan="18"><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideEmotionSelection()" id="closeEmotionSelectionDiv">Close This Menu</div></td>';
+	      grid += '</tr>';
 	      grid += '</table>';
-	
-	      return grid;
+      return grid;
    }
 
    Templates.prototype.font_name = function()
    {
+	  var fonts_n = new Array("Arial:Arial","Courier:Courier","Times:Times New Roman");
 	  var grid = '';
-    	  grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFont(\'Arial\')" id="fontStyle1" style="width:120px;font-family:arial">Arial</div>';
-      	  grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFont(\'Courier\')" id="fontStyle1" style="width:120px;font-family:Courier">Courier</div>';
-      	  grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFont(\'Times\')" id="fontStyle1" style="width:120px;font-family:Times New Roman">Times New Roman</div>';
-          grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>';
-    	  grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontNameSelection()" id="fontStyle1" style="width:120px">Close This Menu</div>';
+
+	  for(var i in fonts_n )
+    	  grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFont(\'' + fonts_n[i].substr(0,fonts_n[i].indexOf(':') + 1 )+'\')" id="fontStyle1" style="width:120px;font-family:'+fonts_n[i].substr(fonts_n[i].indexOf(':') + 1 )+'">' + fonts_n[i].substr(fonts_n[i].indexOf(':') + 1 ) + '</div>';	  
+
+      grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>';
+  	  grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontNameSelection()" id="fontStyle1" style="width:120px">Close This Menu</div>';
+
       return grid;
    }
@@ -226,14 +180,13 @@
    Templates.prototype.font_size = function()
    {
+      var fonts_s = new Array("9pt:9","10pt:10","11pt:11","12pt:12","14pt:14","16pt:16","18pt:18");
       var grid = '';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'9pt\');" id="fontStyle1" style="width:100px">9</div>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'10pt\');" id="fontStyle1" style="width:100px">10</div>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'11pt\');" id="fontStyle1" style="width:100px">11</div>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'12pt\');" id="fontStyle1" style="width:100px">12</div>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'14pt\');" id="fontStyle1" style="width:1!00px">14</div>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'16pt\');" id="fontStyle1" style="width:100px">16</div>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'18pt\');" id="fontStyle1" style="width:100px">18</div>';
-          grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontSizeSelection()" id="fontStyle1" style="width:100px">Close This Menu</div>';
+
+	  for(var i in fonts_s)
+	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'' + fonts_s[i].substr(0,fonts_s[i].indexOf(':')) + '\');" id="fontStyle1" style="width:100px">' + fonts_s[i].substr(fonts_s[i].indexOf(':') + 1 ) + '</div>';
+
+      grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>';
+      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontSizeSelection()" id="fontStyle1" style="width:100px">Close This Menu</div>';
+
       return grid;
    }
@@ -241,15 +194,13 @@
    Templates.prototype.font_color = function()
    {
-     var  grid = '';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#000000\')" id="fontStyle1" style="width:100px">Black</div>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#c0c0c0\')" id="fontStyle1" style="width:100px">Silver</div>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#ffff00\')" id="fontStyle1" style="width:100px">Yellow</div>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#ff0000\')" id="fontStyle1" style="width:100px">Red</div>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#ff00ff\')" id="fontStyle1" style="width:100px">Pink</div>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#00ff00\')" id="fontStyle1" style="width:100px">Green</div>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#1111ff\')" id="fontStyle1" style="width:100px">Blue</div>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'#800080\')" id="fontStyle1" style="width:100px">Magenta</div>';
-          grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>';
-	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontColorSelection()" id="fontStyle1" style="width:100px">Close This Menu</div>';
+      var fonts_c = new Array("#000000:Black","#c0c0c0:Silver","#ffff00:Yellow","#ff0000:Red","#ff00ff:Pink","#00ff00:Green","#1111ff:Blue","#800080:Magenta");
+	  var grid = '';		 
+	  
+	  for(var i in fonts_c)	
+	      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'' + fonts_c[i].substr(0,fonts_c[i].indexOf(':')) + '\')" id="fontStyle1" style="width:100px">' + fonts_c[i].substr(fonts_c[i].indexOf(':') + 1 )  + '</div>';
+
+      grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>';
+      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontColorSelection()" id="fontStyle1" style="width:100px">Close This Menu</div>';
+	  	      
       return grid;
    }
@@ -257,12 +208,13 @@
    Templates.prototype.font_style = function()
    {
+     var fonts = new Array("normal:Regular","italic:Italic","bold:Bold");
      var grid = '';
-      	 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontStyle(\'normal\')" id="fontStyle1" style="width:100px">Regular</div>';
-      	 grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontStyle(\'italic\')" id="fontStyle1" style="width:100px"><i>Italic</i></div>';
-         grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontStyle(\'bold\')" id="fontStyle1" style="width:100px"><b>Bold</b></div>';
-         grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>';
-         grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontStyleSelection()" id="fontStyle1" style="width:100px">Close This Menu</div>';
-
-      return grid;
+     
+     for(var i in fonts)
+     	grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontStyle(\'' + fonts[i].substr(0,fonts.indexOf(':')) + '\')" id="fontStyle1" style="width:100px">' + fonts[i].substr( fonts[i].indexOf(':') + 1 ) + '</div>';
+     grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>';
+     grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontStyleSelection()" id="fontStyle1" style="width:100px">Close This Menu</div>';
+	 
+     return grid;
    }
 
@@ -313,7 +265,6 @@
 			this.transfer = 0;
 			this.time_set = "";
-			// Envia a Mensagem para a baixa do arquivo;
+
 			var h_name_file = function(data){
-				//var pJID = "alexandrecorreia@im.pr.gov.br";
 				var pJID = pJid;
 				var message_conf = '<iframe name="IM_down_file" style="display:none"></iframe>'+
Index: trunk/instant_messenger/js/json.js
===================================================================
--- trunk/instant_messenger/js/json.js	(revision 20)
+++ 	(revision )
@@ -1,135 +1,0 @@
-JSONTools = {
-	"toStr" : function(pType)
-	{
-		switch ( pType.constructor )
-		{
-			case Object  : return this.object(pType);  break;
-			case Array   : return this.array(pType);   break;
-			case String  : return this.string(pType);  break;
-			case Number  : return this.number(pType);  break;
-			case Boolean : return this.boolean(pType); break;
-			case Date    : return this.date(pType);    break;
-		}
-	},
-	"object" : function(pType)
-	{
-	    var a = ['{'],
-            b,
-            k,
-            v,
-            _this = this;
-        function p(s)
-        {
-            if ( b )
-                a.push(',');
-            a.push(_this.toStr(k), ':', s);
-            b = true;
-        }
-        for ( k in pType )
-        {
-            if ( pType.hasOwnProperty(k) )
-            {
-                v = pType[k];
-                switch ( typeof v )
-                {
-                case 'object':
-                    if (v)
-                    	p(this.toStr(v));
-                    else
-                        p("null");	
-                    break;
-
-            case 'string':
-            case 'number':
-            case 'boolean':
-                    p(this.toStr(v));
-                }
-            }
-        }
-        a.push('}');
-        return a.join('');
-	},
-	"array" : function(pType)
-	{
-        var a = ['['],
-            b,
-            i,
-            l = pType.length,
-            v;
-        function p(s)
-        {
-            if ( b )
-                a.push(',');
-            a.push(s);
-            b = true;
-        }
-        for ( i = 0; i < l; i += 1 )
-        {
-            v = pType[i];
-            switch ( typeof v )
-            {
-            case 'object':
-                if ( v )
-                {
-                        p(this.toStr(v));
-                } else {
-                    p("null");
-                }
-                break;
-            case 'string':
-            case 'number':
-            case 'boolean':
-                p(this.toStr(v));
-            }
-        }
-        a.push(']');
-        return a.join('');
-	},
-    "string" : function(pType)
-    {
-        var m = {
-            '\b': '\\b',
-            '\t': '\\t',
-            '\n': '\\n',
-            '\f': '\\f',
-            '\r': '\\r',
-            '"' : '\\"',
-            '\\': '\\\\'
-        };
-            if ( /[\\\x00-\x1f]/.test(pType) )
-            {
-                return '"' + pType.replace(/([\x00-\x1f\\])/g, function(a, b)
-                {
-                    var c = m[b];
-                    if (c) {
-                        return c;
-                    }
-                    c = b.charCodeAt();
-                    return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
-                }) + '"';
-            }
-            return '"' + pType + '"';
-	},
-    "boolean" : function(pType)
-    {
-        return String(pType);
-    },
-    "date" : function(pType)
-    {
-        function f(n)
-        {
-            return n < 10 ? '0' + n : n;
-        }
-
-        return '"' + pType.getFullYear() + '-' +
-                f(pType.getMonth() + 1) + '-' +
-                f(pType.getDate()) + 'T' +
-                f(pType.getHours()) + ':' +
-                f(pType.getMinutes()) + ':' +
-                f(pType.getSeconds()) + '"';
-    },
-    "number" : function(pType)
-    {
-        return isFinite(pType) ? String(pType) : "null";
-    }
-}
