var ct = window.ct || {};
ct.adsense = {
  cpc_num: 0,
  width: 'wide'
};

function google_ad_request_done(google_ads) {
  if (google_ads.length == 0) {
    return;
  }
  var s = '<div class="adsense">';
  var i;
  s += '<div style="margin:8px 4px;"><a href="' +
        google_info.feedback_url + '" style="color:#000;text-decoration:underline;">Ads by Google</a></div>';
  if (google_ads[0].type == 'flash') {
    s += '<div><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="AllowScriptAccess" value="never">' +
	 '<embed 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></div>';
  } else if (google_ads[0].type == 'image') {
    s += '<div><a href="' + 
         google_ads[0].url + '" target="_top" title="go to ' + 
         google_ads[0].visible_url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
         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></div>';
  } else if (google_ads[0].type == 'html') {
    s += google_ads[0].snippet;
  } else {
    for (i = 0; i < google_ads.length; i++) {
      s += '<div style="margin:8px 0;padding:0 4px;"><div><a style="text-decoration:none" href="' + 
           google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
           google_ads[i].visible_url + '\';return true"><span style="text-decoration:underline"><b>' + 
           google_ads[i].line1 + '</b></span></a> <a style="margin-left:1em;color:#008000;font-size:10px;text-decoration:none" href="' +
           google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
           google_ads[i].visible_url + '\';return true">' +
           google_ads[i].visible_url + '</a></div><div style="color:#000;">' +
           google_ads[i].line2 + '&nbsp;' +
           google_ads[i].line3 + '</div></div>';
    }
    if (google_ads[0].bidtype == 'CPC') {
      window.ct.adsense.cpc_num += google_ads.length;
    }
  }
  s += '</div>';
  document.write(s);
  return;
}
