// This function displays the ad results.
// It must be defined above the script that calls show_ads.js
// to guarantee that it is defined when show_ads.js makes the call-back.
function google_ad_request_done(google_ads) {

	// Proceed only if we have ads to display!
	if (google_ads.length < 1 )
	    return;
	
    if (typeof (googleAdTitle) == 'undefined' || googleAdTitle.length < 2)
        googleAdTitle = new Array("Ads by Google", "What's This?", '320', '330' );
    else if (typeof (googleAdTitle) == 'undefined' || (googleAdTitle.length >= 2 && googleAdTitle.length < 4))
        googleAdTitle = new Array(googleAdTitle[0], googleAdTitle[1], '320', '330' );
	
	if (typeof (googleAdAlign) != 'undefined')
	    document.write("<div style='text-align:" + googleAdAlign + "'>");
	    
	document.write("<div id=\"googleAd\" class=\"textAd\"><div class=\"textAdHeader\"><h3>" + googleAdTitle[0] + "</h3><div class=\"headerLink\"><a href=\"javascript:commonPopup('/tools/googleAdHelp', '" + googleAdTitle[2] + "', '" + googleAdTitle[3] + "')\">" + googleAdTitle[1] + "</a></div></div><div class=\"textAdBody\">");
	
	// For text ads, display each ad in turn.
	// In this example, each ad goes in a new row in the table.
	if (google_ads[0].type == 'text') {
	for(i = 0; i < google_ads.length; ++i) {
		document.write("<p>" + 
		"<a href=\"" + google_ads[i].url + "\" target=\"_blank\"" + ">" +
		google_ads[i].line1 + "</a><br />" + 
		"<a href=\"" + google_ads[i].url + "\" class=\"textAdDesc\" target=\"_blank\"" + ">" + google_ads[i].line2 + " " +
		google_ads[i].line3 +  "</a><br />" +
		"<a href=\"" + google_ads[i].url + "\" target=\"_blank\"" + ">" +
		google_ads[i].visible_url +
		"</a></p>"); 
	}
	}

	// For an image ad, display the image; there will be only one .
	if (google_ads[0].type == 'image') {
	document.write("<tr><td align=\"center\">" +
		"<a href=\"" + google_ads[0].url + "\"target=_blank\"" + "\">" +
		"<img src=\"" + google_ads[0].image_url + 
		"\" height=\"" + google_ads[0].height + 
		"\" width=\"" + google_ads[0].width +
		"\" border=\"0\"></a></td></tr>");
	}

	// Finish up anything that needs finishing up
	document.write ("</div>"); //end of textAdBody
	document.write ("</div>"); //end of textAd
	
    if (typeof (googleAdAlign) != 'undefined')
	    document.write ("</div>");

	google_encoding = "utf8";
}