function google_ad_request_done(google_ads) {
  var s = '';
  var i;
  
  if (google_ads.length == 0) {
    return;
  }
  
  s = showAd();
  document.getElementById(cur_google_id).innerHTML = s;
  if(cur_google_id=="top" && google_ads[0].type!="text" && cur_google_direction=="horizontal" && window.innerWidth && parseInt(window.innerWidth)>1200) {
    document.getElementById(cur_google_id).style.cssFloat = 'left';
    document.getElementById(cur_google_id).style.marginRight = '20px';
    
    if(document.getElementById('attributeDiv')) {
      document.getElementById('attributeDiv').style.clear = 'left';
    } else {
      document.getElementById('textP').innerHTML += '<br style="clear:left;height:1px;line-height:1px;font-size:1px />';
    }
    
    if(document.getElementById('werbefrei_'+cur_google_id)) document.getElementById('werbefrei_'+cur_google_id).style.display = 'none';
  }
  return;
}

function showAd() {
  var s = '';
  if(google_ads[0].type!="html") s = '<a href="' + google_info.feedback_url + '" style="text-decoration:none;color:#555;font-size:12px;padding-left:6px">Google-Anzeigen</a>';
  
  if (google_ads[0].type == "flash") {
    s += '<br>' + 
        '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
          ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="' + 
          google_ad.image_width + '" HEIGHT="' + 
          google_ad.image_height + '"> <PARAM NAME="movie" VALUE="' + 
          google_ad.image_url + '">' + 
          '<PARAM NAME="quality" VALUE="high" /><param name="wmode" value="opaque" />' + 
          '<PARAM NAME="AllowScriptAccess" VALUE="never" />' + 
          '<EMBED wmode="opaque" src="' + 
          google_ad.image_url + '" WIDTH="' + 
          google_ad.image_width + '" HEIGHT="' + 
          google_ad.image_height + 
          '" TYPE="application/x-shockwave-flash"' + 
          ' AllowScriptAccess="never" ' + 
          ' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
    
  } else if (google_ads[0].type == "image") {
     s += '<br> <a href="' + 
          google_ads[0].url + '" target="_top" title="' + 
          google_ads[0].visible_url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'' +
          google_ads[0].visible_url + '\';return true"><img border="0" src="' + 
          google_ads[0].image_url + '"width="' + 
          google_ads[0].image_width + '"height="' + 
          google_ads[0].image_height + '"></a><br />';
  } else if (google_ads[0].type == "html") {
    s += google_ads[0].snippet;
  } else {
    if (google_ads[0].bidtype == "CPC") {
      google_num += google_ads.length;
    }
    
    if(cur_google_direction=="horizontal") {
      for(var i = 0; i < google_ads.length; ++i) {
        if(i>=google_ads.length) break;
        s += '<div';
        if(TEST_MOUSEOVER==testchannels[1]) s += ' onmouseover="this.style.background=\'#fff\'" onmouseout="this.style.background=\'#F7F7F7\'"';
        s += ' style="border:solid 1px #9F1919;';
        //if(i==0) {
          s += '-moz-border-radius-topright:6px;-webkit-border-radius-topright:6px;border-radius-topright:6px;-moz-border-radius-topleft:6px;-webkit-border-radius-topleft:6px;border-radius-topleft:6px;';
          if(google_ads.length==1) s += 'font-size:16px;';
        //}
        //if(i==google_ads.length-1) {
          //if(i>0) s += 'border-top:none;';
          if(i>0) s += 'margin-top:5px;';
          s += '-moz-border-radius-bottomright:6px;-webkit-border-radius-bottomright:6px;border-radius-bottomright:6px;-moz-border-radius-bottomleft:6px;-webkit-border-radius-bottomleft:6px;border-radius-bottomleft:6px;';
        //}
  
        s += 'background:#F7F7F7;padding:4px 6px"><a href="' + 
            google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'' +
            google_ads[i].visible_url + '\';return true"><b>' + 
            google_ads[i].line1 + '</b></a> ' +
            google_ads[i].line2 + ' ' +
            google_ads[i].line3 + ' <br /><a style="text-decoration:none;color:#333" href="' + 
            google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'' +
            google_ads[i].visible_url + '\';return true">' + 
            google_ads[i].visible_url + '</a></div>';
      }
    } else if(cur_google_direction=="vertical") {
      for(i = 0; i < google_ads.length; ++i) {
        s += '<div style="padding:4px 6px"><a href="' + 
            google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'' +
            google_ads[i].visible_url + '\';return true"><b>' + 
            google_ads[i].line1 + '</b></a><br />' +
            google_ads[i].line2 + '<br />' +
            google_ads[i].line3 + '<br /><a style="text-decoration:none;color:#333" href="' + 
            google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'' +
            google_ads[i].visible_url + '\';return true">' + 
            google_ads[i].visible_url + '</a></div>';
      }
    }
  }
  return s;
}

var google_num = 0;