Programming Help

I have an idea on how to generate some income for my friends in the Bear Flag League but I'm stuck.

Does a program exist or can it be written that puts blog advertising in rotation on a blog? Each time a new user visits or the page is refreshed a new ad shows up? First you get Joe's Diner, next time it's Susie's Shoe Shop, you refresh and get Mark's Tree Service? A customer could then buy advertising relatively cheaply on a network of blogs, because they wouldn't be exclusively occupying the prime territory.

Any ideas?