// ==UserScript==
// @name           Prefetch Google Ads
// @namespace      http://hublog.hubmed.org
// @description    Prefetches Google Ad Links
// @include        http://*
// ==/UserScript==

window.addEventListener("load", function(e) {

    var a = document.evaluate("//a[contains(@href,'iclk')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    var x, i;
    var n = new Array();    for (i = 0; x = a.snapshotItem(i); i++) { n.push(x); }
    var l = n.length;
    if (!l) return;
    var r = Math.round(Math.random()*(l-1));
    var link = n[r].href;
    window.setTimeout(
        function(){
            GM_xmlhttpRequest({
                method: "GET",
                url: link,
                headers: {
                  'Referer': document.location
                }
            });
        }
    ,Math.random()*20000);           }, false);

