var enhanceLinks = { initialise: function() { // Check the browser can understand this script: if (!document.getElementsByTagName) return; var pageLinks = document.getElementsByTagName('a'); for (var i = 0; i < pageLinks.length; i++) { // Check if the link leads outside the parent domain: if (pageLinks[i].href.indexOf('http://' + window.location.hostname) == -1) { // Don't write over any existing class names: pageLinks[i].className += ' external'; pageLinks[i].title = 'This is an external link that will open a new window (' + pageLinks[i].href + ')'; pageLinks[i].onclick = enhanceLinks.popup; } } }, popup: function() { window.open(this.href, 'flPopup', ''); return false; } }