Index: sandbox/filemanager/inc/class.uifilemanager.inc.php
===================================================================
--- sandbox/filemanager/inc/class.uifilemanager.inc.php	(revision 1841)
+++ sandbox/filemanager/inc/class.uifilemanager.inc.php	(revision 1846)
@@ -347,4 +347,5 @@
 			echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/draw_api.js'></script>";
 			echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/drag_area.js'></script>";
+			echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/handler.js'></script>";
 			include('load_lang.php');
 
Index: sandbox/filemanager/js/draw_api.js
===================================================================
--- sandbox/filemanager/js/draw_api.js	(revision 1841)
+++ sandbox/filemanager/js/draw_api.js	(revision 1846)
@@ -417,5 +417,5 @@
 					inputName.value = filename;
 					inputName.onclick = function () { oldValue = inputName.value; }
-					inputName.onblur = function () { if (inputName.value == oldValue) handlerRename(); else cExecute('./index.php?menuaction=filemanager.vfs_functions.rename&file='+base64_encode(this.id.substr(6))+'&to='+base64_encode(this.value)+"&path="+base64_encode(currentPath),handlerRename) };
+					inputName.onblur = function () { if (inputName.value == oldValue) handler.rename(); else cExecute('./index.php?menuaction=filemanager.vfs_functions.rename&file='+base64_encode(this.id.substr(6))+'&to='+base64_encode(this.value)+"&path="+base64_encode(currentPath),handler.rename) };
 					inputName.onkeydown=function (event) {if (event.keyCode == KEY_ENTER) this.blur(); };
 					nameLink.parentNode.appendChild(inputName);
@@ -462,5 +462,5 @@
 
 			cExecute('./index.php?menuaction=filemanager.vfs_functions.delete&path='+
-					base64_encode(currentPath)+filesUrl,handlerDelete);
+					base64_encode(currentPath)+filesUrl,handler.del);
 			break;
 		case 'move_to':
Index: sandbox/filemanager/js/handler.js
===================================================================
--- sandbox/filemanager/js/handler.js	(revision 1846)
+++ sandbox/filemanager/js/handler.js	(revision 1846)
@@ -0,0 +1,88 @@
+function handler(){
+}
+handler.prototype.del = function(data){
+        var returnVal = data.split(':');
+        var deletedFiles = "";
+        for (i=0; i < returnVal.length; i++)
+                if (returnVal[i] == 'False'){
+                        write_error(get_lang('Could not delete %1',returnVal[i+1]));
+                        return;
+                }else
+                {
+                        if (returnVal[i] != ""){
+                                deletedFiles += ", "+returnVal[i];
+                                var element = document.getElementById("name_"+returnVal[i]);
+                                var pai = element.parentNode.parentNode;
+                                pai.parentNode.removeChild(pai);
+                        }
+                }
+                write_msg(get_lang('Deleted %1',deletedFiles.substr(2)));
+        //Repaint stripes 
+        folderList.drawStripes();
+}
+handler.prototype.rename = function(data) {
+        if (data == null){
+                var returnVal = new Array ("True",oldValue,oldValue);
+        }
+        else
+                var returnVal = data.split(':');
+        if ( returnVal[0] == "True" ){
+                if (returnVal[1] != returnVal[2]) write_msg(get_lang('Renamed %1 to %2',returnVal[1],returnVal[2]));
+                var nameLink = document.createElement('A');
+                var inputName = document.getElementById('input_'+returnVal[1]);
+                nameLink.innerHTML = returnVal[2];
+                nameLink.href="./index.php?menuaction=filemanager.uifilemanager.view&file="+base64_encode(returnVal[2])+"&path="+base64_encode(currentPath);
+                nameLink.target = "_blank";
+                nameLink.id = "name_"+returnVal[2];
+
+                /*Value da checkbox correspondente ao arquivo Ã© atualizada*/
+                inputName.parentNode.parentNode.firstChild.firstChild.value = returnVal[2];
+
+                inputName.parentNode.appendChild(nameLink);
+                inputName.parentNode.removeChild(inputName);
+        }
+        else
+        {
+                if (returnVal[1] == "badchar")
+                        write_error(get_lang('File names cannot contain "%1"',returnVal[2]));
+                else
+                        if (returnVal[1] == "slashes")
+                                write_error(get_lang('File names cannot contain \\ or /'));
+                        if (returnVal[1] == "editing")
+                                write_error(get_lang('This file is being edited right now'));
+                        else
+                                write_error(get_lang('Could not rename %1 to %2', returnVal[1], returnVal[2]));
+        }
+
+}
+handler.prototype.upload = function(data){
+        close_window();
+        connector.hideProgressBar();
+        var response = unserialize(data);
+        if (response[0] == "Ok")
+                write_msg(get_lang('All files created sucessfuly'));
+        else
+                for (var i=0;i < response.length; i++)
+                        write_error(response[i]);
+        toolbar.control('reload');
+}
+handler.prototype.restricted = function(data){
+        if (data.indexOf("True") == 0){
+                returnVal = data.split(':');
+                var img_lock = document.getElementById('restrict_'+returnVal[1]);
+                if (img_lock.src.indexOf('button_unlock') > 0)
+                {
+                        img_lock.src = img_lock.src.replace(/button_unlock/g,'button_lock');
+                        write_msg(get_lang('%1 marked as restricted',returnVal[1]));
+                }
+                else
+                {
+                        img_lock.src = img_lock.src.replace(/button_lock/g,'button_unlock');
+                        write_msg(get_lang('%1 unmarked as restricted',returnVal[1]));
+                }
+        }
+        else
+                write_error("Could not mark as restricted");
+}
+
+var handler = new handler();
Index: sandbox/filemanager/js/common_functions.js
===================================================================
--- sandbox/filemanager/js/common_functions.js	(revision 1841)
+++ sandbox/filemanager/js/common_functions.js	(revision 1846)
@@ -139,24 +139,5 @@
 	var continue_set = confirm(get_lang('This property will change the visibility of all users that have access to this file, continue?'));
 	if (continue_set)
