Topic: dinamically position categories


I have a lot of categories and would like to dinamically postion them, based on referer. let say I have

- Main cat
- cat 1
- cat 2
- cat 3
- and so on...

My goal is to place certain category to 2nd position, right after main category.

Optimal solution would be, to arrange categories in php code (through extension if possible, not mods). ID for 2nd categorry could be in cookie.

another solution will be to rearrange categories after they are printed, using jquery.

any ideas an comments are welcome

thanks in advance.