      1 (function ($, rf) {
      2
      3     rf.ui = rf.ui || {};
      4
      5   rf.ui.toolbarHandlers = function(options) {
      6       if (options.id && options.events) {
      7           $('.rf-tb-itm', document.getElementById(options.id)).bind(
      8               options.events);
      9       }
     10       var groups = options.groups;
     11       if (groups && groups.length > 0) {
     12           var group;
     13           var i;
     14           for (i in groups) {
     15               group = groups[i];
     16               if (group) {
     17                   var groupIds = group.ids;
     18                   var y;
     19                   var groupElements = [];
     20                   for (y in groupIds) {
     21                       groupElements.push(document.getElementById(groupIds[y]));
     22                   }
     23                   $(groupElements).bind(group.events);
     24               }
     25           }
     26       }
     27   }
     28
     29 })(RichFaces.jQuery, RichFaces);