rem: if(selectedIndex >= 0) listbox.selectedIndex = selectedIndex; 
add: if(selectedIndex < 0) selectedIndex = 0; listbox.selectedIndex = selectedIndex; 
context: function onLoad(){  var args = window.arguments[0];  window.onAcceptCallback = args.onOk;  // set the current date/time for the duedate control.  // this is just a placeholder until we support absolute reminders.  var duedate = document.getElementById("reminder-duetime");  duedate.value = new Date();  // load the reminders from preferences  var reminders = loadReminders();    // check if a possibly incoming reminder object matches  // the ones we already know about...  var incoming = args.reminder;  var selectedIndex = -1;  if(incoming) {    for (var i=0; i<reminders.length; i++) {      var reminder = reminders[i];      if(reminder.relation == incoming.relation &&         reminder.length == incoming.length &&         reminder.unit == incoming.unit) {        selectedIndex = i;        break;      }    }    // if we didn't find a match, we append the unknown    // reminder to the array of custom reminders.    if(selectedIndex < 0) {      reminders.push(incoming);      selectedIndex = reminders.length-1;    }  }    var listbox = document.getElementById("reminder-listbox");  while(listbox.childNodes.length > reminders.length)    listbox.removeChild(listbox.lastChild);  var numChilds = listbox.childNodes.length;  for (var i=0; i<reminders.length; i++) {    if(i >= numChilds) {      var newNode = listbox.childNodes[0].cloneNode(true);      listbox.appendChild(newNode);    }    var node = listbox.childNodes[i];    var reminder = reminders[i];    var details = stringFromReminderObject(reminder);    node.setAttribute('label',details);    node.reminder = reminder;  }  if(selectedIndex >= 0)    listbox.selectedIndex = selectedIndex;  opener.setCursor("auto");}
meta: 5459	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5459/c8b7e1a631d4160d77274818eb4e9b4a7bb44a72/sun-calendar-event-dialog-reminder.js/clean/calendar/prototypes/wcap/sun-calendar-event-dialog-reminder.js