Run function on link, send user to pre-link ad page, ad page redirects user after 5 seconds
<p>On page with a bunch of links like so:</p>

<pre><code>&lt;a class="wsite-button wsite-button-large wsite-button-highlight"  href="/uploads/7/0/9/4/70947887/custom_themes/436120861689278040/files/Games/17waystokillboss.swf" id="link" onclick="doalert(); return false;&gt;&lt;span class="wsite-button-inner"&gt;17 Ways To Kill Your Boss(NEW)&lt;/a&gt;&lt;br&gt;
&lt;a class="wsite-button wsite-button-large wsite-button-highlight"  href="/uploads/7/0/9/4/70947887/custom_themes/436120861689278040/files/Games/24waystokyb.swf" id="link" onclick="doalert(); return false;&gt;&lt;span class="wsite-button-inner"&gt;24 Ways To Kill Your Boss(NEW)&lt;/a&gt;&lt;br&gt;
&lt;a class="wsite-button wsite-button-large wsite-button-highlight"  href="/uploads/7/0/9/4/70947887/custom_themes/436120861689278040/files/Games/4-wheel-madness.swf" id="link" onclick="doalert(); return false;&gt;&lt;span class="wsite-button-inner"&gt;4 Wheel Madness&lt;/a&gt;&lt;br&gt; 
&lt;a class="wsite-button wsite-button-large wsite-button-highlight"  href="/uploads/7/0/9/4/70947887/custom_themes/436120861689278040/files/Games/Achilles.swf" id="link" onclick="doalert(); return false;&gt;&lt;span class="wsite-button-inner"&gt;Achillies(NEW)&lt;/a&gt;&lt;br&gt;
&lt;a class="wsite-button wsite-button-large wsite-button-highlight"  href="/uploads/7/0/9/4/70947887/custom_themes/436120861689278040/files/Games/alien_hominid.swf" id="link" onclick="doalert(); return false;&gt;&lt;span class="wsite-button-inner"&gt;Alien Hominid(NEWER)&lt;/a&gt;&lt;br&gt;
&lt;a class="wsite-button wsite-button-large wsite-button-highlight"  href="/uploads/7/0/9/4/70947887/custom_themes/436120861689278040/files/Games/asteroids.swf" id="link" onclick="doalert(); return false;&gt;&lt;span class="wsite-button-inner"&gt;Asteriods(NEW)&lt;/a&gt;&lt;br&gt;
</code></pre>

<p>Script running this page to send to adpage:</p>

<pre><code>&lt;script&gt;
function doalert() {
var str1 = "http://www.goldandblack.net/adpage.html#";

    window.location.href = str1.concat(document.getElementById("link").getAttribute("href")));
    return false;
};
&lt;/script&gt;
</code></pre>

<p>Script on adpage to forward to clicked page:</p>

<pre><code>&lt;script&gt;
window.onload = function() {
var str2 = window.location.href;
var str3 = str2.replace("http://www.goldandblack.net/adpage.html#", "");
window.location.href = str3;
};

&lt;/script&gt;
</code></pre>

<p>This isn't working for some reason</p>