add: oldTreeChildren.selectedIndex = oldSelectedIndex; 
context: function refreshToDoTree( eventArray ){   // get the old tree children item and remove it      var oldTreeChildren = document.getElementById( ToDoUnifinderTreeName );   var elementsToRemove = document.getElementsByAttribute( "taskitem", "true" );      for( var i = 0; i < elementsToRemove.length; i++ )   {      elementsToRemove[i].parentNode.removeChild( elementsToRemove[i] );   }   // add: tree item, row, cell, box and text items for every event   for( var index = 0; index < eventArray.length; ++index )   {      var calendarToDo = eventArray[ index ];            // make the items      var oldTreeItems = document.getElementsByAttribute( "name", "sample-todo-listitem" );      var oldTreeItem = oldTreeItems[0];            var treeItem = oldTreeItem.cloneNode( true );            treeItem.toDo = calendarToDo;      var now = new Date();            var thisMorning = new Date( now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0 );      if( calendarToDo.start.getTime() <= thisMorning.getTime() )      {         //this task should be started         treeItem.setAttribute( "started", "true" );      }      var completed = calendarToDo.completed.getTime();      if( completed > 0 )      {         treeItem.getElementsByTagName( "checkbox" )[0].checked = true;                  /* for setting some css */         treeItem.setAttribute( "completed", "true" );      }      treeItem.getElementsByAttribute( "name", "title-listcell" )[0].setAttribute( "label", calendarToDo.title );      var dueDate = new Date( calendarToDo.due.getTime() );      var now = new Date();      var tonightMidnight = new Date( now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59 );      if( now.getTime() > tonightMidnight.getTime() )      {         /* for setting some css */         treeItem.setAttribute( "overdue", "true" );      }      var FormattedDueDate = formatUnifinderEventDate( dueDate );      treeItem.getElementsByAttribute( "name", "due-date-listcell" )[0].setAttribute( "label", FormattedDueDate );      treeItem.removeAttribute( "collapsed" );      treeItem.setAttribute( "taskitem", "true" );      oldTreeChildren.appendChild( treeItem );   }  }
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/8c12cfcc4a5aba546b9b56ad6b1490fd50ec0427/unifinderToDo.js/clean/calendar/resources/content/unifinderToDo.js