Index: sandbox/filemanager/inc/class.user.inc.php
===================================================================
--- sandbox/filemanager/inc/class.user.inc.php	(revision 1704)
+++ sandbox/filemanager/inc/class.user.inc.php	(revision 1809)
@@ -102,7 +102,20 @@
 		}
 		function save_preferences(){
-	                $string_serial = addslashes($this->preferences);
-			$query = "update phpgw_preferences set preference_value = '".$string_serial."' where preference_app = 'filemanager'".
-				" and preference_owner = '".$this->user_id."'";
+			/* See if preferences exists or not */
+			$query = "SELECT count(preference_owner) FROm phpgw_preferences WHERE preference_app = 'filemanager' AND preference_owner = 1009 LIMIT 1";
+			if ($GLOBALS['phpgw']->db->query($query) && $GLOBALS['phpgw']->db->next_record())
+				$val = $GLOBALS['phpgw']->db->row();
+			else
+			{
+				echo $GLOBALS['phpgw']->db->error;
+				return false;
+			}
+
+			$string_serial = addslashes($this->preferences);
+			if ($val['count'] == '1')
+			{
+				$query = "UPDATE phpgw_preferences set preference_value = '".$string_serial.
+					"' where preference_app = 'filemanager'".
+					" and preference_owner = '".$this->user_id."'";
 				if (!$GLOBALS['phpgw']->db->query($query)){
 					echo $GLOBALS['phpgw']->db->error;
@@ -113,4 +126,19 @@
 					return;
 				}
+			}
+			else
+			{
+				/*preferences does not exist*/
+				$query = "INSERT INTO phpgw_preferences values (".$this->user_id.",'filemanager','".$string_serial."')";
+				if (!$GLOBALS['phpgw']->db->query($query)){
+					echo $GLOBALS['phpgw']->db->error;
+					return false;
+				}
+				else{
+					echo "True";
+					return;
+				}
+
+			}
 		}
 
Index: sandbox/filemanager/js/drag_area.js
===================================================================
--- sandbox/filemanager/js/drag_area.js	(revision 1804)
+++ sandbox/filemanager/js/drag_area.js	(revision 1809)
@@ -21,6 +21,6 @@
 		if (elem != null){
 		        var _event  = is_ie ? window.event : e;
-			elem.style.left = (_event.clientX - 80) + "px";
-			elem.style.top = (_event.clientY) + "px";
+			elem.style.left = _event.clientX - 80 + "px";
+			elem.style.top = _event.clientY + "px";
 		}
 	}
Index: sandbox/filemanager/js/draw_api.js
===================================================================
--- sandbox/filemanager/js/draw_api.js	(revision 1804)
+++ sandbox/filemanager/js/draw_api.js	(revision 1809)
@@ -28,5 +28,4 @@
 	permissions['private']=(permission & ACL_PRIVATE);
 	toolbar.load();
-	loadPreferences();
 }
 function close_window(){
@@ -45,6 +44,6 @@
 		menu = document.createElement('DIV');
 		menu.id = "dwindow";
-		menu.style.left = DocX - 200;
-		menu.style.width = "auto";
+		menu.style.left = 200;
+		menu.style.width = "400px";
 		menu.style.top = DocY;
 		menu.className = 'menubox';
@@ -146,4 +145,5 @@
 
 function initDrawApi(){
+	loadPreferences();
 	currentPath = document.getElementById('currentPath').value;
 	toolbar.control('reload');
Index: sandbox/filemanager/js/common_functions.js
===================================================================
--- sandbox/filemanager/js/common_functions.js	(revision 1804)
+++ sandbox/filemanager/js/common_functions.js	(revision 1809)
@@ -276,5 +276,5 @@
 				preferences[checkBoxes[i].value] = '0';
 		}
-		cExecute('./index.php?menuaction=filemanager.user.save_preferences&preferences='+base64_encode(serialize(preferences)),function () { toolbar.control('reload'); EditColumns('close'); })
+		cExecute('./index.php?menuaction=filemanager.user.save_preferences&preferences='+base64_encode(serialize(preferences)),function () { toolbar.control('reload'); EditColumns('close'); });
 		return;
 	}
Index: sandbox/filemanager/templates/default/main.tpl
===================================================================
--- sandbox/filemanager/templates/default/main.tpl	(revision 1785)
+++ sandbox/filemanager/templates/default/main.tpl	(revision 1809)
@@ -64,5 +64,5 @@
 <div style="visibility: hidden" id="allMessages">{messages}</div>
 </div>
+{preferences}
 {script}
-{preferences}
 <!-- END filemanager_footer -->
