function google_ad_request_done (google_ads) { // Don't try to alert something prior to the document.write or the write will fail IN IE 6. Don't ask me why... //alert('google_ad_request_done() successfully called\ngoogle_ads.length: ' + google_ads.length); var i; /* Verify that there are actually ads to display. */ if (google_ads.length == 0) { return; } var ads = ''; for (i=0; i < google_ads.length; ++i) { var adsense_unit = adsense_unit_template.replace(/%%URL%%/g, google_ads[i].url); adsense_unit = adsense_unit.replace(/%%LINE1%%/g, google_ads[i].line1); adsense_unit = adsense_unit.replace(/%%LINE2%%/g, google_ads[i].line2); adsense_unit = adsense_unit.replace(/%%LINE3%%/g, google_ads[i].line3); adsense_unit = adsense_unit.replace(/%%VISIBLE_URL%%/g, google_ads[i].visible_url); ads += adsense_unit; } var final_ads_string = adsense_container_template.replace(/%%ADSENSE_ADS%%/, ads); final_ads_string = final_ads_string.replace(/%%ADSENSE_FEEDBACK_URL%%/, google_info.feedback_url); document.write(final_ads_string); return; }