
function google_afs_request_done(google_ads)
{
    /*
     * Verify that there are actually ads to display.
     */
    var google_num_ads = google_ads.length;
    if (google_num_ads <= 0)
    {
        return;
    }
    
    var wideAds1 = "";   // wide ad unit html text
    var wideAds2 = "";   // wide ad unit html text
    var wideAds3 = "";   // wide ad unit html text
    
    var box_top = '<div class="box" style="width: 476px;"><div class="box_top box_gray"><div class="tl box_tl_gray"> </div><div class="tr box_tr_gray"> </div></div><div class="box_cont_single box_gray"><div class="box_azienda">';
    var box_bot = '</div></div><div class="box_bottom box_gray"><div class="bl box_bl_gray"> </div><div class="br box_br_gray"> </div></div></div>';

    for(i = 0; i < google_num_ads; i++)
    {
        if (google_ads[i].type=="text/wide")
        {
            // render a wide ad
            if ( i >= 0 && i < 3){
            wideAds1+= box_top + '<a style="text-decoration:none" onmouseover="javascript:window.status=\'' + google_ads[i].url + '\';return true;" ' + 'onmouseout="javascript:window.status=\'\';return true;" ' +'href="' + google_ads[i].url + '">' +
                    '<span class="ad_line1">' + google_ads[i].line1 + '</span></a><br>' +
                    '<span class="ad_text">' + google_ads[i].line2 + '</span><br>' +
                    '<a style="text-decoration:none" onmouseover="javascript:window.status=\'' + google_ads[i].url + '\';return true;" ' + 'onmouseout="javascript:window.status=\'\';return true;" ' + 'href="' + google_ads[i].url + '">' +
                    '<span class="ad_url">' + google_ads[i].visible_url + '</span><br><br></a>' + box_bot;
        }
        if ( i >= 3 && i < 5){
          wideAds2+=  box_top +  '<a style="text-decoration:none" onmouseover="javascript:window.status=\'' + google_ads[i].url + '\';return true;" ' + 'onmouseout="javascript:window.status=\'\';return true;" ' +'href="' + google_ads[i].url + '">' +
                    '<span class="ad_line1">' + google_ads[i].line1 + '</span></a><br>' +
                    '<span class="ad_text">' + google_ads[i].line2 + '</span><br>' +
                    '<a style="text-decoration:none" onmouseover="javascript:window.status=\'' + google_ads[i].url + '\';return true;" ' + 'onmouseout="javascript:window.status=\'\';return true;" ' + 'href="' + google_ads[i].url + '">' +
                    '<span class="ad_url">' + google_ads[i].visible_url + '</span><br><br></a>' + box_bot;
        }
        
        if ( i >= 6 && i < 9){
          wideAds3+=  box_top + '<a style="text-decoration:none" onmouseover="javascript:window.status=\'' + google_ads[i].url + '\';return true;" ' + 'onmouseout="javascript:window.status=\'\';return true;" ' +'href="' + google_ads[i].url + '">' +
                    '<span class="ad_line1">' + google_ads[i].line1 + '</span></a><br>' +
                    '<span class="ad_text">' + google_ads[i].line2 + '</span><br>' +
                    '<a style="text-decoration:none" onmouseover="javascript:window.status=\'' + google_ads[i].url + '\';return true;" ' + 'onmouseout="javascript:window.status=\'\';return true;" ' + 'href="' + google_ads[i].url + '">' +
                    '<span class="ad_url">' + google_ads[i].visible_url + '</span><br><br></a>' + box_bot;
        }
    
        }
     
    }

   
    if (wideAds1 != "")
    {
        wideAds1 = '<a style="text-decoration:none" ' +
                  'href="http://services.google.com/feedback/online_hws_feedback">' +
                  '<span class="ad_header" style="text-align:left">Annunci Google</span></a>' + wideAds1;
    }
    if (wideAds2 != "")
    {
        wideAds2 = '<a style="text-decoration:none" ' +
                  'href="http://services.google.com/feedback/online_hws_feedback">' +
                  '<span class="ad_header" style="text-align:left">Annunci Google</span></a>' + wideAds2;
    }
    if (wideAds3 != "")
    {
        wideAds3 = '<a style="text-decoration:none" ' +
                  'href="http://services.google.com/feedback/online_hws_feedback">' +
                  '<span class="ad_header" style="text-align:left">Annunci Google</span><br><br></a>' + wideAds3;
    }
    // Write HTML for wide and narrow ads to the proper <div> elements
    document.getElementById("wide_ad_unit1").innerHTML = wideAds1;
    document.getElementById("wide_ad_unit2").innerHTML = wideAds2;
   // document.getElementById("wide_ad_unit3").innerHTML = wideAds3;
}



