function google_ad_request_done(google_ads)
{
  google_ad_request_done_entry(google_ads);
}


function google_ad_request_done_entry(google_ads)
{
  var s = '';
  var i;
  /** Verify that there are actually ads to display.*/
  if (google_ads.length == 0) {
    return;
  }
  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 if (google_ads[0].type == "flash") {
    s += '<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>';
  } 
  else if (google_ads[0].type == "text") 
  {
    s += '<h4 class="google_ad_header">Ads by Google</h4><div class="google-ads">';
    if (google_ads.length == 1) 
    {
        var link = '<a target="_blank" href="' + google_ads[0].url + '" ' +
                        'onmouseout="window.status=\'\';return true;" ' +
                        'onmouseover="window.status=\'go to ' +
                        google_ads[0].visible_url + '\';return true;" ' +
                        'style="text-decoration:none;">';
  s += link +
		  '<span class="google_ad_title">' +
		  google_ads[0].line1 + '</a><br/></span>' + 
		  '<span class="google_ad_text">' +
		  google_ads[0].line2 + '&nbsp;' +
		  google_ads[0].line3 + '<br/></span>' +
		  link + '<span class="google_ad_link">' +
		  google_ads[0].visible_url + '</span></a><br/>';
    } 
    else
    {
  	  for(i=0; i < google_ads.length; ++i) 
  	  {
        var link = '<a target="_blank" href="' + google_ads[i].url + '" ' +
                              'onmouseout="window.status=\'\';return true;" ' +
                              'onmouseover="window.status=\'go to ' +
                              google_ads[i].visible_url + '\';return true;" ' +
                                  'style="text-decoration:none;">';
      s += '<div class="google-ad">' + link +	'<span class="google_ad_title">';
      s += google_ads[i].line1 + '</a><br/></span>' + '<span class="google_ad_text">' +  google_ads[i].line2 + '&nbsp;' +
			google_ads[i].line3 + '<br/></span>' +	link + '<span class="google_ad_link">' +	google_ads[i].visible_url + '</span></a></div>';
      }
    }
    s += '<div class="clear"></div></div>';
  }
  document.write(s);
  return;
}
