rem: var slave_id = select.id.replace( /^([a-z_]+)\[([0-9]+)\]\[[a-z_]+\]$/, "$1[$2][" + slave_column + "]" ); 
add: var master_column = select.id.replace( /^.*\[([a-z_]+)\]$/, "$1" ); var slave_id = select.id.replace( master_column, slave_column ); 
context: function master_change( select, slave_column ) {  var slave_id = select.id.replace( /^([a-z_]+)\[([0-9]+)\]\[[a-z_]+\]$/, "$1[$2][" + slave_column + "]" );  var slave = $( slave_id );  var new_value = select.value;  var options = slave.options;  var enabled_counter = 0;  var first_valid;  for (var i = 0; i < options.length; i++ ) {    if ( options[i].className == new_value ) {      options[i].style.display = 'block';      enabled_counter++;      if (!first_valid) first_valid = options[i].value;    } else {      options[i].style.display = 'none';    }  }  if ( enabled_counter == 0 ) {    slave.style.display = 'none';     } else {    slave.style.display = 'block';       slave.value = first_valid;  }}
meta: 2782	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/2782/f585b0853340dee97ede34e9d2a5d25e653b518b/application.js/buggy/rails/public/javascripts/application.js