var currentURL = document.location.href;
// The domain of your web site (no http or www)
var domain = document.location.host.replace(/^www\./gi, '');

function frame(url) {
with (document) {
clear();
write('<frameset rows="50, *">');
write('<frame src="return.php?back=' + currentURL + '" scrolling="no" noresize="noresize"></frame>');
write('<frame id="mainFrame" name="main" src="' + url + '"></frame>');
write('</frameset>');
}
return false;
}
function offsiteLink(url) {
// If the URL is on our domain, it's not an offsite link
if (url.match(domain)) { return false; }

// If the URL contains a colon, i.e. "http://someothersite.com", it's offsite
if (url.match(':')) { return true; }

// Otherwise, it's a local link (i.e. "page.html")
return false;
}
with (document) {
// Step through each link on the page
for (i=0; i<links.length; i++) {

// If the link is an offsite link, make it open with a branded frame
if (offsiteLink(links[i].href)) {
links[i].target = "_top";
links[i].onclick = function() { return frame(this.href); };
}
}
}