

 var two_google_links='';
 var remaining_google_links='';
 top_google_links = true;

//This function only assigns values to string variables, does NOT print anything

/*
If Google link results > 5
		Content area displays first five links.
		Banner links displays up to two remaining links.

Else If Google link results <= 5
		Content area displays one to five links.
		No google banner displayed.
*/

function google_ad_request_done(google_ads)
{

// document.write("<b>" + google_ads.length + "</b>"); // test: display number of links displayed
	if(!top_google_links)
	{
		top_google_links = false;
	}

	var i;
	var limit = 5; //default : 2 links at the top
	var bottom_ads_start = 0; //show all links at the bottom by default

	if(google_ads.length > 5)
	{
		limit = 5;
		bottom_ads_start = 5;
	}
	else
	{
		limit = google_ads.length;
		bottom_ads_start = google_ads.length;
	}

	if(google_ads.length){

		//if displaying links at the top, write table and loop through google_ads[]

		if(top_google_links)
		{
			//now create a string that contains 2 google links in a table

			remaining_google_links += '<table cellpadding="0" cellspacing="0" border="0"  class="cpctable" width="100%"><tr><td>';
	 		remaining_google_links += '<div class="cpctitle">Sponsored Links</div><table cellpadding="0" cellspacing="0" border="0">';
			for(i = 0; i < limit; ++i)
			{
				remaining_google_links += '<tr><td class="ch" id="taw' + i + '" onMouseOver="ss(\'go to ' + google_ads[i].visible_url + '\')" onMouseOut="cs()" onClick="ga(this,event)">';
				remaining_google_links += '<a id="aw' + i + '" class="cpclink" href=' + google_ads[i].url + ' onMouseOver="return ss(\'go to ' + google_ads[i].visible_url + '\')" onMouseOut="cs()" target="_blank">' + google_ads[i].line1 + '</a>' + '<br><span class="cpctext">' + google_ads[i].line2 + ' ' + google_ads[i].line3 + '</span><br><span class="cpcurl">' + google_ads[i].visible_url + '</span><br><br></td></tr>';
			}
			remaining_google_links += '</table></td></tr></table>';
		}
		//now create a string that contains remaining google links

		if (bottom_ads_start < google_ads.length){

				two_google_links = '<table cellpadding="0" cellspacing="1" border="0" bgcolor="#003366" width="468"><tr><td><table cellpadding="5"  background="http://www.outdoorsbest.com/468x60bg.gif"cellspacing="0" border="0" width="100%" bgcolor="#ffffff">';

			for(i = bottom_ads_start; i < google_ads.length; i++){

				two_google_links +='<tr><td  background="" valign="top" class="ch" width="100%" id="taw' + i + '" onMouseOver="ss(\'go to ' + google_ads[i].visible_url + '\')" onMouseOut="cs()" onClick="ga(this,event)">';
				two_google_links +='<a id="aw' + i + '" class="cpclink" href=' + google_ads[i].url + ' onMouseOver="return ss(\'go to ' + google_ads[i].visible_url + '\')" onMouseOut="cs()">' + google_ads[i].line1 + '</a>' + '&nbsp;-&nbsp;<span class="cpcurl">' + google_ads[i].visible_url + '</span>' + '<br><span class="cpctext">' + google_ads[i].line2 + ' ' + google_ads[i].line3 + '</span></td></tr>';
			}
				two_google_links +='</tr></table></td></tr></table><div class="cpcspacer">&nbsp;</div>';

		}
	}
}