;

var script_url = 'http://ads.displays.com/ishowads/?';
for (var i = 0; i < displays_queries.length; i++) {
    script_url += 's';
    if (i) {
        script_url += i;
    }
    script_url += '=';
    script_url += encodeURIComponent(displays_queries[i]);
    script_url += '&';
}

script_url += 'target=';
script_url += encodeURIComponent(displays_targets.join(','));
script_url += '&';

script_url += 'bf=';
script_url += encodeURIComponent(displays_banner_formats.join(','));
script_url += '&';

script_url += 'af=';
script_url += encodeURIComponent(displays_ad_formats.join(','));
script_url += '&';

if (displays_strict) {
    script_url += 'strict=yes&';
}

var key = '';
for (key in displays_parameters) {
    var value = displays_parameters[key];
    script_url += key + '=' + encodeURIComponent(value) + '&';
}

script_url += 'ref=' + encodeURIComponent(window.location);

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {
   var script = document.createElement('script');
   script.setAttribute('src', script_url);
   script.setAttribute('type', 'text/javascript');
   document.body.appendChild(script);
});
