Index: branches/2.2/filemanager/js/draw_api.js
===================================================================
--- branches/2.2/filemanager/js/draw_api.js	(revision 3578)
+++ branches/2.2/filemanager/js/draw_api.js	(revision 3585)
@@ -2,5 +2,5 @@
 var offset;
 var showHidden 	= null;
-var Xtools		= null;
+var Xtools		= null; 
 var zIndex		= 1000;
 
@@ -19,5 +19,12 @@
 }
 
-function loadPermissions(data){
+function loadXtools()
+{
+	if( Xtools == null )
+		Xtools = new xtools( path_filemanager + "tp/expressowindow/" );
+}
+
+function loadPermissions(data)
+{
 	var permission = parseInt(data);
 	var ACL_READ = 1;
@@ -34,6 +41,8 @@
 	toolbar.load();
 }
-function close_window(){
-	_winBuild('dwindow'+(zIndex-1), 'hidden')
+
+function close_window()
+{
+	_winBuild( 'dwindow' + (zIndex-1) , "remove" );
 }
 
@@ -562,6 +571,5 @@
 				var action = ( ( arg == 'move_to') ? get_lang('move to:') : get_lang('copy to:') );
 				
-				if( Xtools == null )
-					Xtools = new xtools( path_filemanager + "tp/expressowindow/" );
+				loadXtools();
 				
 				var _xml 	= Xtools.xml('files');
@@ -662,14 +670,30 @@
 
 }
-function editFolders(operation)
-{
-	if (operation == 'new')
+function editFolders( operation )
+{
+	if( operation == 'new' || operation == 'remove')
+	{
+		var _selectFolders	= document.getElementById('folders_box');
+		var Dfolder		= "";
+		var parentDir	= "";
+		
+		for( var i = 0 ; i < _selectFolders.options.length; i++ )
+		{
+			if( _selectFolders.options[i].selected )
+			{
+				Dfolder 	= _selectFolders.options[i].value;
+				parentDir	= _selectFolders.options[i].value;
+			}
+		}
+	}
+	
+	if ( operation == 'new' )
 	{
 		var name = prompt(get_lang('Enter with the name of new file/directory'), '');
-		if (name != null && name != '')
+		
+		if ( name != null && name != '' )
 		{
-			var parentDir = document.getElementById('folders_box').value;
 			cExecute_('./index.php?menuaction=filemanager.uifilemanager.createdir&path='+base64_encode(parentDir)+'&filename='+base64_encode(name),handler.refreshDir);
-			currentPath = parentDir+'/'+name;
+			currentPath = ( parentDir != "" ) ? parentDir + '/' + name : my_home_filemanager + '/' + name;
 			close_window();
 		}
@@ -677,33 +701,53 @@
 	else
 	{
-		if (operation == 'remove')
+		if ( operation == 'remove' )
 		{
-			var Dfolder = document.getElementById('folders_box').value;
-			
-			if (confirm(get_lang('Do you really want to remove folder: %1?',Dfolder.replace(my_home_filemanager, get_lang("My folder"))), ''))
-			{
-				cExecute_('./index.php?menuaction=filemanager.uifilemanager.removedir&path='+base64_encode(crypt.encode(Dfolder)),handler.refreshDir);
-				var lastIndex = Dfolder.lastIndexOf('/');
-				currentPath = Dfolder.substr(0,lastIndex);
-				close_window();
-			}
+			if( Dfolder != "" )
+			{	
+				if ( confirm(get_lang('Do you really want to remove folder: %1?',
+						Dfolder.replace(my_home_filemanager, get_lang("My folder"))), '') )
+				{
+					//var Dfolder_en = base64_encode( crypt.encode(Dfolder) );
+					var Dfolder_en = base64_encode( Dfolder );
+					
+					cExecute_('./index.php?menuaction=filemanager.uifilemanager.removedir&path=' + Dfolder_en,handler.refreshDir );
+					var lastIndex = Dfolder.lastIndexOf('/');
+					currentPath = Dfolder.substr(0,lastIndex);
+					close_window();
+				}
+			}
+			else
+				alert("É necessário escolher uma pasta !");
 		}
 		else
 		{
-			var buf = "<select id='folders_box'>";
-			
-			for (var i=0; i < folders.length; i++)
+			loadXtools();
+			
+			var _xml 		= Xtools.xml("root");
+			var _doc		= _xml.documentElement;
+			var _folders	= _xml.createElement("folders") 
+			
+			for( var i = 0; i < folders.length; i++ )
 			{
-				buf += "<option value='"+folders[i]+"'>"+folders[i].replace(my_home_filemanager, get_lang("My folder") );
-				buf += "</option>";
-			}
-			buf += "</select>";
-			
-			code =  "<table><tbody><tr><td colspan='2'>"+buf+"</td></tr>" +
-					"<tr><td><input type='button' onclick='editFolders(\"new\")' value='"+get_lang('new folder')+"'></td>" +
-					"<td><input type='button' onclick='editFolders(\"remove\")' value='"+get_lang('remove folder')+"'></td>" +
-					"</tr></tbody></table>";
-			
-			draw_window( code, 350, 210 );
+				var fd = _xml.createElement('name');
+					fd.setAttribute('value', folders[i]);
+					fd.appendChild( _xml.createTextNode(folders[i].replace(my_home_filemanager, get_lang("My folder"))) );
+					_folders.appendChild(fd);
+			}
+			
+			_doc.appendChild( _folders );
+			
+			var pArgs =
+			{
+				'lang_new_folder'		: get_lang('new folder'),
+				'lang_remove_folder'	: get_lang('remove folder'),
+				'path_filemanager'		: path_filemanager,
+				'onclick_new_folder'		: 'editFolders("new")',
+				'onclick_remove_folder'		: 'editFolders("remove")'
+			};
+			
+			var code = Xtools.parse( _doc, "edit_folders.xsl", pArgs );
+			
+			draw_window( code, 310, 230 );
 		}
 	}
Index: branches/2.2/filemanager/js/handler.js
===================================================================
--- branches/2.2/filemanager/js/handler.js	(revision 3541)
+++ branches/2.2/filemanager/js/handler.js	(revision 3585)
@@ -123,11 +123,17 @@
 
 }
-handler.prototype.draw_folders_list = function (data) {
+
+handler.prototype.draw_folders_list = function (data)
+{
+	
 	toolbar.control('reload');
 	folders_tree = new dFTree({name: 'main'});
+	
 	folders = unserialize(data);
+	
 	var rootFold = new dNode({id:'root', caption:get_lang("filemanager")});
 	folders_tree.add(rootFold,'root');
-	for (var i=0;i<folders.length;i++)
+	
+	for ( var i = 0 ; i < folders.length; i++ )
 	{
 		var lastIndex = folders[i].lastIndexOf('/');
@@ -137,7 +143,10 @@
 			var name = get_lang("My Folder");
 		var parentDir = folders[i].substr(0,lastIndex);
+	
 		if (parentDir == '/home')
 			parentDir = 'root';
-		var search_child = function(afolders,name){
+		
+		var search_child = function(afolders,name)
+		{
 			for (j=0; j < afolders.length; j++)
 				if (afolders[j].indexOf(name+'/') == 0)
@@ -145,15 +154,22 @@
 			return false;
 		}
+		
 		folder = new dNode({id:folders[i], caption:name, plusSign:search_child(folders,folders[i]), onClick:'load(\''+folders[i]+'\',this)'});
+		
 		if (i == 0)
 			folders_tree.add(folder,'root');
 		else
-		        folders_tree.add(folder,parentDir);
-	}
+			folders_tree.add(folder,parentDir);
+	}
+	
 	document.getElementById('content_folders').innerHTML = "";
+	
 	folders_tree.draw(document.getElementById('content_folders'));
-        folders_tree.openTo(currentPath);
+    
+	folders_tree.openTo(currentPath);
+	
 	folders_tree.getNodeById(currentPath)._select();
 }
+
 handler.prototype.copyto = function (data) {
 	returnVal = data.split('|');
