var url = window.location.href; if(url.indexOf("#in") > -1) { var idin = url.substring((url.indexOf("#in"))+3,url.length); idregexp = new RegExp(/^[0-9]*$/); if (idregexp.test(idin)) { top.location.href = ("http://xonium.net/topsites/in.php?id=" + idin + ""); } }