var adsenseCurrent = 0;
var adsenseContainer = new Array();
var adsenseLineSeperator = new Array();

function google_ad_request_done(google_ads)
{
	adsenseCurrent++;
	
	if (google_ads.length == 0 || adsenseCurrent > adsenseContainer.length || adsenseCurrent > adsenseLineSeperator.length)
	{
		return;
	}

	var content = '';


	if (google_ads[0].type == "flash")
	{
		content = '<div class="goggleLink" style="width: ' + google_ads[0].image_width + 'px;">' +
		          ' <a href="' + google_info.feedback_url + '" target="_blank">Ads by Google</a>' +
		          '</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>';
	}
	else if (google_ads[0].type == "image")
	{
		content = '<div>' +
		          ' <div class="goggleLink" style="width: ' + google_ads[0].image_width + 'px;">' +
		          '  <a href="' + google_info.feedback_url + '" target="_blank">Ads by Google</a>' +
		          ' </div>' +
		          ' <a href="' + google_ads[0].url + '" target="_blank" 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><br />';
	}
	else if (google_ads[0].type == "html")
	{
		content = google_ads[0].snippet;
	}
	else
	{
		content = '<div class="adsense">' +
		          '<div class="goggleLink"><a href="' + google_info.feedback_url + '\" target="_blank">Ads by Google</a></div>' +
		          '<ul>';
	
		for (var i = 0; i < google_ads.length; i++)
		{
			content += '<li>' +
			           ' <a href="' + google_ads[i].url + '" target="_blank" style="text-decoration: none" 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><br />' +
			           ' <span style="color: #000">' +
			           '  ' + google_ads[i].line2 + adsenseLineSeperator[adsenseCurrent-1] +
			           '  ' + google_ads[i].line3 + '<br />' +
			           ' </span>' +
			           ' <a href="' + google_ads[i].url + '" target="_blank" style="color: #008000; text-decoration: none" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\';return true">' +
			           '  ' + google_ads[i].visible_url +
			           ' </a>' +
			           '</li>';
		}
		
		content += '</ul>' +
		           '<div style="clear: both; height: 1px;"></div>' +
		           '</div>';
	}
	
	var obj = document.getElementById(adsenseContainer[adsenseCurrent-1]);
	if (obj) obj.innerHTML = content;
}
