if(BBC.adverts.checkWrite(bbc_adsense_slot)) {
     function google_ad_request_done(google_ads) {
        var s = '';
        var i;

        if (google_ads.length == 0)
            return;

        if (google_ads[0].type == "text") {

            s +='<h3>' +
                    '<a href="http://www.bbc.co.uk/bbc.com/faq/ads_by_google.shtml">Ads by Google</a>' +
                '</h3>' +
                '<ul>';

            if (google_ads.length == 1) {

                s +='<li>' +
                        '<h4>' +
                            '<a href="' + google_ads[0].url + '" ' +
                                'onmouseout="window.status=\'\'" ' +
                                'onmouseover="window.status=\'go to ' + google_ads[0].visible_url + '\';return true;" ' +
                                'target="_blank">' +
                            google_ads[0].line1 + '</a>' +
                        '<h4>' +
                        '<p>' +
                            google_ads[0].line2 + ' ' +
                        '</p>' +
                        '<p>' +
                            '<a href="' + google_ads[0].url + '" ' +
                                'onmouseout="window.status=\'\'" ' +
                                'onmouseover="window.status=\'go to ' + google_ads[0].visible_url + '\';return true;" ' +
                                'target="_blank">' +
                            google_ads[0].line3 + '</a>' +
                        '</p>' +
                        '<p>' + google_ads[0].visible_url + '</p>' +
                    '</li>';

            } else if (google_ads.length > 1) {

                for(i=0; i < google_ads.length; ++i) {
                    s +='<li>' +
                            '<h4>' +
                                '<a href="' + google_ads[i].url + '" ' +
                                    'onmouseout="window.status=\'\'" ' +
                                    'onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\';return true;" ' +
                                    'target="_blank">' +
                                google_ads[i].line1 + '</a>' +
                            '</h4>' +
                            '<p>' +
                                google_ads[i].line2 + ' ' + google_ads[i].line3 +
                            '</p>' +
                            '<p>' +
                                '<a href="' + google_ads[i].url + '" ' +
                                    'onmouseout="window.status=\'\'" ' +
                                    'onmouseover="window.status=\'go to ' +	google_ads[i].visible_url + '\';return true;" ' +
                                    'target="_blank">' +
                                google_ads[i].visible_url + '</a>' +
                            '</p>' +
                        '</li>';
                }

            }
            s +='</ul>';
        }

        if( typeof BBC.adverts.getZoneData().keyValues[bbc_adsense_slot] != 'undefined' &&
            BBC.adverts.getZoneData().keyValues[bbc_adsense_slot].indexOf("weather") != -1 ){
            document.write('<div class="'+BBC.adverts.getZoneData().keyValues[bbc_adsense_slot]+'_top"></div><div class="'+BBC.adverts.getZoneData().keyValues[bbc_adsense_slot]+'">'+s+'</div><div class="'+BBC.adverts.getZoneData().keyValues[bbc_adsense_slot]+'_bottom"></div>');
        }else{
            document.write('<div class="'+BBC.adverts.getZoneData().keyValues[bbc_adsense_slot]+'">'+s+'</div>');
        }

        return;
    }
    google_ad_client = 'ca-bbccom';
    google_ad_channel = bbc_adsense_country+"_"+BBC.adverts.getZoneData().zone;
    google_ad_output = 'js';
    google_max_num_ads = '3';
    google_ad_type = 'text'; // type of ads to display
    google_language = 'en';

    <!-- Start: AdSense for Content A/B Test Code -->
    // % of impressions to serve with the test option B instead of control option A
    var test_percent = 100;
    isTestImpression=(Math.random()<=(test_percent/100)?true:false);
    if (isTestImpression) {
        // Test option B parameters
        google_ad_channel = bbc_adsense_country+"_"+BBC.adverts.getZoneData().zone+" channel_b";
        if (document.getElementById('bbccom_adsense_middle')) {
            var adsense_middle = document.getElementById('bbccom_adsense_middle');
            adsense_middle.className = adsense_middle.className + ' adsense_optionB';
        } else if (document.getElementById('bbccom_adsense_mpu')) {
            var adsenseMpu = document.getElementById('bbccom_adsense_mpu');
            adsenseMpu.className = adsenseMpu.className + ' adsense_optionB';
        }
    } else {
        // Control option A parameters
        google_ad_channel = bbc_adsense_country+"_"+BBC.adverts.getZoneData().zone+" channel_a";
    }
    <!-- End: AdSense for Content A/B Test Code -->

    // News homepage specific params
    if (BBC.adverts.getZoneData().zone == "news_homepage_int"){
        var bbc_adsense_ran = Math.ceil(Math.random() * 3);
        bbc_adsense_ran == 1 ? google_page_url = "http://www.bbc.co.uk/news/business/" :
            bbc_adsense_ran == 2 ? google_page_url = "http://www.bbc.co.uk/news/science_and_environment/" :
                google_page_url = "http://www.bbc.co.uk/news/technology/";
    } else if (BBC.adverts.getZoneData().zone.substring(0,15) == "news_marketdata"){
        google_page_url = "http://www.bbc.co.uk/news/business/";
    }
    document.write('<script language="JavaScript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></scr'+'ipt>');

    <!-- Start: Testing on CREAM Story Pages -->
    gloader.load(["glow","1","glow.dom"],{
        onLoad: function(glow){
            glow.ready(function(){
                if (BBC.adverts.getNewsGvl3() && glow.dom.get("#bbccom_adsense_mpu").length > 0 && glow.dom.get("#main-content.story").length > 0) {
                    glow.dom.get(".layout-block-b").append('<div id="bbccom_adsense_mpu_rhs" class="bbccom-advert bbccom_adsense"></div>');
                    var source = glow.dom.get("#bbccom_adsense_mpu");
                    var dest = glow.dom.get("#bbccom_adsense_mpu_rhs");
                    source.get("script").remove();
                    dest.html(source.html());
                    glow.dom.get("#bbccom_adsense_mpu").remove();
                }
            })
        }
    });
    <!-- End: Testing on CREAM Story Pages -->
}

