It will be easier if you give your img an id, then use JS to change the src:
Code:
document.getElementById('imgid').src = "whatever.jpg";
Use JS's version of a random number, something like
Code:
var randomnumber=Math.floor(Math.random()*21);
If the value of URL_THEME is not available to JS
somewhere then you'll need to extract it from the existing img's src using indexOf(), substr() (or substring()).
If this describes what you are after then you could report back and I (or someone else

) might help you assemble the code you need.