Hi, > // imagine yourself some code in these functions. > [...] > > Event.observe($("#switch"), 'click', switchViews)
I like that. In jQuery-style it could be something like this: jQuery('#switch').bind('click',function() { var showme = jQuery.treeView('#mytree'); var hideme = jQuery.gridView('#mygrid'); if(showme.visible()) { var tmp = hideme; hideme = showme; showme = tmp; } jQuery(hideme).hide(); jQuery(showme.redraw()).show(); jQuery.menu('#mymenu').viewToggle(true); }); That way the controlers themself can be queuable with their methods and the jQuery() function can convert controllers to jQuery-Objects. If the controller functions usually take everything that jQuery() takes as well they migt always have the same structure: jQuery.treeView = function(selector,options,context) { return { jqo :$(selector,context).each(function() { if( !this.controllers ) this.controllers = {}; if( !this.controllers.treeView ) { this.controllers.treeView = { options: options, init: function() {...}, changeOptions: function(newOptions) {...}, redraw: function() {...}, ... } this.controllers.treeView.init(); } else this.controllers.treeView.changeOptions(options); }), redraw: function() { this.jqo.each(function() { this.redraw(); }); return this; }, ... } }; Christof _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/