Step One - Go to https://github.com/krux/postscribe and get the postscribe.js and htmlparser.js files.
Step Two. Create a separate ad99.js file for each ad with the ad code in it and using postscribe to add the external script from Google.
google_ad_client = "pub-9999999999999999";
google_ad_slot = "9999999999";
google_ad_width = 300;
google_ad_height = 250;
Step Three. Add a div with the specified id (id="adv1" in my example) where you want the ad to appear.
Step Four. Repeat steps two and three for any additional ads - each needs to be in a separate file as the postscribe call must be the last line.
Step Five. Add the following to the bottom of your page immediately before the </body> tag - listing each of the ad scripts you created in place of ad1.js and ad2.js (update the src to include the path to where ever you put the scripts).
I believe that the htmlparser script originated with John Resig who also created JQuery. I came across a version of that code with his name on it a couple of years ago but was never able to figure out how to get it to place Google ads in the right place (I could get the script tags for the ad inserted at the right spot but the ad still appeared after the script that added those tags rather than in that spot. Those responsible for postscribe appear to have resolved that problem so that the ad itself will also appear where it is supposed to.