do something like this ...
name your images 1.gif, 2.gif etc
then in the header use
Code:
{if $cat}
[img]{$ImagesDir}/{$cat}.gif[/img]
{else}
<img src="{$ImagesDir}/normal_image.gif"}
{/if}
what were doing here is having a different image for each category and naming it after the category id number. all images are stored in skin1/images folder.
we also have an image called say normal_image.gif for all the times that your not viewing a category
that should give you some idea and you could expand on it from there