
function all_external_links_target_blank() {

	locc = 'http://' + document.domain + '/';

	for (i in document.links) {

		if(document.links[i].href && document.links[i].href.search(locc) < 0) {
			document.links[i].target = "_blank";
//			document.links[i].href = "/frame.php?"+document.links[i].href;
		}

		if(document.links[i].href && document.links[i].href.search(locc+"frame.php?") == 0) {
			document.links[i].target = "_blank"
		}
	}
}

// ================================================

function addEvent(elm, evType, fn, useCapture)
{
	if (elm.addEventListener)
	{
		elm.addEventListener(evType, fn, useCapture);
		return true;
	} 
	else if (elm.attachEvent)
	{
		var r = elm.attachEvent("on"+evType, fn);
		return r;
	}
}

addEvent(window, "load", all_external_links_target_blank);