Index: sandbox/filemanager/js/common_functions.js
===================================================================
--- sandbox/filemanager/js/common_functions.js	(revision 1704)
+++ sandbox/filemanager/js/common_functions.js	(revision 1719)
@@ -1,35 +1,5 @@
-var menuTimeout;
-/* draw_menu(id of menu, left position, top position, menu elements) */
-function draw_menu(id,left_pos,top_pos,elements){
-	var menu = document.getElementById('menu_newFile'+id);
-	if (menu == null){
-		menu = document.createElement('DIV');
-		menu.id = "menu_newFile"+id;
-		menu.style.left = left_pos+"px";
-		menu.style.top = top_pos+"px";
-		for(j in elements)
-		{
-			if (typeof(elements[j]['img']) != 'undefined'){
-				var img = document.createElement( 'IMG' );
-				img.src = elements[j]['img'];
-				menu.appendChild(img);
-			}
-			var link = document.createElement( 'A' );
-			link.href = elements[j]['url'];
-			link.appendChild( document.createTextNode( elements[j]['text'] ) );
-			menu.appendChild(link);
-			menu.appendChild(document.createElement( 'BR' ));
-		}
-
-		menu.onmouseout = function () { menuTimeout = setTimeout("document.getElementById('menu_newFile"+id+"').style.visibility = 'hidden'",50);}
-		menu.onmouseover = function () { clearTimeout(menuTimeout); };
-		menu.className = 'menubox';
-		menu.style.zIndex='1';
-		document.getElementById('divAppboxHeader').appendChild(menu);
-	}
-	menu.style.visibility = 'visible';
-}
 function load(path){
-	window.location = "/index.php?menuaction=filemanager.uifilemanager.index&path="+base64_encode(path);
+	currentPath = path;
+	cExecute('/index.php?menuaction=filemanager.uifilemanager.get_permissions&path='+base64_encode(path),loadPermissions);
 }
 
@@ -55,5 +25,5 @@
 			address = address.split("?");
 			elements[2]['url'] = address[0]+"?menuaction=filemanager.uifilemanager.index&upload=clicked&upload.x=1&path="+base64_encode(currentPath);
-			draw_menu(arg,50,130,elements);
+			draw_menu(arg,elements);
 			break;
 		case 'rename':
@@ -69,5 +39,5 @@
 					var filename = nameLink.innerHTML;
 					inputName.value = filename;
-					inputName.onblur = function () { cExecute('/index.php?menuaction=filemanager.vfs_functions.rename&file='+base64_encode(this.id.substr(6))+'&to='+base64_encode(this.value)+"&path="+base64_encode(currentPath.value),updateRename) };
+					inputName.onblur = function () { cExecute('/index.php?menuaction=filemanager.vfs_functions.rename&file='+base64_encode(this.id.substr(6))+'&to='+base64_encode(this.value)+"&path="+base64_encode(currentPath),updateRename) };
 					nameLink.parentNode.appendChild(inputName);
 					nameLink.parentNode.removeChild(nameLink);
@@ -113,5 +83,5 @@
 
 			cExecute('/index.php?menuaction=filemanager.vfs_functions.delete&path='+
-					base64_encode(currentPath.value)+filesUrl,handlerDelete);
+					base64_encode(currentPath)+filesUrl,handlerDelete);
 			break;
 		case 'move_to':
@@ -133,21 +103,23 @@
 			}
 			var elements = new Array();
-			inputEl = document.getElementsByName('todir');
-			for(i=0; i< inputEl[0].childNodes.length; i++)
+			inputEl = document.getElementById('content_folders');
+			for(i=0; i< inputEl.childNodes.length; i++)
 			{
+				if (inputEl.childNodes[i].nodeName != 'SPAN')
+					continue;
 				elements[i] = new Array();
-				elements[i]['text'] =inputEl[0].childNodes[i].innerHTML;
+				elements[i]['text']=inputEl.childNodes[i].innerHTML;
 				address = document.location.toString();
 				address = address.split("&");
 				elements[i]['url'] = address[0]+
 					"&"+escape(arg)+".x=10"+
-					"&to="+base64_encode(inputEl[0].childNodes[i].innerHTML)+
+					"&to="+base64_encode(inputEl.childNodes[i].innerHTML)+
 					filesUrl;
 
 			}
