// Adsense for content.

function google_ad_request_done(google_ads) {
  /*
   * 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.
   */
  var s = '';
  var i;

  /*
   * Verify that there are actually ads to display.
   */
  if (google_ads.length == 0) {
    return;
  }

  /*
   * If an image ad is returned, then that ad should be
   * displayed. Otherwise, build a string containing all of
   * the ads and then use a document.write() command to
   * print it when the string is complete.
   */

  if (google_ads[0].type == "image") {
    s += '<a href="' + google_ads[0].url +
            '" target="_top" title="go to ' + google_ads[0].visible_url +
            '"><img border="0" src="' + google_ads[0].image_url +
            '"width="' + google_ads[0].image_width +
            '"height="' + google_ads[0].image_height + '"></a>';
  } else {
    s += '<div class="md4a" style="background-color: #f5f5f5;">' +
         '<div class="mdtop"><div class="mdformat"></div></div>' +
         '<div class="mdmid">' +
         '<div class="mdhdr" style="text-transform: none;">';
    s += '<a href="https://www.google.com/adsense/support/bin/request.py?contact=abg_afc&amp;hl=en" target="_blank" style="color: #000;">Ads by Google</a>';
    s += '</div>' +
         '<div class="mdbdy">';
    
    if (google_ads.length >= 1) {
      /*
       * For text ads, append each ad to the string.
       */
      for(i=0; i < google_ads.length; ++i) {
        s += '<div style="margin-bottom: 4px;">';
        s += '<a href="' + google_ads[i].url + '" ' +
                          'target="_blank"' +
                          'onmouseout="window.status=\'\'" ' +
                          'onmouseover="window.status=\'go to ' +
                          google_ads[i].visible_url + '\';return true;" ' +
                          'style="text-decoration:none">' +
                          '<span style="text-decoration:underline">' +
                          '<b>' + google_ads[i].line1 + '</b><br></span>' + 
                          '<span style="color:#000000">' +
                          google_ads[i].line2 + ' ' +
                          google_ads[i].line3 + '<br></span>' +
                          '<span style="color:#008000">' +
                          google_ads[i].visible_url + '</span></a>' +
                          '</div>';
      }
    }
    s += '</div>' + 
         '</div>' +
         '<div class="mdbot"><div class="mdformat"></div></div>' +
         '</div>';
  }

  document.write(s);
  return;
}

var path = ''+document.location.pathname;

// Google parameters.
google_ad_client = 'ca-tiscali-uk-con_js';
google_ad_output = 'js';
google_ad_type = 'text';
google_max_num_ads = '2';
google_language = 'en';
google_safe = 'high';
if(path.match(/^\/([^\/]+)\//)) {
  google_ad_channel = RegExp.$1;
}

//google_page_url = 'http://www.tiscali.co.uk/motoring/galleries/view/motoring/carstodroolat/browse/1'; // Remove when live.
//google_adtest = 'on'; // Remove when live.
//google_image_size = '468x60';
//google_encoding = 'utf8';
//google_ad_channel = 'sports';
//google_hints = '';
//google_kw = 'flowers, red roses';
//google_kw_type = 'broad';
//google_contents = '';
//google_ad_section = 'default';