This may help with custom template coding. Instead of an advertising position you could randomize the header code and if you have multiple styles I suggest using the TMS. (Template management system)
Randomising content can be used in various ways, the most common of which is for header images and logos, or advertising banners.