
/*
 * This function is required. It processes the google_ads JavaScript object,
 * which contains AFS ads relevant to the user's search query. The name of
 * this function <i>must</i> be <b>google_afs_request_done</b>. If this
 * function is not named correctly, your page will not display AFS ads.
 */

function google_afs_request_done(google_ads)
{
    /*
     * Verify that there are actually ads to display.
     */
    var google_num_ads = google_ads.length;
    if (google_num_ads <= 0)
    {
        return;
    }

    var wideAds = "";   // wide ad unit html text
    var narrowAds = "";   // narrow ad unit html text

    for(i = 0; i < google_num_ads; i++)
    {
        if (google_ads[i].type=="text/wide")
        {
            // render a wide ad
            wideAds+='<p style="margin-bottom:10px; line-height:18px;"><a class="ad_line1" target="_blank" style="text-decoration:underline;" onmouseover="javascript:window.status=\'' +
                    google_ads[i].url + '\';return true;" ' +
                    'onmouseout="javascript:window.status=\'\';return true;" ' +
                    'href="' + google_ads[i].url + '">' +

                    google_ads[i].line1 + '</a> ' +
                    
                    '<a class="ad_url" target="_blank" style="text-decoration:none" onmouseover="javascript:window.status=\'' +
                    google_ads[i].url + '\';return true;" ' +
                    'onmouseout="javascript:window.status=\'\';return true;" ' +
                    'href="' + google_ads[i].url + '">' +
                    
                    google_ads[i].visible_url + '</a> ' +
                    
                    '<span class="ad_text">' + google_ads[i].line2 + '</span></p>';
        }

        else
        {
            // render a narrow ad
            narrowAds+='<p class="p_b_lijn"><p class="p_b_0">' +
            		'<a target="_blank" style="text-decoration:underline;" onmouseover="javascript:window.status=\'' +
                    google_ads[i].url + '\';return true;" ' +
                    'onmouseout="javascript:window.status=\'\';return true;" ' +
                    'href="' + google_ads[i].url + '">' +
                    '<span class="ad_line1">' + google_ads[i].line1 + '</span></a><br>' +
                    '<span class="ad_text">' + google_ads[i].line2 + '</span><br>' +
                    '<span class="ad_text">' + google_ads[i].line3 + '</span><br>' +
                    '<a target="_blank" style="text-decoration:none; font-size:90%; font-weight:normal;" onmouseover="javascript:window.status=\'' +
                    google_ads[i].url + '\';return true;" ' +
                    'onmouseout="javascript:window.status=\'\';return true;" ' +
                    'href="' + google_ads[i].url + '">' + google_ads[i].visible_url + '</a></p>';
        }
    }

    if (narrowAds != "")
    {
        narrowAds = '<p class="p_ban_kop"><a style="text-decoration:none" ' +
                    'href="http://services.google.com/feedback/online_hws_feedback">' +
                    'Gesponsorde Koppelingen</span></a></p>' + narrowAds;
    }

    if (wideAds != "")
    {
    	wideAds = '<p class="d_add_title"><a style="font-weight:bold;" href=\"http://services.google.com/feedback/online_hws_feedback\">Advertenties door Google</a></p>' + wideAds;
    }

    // Write HTML for wideads to the proper <div> element
    document.getElementById(wide_ad_div).innerHTML = wideAds;
}


var google_adnum = 0;

function google_ad_request_done(google_ads)
{
	
	/*
	* This function is required and is used to display
	* the ads that are returned from the JavaScript
	* request. You should modify the document.write
	* commands so that the HTML they write out fits
	* with your desired ad layout.
	*/
	var s = '';
	var i;

	/*
	* Verify that there are actually ads to display.
	*/
	if (google_ads.length == 0) 
	{
		return;
	}

	/*
	* If an image or flash ad is returned, display that ad.
	* Otherwise, build a string containing all of the ads and
	* then use a document.write() command to print that string.
	*/

	if (google_ads[0].type == "flash")
	{
	   s += '<a href=\"' +
		google_info.feedback_url + '\" style="color:000000">Ads by Google</a><br>' + 
		'<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") 
	{
		s += '<p class="d_add_title"><a style="font-weight:bold;" href=\"' + google_info.feedback_url + '\">Advertenties door Google</a></p>';
		s += '<p style="margin-bottom:10px;">'+
			 	'<a class="ad_line1" href="' + google_ads[0].url + '" target="_blank" onmouseout="window.status=\'\'" onmouseover="window.status=\'\';return true">' +
			 		'<img border="0" src="' + google_ads[0].image_url + '"width="' + google_ads[0].image_width + '"height="' + google_ads[0].image_height + '">' +
			 	'</a>' +
			 '</p>';
	} 
	else if (google_ads[0].type == "html") 
	{
		s += google_ads[0].snippet;
	} 
	else
	{
	    s += '<p class="d_add_title"><a style="font-weight:bold;" href=\"' + google_info.feedback_url + '\">Advertenties door Google</a></p>';

		for(i = 0; i < google_ads.length; ++i)
		{
			s += '<p style="margin-bottom:10px;">'+
				 	'<a class="ad_line1" href="' + google_ads[i].url + '" target="_blank" onmouseout="window.status=\'\'" onmouseover="window.status=\'\';return true">' +
				 		'<b>' + google_ads[i].line1 + '</b>'+
				 	'</a>&nbsp;' +
				 	'<a class="ad_url" target="_blank" style="text-decoration:underline;" href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'\';return true">' + 
		 				google_ads[i].visible_url + 
		 			'</a>&nbsp;' +
				 	'<span class="ad_text">' + 
				 		google_ads[i].line2 + '&nbsp;' + google_ads[i].line3 + 
				 	'</span>' +
				 '</p>';
		}
	   
	   if (google_ads[0].bidtype == "CPC")
	   { 
		   google_adnum = google_adnum + google_ads.length;
	   }
	}
	
	document.getElementById(google_afc_div).innerHTML = s;
	
    return;
  }


