edit; I am sorry, friend. I have failed you. I cannot seem to figure out how to do it. I thought maybe playing with the javascript would come up with a solution, but I only succeeded in giving myself a headache. Unless someone else knows how, I'd say this is impossible

You can replicate that for each rank, and then it'll automatically apply it if they have the correct rank. The "class" you give each rank is solely up to you, but must be defined correspondingly to the javascript.