add: if ( options[i].value == slave.value ) first_valid = slave.value; 
context: function master_change( select, slave_column ) {  var master_column = select.id.replace( /^.*\[([a-z_]+)\]$/, "$1" );  var slave_id = select.id.replace( master_column, 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';    slave.value = '';  } else {    slave.style.display = 'block';    slave.value = first_valid;  }}
meta: 8040	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/8040/ec9b2c79be392809758f27d9d7bdc4a2715f6d79/application.js/buggy/rails/public/javascripts/application.js