  // This function displays the ad results.
  // It must be defined above the script that calls show_ads.js
  // to guarantee that it is defined when show_ads.js makes the call-back.

function insertAfter(parent, node, referenceNode) {
  parent.insertBefore(node, referenceNode.nextSibling);
}

function google_ad_request_done(google_ads) {
  // Proceed only if we have ads to display!
  if (google_ads.length < 1 )
    return;
    
  if (typeof google_adsbygoogle_firstonly == 'undefined') {
    google_adsbygoogle_firstonly = 0;
  }
      
  if (typeof google_adsbygoogle_position == 'undefined') {
    google_adsbygoogle_position = 'top';
  }
      
  for( i = 0; i < google_ads.length; i++ )
  {
    var s = '';

    if ((google_adsbygoogle_firstonly == 0 || i == 0)
        && google_adsbygoogle_position == 'top'
        && google_needs_header(i))
    {
        s += google_ad_get_header(google_info);
    }        

    // For text ads, display each ad in turn.
    // In this example, each ad goes in a new row in the table.
    if (google_ads[0].type == 'text') { 
       s += '<a style="cursor:pointer;text-decoration:none" onclick="javascript:top.location.href=\'' + google_ads[i].url + '\'" onmouseover="window.status=\'Ga naar ' + google_ads[i].visible_url + '\'" onmouseout="window.status=\'\'">' +
         '<span style="color:#0000CC;text-decoration:underline;margin-left:140px">' + google_ads[i].line1 + '</span><br/><span class="hometekst" style="color: #4f4f4f;margin-left:140px"><span>' + google_ads[i].visible_url + '</span><br>' +
         '</a>' + 
         '<span style=";margin-left:140px">'  + google_ads[i].line2 + '&nbsp;' + google_ads[i].line3 + '</span></span>';
    }

    // For an image ad, display the image; there will be only one.
    /*
    if (google_ads[0].type == 'image') {
      s = '<td align="center">' +
        '<a href="' + google_ads[0].url + '"style="text-decoration: none">' +
        '<img src="' + google_ads[0].image_url + 
        '" height="' + google_ads[0].height + 
        '" width="' + google_ads[0].width +
        '" border="0"></a></td>';
    }
    */

    if ((google_adsbygoogle_firstonly == 0 || i == google_ads.length-1)
      && google_adsbygoogle_position == 'bottom'
      && google_needs_header(i))
    {
        s += google_ad_get_header(google_info);
    }

    // Finish up anything that needs finishing up
    if (document.getElementById('googleAdsRow'+i))
    {
        document.getElementById('googleAdsRow'+i).innerHTML = s;
    }
  }


  return;
}

function google_needs_header(offset) {
    if (typeof(google_adsbygoogle_offset) != 'undefined')
    {
        for (var iOffset = 0; iOffset < google_adsbygoogle_offset.length; iOffset++)
        {
            if (google_adsbygoogle_offset[iOffset] == offset)
            {
                return true;
            }
        }
        
        return false;
    }
    else
    {
        return true;
    }
}

function google_ad_get_header(google_info) {
    s = '';
    s += '<div class="adsByGoogle" style=";margin-left:140px">'; 
    if (google_info.feedback_url) {
        s += '<a href="' + google_info.feedback_url + '" target="_top">Ads by Google</a>';
    } else {
        s += 'Ads by Google';
    }
    s += '</div>';
    
    return s;
}

