Moving <option>s into an <optgroup>
Firefox, IE6+/Win, NS6+, Opera 7+, Konqueror 3, and Safari support <optgroup>; older versions of IE, Netscape, and Opera do not. In this example, group membership is determined by looking at the text in each option. The value, title, or class attribute could be used to determine group membership instead. This script places any options that don't belong in an <optgroup> at the beginning of the list.