
/*
 * This function retrieves keywords from the url
 */
function getQuery(url) {
	
	url = url.replace(/http%3A/i,''); // remove http:
	url = url.replace(/(\w{0,3}).zoover.(\w{0,3})/i,''); // remove *.zoover.*
	url = url.replace(/%23(\w+)/i,''); // remove #* (anchors)
	url = url.replace(/%2F/ig,' '); // replace / with a space
	url = url.replace(/beoordelingen/ig,''); // remove 'beoordelingen'
	url = url.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); //trim whitespace at string start/end

  	return url;
}



/*
 * 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:5px;"><a style="color:#FF5D10; font-weight:bold; text-decoration:underline;" target="_blank" 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><br>' +
                    
                    '<a style="text-decoration:none; font-weight:normal; color:black;" href="' + google_ads[i].url + '" target="_blank"><span class="ad_text">' 
                    + google_ads[i].line2 + '</span></a><br>' +
                    
                    '<a style="text-decoration:none; font-weight:normal; color:black; font-size:80%;" target="_blank" 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 + '<br/>&nbsp;</a></p>';
        }

        else
        {
            // render a narrow ad
         	narrowAds+='<p style="margin:5px;"><a style="color:#FF5D10; font-weight:bold; text-decoration:underline;" target="_blank" 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><br>' +
                    
                    '<a style="text-decoration:none; font-weight:normal; color:black;" href="' + google_ads[i].url + '" target="_blank"><span class="ad_text">' 
                    + google_ads[i].line2 + '</span></a><br>' +
                    
                    '<a style="text-decoration:none; font-weight:normal; color:black; font-size:80%;" target="_blank" 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 + '<br/>&nbsp;</a></p>';
        }
    }

    if (narrowAds != "")
    {
        narrowAds = '<p><a target="_blank" style="text-decoration:none; font-weight:bold; color:black;" ' +
                    'href="http://services.google.com/feedback/online_hws_feedback">' +
                    'Advertenties door Google</a></p>' + narrowAds;
    }

    if (wideAds != "")
    {
        wideAds = '<p><a target="_blank" style="text-decoration:none; font-weight:bold; color:black;" ' +
                  'href="http://services.google.com/feedback/online_hws_feedback">' +
                  'Advertenties door Google</a></p>' + wideAds;
    }

    // Write HTML for wide and narrow ads to the proper <div> elements
    document.getElementById("wide_ad_unit").innerHTML = wideAds;
    document.getElementById("narrow_ad_unit").innerHTML = narrowAds;
}

google_afs_client = 'pub-1772393173576368'
google_afs_hl = 'nl';