-			draw_menu(arg,button.offsetLeft+220,button.parentNode.offsetTop-20,elements);
+			draw_menu(arg,elements);
 			break;
 		case 'reload':
-			window.location = "/index.php?menuaction=filemanager.uifilemanager.index&path="+base64_encode(currentPath);
+			cExecute('/index.php?menuaction=filemanager.uifilemanager.dir_ls&path='+base64_encode(currentPath)+'&criteria='+criteria+'&otype='+order_type,drawFiles);
 			return;
 		case 'tools':
@@ -156,5 +128,5 @@
                         elements[0]['text'] = get_lang('Preferences');
                         elements[0]['url'] = 'preferences/preferences.php?appname=filemanager';
-			elements[0]['img'] = 'filemanager/templates/default/images/preferences.png';
+			elements[0]['img'] = templatePath+'images/preferences.png';
                         elements[1] = new Array();
                         elements[1]['text'] = get_lang('Search');
@@ -162,20 +134,20 @@
 						document.getElementById("menu_newFiletools").style.visibility="hidden";\
 						document.getElementById("em_message_search").focus();';
-			elements[1]['img'] = 'filemanager/templates/default/images/search.gif';
+			elements[1]['img'] = templatePath+'images/search.gif';
                         /*
 			elements[2] = new Array();
                         elements[2]['text'] = get_lang('Edit Folders');
                         elements[2]['url'] = 'javascript:EditFolders()';
-			elements[2]['img'] = 'filemanager/templates/default/images/mime16_directory.png';
+			elements[2]['img'] = 'images/mime16_directory.png';
 			*/
                         elements[3] = new Array();
                         elements[3]['text'] = get_lang('Share Folders');
                         elements[3]['url'] = "index.php?menuaction=preferences.uiaclprefs.index&acl_app=filemanager";
-			elements[3]['img'] = 'filemanager/templates/default/images/mime16_directory.png';
+			elements[3]['img'] = templatePath+'images/mime16_directory.png';
                         elements[4] = new Array();
                         elements[4]['text'] = get_lang('Edit Columns');
                         elements[4]['url'] = "javascript:EditColumns()";
-			elements[4]['img'] = 'filemanager/templates/default/images/editpaste.png';
-                        draw_menu(arg,50,190,elements);
+			elements[4]['img'] = templatePath+'images/editpaste.png';
+                        draw_menu(arg,elements);
 			break;
 		default:
@@ -301,8 +273,8 @@
 
 
-function setRestricted(link){
+function setRestricted(name){
 	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(link,setRestricted_handler);
+		cExecute('/index.php?menuaction=filemanager.vfs_functions.setRestricted&file='+base64_encode(name)+'&path='+base64_encode(currentPath),setRestricted_handler);
 }
 
@@ -391,5 +363,5 @@
 		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.value);
+		nameLink.href="./index.php?menuaction=filemanager.uifilemanager.view&file="+base64_encode(returnVal[2])+"&path="+base64_encode(currentPath);
 		inputName.parentNode.appendChild(nameLink);
 		inputName.parentNode.removeChild(inputName);
@@ -426,5 +398,5 @@
 				preferences[checkBoxes[i].value] = '0';
 		}
-		cExecute('/index.php?menuaction=filemanager.user.save_preferences&preferences='+base64_encode(serialize(preferences)),function () { toolbar_control('reload') })
+		cExecute('/index.php?menuaction=filemanager.user.save_preferences&preferences='+base64_encode(serialize(preferences)),function () { toolbar_control('reload'); EditColumns('close'); })
 		return;
 	}
