// convenience functions function initMagic() { /** * Checkbox Group * Set the check all checkbox with class name 'check-all-trigger'. Set all * target checkboxes with class name #check-all-id-target. * * Example: if check-all checkbox is id 'foo' then all target checkboxes * should be decorated with class names 'foo-target'. */ $('input[@type=checkbox].check-all-trigger').click(function(e) { el = this; $('input.'+el.id+'-target').each(function() { this.checked = el.checked; }); }); /** * Expand Node * */ $('.expand-trigger').click(function(e) { e.preventDefault(); $('#'+this.id+'-expand-target').slideToggle("slow"); }); } $(document).ready(initMagic); /** * * */ $.extend($, { debug: function(msg) { if (window.console) { console.debug(msg); } else { alert(msg); } } });