Index: sandbox/filemanager/js/draw_api.js
===================================================================
--- sandbox/filemanager/js/draw_api.js	(revision 1879)
+++ sandbox/filemanager/js/draw_api.js	(revision 1880)
@@ -148,4 +148,8 @@
 
 function initDrawApi(){
+	SecEl = document.getElementById('userKey');
+	crypt = new crypt(SecEl.value);
+	SecEl.parentNode.removeChild(SecEl);
+
 	loadPreferences();
 	currentPath = document.getElementById('currentPath').value;
@@ -286,5 +290,5 @@
 		if (preferences.createdby_id =='1') retBuff += fl.td+file.creatdby+'</td>';
 		if (preferences.modifiedby_id =='1') retBuff += fl.td+file.modifdby+'</td>';
-		if (preferences.comment =='1') retBuff += fl.td+'<input id="'+file.name+'" class="inputComment" onkeydown="enterComments(event,this)" onclick="presetComments(this)" onblur="setComments(this)" value="'+file.comm+'" alt="'+get_lang('Click to change comments')+'" title="'+get_lang('Click to change comments')+'"></input></td>';
+		if (preferences.comment =='1') retBuff += fl.td+'<input id="'+file.name+'" class="inputComment" onkeydown="enterComments(event,this)" onclick="presetComments(this)" onblur="setComments(this)" value="'+(file.comm==null?'':file.comm)+'" alt="'+get_lang('Click to change comments')+'" title="'+get_lang('Click to change comments')+'"></input></td>';
 		if (preferences.version =='1') retBuff += fl.td+'<span onclick="loadHistory(\''+file.name+'\')">'+file.vers+'</span></td>';
 		return retBuff;
@@ -499,5 +503,5 @@
 			}
 			// TODO use DES, or something strong
-			var pswd = crypt(password,currentPath);
+			var pswd = crypt.encode(password);
 			cExecute('./index.php?menuaction=filemanager.vfs_functions.archive&pswd='+base64_encode(pswd.toString())+'&path='+base64_encode(currentPath)+filesUrl,handler.archive);
 			break;
@@ -578,9 +582,8 @@
 
 function unarchive(filename){
-	password = prompt(get_lang('Please, type archive password or leave it empty if it is not encrypted'));
+	password = crypt.encode(prompt(get_lang('Please, type archive password or leave it empty if it is not encrypted')));
 	if (password == null)
 		return;
-	var pswd = crypt(password,currentPath);
-	cExecute('./index.php?menuaction=filemanager.vfs_functions.unarchive&pswd='+base64_encode(pswd)+'&path='+base64_encode(currentPath)+'&file='+base64_encode(filename),handler.archive);
+	cExecute('./index.php?menuaction=filemanager.vfs_functions.unarchive&pswd='+base64_encode(password)+'&path='+base64_encode(currentPath)+'&file='+base64_encode(filename),handler.archive);
 }
 
@@ -600,27 +603,22 @@
 	}
 	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), ''))
 			{
-				var now = new Date();
-				nowTs = parseInt(now.getTime()/5000).toString();
-				for (var i=0 ;i < 20; i++)
-					nowTs+=nowTs;
-				var toRemove = crypt(Dfolder,nowTs);
-				cExecute('./index.php?menuaction=filemanager.uifilemanager.removedir&path='+base64_encode(toRemove),handler.refreshDir);
-		                var lastIndex = Dfolder.lastIndexOf('/');
+				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();
 			}
-	}
-	else{
-	var buf = "<select id='folders_box'>";
-	for (var i=0; i < folders.length; i++)
-		buf += "<option value='"+folders[i]+"'>"+folders[i]+"</option>";
-	buf += "</select>";
-	code = "<table><tbody><tr><td>"+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);
-	}
+		}
+		else{
+			var buf = "<select id='folders_box'>";
+			for (var i=0; i < folders.length; i++)
+				buf += "<option value='"+folders[i]+"'>"+folders[i]+"</option>";
+			buf += "</select>";
+			code = "<table><tbody><tr><td>"+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);
+		}
 }
 
