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") {
    if(typeof cur_title_pre != 'undefined') {
      s += cur_title_pre;
      delete cur_title_pre;
    }
    s += '<a href="' + google_info.feedback_url + '" style="text-decoration:none;color:#555;font-size:12px;padding-left:6px">Google-Anzeigen</a>';
    if(typeof cur_title_after != 'undefined') {
      s += cur_title_after;
      delete cur_title_after;
    }
  }
  
  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="_blank" 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") {
      if(typeof linebreaks == 'undefined') {
        linebreaks = Math.floor(Math.random() * (3 + 1));
      }
      for(var i = 0; i < google_ads.length; ++i) {
        if(i>=google_ads.length) break;
        s += '<div';
        if(window.TEST_MOUSEOVER && TEST_MOUSEOVER==testchannels[1]) s += ' onmouseover="this.style.background=\'#fcc\'" onmouseout="this.style.background=\'#F7F7F7\'"';
        //if(TEST_MOUSEOVER==testchannels[3]) s += ' onmouseover="this.style.border=\'inset 1px #000\'" onmouseout="this.style.border=\'none\'"';
        s += ' style="';
        //if(TEST_MOUSEOVER!=testchannels[2] && TEST_MOUSEOVER!=testchannels[3] && cur_google_id!='belowContact') s += 'border:solid 1px #9F1919;';
        if(window.TEST_MOUSEOVER && (TEST_MOUSEOVER==testchannels[2] || TEST_MOUSEOVER==testchannels[3])) s += 'color:#000;';
        //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 && window.TEST_MOUSEOVER && TEST_MOUSEOVER!=testchannels[3]) 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;';
        //}
        if(window.TEST_MOUSEOVER && TEST_MOUSEOVER==testchannels[3]) s+='border:solid 1px #F7F7F7;';
  
        s += 'background:#F7F7F7';
        
        s += ';padding:4px 6px"><a href="' +
            google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'' +
            google_ads[i].visible_url + '\';return true"';
        s += ' target="_blank"><b>' + 
            google_ads[i].line1 + '</b></a> ';
        if(window.linebreaks && linebreaks>2) s += '<br />';
        s += google_ads[i].line2+' ';
        if(window.linebreaks && linebreaks>1) s += '<br />';
        s += google_ads[i].line3+' ';
        if(window.linebreaks && linebreaks>0) s += '<br />';
        s += '<a style="text-decoration:none;';
        if(window.TEST_MOUSEOVER && TEST_MOUSEOVER==testchannels[2]) s += 'color:#000';
        else s += 'color:#333';
        
        s += '" href="' + 
            google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'' +
            google_ads[i].visible_url + '\';return true" target="_blank">' + 
            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" target="_blank"><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" target="_blank">' + 
            google_ads[i].visible_url + '</a></div>';
      }
    }
  }
  if(typeof cur_body_after != 'undefined') {
    s += cur_body_after;
    delete cur_body_after;
  }
  return s;
}

var google_num = 0;
