// Replaces all ad place-holders with real ads.  The place-holder should be an empty div,
// with an ID that starts with "adSpot" (e.g.: "adSpot1").  The actual ad must be inside
// a div at the bottom of the page.  This div should have the style "display:none" and
// must be named the same but with the prefix "swap-" (e.g.: "swap-adSpot1").

function swapAllAds() {
    var d = document;
    if (!d.getElementsByTagName) return;
    var divs = d.getElementsByTagName('div');

    // Move all the ads up.
    for (var i = 0; i < divs.length; i++) {
        var div = divs[i];
        if (div.id && div.id.indexOf('adSpot') == 0) {
            var swap = d.getElementById("swap-" + div.id);
            if (swap != null) {
				div.innerHTML = swap.innerHTML;
				swap.innerHTML = '';
			}
        }
    }
}

swapAllAds();
