function google_afs_request_done(google_ads){
	google_ad_request_done(google_ads);
}

function google_ad_request_done(google_ads) {
	
	var s = '';
	var i;
	
	if (google_ads.length == 0) {
		return;
	}
	
	if (google_ads[0].type == "flash") {
		//
	} else if (google_ads[0].type == "image") {
		//
	} else {
	  	
		if(google_ad_ourid==1){	// top box on profile page
			s += '<p style="padding:5px;font-size:11px;font-weight:bold;"><a style="text-decoration:none;color:#89a;" href="http://services.google.com/feedback/online_hws_feedback">ADS BY GOOGLE</a></p>';
			for(i = 0; i < google_ads.length; ++i) {  
			
				s += '<p style="font-size:13px;line-height:15px;padding:5px;"><a style="font-size:15px;line-hight:17px;text-decoration:none" href="' + 
				google_ads[i].url + '" 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><br></span></a> <span style="color:#000000">' +
				google_ads[i].line2 + ' ' + google_ads[i].line3 + '<br></span> <span><a style="color:#008000;text-decoration:none" href="' + 
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true">' + 
				google_ads[i].visible_url + '</span></a></p>';
			}
			
		}else if(google_ad_ourid==2){  // side bar 
			s += '<p style="padding:5px;font-size:11px;font-weight:bold;color:#89a"><a style="text-decoration:none;color:#89a;" href="http://services.google.com/feedback/online_hws_feedback">ADS BY GOOGLE</a></p>';

			for(i = 0; i < google_ads.length; ++i) {
			
				tvurl=google_ads[i].visible_url;
				if(tvurl.length>25)
					tvurl=tvurl.substr(0,20)+'...';
			
				s += '<p style="font-size:10px;line-height:12px;padding:0px 5px 8px 5px;line-height:17px"><a style="font-size:12px;line-hight:14px;text-decoration:none" href="' + 
				google_ads[i].url + '" 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><br></span></a> <span style="color:#000000;font-size:12px">' +
				google_ads[i].line2 + ' ' + google_ads[i].line3 + '<br></span> <span><a style="font-size:12px;color:#008000;text-decoration:none" href="' + 
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true">' + 
				tvurl + '</span></a></p>';
			}
			
		}else if(google_ad_ourid==3){  // horazontal - not used yet
			s += '</tr><tr><td><p style="padding:none;font-size:11px;font-weight:bold;color:#89a"><a style="text-decoration:none;color:#89a;" href="http://services.google.com/feedback/online_hws_feedback">ADS BY GOOGLE</a></p></td><tr></table>';

			s += '<table style="text-align:left"><tr>'; 

			for(i = 0; i < google_ads.length; ++i) {
			
				tvurl=google_ads[i].visible_url;
				if(tvurl.length>25)
					tvurl=tvurl.substr(0,20)+'...';
			
				s += '<td><p style="font-size:10px;line-height:12px;padding:2px 5px 2px 5px"><a style="font-size:12px;line-hight:14px;text-decoration:none" href="' + 
				google_ads[i].url + '" 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><br></span></a> <span style="color:#000000">' +
				google_ads[i].line2 + '<br/>' + google_ads[i].line3 + '<br></span> <span><a style="color:#008000;text-decoration:none" href="' + 
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true">' + 
				tvurl + '</span></a></p></td>';
			}
			
		}else if(google_ad_ourid==4){	// blocks on profile
			s += '<style>.title a{ text-decoration: none;} .title a:hover{text-decoration: underline;}</style><p style="background-color:#11568b;margin:0;padding:0 0 0 5px;font-weight:bold;font-size:11px;color:#000;padding-left:30px;"><a style="text-decoration:none;color:#3796df;" href="http://services.google.com/feedback/online_hws_feedback">ADS BY GOOGLE</a></p>';			

			for(i = 0; i < google_ads.length; ++i) {  
						
				s += '<p style="background-color:#11568b;font-size:13px;line-height:15px;margin:0;padding:10px 5px 5px 30px;"><a class="title" style="color:#FFFFFF;font-size:15px;line-hight:17px;font-weight:bold;" href="' + 
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true"> ' + 
				google_ads[i].line1 + '</a><br> <span style="color:#f3f2f2">' +
				google_ads[i].line2 + ' ' + google_ads[i].line3 + '<br></span> <span><a style="color:#acd3f1;text-decoration:none" href="' + 
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true">' + 
				google_ads[i].visible_url + '</span></a></p>';
			}

        }else if(google_ad_ourid==5){    // blocks on directory / new style
            s += '<p style="margin:0;padding:0;padding-bottom:5px;font-weight:bold;font-size:11px;color:#89a"><a style="text-decoration:none;color:#89a;" href="http://services.google.com/feedback/online_hws_feedback">ADS BY GOOGLE</a></p>';            

            for(i = 0; i < google_ads.length; ++i) {  
                        
                s += '<div class="g_ad"><a style="font-family:arial;font-size:15px;line-hight:17px;text-decoration:none" href="' + 
                google_ads[i].url + '" 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><br></span></a> <span style="color:#000000" class="body">' +
                google_ads[i].line2 + ' ' + google_ads[i].line3 + '<br></span> <span class="body"><a style="color:#606060;text-decoration:none" href="' + 
                google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
                google_ads[i].visible_url + '\';return true">' + 
                google_ads[i].visible_url + '</span></a></div>';
            }
        }else if(google_ad_ourid==6){  // custom search bar
            s += '<p style="display:inline;padding-left:5px;font-size:11px;font-weight:bold;color:#89a"><a style="text-decoration:none;color:#89a;" href="http://services.google.com/feedback/online_hws_feedback">ADS BY GOOGLE</a></p>';

            for(i = 0; i < google_ads.length; ++i) {
            
                tvurl=google_ads[i].visible_url;
                if(tvurl.length>25)
                    tvurl=tvurl.substr(0,20)+'...';
            
                s += '<p style="font-size:10px;line-height:12px;padding:0px 5px 8px 5px;line-height:17px"><a style="font-size:12px;line-hight:14px;text-decoration:none" href="' + 
                google_ads[i].url + '" 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><br></span></a> <span style="color:#000000;font-size:12px">' +
                google_ads[i].line2 + ' ' + google_ads[i].line3 + '<br></span> <span><a style="font-size:12px;color:#008000;text-decoration:none" href="' + 
                google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
                google_ads[i].visible_url + '\';return true">' + 
                tvurl + '</span></a></p>';
            }
            
		}else if(google_ad_ourid==7){	// blocks on profile - yellow
			s += '<style>.title a{ text-decoration: none;} .title a:hover{text-decoration: underline;}</style><p style="background-color:#d2fcd2;margin:0;padding:0 0 0 10px;padding-bottom:10px;padding-top:10px;font-weight:bold;font-size:11px;color:#89a;padding-left:20px;"><a style="text-decoration:none;color:#89a;" href="http://services.google.com/feedback/online_hws_feedback">ADS BY GOOGLE</a></p>';			

			for(i = 0; i < google_ads.length; ++i) {  
						
				s += '<p style="background-color:#d2fcd2;font-size:13px;line-height:15px;margin:0;padding:3px 10px 10px 20px;"><a class="title" style="color:#0000AA;font-size:15px;line-hight:17px;font-weight:bold;" href="' + 
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true"> ' + 
				google_ads[i].line1 + '</a><br> <span style="color:#000000">' +
				google_ads[i].line2 + ' ' + google_ads[i].line3 + '<br></span> <span><a style="color:#008000;text-decoration:none" href="' + 
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true">' + 
				google_ads[i].visible_url + '</span></a></p>';
			}
		}else if(google_ad_ourid==8){	// blocks on profile - yellow
			s += '<style>.title a{ text-decoration: none;} .title a:hover{text-decoration: underline;}</style><p style="background-color:#e0eeff;margin:0;padding:0 0 0 10px;padding-bottom:10px;padding-top:10px;font-weight:bold;font-size:11px;color:#89a;padding-left:20px;"><a style="text-decoration:none;color:#89a;" href="http://services.google.com/feedback/online_hws_feedback">ADS BY GOOGLE</a></p>';			

			for(i = 0; i < google_ads.length; ++i) {   // new colour - e0eeff
						
				s += '<p style="background-color:#e0eeff;font-size:13px;line-height:15px;margin:0;padding:3px 10px 10px 20px;"><a class="title" style="color:#0000AA;font-size:15px;line-hight:17px;font-weight:bold;" href="' + 
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true"> ' + 
				google_ads[i].line1 + '</a><br> <span style="color:#000000">' +
				google_ads[i].line2 + ' ' + google_ads[i].line3 + '<br></span> <span><a style="color:#008000;text-decoration:none" href="' + 
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true">' + 
				google_ads[i].visible_url + '</span></a></p>';
			}
			            
		}else if(google_ad_ourid==9){	// blocks on profile - yellow
			/*s += '<style>.title a{ text-decoration: underline;} .title a:hover{text-decoration: underline;}</style><p style="background-color:#fff9dd;margin:0;padding:0 0 0 10px;padding-bottom:10px;padding-top:10px;font-weight:bold;font-size:11px;color:#89a;padding-left:20px;"><a style="text-decoration:none;color:#89a;" href="http://services.google.com/feedback/online_hws_feedback">ADS BY GOOGLE</a></p>';			

			for(i = 0; i < google_ads.length; ++i) {   // new colour - e0eeff
						
				s += '<p style="background-color:#fff9dd;font-size:13px;line-height:15px;margin:0;padding:3px 10px 10px 20px;"><a class="title" style="color:#0000AA;font-size:15px;line-hight:17px;font-weight:bold;text-decoration:underline;" href="' + 
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true"> ' + 
				google_ads[i].line1 + '</a><br> <span style="color:#000000">' +
				google_ads[i].line2 + ' ' + google_ads[i].line3 + '<br></span> <span><a style="color:#008000;text-decoration:none" href="' + 
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true">' + 
				google_ads[i].visible_url + '</span></a></p>';
			} */
			s += '<div style="background-color:#fff9dd"><p style="padding:5px;font-size:11px;margin:0;font-weight:bold;padding-left:10px;"><a style="text-decoration:none;color:#89a;" href="http://services.google.com/feedback/online_hws_feedback">ADS BY GOOGLE</a></p>';
				for(i = 0; i < google_ads.length; ++i) {  
					s += '<p style="font-size:13px;line-height:15px;padding:5px;margin:0;padding-left:10px;"><a style="font-size:16px;line-height:17px;text-decoration:none" href="' + 
					google_ads[i].url + '" 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><br></span></a> <span style="color:#000000;padding-top:3px;display:block;">' +
					google_ads[i].line2 + ' ' + google_ads[i].line3 + '<br></span> <span><a style="color:#008000;text-decoration:none" href="' + 
					google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
					google_ads[i].visible_url + '\';return true">' + 
					google_ads[i].visible_url + '</span></a></p>';
				}
			s += '</div>';

			            
		}else if(google_ad_ourid==10){	// blocks on profile - yellow
			s += '<style>.title a{ text-decoration: none;} .title a:hover{text-decoration: underline;}</style><p style="background-color:#ebe5e5;margin:0;padding:0 0 0 10px;padding-bottom:10px;padding-top:10px;font-weight:bold;font-size:11px;color:#89a;padding-left:20px;"><a style="text-decoration:none;color:#89a;" href="http://services.google.com/feedback/online_hws_feedback">ADS BY GOOGLE</a></p>';			

			for(i = 0; i < google_ads.length; ++i) {   // new colour - e0eeff
						
				s += '<p style="background-color:#ebe5e5;font-size:13px;line-height:15px;margin:0;padding:3px 10px 10px 20px;"><a class="title" style="color:#0000AA;font-size:15px;line-hight:17px;font-weight:bold;" href="' + 
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true"> ' + 
				google_ads[i].line1 + '</a><br> <span style="color:#000000">' +
				google_ads[i].line2 + ' ' + google_ads[i].line3 + '<br></span> <span><a style="color:#008000;text-decoration:none" href="' + 
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true">' + 
				google_ads[i].visible_url + '</span></a></p>';
			}
			            
        }else if(google_ad_ourid==999){    // AFS SEARCH CODE
        
              var narrowAds = "";   // wide ad unit html text
              var content_start = '<p style="margin:0;padding:0;padding-bottom:5px;font-weight:bold;font-size:11px;color:#89a;font-family:arial;"><a style="text-decoration:none;color:#89a;" href="http://services.google.com/feedback/online_hws_feedback">ADS BY GOOGLE</a></p>';   // narrow ad unit html text
              var bar_start = '<p style="display:inline;padding-left:5px;font-size:11px;font-weight:bold;color:#89a"><a style="text-decoration:none;color:#89a;" href="http://services.google.com/feedback/online_hws_feedback">ADS BY GOOGLE</a></p>';
              var content_ads = Array();            
              var bar_ads = Array();            

     /*           for(i = 0; i < google_ads.length; ++i) {
                
                }
    */            
              var ad_type = 'content';
              var r = 0;
              var google_num_ads = google_ads.length;
              
              for(i = 0; i < google_num_ads; i++)
              {
                
                if(i >= google_styles["content"] && ad_type != "bar") {
                    r = 0;
                    ad_type = "bar";
                }
                
    //            alert("ad:" + i + " - for: " + ad_type);
                  if (google_ads[i].type=="text/wide")
                  {
                  }

                  else
                  {
//                                      alert(google_ads[i].url);
                  if(ad_type == "content") {
                            content_ads[r] = '<div class="g_ad"><a style="font-family:arial;font-size:15px;line-hight:17px;text-decoration:none" href="' + 
                            google_ads[i].url + '" 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><br></span></a> <span style="color:#000000" class="body">' +
                            google_ads[i].line2 + ' ' + google_ads[i].line3 + '<br></span> <span class="body"><a style="color:#606060;text-decoration:none" href="' + 
                            google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
                            google_ads[i].visible_url + '\';return true">' + 
                            google_ads[i].visible_url + '</span></a></div>';
/*                        content_ads[r] = '<p style="font-size:13px;line-height:15px;margin:0;padding:5px 5px 10px 5px;"><a style="font-size:16px;line-hight:17px;text-decoration:none" href="' + 
                            google_ads[i].url + '" 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><br></span></a> <span style="color:#000000;padding-top:3px;display:block;">' +
                            google_ads[i].line2 + ' ' + google_ads[i].line3 + '<br></span> <span><a style="color:#008000;text-decoration:none" href="' + 
                            google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
                            google_ads[i].visible_url + '\';return true">' + 
                            google_ads[i].visible_url + '</span></a></p>';
*/                            r++;
                    } else {
                        tvurl=google_ads[i].visible_url;
                        if(tvurl.length>25)
                            tvurl=tvurl.substr(0,20)+'...';
                    
                         bar_ads[r] = '<p style="font-size:10px;line-height:12px;padding:0px 5px 8px 5px;line-height:17px"><a style="font-size:12px;line-hight:14px;text-decoration:none" href="' + 
                        google_ads[i].url + '" 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><br></span></a> <span style="color:#000000;font-size:12px">' +
                        google_ads[i].line2 + ' ' + google_ads[i].line3 + '<br></span> <span><a style="font-size:12px;color:#008000;text-decoration:none" href="' + 
                        google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
                        google_ads[i].visible_url + '\';return true">' + 
                        tvurl + '</span></a></p>';
/*                        bar_ads[r] = '<p style="font-size:10px;line-height:12px;padding:8px 5px 8px 5px"><a style="font-size:12px;line-hight:14px;text-decoration:none" href="' + 
                        google_ads[i].url + '" 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><br></span></a> <span style="color:#000000">' +
                        google_ads[i].line2 + ' ' + google_ads[i].line3 + '<br></span> <span><a style="color:#008000;text-decoration:none" href="' + 
                        google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
                        google_ads[i].visible_url + '\';return true">' + 
                        tvurl + '</span></a></p>';
*/                            r++;
                    
                    }
                  }
              }



              // Write HTML for wide and narrow ads to the proper <div> elements
    //          document.getElementById("bar_top").innerHTML = narrowAds;//wideAds
    //          alert(narrowAds);
    //          document.getElementById("bar_bot").innerHTML = narrowAds;//narrowAds;
//              alert("eh");
              var run_tot = 0;
              
                for(var i in google_blocks) {
                    var ads = '';
                    var value = google_blocks[i];
                    var to = run_tot + value;

                        if(i == "bar_top") {
                              if(value > 0) {
                                  ads = content_start;

                                  for(a = run_tot; a < to; a++) {
                                    if(content_ads[a] != null){
                                        ads += content_ads[a];
                                    }
                                    run_tot++;
                                  
                                  }
                                  ads += "</div>";
                              }
                        }else if(i == "bar_bot") {
                              if(value > 0) {
                                  ads = content_start;
                                  for(a = run_tot; a < to; a++) {
                                    if(content_ads[a] != null){
                                        ads += content_ads[a];
                                    }
                                    run_tot++;
                                  }
                                    
                                  ads += "</div>";
                              }
                        }else if(i == "side") {
                              if(value > 0) {
                              ads = bar_start;
                                  for(a = 0; a < value; a++) {
                                    if(bar_ads[a] != null){
                                        ads += bar_ads[a];
                                    } else {
                                        ads = '';
                                    }
                                    run_tot++;
                                  }
                              }
                              
                        }  
                    document.getElementById(i).innerHTML = ads;//wideAds
                }
        
        }
        
    }
    
    if(google_ad_ourid !=999){
        document.write(s);
    }
    return;

}