sort_itemnames function

Sorts item names according to user-specified priority