;(function() {
  var options_base = {
    'pubId'     : 'pub-2615428063642387',
    'query'     : query,
    'hl'        : 'nl'
  };

  var adblock_base = {
    'number'              : 6,
    'width'               : '312',
    'fontFamily'          : 'arial',
    'fontSizeTitle'       : '12px',
    'fontSizeDescription' : '12px',
    'fontSizeDomainLink'  : '12px',
		'colorBackground'			: '#fafafa',
		'callback'						: function(id, got_ads) {
			// show container which contains ads (if there are ads to show)
			if (got_ads)
				$('#' + id).closest('.widget_container').removeClass('afs-hidden');
		}
  };

	var ilse_colors = { colorTitleLink 	: '#f47709', colorDomainLink	: '#5f5a50' };
	var tests 			= [
	 // 2-nositelinks-google
	 [ { channel : '6968632001', siteLinks : false }, { lines : 2 } ],
	 // 2-nositelinks-ilse
	 [ { channel : '7700360376', siteLinks : false }, $.extend({ lines : 2 }, ilse_colors) ],
	 // 2-sitelinks-google
	 [ { channel : '3011392399', siteLinks : true }, { lines : 2 } ],
	 // 2-sitelinks-ilse
	 [ { channel : '4024631649', siteLinks : true }, $.extend({ lines : 2 }, ilse_colors) ],
	 // 3-nositelinks-google
	 [ { channel : '9395906495', siteLinks : false }, { lines : 3 } ],
	 // 3-nositelinks-ilse
	 [ { channel : '4030684595', siteLinks : false }, $.extend({ lines : 3 }, ilse_colors) ],
	 // 3-sitelinks-google
	 [ { channel : '1414585025', siteLinks : true }, { lines : 3 } ],
	 // 3-sitelinks-ilse
	 [ { channel : '5996219639', siteLinks : true }, $.extend({ lines : 3 }, ilse_colors) ]
	];

	// pick a random test
	var index 	= Math.floor(Math.random() * tests.length);
	var options = $.extend({}, options_base, tests[index][0]);
	var adblock = $.extend({}, adblock_base, tests[index][1]);

	// build ad blocks
  var adblock_middle  = $.extend({}, adblock, { 'container' : 'google-afs-middle' });
  var adblock_right		= $.extend({}, adblock, { 'container' : 'google-afs-right' });

	// show ads
  try {
    new google.ads.search.Ads(options, adblock_right, adblock_middle);
  } catch(e) {};
})();

