hide_ads=false;
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;
var visURL = "";
var advert_number_to_display = 4;
/* Verify that there are actually ads to display. */
if (google_ads.length == 0) { return; } 
else {  // it should be noted that we are intentionally ignoring the one ad case, we want either the first N adverts or the whatever Google gives us whichever is the smaller
	if (google_ads.length < advert_number_to_display) numberOfAdverts = google_ads.length;
	else numberOfAdverts = advert_number_to_display;
	/* For text ads, append each ad to the string. */
		s+='<div class="googleads">';
		main_number = 3; // number of ads to display in the main section
		blog_number = 1; // number of ads to display in the blog section
		weather_top_number = 1; // number of ads to display in the weather section at the top
		weather_bottom_number = 4; // number of ads to display in the weather section at the top
		if(!restricted){ s+='<a href="' + google_info.feedback_url + '" class="googlelink">Ads by Google</a>'; }
		else{ }
		switch(custom_type){
			case "main-wide":
			startnum = 0;
			endnum = main_number;
			break;
			case "blog-wide-1":
			startnum = 0;
			endnum = blog_number;
			break;
			case "blog-wide-2":
			startnum = 1;
			endnum = startnum + blog_number;
			break;
			case "blog-wide-3":
			startnum = 2;
			endnum = startnum + blog_number;
			break;
			case "weather-top":
			startnum = 0;
			endnum = weather_top_number;
			break;
			case "weather-bottom":
			startnum = 1;
			endnum = weather_bottom_number;
			break;
		}
		// we want to ensure that we show the correct ads for the right hand side, even though google may not send the correct number  
		if(endnum > (google_ads.length)){ // look for whetehr googel sent us a lesser number
			endnum = google_ads.length; // set the endnum back to get the end of the list sent
			if(startnum > (google_ads.length - 1))startnum=endnum-blog_number; // try to get the right number of ads
			if(startnum < 0)startnum=0; // if all else fails start at 0
		}
		s+='<ul class="sponsored-google-ads">';
		//window.alert("startnum=" + startnum + " endnum=" + endnum + " google_ads.length=" + google_ads.length );
		for(i = startnum; i < endnum; ++i) {
		// we need to process the visible url so that we don't have it spilling out over the side
			rawvisURL = google_ads[i].visible_url;
			if((rawvisURL.length > 18) && (custom_type=="right-sidebar")){
				visURL=rawvisURL.slice(0,18);
				visURL += "...";
			} else { visURL=rawvisURL; }
			s+='<li>';
			s+='<a href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + visURL + '\'"><strong>' + google_ads[i].line1 + '</strong></a>';
			s+=' &nbsp; <a href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + visURL + '\'" class="url">(' + visURL + ')</a>';
			s+='<p><a href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + visURL + '\'">' + google_ads[i].line2 + '&nbsp;' + google_ads[i].line3 + '</a></p>';
			s+='</li>';
		}
		s+="</ul>";
		s+='</div>'; 
	}
	//document.write(s);
	if(!hide_ads){document.write(s);}
	//window.alert(s);
	return;
}
custom_type="main-wide"; // set global value to the ad-type that isbackground-color:#e4f9db the ones in the middle section with the listings
global_s="";