In the onchange event for the name picker add code that will set a variable value and do a partial refresh on the two fields below (put both fields in a panel or div).
Set the visibility property of the container for the fields (a panel or div) based upon the value set in the namepickers on change event.
Compute the two field values by reading the selected value of the name picker.