function google_ad_request_done(google_ads)
{
    var start_call  = new Date().getTime();
    var call_time   = ( start_call - start_time ) / 1000;

    var  Ads_header = '<div style="text-align:left; height: 20px;">' +
    				  '<a style="text-decoration:none; font-weight: normal; font-size: 12px; color: #929292;"'+
    				  'href="'+ google_info.feedback_url +'" target="'+ gAFC_target +'">'+ google_afs_caption +'</a></div>';
    var afc_ads      = '';
    var i;

    if (google_ads.length == 0){
        // alert( "google_ad_request_done\n\n"+ afc_container +":\t"+ google_ads.length +"\ncall:\t"+ call_time +"sec" );
      return;
    }

    if      (google_ads[0].type == "flash")     afc_ads += createFlash_AFC_Ad(google_ads);
    else if (google_ads[0].type == "image")     afc_ads += createImg_AFC_Ad(google_ads);
    else if (google_ads[0].type == "html")      afc_ads += google_ads[0].snippet;
    else
    {
        var AFC_Format_obj = (afc_container == "right_afc_container")?
                                                            {	'container_css': "padding: 7px 0px; font-size: 11px;",
                                                            	'head_class':    "a_google_afs_head",
                                                            	'txt_break':     false,
                                                            	'txt_css':       "line-height: 150%;",
                                                            	'url_break':     true,
                                                            	'url_class':     "a_google_afs_url",
                                                            	'type':          "vertical"
                                     	                    } :
                                                            {   'container_css': "padding: 0px 9px; margin-bottom: 6px;" +
                                                                                 "font-size: 12px; height: 38px;",

                                                                'head_class':    "a_google_afs_head",
                                                                'txt_break':     false,
                                                                'txt_css':       "line-height: 150%;",
                                                                'url_break':     false,
                                                                'url_class':     "a_google_afs_url2",
                                                                'type':          "horizontal"
                                                            };
        for(i = 0; i < google_ads.length; ++i)  afc_ads +=  createTxt_AFC_Ad( google_ads[i], AFC_Format_obj );

        if( afc_ads == ""                   ) afc_cnt.style.display  = "none";
        if( google_ads[0].bidtype == "CPC"  ) google_afc_skips      += google_ads.length; // skip
    }
    var afc_cnt = document.getElementById(afc_container);
    if( afc_cnt )   afc_cnt.innerHTML = Ads_header + afc_ads;
/*
    alert(  "google_ad_request_done\n\n"+ afc_container +":\t"+ google_ads.length +"\ncall:\t\t\t"+ call_time +"sec\n"+
            "javascript:\t"+ ((new Date().getTime() - start_call) / 1000) +"sec" );
*/
  return;
}


function createFlash_AFC_Ad( google_ads ){
    return  '<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>';
}


function createImg_AFC_Ad( google_ads ){
    return  '<a href="' +
            google_ads[0].url           + '" target="'+ gAFC_target +'" 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>';
}


function createTxt_AFC_Ad( data_obj, format_obj ){
    if( typeof data_obj == "undefined" ) return '';

    try{    data_obj.line1       = decodeURI(data_obj.line1);           }catch(e){}
    try{    data_obj.visible_url = decodeURI(data_obj.visible_url);     }catch(e){}

    return ((format_obj.type == "vertical" )? createVerticalAFCAd( data_obj, format_obj ) : createHorizontalAFCAd( data_obj, format_obj ) );
}


function createVerticalAFCAd( data_obj, format_obj ){
	return 	'<div 	style="'+ format_obj.container_css +'" onmouseover="this.style.backgroundColor=\'#fef3e0\';" '  +
	 													 ' onmouseout="this.style.backgroundColor=\'\';">'			+
    		'<a class="'+ format_obj.head_class +'" onmouseover="javascript:window.status=\''						+
             data_obj.url + '\';return true;" onmouseout="javascript:window.status=\'\';return true;" '             +
             'href="' + data_obj.url + '" target="'+ gAFC_target +'">'	+   data_obj.line1  +'</a><br>'  		                +
             '<span style="'+ format_obj.txt_css +'">' 		+   data_obj.line2	+( (format_obj.txt_break)? '<br/>' : '&nbsp;' )+
                                                                data_obj.line3  +'</span>'		                    +
             ( (format_obj.url_break)? '<br/>' : '&nbsp;&nbsp;&nbsp;' ) +
             '<a class="'+ format_obj.url_class +'" onmouseover="javascript:window.status=\''+   data_obj.url 	    +'\';return true;" '+
             'onmouseout="javascript:window.status=\'\';return true;" '                                             +
             'href="' + data_obj.url   + '" target="'+ gAFC_target +'">'+ data_obj.visible_url +'</a></div>';
}


function createHorizontalAFCAd( data_obj, format_obj ){
	return 	'<div  	style="'+ format_obj.container_css + ' background:url('+ root_directory +'images/orange_design/greybox_ad.gif) no-repeat;" '+
                    'onmouseover="this.style.backgroundImage=\'url('+ root_directory +'images/orange_design/greybox_ad_over.gif)\'" '+
                    'onmouseout ="this.style.backgroundImage=\'url('+ root_directory +'images/orange_design/greybox_ad.gif)\'">'     +
            '<div style="padding-top: 3px;">' +

    		'<div style="float: left; display: inline;">'+
            '<a class="'+ format_obj.head_class +'" onmouseover="javascript:window.status=\''						+
             data_obj.url + '\';return true;" onmouseout="javascript:window.status=\'\';return true;" '             +
             'href="' + data_obj.url + '" target="_blank">'	+   data_obj.line1  +'</a><br>'  		    +
             '<span style="'+ format_obj.txt_css +'">' 		+   data_obj.line2	+( (format_obj.txt_break)? '<br/>' : '&nbsp;' )+
             ( (data_obj.type == "text/wide")?           '' : (	data_obj.line3 ) ) 	+'</span>'		                +
             ( (format_obj.url_break)? '<br/>' :  '') + // '&nbsp;&nbsp;&nbsp;'
             '</div><div style="float: right; padding-top: 10px; display: inline;"> '+
             '<a class="'+ format_obj.url_class +'" onmouseover="javascript:window.status=\''+   data_obj.url 	    +'\';return true;" '+
             'onmouseout="javascript:window.status=\'\';return true;" '                                             +
             'href="' + data_obj.url   + '" target="_blank">'+ data_obj.visible_url +'</a></div>'+
             '</div>' +
             '</div>';
}