// #######################################################################################
// START: Google Adsense - Funktion fuer Boxen im Content, rechte Leiste und Skyscraper

var google_adnum  = 0;
var google_cont   = 0;
var google_sky    = 0;
var google_renav  = 0;
var google_home   = 0;

/*
* This function is required and is used to display the ads
* that are returned from the JavaScript request. You should
* modify the document.write commands so that the HTML they
* write out fits with your desired ad layout.
*/

function google_ad_request_done(google_ads) {        
  var s = '';
  var i;

  if (google_ads.length > 0) {
    if (google_ads[0].type == "image") {
      //document.write('<a href="' + google_ads[0].url + '" target="_top" title="go to ' + google_ads[0].visible_url + '"><img style="border:none;" src="' + google_ads[0].image_url + '" width="' + google_ads[0].image_width + '" height="' + google_ads[0].image_height + '"/></a>');
      }
    // =========== Google-Anzeigen im Content ============================================================
    else if (google_cont == 1) {
      document.write('<div class="google_top"><a href="' + google_info.feedback_url + '" target="_blank">Google-Anzeigen</a></div>');
      document.write('<div class="google_content">');
      for (i = 0; i < google_ads.length; i++) {
        document.write('<div><a href="' + google_ads[i].url  + '" target="_blank" class="google_linktext"><strong>' + google_ads[i].line1 + '</strong></a><br /><span>' + google_ads[i].line2 + '&nbsp;' + google_ads[i].line3 + '</span><br /><a href="' + google_ads[i].url  + '" target="_blank">' + google_ads[i].visible_url + '</a></div>');
        if (i+1 < google_ads.length) {
            document.write('<div class="google_trennlinie"></div>');
        }
        }
      document.write('</div>');
      // Note that google_adnum is only incremented for CPC text ads
      if (google_ads[0].bidtype == "CPC") {
        google_adnum = google_adnum + google_ads.length;
        }
      }

    // =========== Google-Anzeigen im Skyscraper ============================================================
    else if (google_sky == 1) {
      document.write('<div class="nMain" style="width:160px;"><div class="nteaser301bg1px" style="width:160px; height:600px; background-image:url(http://pix.sueddeutsche.de/app/google/img/nteaser301_bg1px_google.gif);"><div class="nteaser301top1px" style="width:160px; background-image:url(http://pix.sueddeutsche.de/app/google/img/nteaser301_top1px_google.gif); background-repeat:no-repeat;">');
      document.write('<div class="nteaserheader" style="width:160px; padding-left:10px;"><a href="' + google_info.feedback_url + '" class="nlinkstandard" style="font-weight:bold;" target="_blank">Google-Anzeigen</a></div>');
      document.write('</div><div class="nteaser301content" style="height:557px; _height:567px; padding-left:10px;">');
      var anzahlAds = google_ads.length;
      for(i = 0; i < anzahlAds; i++) {
        if (i == 0) { document.write ('<div class="ndivlinetopfirst" style="margin-bottom:15px;">'); }
        else if (i == (anzahlAds - 1)) { document.write('<div class="ndivlinebottom">'); }
        else { document.write('<div class="ndivlinetop" style="margin-bottom:15px;">'); }
        document.write('<a href="' + google_ads[i].url  + '" class="nlinktext" target="_blank"><strong>' + google_ads[i].line1 + '</strong></a><br />');
        document.write('<a href="' + google_ads[i].url  + '" class="nlinktext" target="_blank">' + google_ads[i].line2 + '&nbsp;' + google_ads[i].line3 + '</a><br />');
        document.write('<a href="' + google_ads[i].url  + '" class="nlinkstandard" target="_blank">' + google_ads[i].visible_url.substr(0,20) + '</a></div>');
        }
      document.write('</div>');
      document.write('<div class="nteaser301bottom1px" style="width:160px; background-color:#f2f2f2; background-image:url(http://pix.sueddeutsche.de/app/google/img/nteaser301_bottom1px_google.gif); background-repeat:no-repeat;"></div>');
      document.write('</div>');
      document.write('</div>');
      // Note that google_adnum is only incremented for CPC text ads
      if (google_ads[0].bidtype == "CPC") {
        google_adnum = google_adnum + google_ads.length;
        }
      }

    // =========== Google-Anzeigen in der Servicespalte ============================================================
    else if (google_renav == 1) {
      document.write('<div class="google_teaserbox">');
      document.write('<div class="google_top"><a href="' + google_info.feedback_url + '" target="_blank">Google-Anzeigen</a></div>');
      
      var anzahlAds = google_ads.length;
      for (i = 0; i < anzahlAds; i++) {
        document.write('<div><a href="' + google_ads[i].url  + '" class="google_linktext" target="_blank"><strong>' + google_ads[i].line1 + '</strong></a><br />');
        document.write('<span class="google_linktext">' + google_ads[i].line2 + '&nbsp;' + google_ads[i].line3 + '</span><br />');
        document.write('<a href="' + google_ads[i].url  + '" class="google_linkstandard" target="_blank">' + google_ads[i].visible_url + '</a></div>');
        }
      
      document.write('</div>');
      // Note that google_adnum is only incremented for CPC text ads
      if (google_ads[0].bidtype == "CPC") {
        google_adnum = google_adnum + google_ads.length;
        }
      }

    // =========== Google-Anzeigen in der Homepage ============================================================
    else if (google_home == 1) {
      document.write('<table class="ModulBox" cellpadding="0" cellspacing="0"><tr><td class="ModulBoxObenLinks"><img src="http://pix.sueddeutsche.de/img/g_.gif" class="spacerGif"></td><td class="ModulBoxRahmenTop"><img src="http://pix.sueddeutsche.de/img/g_.gif" class="spacerGif"></td><td class="ModulBoxObenRechts"><img src="http://pix.sueddeutsche.de/img/g_.gif" class="spacerGif"></td></tr><tr><td class="ModulBoxRahmenContent" colspan="3" id="rechteSpalte">');
      document.write('<div class="ModulBoxDachzeile"><p><a href="' + google_info.feedback_url + '" id="title" target="_blank">Google-Anzeigen</a></p></div>');
      var anzahlAds = google_ads.length;
      for(i = 0; i < anzahlAds; i++) {
        document.write('<table class="ModulBoxContent" cellpadding="0" cellspacing="0"><tr><td class="ModulBoxContentText"><h4 class="headline"><a href="' + google_ads[i].url  + '" target="_blank">' + google_ads[i].line1 + '</a></h4><h5 class="fliesText">' + google_ads[i].line2 + '&nbsp;' + google_ads[i].line3 + '<br /><a href="' + google_ads[i].url  + '" class="mehr" target="_blank">' + google_ads[i].visible_url + '</a></h5></td></tr></table>');
        if (i < (anzahlAds - 1)) {
          document.write('<div class="linie"><img src="http://pix.sueddeutsche.de/img/g_.gif" class="spacerGif"></div>');
          }
        }
      document.write('</td></tr><tr><td class="ModulBoxUntenLinks"><img src="http://pix.sueddeutsche.de/img/g_.gif" class="spacerGif"></td><td class="ModulBoxRahmenBottom"><img src="http://pix.sueddeutsche.de/img/g_.gif" class="spacerGif"></td><td class="ModulBoxUntenRechts"><img src="http://pix.sueddeutsche.de/img/g_.gif" class="spacerGif"></td></tr></table>');
      }

    // =========== Google-Anzeigen ausgeblendet ============================================================
    else {
      //document.write('<!--' + google_info.feedback_url + '-->');
      //document.write('<!--' + google_ads[i].url  + '-->');
      //document.write('<!--' + google_ads[i].line1 + '-->');
      //document.write('<!--' + google_ads[i].line2 + '-->');
      //document.write('<!--' + google_ads[i].line3 + '-->');
      //document.write('<!--' + google_ads[i].visible_url + '-->');
      document.write('');
      }
    }
  }
// ENDE: Google Adsense
