$(document).ready( evReady );

function evReady() {
	$("a[href^='http']").click( evClickExternal );
	displayExternal();
}

function evClickExternal( objSource ) {
	if( $(this).attr("href") != 'https://www2.netteller.com/beaconfederal' ) {
		objSource.preventDefault();
		document.location.href = cp + '/leaving-site.html?r=' + $(this).attr("href");
	}
}

function displayExternal() {

	var addr = $("span.externalAddress");
	
	if( addr.length > 0 ) {
		var href = getHref();
		addr.html( "<b>" + href + "</b>" );
		$("a.externalConfirm").click( function(obj) { obj.preventDefault(); document.location.href=href; return false; } );
	}
}

function getHref() {
	var qs = document.location.search;
	if( qs != null && qs != "" ) {
		return (qs.split("?r=")[1]).replace("<", "&lt;").replace(">", "&gt;");
	}
	
	return "#";
}