-		cExecute('./index.php?menuaction=filemanager.vfs_functions.setRestricted&file='+base64_encode(name)+'&path='+base64_encode(currentPath),setRestricted_handler);
-}
-
-function setRestricted_handler(data){
-	if (data.indexOf("True") == 0){
-		returnVal = data.split(':');
-		var img_lock = document.getElementById('restrict_'+returnVal[1]);
-		if (img_lock.src.indexOf('button_unlock') > 0)
-		{
-			img_lock.src = img_lock.src.replace(/button_unlock/g,'button_lock');
-			write_msg(get_lang('%1 marked as restricted',returnVal[1]));
-		}
-		else
-		{
-			img_lock.src = img_lock.src.replace(/button_lock/g,'button_unlock');
-			write_msg(get_lang('%1 unmarked as restricted',returnVal[1]));
-		}
-	}
-	else
-		write_error("Could not mark as restricted");
+		cExecute('./index.php?menuaction=filemanager.vfs_functions.setRestricted&file='+base64_encode(name)+'&path='+base64_encode(currentPath),handler.restricted);
 }
 
@@ -194,62 +175,4 @@
 
 }
-
-function handlerDelete(data){
-	var returnVal = data.split(':');
-	var deletedFiles = "";
-	for (i=0; i < returnVal.length; i++)
-		if (returnVal[i] == 'False'){
-			write_error(get_lang('Could not delete %1',returnVal[i+1]));
-			return;
-		}else
-		{
-			if (returnVal[i] != ""){
-				deletedFiles += ", "+returnVal[i];
-				var element = document.getElementById("name_"+returnVal[i]);
-				var pai = element.parentNode.parentNode;
-				pai.parentNode.removeChild(pai);
-			}
-		}
-		write_msg(get_lang('Deleted %1',deletedFiles.substr(2)));
-	//Repaint stripes 
-	folderList.drawStripes();
-}
-
-function handlerRename(data) {
-	if (data == null){
-		var returnVal = new Array ("True",oldValue,oldValue);
-	}
-	else
-		var returnVal = data.split(':');
-	if ( returnVal[0] == "True" ){
-		if (returnVal[1] != returnVal[2]) write_msg(get_lang('Renamed %1 to %2',returnVal[1],returnVal[2]));
-		var nameLink = document.createElement('A');
-		var inputName = document.getElementById('input_'+returnVal[1]);
-		nameLink.innerHTML = returnVal[2];
-		nameLink.href="./index.php?menuaction=filemanager.uifilemanager.view&file="+base64_encode(returnVal[2])+"&path="+base64_encode(currentPath);
-		nameLink.target = "_blank";
-		nameLink.id = "name_"+returnVal[2];
-
-		/*Value da checkbox correspondente ao arquivo Ã© atualizada*/
-		inputName.parentNode.parentNode.firstChild.firstChild.value = returnVal[2];
-
-		inputName.parentNode.appendChild(nameLink);
-		inputName.parentNode.removeChild(inputName);
-	}
-	else
-	{
-		if (returnVal[1] == "badchar")
-			write_error(get_lang('File names cannot contain "%1"',returnVal[2]));
-		else
-			if (returnVal[1] == "slashes")
-				write_error(get_lang('File names cannot contain \\ or /'));
-			if (returnVal[1] == "editing")
-                                write_error(get_lang('This file is being edited right now'));
-			else
-				write_error(get_lang('Could not rename %1 to %2', returnVal[1], returnVal[2]));
-	}
-
-}
-
 function EditColumns(param){
 	if (param == 'close')
@@ -350,19 +273,7 @@
 
 function sendFiles(){
-		cExecuteForm(document.getElementById('form_up'),handler_upload);
+		cExecuteForm(document.getElementById('form_up'),handler.upload);
 		document.getElementById('button_up').style.visibility = "hidden";
 		var line = document.getElementById('uploadOption');
 		line.parentNode.innerHTML = "<img src='"+templatePath+"images/progress.gif'>";
 }
-
-function handler_upload(data){
-	close_window();
-	connector.hideProgressBar();
-	var response = unserialize(data);
-	if (response[0] == "Ok")
-		write_msg(get_lang('All files created sucessfuly'));
-	else
-		for (var i=0;i < response.length; i++)
-			write_error(response[i]);
-	toolbar.control('reload');
-}
