App_Part_List = { options: { buttonsState: [], hideText: 'Hide All Processes', displayText: 'Show All Processes', processClass: 'part_process_row' }, init: function(params) { if (typeof params != 'undefined') { this.options = $.extend(this.options, params); } $('.part_visible_button').bind('click', function() { var buttonId = $(this).attr('id'); if (App_Part_List.options.buttonsState[buttonId] != true ) { App_Part_List.options.buttonsState[buttonId] = true; var state = 'block'; $(this).text(App_Part_List.options.hideText); } else { App_Part_List.options.buttonsState[buttonId] = false; var state = 'none'; $(this).text(App_Part_List.options.displayText); } var parendId = $(this).parent().attr('id'); $('#' + parendId + ' .' + App_Part_List.options.processClass).css('display', state); }) } }