  var google_adnum = 0;
  var google_ad_index = 0;
  var split = false;
  var afs_ads = null;
  var is_afs = false;
  var afs_second_half = false;
  function google_afs_request_done(google_ads) {
  	is_afs = true;
  	google_ad_request_done(google_ads);
  	is_afs = false;
  	afs_ads = google_ads;
  }
  
  function display_rest_of_afs() {
  	afs_second_half = true;
  	google_ad_request_done(afs_ads);
  	afs_second_half = false;
  	afs_ads = null;
  }
  
  function google_ad_request_done(google_ads) {
	var s = '';
	var i;
	var adnum_add = 1;

	if (google_ads.length == 0) {
		return;
	}

	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>';
		s += '<br/><div style="width10px; float:right;"><a href=\"' + google_info.feedback_url + '\" style="color:000000">Ads&nbsp;by&nbsp;Google</a></div>';
	} else if (google_ads[0].type == "image") {
   		s += '<a target="_blank" href="' +
			google_ads[0].url + '" target="_top" 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>';
		s += '<br/><div style="width10px; float:right;"><a href=\"' + google_info.feedback_url + '\" style="color:000000">Ads&nbsp;by&nbsp;Google</a></div>';
	} else if (google_ads[0].type == "html") {
		s += google_ads[0].snippet;
	} else {
		if (google_ads.length == 1 && !is_afs) {
   			s += '<a target="_blank" style="text-decoration:none" href="' +
				google_ads[0].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[0].visible_url + '\';return true"> <span style="text-decoration:underline;font-size:20pt"> <b>' +
				google_ads[0].line1 + '</b><br></span></a> <span style="color:#000000;font-size:16pt">' +
				google_ads[0].line2 + '&nbsp;' +
				google_ads[0].line3 + '<br></span> <span><a target="_blank" style="color:#008000;font-size:14pt;text-decoration:none" href="' +
				google_ads[0].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[0].visible_url + '\';return true">' +
				google_ads[0].visible_url + '</span></a><br>';
			s += '<br/><br/><div style="width10px; float:right;"><a href=\"' + google_info.feedback_url + '\" style="color:000000">Ads&nbsp;by&nbsp;Google</a></div>';
		} else {
			adnum_add = num_ads;
			google_ad_current_block[google_ad_index] = 0;
			var feedback_url = 'http://services.google.com/feedback/online_hws_feedback';
			if (typeof(google_info) != 'undefined') {
				feedback_url = google_info.feedback_url;
			}
			if (google_link == 'top') {
				s += '<div style="margin-bottom:-5px;"><a href=\"' + feedback_url + '\" style="font-weight:bold; color:#666666; text-decoration:none;">Ads&nbsp;by&nbsp;Google:</a></div>';
			} else if (google_link == 'top_bold') {
				s += '<div style="margin-bottom:-5px;"><a style="font:12px Verdana, Arial, Helvetica, sans-serif; font-weight:bold; color:#666666; text-decoration:none;" href=\"' + feedback_url + '\">Ads&nbsp;by&nbsp;Google:</a></div>';
			}
			var length = google_ads.length;
			if (is_afs && num_ads < length) {
			 length = num_ads;
			}
			var start = 0;
			if (afs_second_half) {
			 start = google_skip;
			}
			var divider = 2 + start;
			for(i = start; i < length; ++i) {
				j = i/num_ads;
				if (i % num_ads == 0) {
					if (i == 0) {
						s += '<div id="'+google_ad_index+'gad_'+j+'">';
					} else {
						s += '<div id="'+google_ad_index+'gad_'+j+'">';
					}
				}
				var br = ' ';
				if (desc == 'bottom') {
					br = '<br/>';
				}
				s += '<br><a target="_blank" style="font-size:'+font_size+';color:'+color_link+';text-decoration:none" href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\';this.style.color=\''+color_link+'\';" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';this.style.color=\'#afaf00\';return true"><b>' +
				google_ads[i].line1 + '</b>'+br+'</a><span style="font-size:'+font_size+'; color:#000000">' +
				google_ads[i].line2;
				if (google_ads[i].line3 != undefined) {
					s += '&nbsp;' + google_ads[i].line3;
				}
				s += '<br/></span><a target="_blank" class="google_link" style="font-size:'+font_size+'; color:#'+color_url+';text-decoration:none" href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\';this.style.color=\''+color_url+'\';" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';this.style.color=\'#afaf00\';return true">' +
				google_ads[i].visible_url + '</a><br>';
				if (i % num_ads == (num_ads-1)) {
					s += '</div>';
				}
				if (split && i == divider) {
					s += '</td>';
					s += '<td>';
					s += '  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
					s += '</td>';
					s += '<td style="width:336; height:280;" valign="top">';
				}
			}
			//s += '<br/><br/><div style="width10px; float:right;"><a href=\"' + feedback_url + '\" style="color:000000">Ads&nbsp;by&nbsp;Google</a></div>';
   			//s += '<div style="margin-top:5px;"><a style="padding:1px 3px; color:#ffffff; background-color:rgb(165, 165, 255); font-weight:bold; text-decoration:none;" href="" onclick="return google_ad_scroll('+google_ad_index+',\'up\');"><</a>&nbsp;<a style="padding:1px 3px; color:#ffffff; background-color:rgb(165, 165, 255); font-weight:bold; text-decoration:none;" href="" onclick="return google_ad_scroll('+google_ad_index+',\'down\');">></a></div>';
		}
    }
    //if (google_ads[0].bidtype == "CPC") {  /* insert this snippet for each ad call */
		google_adnum = google_adnum + adnum_add;
	//}
	google_ad_index++;
    document.write(s);
    return;
  }
  
  var google_ad_current_block = [];
  function google_ad_scroll(unique_identifier, dir) {
  	var new_block_id = 0;
	if (dir == 'up') {
		new_block_id = google_ad_current_block[unique_identifier] - 1;
	} else {
		new_block_id = google_ad_current_block[unique_identifier] + 1;
	}
	var new_block = document.getElementById(unique_identifier+'gad_'+new_block_id);
	if (null != new_block) {
		var current_block = document.getElementById(unique_identifier+'gad_'+google_ad_current_block[unique_identifier]);
		current_block.style.display = 'none';
		new_block.style.display = 'block';
		google_ad_current_block[unique_identifier] = new_block_id;
	}
	return false;
  }