diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js
index 5bc7fe96ae25fd632318fc250938550a9a4dbb38..9ee12d6c34862cea7d9b9909c4a27b6b92ec020f 100644
--- a/lib/scripts/edit.js
+++ b/lib/scripts/edit.js
@@ -146,7 +146,7 @@ function initToolbar(tbid,edid,tb){
         var btn = createToolButton(tb[i]['icon'],
                                tb[i]['title'],
                                tb[i]['key']);
-        
+
         var actionFunc = 'addBtnAction'+tb[i]['type'].charAt(0).toUpperCase()+tb[i]['type'].substring(1);
         var exists = eval("typeof("+actionFunc+") == 'function'");
         if(exists)
@@ -160,7 +160,7 @@ function initToolbar(tbid,edid,tb){
 /**
  * Add button action for format buttons
  *
- * @param  DOMElement btn   Button element to add the action to 
+ * @param  DOMElement btn   Button element to add the action to
  * @param  array      props Associative array of button properties
  * @param  string     edid  ID of the editor textarea
  * @return boolean    If button should be appended
@@ -176,14 +176,14 @@ function addBtnActionFormat(btn, props, edid)
         jsEscape(props['close'])+"','"+
         jsEscape(sample)+
     "');return false;}");
-    
+
     return true;
 }
 
 /**
  * Add button action for insert buttons
  *
- * @param  DOMElement btn   Button element to add the action to 
+ * @param  DOMElement btn   Button element to add the action to
  * @param  array      props Associative array of button properties
  * @param  string     edid  ID of the editor textarea
  * @return boolean    If button should be appended
@@ -201,7 +201,7 @@ function addBtnActionInsert(btn, props, edid)
 /**
  * Add button action for signature button
  *
- * @param  DOMElement btn   Button element to add the action to 
+ * @param  DOMElement btn   Button element to add the action to
  * @param  array      props Associative array of button properties
  * @param  string     edid  ID of the editor textarea
  * @return boolean    If button should be appended
@@ -222,7 +222,7 @@ function addBtnActionSignature(btn, props, edid)
 /**
  * Add button action for picker buttons and create picker element
  *
- * @param  DOMElement btn   Button element to add the action to 
+ * @param  DOMElement btn   Button element to add the action to
  * @param  array      props Associative array of button properties
  * @param  string     edid  ID of the editor textarea
  * @param  int        id    Unique number of the picker
@@ -243,7 +243,7 @@ function addBtnActionPicker(btn, props, edid, id)
 /**
  * Add button action for the mediapopup button
  *
- * @param  DOMElement btn   Button element to add the action to 
+ * @param  DOMElement btn   Button element to add the action to
  * @param  array      props Associative array of button properties
  * @return boolean    If button should be appended
  * @author Gabriel Birke <birke@d-scribe.de>
@@ -251,7 +251,7 @@ function addBtnActionPicker(btn, props, edid, id)
 function addBtnActionMediapopup(btn, props)
 {
     eval("btn.onclick = function(){window.open('"+
-        jsEscape(props['url']+NS)+"','"+
+        jsEscape(props['url']+encodeURIComponent(NS))+"','"+
         jsEscape(props['name'])+"','"+
         jsEscape(props['options'])+
     "');return false;}");
@@ -367,7 +367,7 @@ function insertAtCarret(edid,value){
     field.focus();
     sel = document.selection.createRange();
     sel.text = value;
-    
+
   //MOZILLA/NETSCAPE support
   }else if (field.selectionStart || field.selectionStart == '0') {
     var startPos  = field.selectionStart;