I've written a context sensitive affiliate adserver that serves relevant ads via Javascript. That works reasonably well, but I do need to optimize the ads themselves some.
That is really cool. Have you open sourced it? It's JavaScript in the first place so I know anyone can see it in your site, but it would be cool to track it on Github.