diff --git a/lib/scripts/toolbar.js b/lib/scripts/toolbar.js
index 9b6afef301e0e49c676974cd151c7b872dfa7641..6beb07c5ba2af7a3bdea8f2c3e3e925b5bea4744 100644
--- a/lib/scripts/toolbar.js
+++ b/lib/scripts/toolbar.js
@@ -12,54 +12,62 @@ var pickercounter=0;
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function initToolbar(tbid,edid,tb, allowblock){
-    var toolbar = $(tbid);
-    if(!toolbar) return;
-    var edit = $(edid);
-    if(!edit) return;
-    if(edit.readOnly) return;
+    var $ = jQuery;
+    if (typeof tbid == 'string') {
+        var toolbar = $('#' + tbid);
+    } else {
+        var toolbar = $(tbid);
+    }
+    
+    if(toolbar.length == 0) return;
+    
+    var edit = $('#' + edid);
+    if(edit.length == 0) return;
+    
+    if(edit.attr('readOnly')) return;
 
     if (typeof allowblock === 'undefined') {
         allowblock = true;
     }
 
     //empty the toolbar area:
-    toolbar.innerHTML='';
+    toolbar.html('');
 
-    var cnt = tb.length;
+    var cnt = tb.length; 
+      
     for(var i=0; i<cnt; i++){
         if (!allowblock && tb[i].block === true) {
             continue;
         }
         var actionFunc;
-
-        // create new button
-        var btn = createToolButton(tb[i]['icon'],
+                         
+        // create new button (jQuery object)
+        var btn = $(createToolButton(tb[i]['icon'],
                                    tb[i]['title'],
                                    tb[i]['key'],
                                    tb[i]['id'],
-                                   tb[i]['class']);
-
-
+                                   tb[i]['class']));
+                                               
         // type is a tb function -> assign it as onclick
         actionFunc = 'tb_'+tb[i]['type'];
-        if( jQuery.isFunction(window[actionFunc]) ){
-            addEvent(btn,'click', bind(window[actionFunc],btn,tb[i],edid));
-            toolbar.appendChild(btn);
+        if( $.isFunction(window[actionFunc]) ){
+            btn.bind('click', bind(window[actionFunc],btn,tb[i],edid) ); 
+            toolbar.append(btn);
             continue;
         }
-
+                                    
         // type is a init function -> execute it
         actionFunc = 'addBtnAction'+tb[i]['type'].charAt(0).toUpperCase()+tb[i]['type'].substring(1);
-        if( jQuery.isFunction(window[actionFunc]) ){
+        if( $.isFunction(window[actionFunc]) ){
             if(window[actionFunc](btn, tb[i], edid)){
-                toolbar.appendChild(btn);
-            }
+                toolbar.append(btn);
+            } 
             continue;
         }
-
+                  
         alert('unknown toolbar type: '+tb[i]['type']+'  '+actionFunc);
     } // end for
-
+      
 }
 
 /**
@@ -197,10 +205,14 @@ function tb_autohead(btn, props, edid){
 function addBtnActionPicker(btn, props, edid) {
     var pickerid = 'picker'+(pickercounter++);
     createPicker(pickerid, props, edid);
-    addEvent(btn,'click',function(){
-        pickerToggle(pickerid,btn);
-        return false;
-    });
+                                               
+    btn.click(
+        function() {
+            pickerToggle(pickerid,btn);
+            return false;
+        }
+    );
+
     return true;
 }
 
@@ -214,7 +226,7 @@ function addBtnActionPicker(btn, props, edid) {
  * @author Andreas Gohr <gohr@cosmocode.de>
  */
 function addBtnActionLinkwiz(btn, props, edid) {
-    jQuery(btn).linkwiz($(edid));
+    jQuery(btn).linkwiz(jQuery('#' + edid));
     return true;
 }
 
@@ -224,17 +236,18 @@ function addBtnActionLinkwiz(btn, props, edid) {
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function pickerToggle(pickerid,btn){
-    var picker = $(pickerid);
-    if(picker.style.marginLeft == '-10000px'){
-        var x = findPosX(btn);
-        var y = findPosY(btn);
-        picker.style.left = (x+3)+'px';
-        picker.style.top = (y+btn.offsetHeight+3)+'px';
-        picker.style.marginLeft = '0px';
-        picker.style.marginTop  = '0px';
-    }else{
-        picker.style.marginLeft = '-10000px';
-        picker.style.marginTop  = '-10000px';
+    var picker = jQuery('#' + pickerid);
+    if (picker.css('marginLeft') == '-10000px'){
+        var x = findPosX(btn[0]);
+        var y = findPosY(btn[0]);
+        
+        picker.css('left',(x+3)+'px')
+            .css('top', (y+btn[0].offsetHeight+3)+'px')
+            .css('marginLeft', '0px')
+            .css('marginTop', '0px');
+    } else {
+        picker.css('marginLeft', '-10000px')
+            .css('marginTop', '-10000px');
     }
 }
 
@@ -244,10 +257,10 @@ function pickerToggle(pickerid,btn){
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function pickerClose(){
-    var pobjs = getElementsByClass('picker');
+    var pobjs = jQuery('#picker');
     for(var i=0; i<pobjs.length; i++){
-        pobjs[i].style.marginLeft = '-10000px';
-        pobjs[i].style.marginTop  = '-10000px';
+        pobjs[i].css('marginLeft', '-10000px')
+            .css('marginTop', '-10000px');
     }
 }