window.onload=function(){ var a=document.getElementsByTagName('a'), i=a.length; while(i--) if( !a[i].href.indexOf('http:')&&!~a[i].href.indexOf('mysite.ru')) a[i].href = '/go?l=' + encodeURIComponent(a[i].href); }