Doug,
I think you're on the right track.
There may be an easier way to do this, but I just tested this script and it seems to work. Just put this code in the "header" section of your saleform.
(I tried pasting the code, but it didn't work - just download the text file).